| name | github-workflow |
|---|---|
| description | GitHub workflow, commit conventions, and PR process for MAPL |
| compatibility | opencode |
Provide comprehensive Git and GitHub workflow guidance for MAPL development, including:
- Critical rules about commits and pushes
- Branch strategy and naming conventions
- Commit message formatting
- Pull request process and checklist
- Code review expectations
Use this skill when:
- Starting new work on MAPL
- Creating commits or pull requests
- Unsure about branch strategy
- Preparing for code review
- Contributing to MAPL for the first time
- DO NOT COMMIT WITHOUT PERMISSION
- DO NOT PUSH TO GITHUB WITHOUT PERMISSION
- FIRST LINE OF GIT COMMIT MUST BE < 50 CHARACTERS
These rules exist to maintain code quality and prevent accidental breaking changes.
IMPORTANT: Always clarify which base branch to use before starting work!
Purpose: Primary integration branch for both MAPL 2.x maintenance and MAPL v3 development
Use for:
- Bug fixes for MAPL 2.x
- Features for current production version
- Maintenance and stability improvements
- MAPL v3 restructuring and new features (previously on release/MAPL-v3)
Status: Active integration branch — all PRs (including MAPL v3 work) target here
Purpose: No longer used for active development of MAPL (superseded by develop)
Note: MAPL v3 integration work has moved to develop. External client repos are still using release/MAPL-v3
Status: Active development, pre-release
All development work happens on feature branches that follow this pattern:
feature/#ISSUE-description
bugfix/#ISSUE-description
hotfix/#ISSUE-description
Where:
#ISSUEis the GitHub issue number (e.g.,#4392)descriptionis a brief kebab-case description
Examples:
feature/#4392-add-opencode-agent-skills
bugfix/#4388-vector-basis-kind-default
feature/#4376-support-rotated-vectors
hotfix/#4390-memory-leak-gridcomp
For multi-task projects (e.g., implementation plan with Task 1, Task 2, etc.):
feature/#ISSUE-task1-foundation
feature/#ISSUE-task2-degenerate-case
feature/#ISSUE-task6-extdata-yaml
See "Multi-Task Project Strategy" section below for details.
Step 1: Create GitHub issue FIRST
Before creating a branch, you need an issue number:
# Create issue via gh CLI
gh issue create --title "Add support for rotated vectors"
# Or create via web interface
# https://github.com/GEOS-ESM/MAPL/issues/newStep 2: Checkout base branch
# For MAPL 2.x work
git checkout develop
git pull origin develop
# For MAPL v3 work
git checkout release/MAPL-v3
git pull origin release/MAPL-v3Step 3: Create feature branch
# Using issue number from Step 1
git checkout -b feature/#4376-support-rotated-vectorsStep 4: Do your work, create commits
# Make changes
git add <files>
git commit -m "Add rotated vector support"
# More changes
git add <files>
git commit -m "Add tests for rotated vectors"Step 5: Push (ONLY WITH PERMISSION)
git push -u origin feature/#4376-support-rotated-vectorsWhen implementing a plan with multiple tasks (Task 1, Task 2, etc., such as an implementation plan):
Why: Easier review, independent approval, can merge tasks incrementally
Branch naming pattern:
feature/#ISSUE-task1-description
feature/#ISSUE-task2-description
feature/#ISSUE-task3-descriptionExample workflow:
# Task 1
git checkout develop
git checkout -b feature/#4407-task1-foundation
# ... do work ...
git push -u origin feature/#4407-task1-foundation
gh pr create --base develop --title "Task 1: Add foundation for vertical alignment"
# Task 2 (can be based on develop or task1 branch)
git checkout develop # or feature/#4407-task1-foundation if dependent
git checkout -b feature/#4407-task2-degenerate
# ... do work ...
git push -u origin feature/#4407-task2-degenerate
gh pr create --base develop --title "Task 2: Add degenerate case handling"
# Task 6 (independent task, much later)
git checkout develop
git checkout -b feature/#4407-task6-extdata-yaml
# ... do work ...
git push -u origin feature/#4407-task6-extdata-yaml
gh pr create --base develop --title "Task 6: Add YAML parsing for ExtData"gh pr create:
# 1. What branch am I on?
git branch --show-current
# 2. Are there existing PRs for this branch?
gh pr list --head $(git branch --show-current)
# 3. What commits will be in this PR?
git log --oneline origin/develop..HEAD
# 4. Verify this is what you intendIf existing PR found for this branch:
- ❌ STOP! You're likely on the wrong branch
- ✓ Either create a new branch for your current work
- ✓ Or confirm you intentionally want to add to the existing PR
Example of what NOT to do:
# Session 1: Working on Task 3-4
git checkout -b feature/#4407-degenerate-case
# ... work ...
gh pr create # PR #4409 created
# Session 2: Working on Task 6 - MISTAKE!
# Forgot to create new branch, still on feature/#4407-degenerate-case
# ... work ...
gh pr create # Creates PR #4410, but PR #4409 still exists!
# NOW BOTH PRS POINT TO SAME BRANCH - CONFLICT!Correct approach for Session 2:
# Session 2: Working on Task 6 - CORRECT
git checkout develop
git checkout -b feature/#4407-task6-extdata-yaml # NEW BRANCH
# ... work ...
gh pr list --head $(git branch --show-current) # Verify no existing PR
gh pr create # Safe to create PROnly combine tasks when:
- Tasks are tightly coupled and can't be reviewed separately
- All tasks are tiny (< 100 lines total)
- Tasks must be merged atomically (all or nothing)
- Explicitly requested by team/user
Otherwise: Create separate PRs per task for easier review and incremental progress
Allowed pattern:
develop
├── feature/#4407-task1-foundation → PR #100
├── feature/#4407-task2-degenerate → PR #101
└── feature/#4407-task6-extdata → PR #102
All three branches based on develop, all have independent PRs. This is fine!
Problem pattern:
develop
└── feature/#4407-degenerate-case
├── PR #4409 (created first)
└── PR #4410 (created second - CONFLICT!)
Same branch, two PRs. This is wrong!
Format: Imperative mood, concise summary
Good examples:
Add dark mode toggle to settings
Fix memory leak in GridComp
Refactor VerticalRegridder for clarity
Update documentation for ExtData
Remove deprecated HistoryV1 code
Bad examples:
Added support for the new dark mode feature in settings (too long!)
fix (too vague)
WIP (not descriptive)
Updated code (what code? how?)
Imperative mood means: Command form, as if giving an instruction
- ✓ "Add feature" not "Added feature" or "Adding feature"
- ✓ "Fix bug" not "Fixed bug" or "Fixes bug"
- ✓ "Refactor code" not "Refactored code"
After first line, add blank line, then details:
Add rotated vector support to regridding
The regridding framework now supports vector fields defined
in rotated coordinate systems. This is required for regional
climate models that use rotated pole grids.
Implementation includes:
- New RotatedVectorTransform class
- Coordinate transformation matrices
- Tests for common rotation angles
- Documentation updates
<verb> <what> in <where> (< 50 chars total)
<blank line>
<optional detailed explanation>
<why this change is needed>
<how it's implemented>
<any caveats or special considerations>
Before creating PR:
- All commits follow message format (first line < 50 chars)
- Code follows MAPL coding standards (see
fortran-styleskill) - Error handling is complete (see
mapl-error-handlingskill) - Tests added/updated as appropriate
- Documentation updated if needed
- CHANGELOG.md updated (required for PRs to
developbranch) - Have permission to push
# Make sure feature branch is pushed
git push -u origin feature/#4376-support-rotated-vectors
# Create PR
gh pr create \
--base develop \
--title "Add rotated vector support to regridding" \
--body "Fixes #4376"Or via web interface: https://github.com/GEOS-ESM/MAPL/pulls
Pull requests should include:
## Types of change(s)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Trivial change (affects only documentation or cleanup)
- [ ] Refactor (no functional changes, no api changes)
## Checklist
- [ ] Tested this change with a run of GEOSgcm
- [ ] Ran the Unit Tests (`make tests` or `ctest`)
## Description
Brief description of what this PR does and why.
## Related Issue
Fixes #ISSUE_NUMBERFormat: Same as commit message - concise, imperative, < 50 chars if possible
Examples:
Add rotated vector support to regridding
Fix memory leak in GridComp initialization
Refactor VerticalRegridder for performance
Update ExtData documentation
CRITICAL: All PRs to the develop branch MUST include a CHANGELOG.md entry.
MAPL follows Keep a Changelog format with these sections:
- Added - New features
- Changed - Changes to existing functionality
- Deprecated - Soon-to-be removed features
- Removed - Removed features
- Fixed - Bug fixes
- Security - Security fixes
Add your change under the [Unreleased] section in the appropriate category:
## [Unreleased]
### Fixed
- Your bug fix here
### Added
- Your new feature here
- Another feature
### Changed
- Your change hereGood entries:
### Added
- Added rotated vector support to regridding framework
- Added MAPL_GetPartition() implementation with unit tests
### Fixed
- Fixed memory leak in GridComp initialization
- Fixed 32-bit integer overflow in QSsort
### Changed
- Update components.yaml
- ESMA_env v5.17.0
- Update to Baselibs 8.24.0Bad entries:
### Added
- Updated code (too vague)
- Bug fix (which bug? belongs in Fixed)
- Made changes (what changes?)Simple changes:
- Added support for rotated vectors in regriddingComplex changes with details:
- Update `components.yaml`
- `ESMA_env` v5.17.0
- Update to Baselibs 8.24.0
- ESMF v9.0.0b08
- GFE v1.22.0Multiple related changes:
- Added implementation for `mapl_GetPartition()` with unit tests
- Added backwards compatibility with non-CF dimensionless vertical coordinate in ExtData2G
- Added logic in History to check for consistent History and averaging coupler alarmsUpdate CHANGELOG when:
- Adding new functionality
- Fixing bugs
- Changing existing behavior
- Removing features
- Updating dependencies (like components.yaml)
Don't update CHANGELOG for:
- Documentation-only changes (unless significant)
- Internal refactoring with no user-visible changes
- CI/build configuration (unless it affects developers)
- Whitespace/formatting fixes
# 1. Make your code changes
git add src/MyFile.F90
# 2. Update CHANGELOG.md
# Edit CHANGELOG.md under [Unreleased] section
vi CHANGELOG.md
# 3. Commit together
git add CHANGELOG.md
git commit -m "Add rotated vector support to regridding
Implements support for vector fields in rotated coordinate systems.
Required for regional climate models using rotated pole grids."
# 4. Push and create PR
git push -u origin feature/#1234-rotated-vectors
gh pr create --base developIMPORTANT: Include CHANGELOG changes in the same commit as your code changes, or in a dedicated CHANGELOG commit if your PR has multiple commits.
From the Code Review Checklist:
Error Handling:
- Return
_SUCCESSat end of procedures - Use of
_RCmacro where appropriate - Always check iostat for read/write operations
- All allocations checked with
_STAT
Optional Variables:
- KeywordEnforcer used for growable list of optional arguments
Code Quality:
- Procedure not too long (consider breaking up)
- Clear, descriptive variable names
- Not too many arguments (consider using derived type)
- No "feature envy" (procedure accessing many fields of another type)
Thread Safety:
- No module variables (except parameters)
- No saved variables in procedures
- Private state in component workspace
Style:
- Follows MAPL Fortran coding standards
- Appropriate indentation (3 spaces)
- Modern operators (
>,==not.gt.,.eq.) -
implicit nonein all modules
Be responsive:
- Address all comments (resolve or discuss)
- Make requested changes promptly
- Push updates to same branch
Be collaborative:
- Code review is about code quality, not personal criticism
- Ask questions if feedback is unclear
- Explain your reasoning if you disagree (respectfully)
Update PR:
# Make requested changes
git add <files>
git commit -m "Address review comments
- Fix error handling in process_data
- Rename confusing variable names
- Add missing assertions"
# Push updates (with permission)
git pushKeep your feature branch up to date with base branch:
# On your feature branch
git fetch origin
# Merge base branch into feature branch
git merge origin/develop # or origin/release/MAPL-v3
# Resolve any conflicts
git add <resolved-files>
git commit -m "Merge develop into feature branch"
# Push (with permission)
git pushIf you haven't pushed yet:
# Fix most recent commit message
git commit --amend
# This opens editor to modify message
# Save and close to updateIf you already pushed: Be very careful with amend/rebase after pushing. Discuss with team first.
Large PRs are hard to review. Consider splitting:
Option 1: Multiple PRs in sequence
# PR 1: Refactoring prep work
feature/#4380-refactor-regridder-prep
# PR 2: New feature (depends on PR 1)
feature/#4376-add-rotated-vectorsOption 2: Multiple commits in one PR
Organize commits logically in single PR:
commit 1: Refactor existing code for clarity
commit 2: Add new RotatedVectorTransform class
commit 3: Integrate into regridding framework
commit 4: Add tests
commit 5: Update documentation
DO NOT merge your own PR without approval!
After approval:
- Ensure CI/CD checks pass
- Squash or merge as appropriate (discuss with team)
- Delete feature branch after merge
Typical merge: Maintainer merges approved PRs
Changes flow from develop to release/MAPL-v3:
develop → release/MAPL-v3
This means:
- Bug fixes on develop will eventually flow to release/MAPL-v3
- Features specific to MAPL v3 stay on release/MAPL-v3
- Critical hotfixes may need to be applied to both branches
Sometimes need to apply same fix to both branches:
# Fix merged to develop
# Now apply to release/MAPL-v3
git checkout release/MAPL-v3
git cherry-pick <commit-hash-from-develop>
git push # With permissionUse sparingly - usually develop flows to v3 naturally
Problem: Local and remote branches have different histories
Solution:
git fetch origin
git status # See how many commits ahead/behind
# If you haven't pushed problematic commits
git reset --hard origin/<branch-name> # CAUTION: loses local commits
# If coordination needed with team
# Discuss before force pushing or resettingProblem: Made commits directly on develop instead of feature branch
Solution:
# Create feature branch from current develop
git checkout -b feature/#ISSUE-emergency-fix
# Reset develop to match origin
git checkout develop
git reset --hard origin/develop
# Continue work on feature branch
git checkout feature/#ISSUE-emergency-fixBefore pushing:
# Interactive rebase last 3 commits
git rebase -i HEAD~3
# Mark commits to squash in editor
# Save and closeAfter pushing: Discuss with team first (requires force push)
# 1. Create GitHub issue first (get #ISSUE number)
gh issue create --title "Your feature description"
# 2. Checkout base branch
git checkout develop # or release/MAPL-v3
git pull origin develop
# 3. Create feature branch
git checkout -b feature/#ISSUE-description
# 4. Do work, commit with proper messages (< 50 char first line)
git add <files>
git commit -m "Add feature description"
# 5. Push (with permission)
git push -u origin feature/#ISSUE-description
# 6. Create PR
gh pr create --base develop# Check first line length
git log --oneline -1 | wc -c # Should be < 52 (50 + newline + SHA)
# View last commit message
git log -1
# Amend if needed (before pushing)
git commit --amendfortran-style- Coding standards for code reviewmapl-error-handling- Error handling review checklist- Code Review Checklist - Available on MAPL wiki
Critical Reminders:
⚠️ DO NOT commit without permission⚠️ DO NOT push without permission⚠️ First line of commit < 50 characters- Always create GitHub issue first (get issue number)
- Use correct base branch (develop vs release/MAPL-v3)
- Follow feature branch naming:
feature/#ISSUE-description - Write clear, imperative commit messages
- Fill out PR template completely
- Respond to code review feedback
- Wait for approval before merging
When in doubt: Ask the team! Better to clarify than to cause problems.