fixes #43 Merge resolved conflicts into terminal branch before cleanup#44
Conversation
advanceBranchHereFromMergeForward skipped the terminal branch entirely,
so when a conflict resolution PR merged into merge-forward-pr-{N}-main,
the cleanup deleted that branch without ever updating main. Now it
merges the merge-forward content into main before deleting the branch.
Made-with: Cursor
WalkthroughThe changes implement fast-forwarding of the terminal branch when merge-forward PRs are successfully merged, addressing cases where conflict resolutions on the last hop into Changes
Sequence DiagramsequenceDiagram
participant BM as BranchMaintainer
participant Git as Git
participant MFB as Merge-Forward Branch
participant TB as Terminal Branch
BM->>BM: advanceBranchHereFromMergeForward(targetBranch)
alt targetBranch === terminalBranch
BM->>Git: fastForwardTerminalBranch()
Git->>Git: checkout targetBranch
Git->>Git: pull origin
Git->>MFB: merge origin/mergeForwardBranch --no-ff
MFB->>TB: (merge commit created)
Git->>Git: push origin targetBranch
Git-->>BM: success
else non-terminal branch
BM->>Git: (existing branch advancement logic)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/branch-maintainer.js (1)
208-219: Consider renamingfastForwardTerminalBranch.This helper never fast-forwards; it always creates a
--no-ffmerge commit. A name that says “merge” would make the call site, logs, and tests less misleading.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/branch-maintainer.js` around lines 208 - 219, The helper fastForwardTerminalBranch actually always creates a non-fast-forward merge commit; rename the function to a descriptive name like mergeTerminalBranchNoFF (or mergeTerminalBranchWithNoFF) and update all references: the declaration (async fastForwardTerminalBranch), all call sites, related log messages, tests, and any documentation to use the new name so behavior and names align; ensure exported identifiers (if any) and JSDoc/comments describing the method are updated to reflect the new name and that it always uses --no-ff.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/branch-maintainer.js`:
- Around line 208-219: The helper fastForwardTerminalBranch actually always
creates a non-fast-forward merge commit; rename the function to a descriptive
name like mergeTerminalBranchNoFF (or mergeTerminalBranchWithNoFF) and update
all references: the declaration (async fastForwardTerminalBranch), all call
sites, related log messages, tests, and any documentation to use the new name so
behavior and names align; ensure exported identifiers (if any) and
JSDoc/comments describing the method are updated to reflect the new name and
that it always uses --no-ff.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 75df6416-5fac-4028-a1aa-16e7c5c8dd53
📒 Files selected for processing (3)
src/branch-maintainer.jstest/branch-maintainer-test.jstest/real-git-test.js
| * because other PRs may have merged into main while the developer | ||
| * was resolving conflicts (making fast-forward impossible). | ||
| */ | ||
| async fastForwardTerminalBranch(mergeForwardBranch, targetBranch) { |
There was a problem hiding this comment.
This function is called fastForwardTerminalBranch, but it's documentation explicitly says "Always creates a merge commit rather than attempting fast-forward". Myabe just mergeToTerminalBranch() instead?
There was a problem hiding this comment.
🤦
thanks for catching that!
The method always creates a --no-ff merge commit, so "fast-forward" was misleading. Addresses PR #44 review feedback from Jerry. Made-with: Cursor
Closes #43
advanceBranchHereFromMergeForwardskipped the terminal branch entirely, so when a conflict resolution PR merged intomerge-forward-pr-{N}-main, the cleanup deleted that branch without ever updatingmain. The resolved changes were lost.Now it merges the merge-forward content into
main(via--no-ffmerge commit) before deleting the branch.Made with Cursor