Skip to content

fix(server): pin GitLab merges to current SHA - #10946

Open
n0mahd wants to merge 1 commit into
pingdotgg:mainfrom
n0mahd:fix/gitlab-merge-require-sha
Open

fix(server): pin GitLab merges to current SHA#10946
n0mahd wants to merge 1 commit into
pingdotgg:mainfrom
n0mahd:fix/gitlab-merge-require-sha

Conversation

@n0mahd

@n0mahd n0mahd commented Sep 9, 2026

Copy link
Copy Markdown

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

  • 56 focused GitLab pull-request tests pass
  • Changed files pass formatting and lint
  • The server typecheck passes

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • No UI changes; screenshots and video are not applicable

Built with GPT-5.6-sol in the Codex harness through T3 Code.

Summary by CodeRabbit

  • Bug Fixes
    • Merge and auto-merge actions now target the merge request’s current source revision.
    • These actions fail clearly when the source revision cannot be determined, preventing unintended merges.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 9, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 2d9d78d

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.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 3c1f07c1-9c6c-4fcc-8360-d117a1e179fc

📥 Commits

Reviewing files that changed from the base of the PR and between 6c58362 and 2d9d78d.

📒 Files selected for processing (2)
  • apps/server/src/pullRequest/GitLabPullRequestCli.test.ts
  • apps/server/src/pullRequest/GitLabPullRequestCli.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Merge and auto-merge actions now fetch GitLab diff refs and pass the current head SHA to glab mr. Tests cover the new command arguments and failure behavior when diff refs are unavailable.

Changes

GitLab merge SHA pinning

Layer / File(s) Summary
SHA-pinned merge actions
apps/server/src/pullRequest/GitLabPullRequestCli.ts, apps/server/src/pullRequest/GitLabPullRequestCli.test.ts
merge and enable-auto-merge fetch diff_refs and pass --sha refs.headSha to glab mr. Tests verify command ordering, SHA arguments, and GitLabDiffRefsUnavailableError when refs are missing.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 2d9d7

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: bil0000, juliusmarminge

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: pinning GitLab merge operations to the current SHA.
Description check ✅ Passed The description includes the required What Changed, Why, and Checklist sections. It also explains that UI changes are not applicable and documents validation results. The description is focused and co…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant