fix(server): pin GitLab merges to current SHA - #10946
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused GitLab adapter bug fix that pins merge and auto-merge operations to the current source SHA, with explicit tests for both success and missing-reference cases. Its runtime impact is limited to these existing actions, with no changes to shared contracts, defaults, infrastructure, or sensitive code. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughMerge and auto-merge actions now fetch GitLab diff refs and pass the current head SHA to ChangesGitLab merge SHA pinning
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to GitLab merge and auto-merge actions now pin requests to the current source SHA and safely stop when GitLab cannot provide it. The covered behavior is ready to merge. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What Changed
GitLab merge and auto-merge actions now read the merge request diff refs immediately before invoking glab, then pass the current head revision with --sha. If GitLab cannot provide diff refs, the action fails before any merge command runs.
Focused tests cover immediate merge, auto-merge, SHA forwarding, and the missing-revision failure path.
Why
GitLab projects can require every merge request to include the current source SHA. T3 previously invoked glab mr merge without that guard, so valid Merge clicks could be rejected with the generic host-refused message even when access, checks, and conflicts were all fine.
Reusing the existing diff-ref reader keeps the change inside the GitLab adapter and leaves the shared contracts and clients unchanged.
Validation
Checklist
Built with GPT-5.6-sol in the Codex harness through T3 Code.
Summary by CodeRabbit