Repository navigation
feat(bin): honor GitLab review heads and merged-result pipelines in PR checks - #6970
dimasmjunior wants to merge 12 commits into
Conversation
|
Speaking as Kun's firstmate: thank you, @dimasmjunior. This is careful work. This is my first stamp. I read head Contract-class: new-default (my own read). Three things change on the unconfigured GitLab path. Review now diffs Waiting on you, no rush: your no-mistakes Test step marked live validation inconclusive. The merged-results and merge-train accept/refuse scenarios ran only against mocked GitLab responses. If you can reach any Premium/Ultimate instance (a GitLab trial would do), could you drive one real merged-results pipeline through the guard and post the output? If not, please just say so plainly. Either way, a re-raise through |
|
Could a maintainer rerun the failed Behavior portable serial 4 job? Its only failing suite is No assertions or unrelated code have been changed. A same-commit rerun would help distinguish a timing-sensitive failure from a reproducible defect. Thanks. |
|
Speaking as Kun's firstmate: thanks @dimasmjunior. Done: I've re-run the failed jobs of run Still waiting on you, no rush: the live-evidence question from my last note. Can you drive one real merged-results pipeline (a GitLab Premium/Ultimate trial works) through the guard? If you can't reach one, please just say so plainly. Once that's answered and the re-run is green, this goes to the captain as a merge-or-leave decision. Nothing else is needed from you. |
|
Thanks for rerunning the job. All 19 checks now pass on We could not access a suitable isolated GitLab Premium/Ultimate instance, so we have not driven a real merged-results or merge-train pipeline through the guard. The guard acceptance, provenance refusals and locked revalidation were exercised with real Git fixtures and substituted GitLab responses; that is regression coverage, not live pipeline evidence. The review-head, readiness-registration and fallback scenarios were exercised through the actual CLI. The no-mistakes Test exception and PR description retain the live merge-provenance limitation. No stronger live-coverage claim is intended. |
|
Speaking as Kun's firstmate: thank you @dimasmjunior. That's the plain answer I needed, and I appreciate you not overstating the coverage. All checks are green on Contract-class: new-default (unchanged). With no configuration, the GitLab merge guard now accepts merged-results and merge-train pipelines, with provenance checks, and reviews diff against the MR head ref. VISION: all rules align. Widening a merge gate is a captain call under "Authority". Status: this is now with Kun for a merge-or-leave decision. It isn't waiting on you. I've noted the one known limitation for that decision: the merged-results/merge-train acceptance path has only been exercised against real Git fixtures with substituted GitLab responses, never against a live Premium/Ultimate pipeline. Nothing more is needed from you unless Kun asks. |
…enance bin/fm-review-diff.sh compared a GitLab task against its local branch, so a fix published to a merge request stayed invisible to review until it reached the copy, and bin/fm-pr-check.sh recorded no pr_head for one, so a no-mistakes ready report fell back to a local-only claim. bin/fm-pr-merge.sh, which requires a successful pipeline at the current head, refused every merged-results or merge-train pipeline because those run on a temporary merge commit. A GitLab task now reads the merge request's own head ref, which the forge keeps publishing while the request is open and after its source branch is deleted. fm_pr_forge_head_ref owns that ref layout for both consumers: reviews fetch it exactly as they fetch refs/pull/<n>/head, and a ready record stores the commit it publishes, with a successful fetch still outranking the recorded value. The guarded merge accepts a successful pipeline that did not run at the head only as this merge request's own refs/merge-requests/<iid>/merge or .../train pipeline, when that ref's current tip in the project repository is exactly the tested commit and the tested commit contains the live head and the current target branch tip. Containment is the test rather than parent shape, because a merge-train car chains through the previous car. Missing, unreadable or ambiguous provenance refuses and names the fact that could not be proven, and the source-head pipeline, the --sha binding and every other pre-merge condition are unchanged. Tests cover the published-head review, including a deleted source branch and a moved remote head, ready-head registration and its fallback order, and the merge guard's acceptance and refusals. Docs correct the claim that GitLab has no review head ref.
…n GitLab fixtures
d47dbb4 to
ce417bd
Compare
|
Speaking as Kun's firstmate (OSS triage, not the captain). Thanks @dimasmjunior for the rebase and the extra review fixes. I read the new head Contract-class: new-default (unchanged, my own read). With no configuration, three things change on the GitLab path:
That widens what the default merge path will land, so it won't auto-merge. VISION.md: One captain, Scripts own the mechanics, A restart is a non-event, Delegation with a spine, The fleet outlives any vendor, and Scope all align. Authority is explicit: aligns, but widening a merge gate is Kun's call. Security review before approving fork CI: no workflow, secret or CI-config edits. The new forge reads are Outcome: waiting-ci. This isn't waiting on you. Once CI is green on |
|
The only failing check on ce417bd is Behavior portable serial 4, at |
…-ins A home keeps its current GitLab behavior unless it creates one of two presence-based config files: - config/gitlab-mr-head lets bin/fm-review-diff.sh compare against refs/merge-requests/<iid>/head and bin/fm-pr-check.sh record that head as pr_head=. Without it a GitLab task records no head and reviews the recorded head or the local branch under the existing warning. - config/gitlab-merged-result-merge lets bin/fm-pr-merge.sh accept a proven merged-results or merge-train pipeline. Without it the guard requires the pipeline at the current head, reports the same refusal, and reads nothing extra. GitHub, Forgejo, and Gerrit paths are unchanged. Each moved behavior keeps its existing test (now opted in) and gains an unopted regression test that fails against the previous implementation; docs/configuration.md owns both settings.
# Conflicts: # bin/fm-pr-merge.sh # docs/gitlab-merge-watch.md
…e in configuration
|
Speaking as Kun's firstmate (OSS triage): thank you @dimasmjunior for reworking this so both behaviors sit behind opt-in files. That answers the concern from the earlier rounds directly. Checked head
GitHub, Forgejo and Gerrit resolve the same way as before. Contract-class (my own read): opt-in (it was new-default before the gating). VISION.md: One captain aligns. Authority aligns: widening the merge gate is now an explicit per-home grant, and the proof is re-checked under the away-record lock. Scripts/agents aligns. Restart aligns. Delegation aligns (stricter provenance, never a looser check). Vendor aligns (GitLab's own refs and API). Scope aligns. Security review before approving fork CI: no workflow, secret or CI-config edits. The new reads are One ask from you, please: the live-validation table is still 0 of 4. I understand merged-results and merge trains need a paid tier, and we won't ask for that. The |
|
Thank you for the review. Here is the live run for I ran Everything was read-only: anonymous
I also ran scenario 1 on a merged request in the same project, https://gitlab.com/gitlab-org/cli/-/merge_requests/3303. The limits: one project and two requests, on free gitlab.com. The worker copy's remote was anonymous https, so a home whose remote needs credentials was not exercised. |
Keep both sides of every conflict. In the GitLab merge guard, check the --expected-head pin from main before the merged-results and merge-train proof, and test that a mismatched expected head refuses even with a proven merged-results pipeline. The head-recording registration tests run with the degraded merge-request watch off, as they did before main enabled it in the shared fixture.
|
Merged current main into this branch. Most of the conflicts were both sides adding code in the same spots: the degraded merge-request watch from #7858, |
|
Speaking as Kun's firstmate: thanks @dimasmjunior. I'm sorry: your Oct 18 live run and your Nov 20 merge both went unanswered for far too long. The live gitlab.com run for What I checked on Gates: the attestation binds Contract class: opt-in, unchanged. It widens a merge gate (as an explicit per-home grant), so a green full suite takes it to Kun as a merge-or-leave card rather than an auto-merge. Heads-up: #8454 and #8830 also touch |
|
Speaking as Kun's firstmate: the quick checks passed on Contract class: opt-in. It widens a merge gate (as an explicit per-home grant), so a green full suite takes it to Kun as a merge-or-leave card. Nothing is waiting on you, @dimasmjunior. |
|
Speaking as Kun's firstmate: the full suite is green on Every gate holds: the attestation binds this head with all steps completed, my diff review is safe with no P1, there are no threads, and it merges cleanly. Contract class: opt-in, security-sensitive. It widens a merge gate (as an explicit per-home grant), so merging needs Kun's explicit word. This now waits on Kun's decision, not on you, @dimasmjunior. If it conflicts with #8454 or #8830 after one of them lands, that's ours to resolve. |
GitLab tasks can now review the merge request's published head and merge a successful merged-results or merge-train pipeline. Both capabilities are off unless a home creates an opt-in file, so nothing changes for an existing installation.
Opting in
Create either or both empty files in the home's
config/directory:config/gitlab-mr-headturns on reading the merge request's published head.config/gitlab-merged-result-mergeturns on accepting a proven merged-results or merge-train pipeline at merge time.Reading the published head (
config/gitlab-mr-head)GitLab publishes each merge request's current head in the project repository at
refs/merge-requests/<iid>/head. With the opt-in,bin/fm-review-diff.shfetches that ref and compares the task against it, andbin/fm-pr-check.shrecords the ref's commit aspr_head=when a task is armed. The ref stays current while the merge request is open and survives deletion of the source branch. The record stays a fallback: a successful fetch outranks it, an unreadable ref records nothing, and the merge path never treats it as authority.Merging a pipeline that ran on a merged result (
config/gitlab-merged-result-merge)A merged-results or merge-train pipeline runs on a temporary merge commit, so its commit is not the merge request's head. With the opt-in,
bin/fm-pr-merge.shaccepts such a pipeline only as this merge request's own pipeline and only when its provenance is proven:refs/merge-requests/<iid>/mergeorrefs/merge-requests/<iid>/train;When the caller passes
--expected-head, that check runs before this proof, so a proven pipeline never stands in for a head that moved.The merge request is read again under the away-record lock and the same proof is repeated; any observed change refuses the merge. Every existing pre-merge condition stays, and
glab mr merge --sha <head>still binds the merge to the verified source head. Missing, unreadable, stale, or mismatched provenance refuses.Without the opt-ins
A GitLab task records no
pr_head=, reviews a recorded head when one exists or the local branch under the existing warning, and refuses a pipeline that did not run at the current head with the same message as before. GitHub, Forgejo, and Gerrit paths are unchanged.Evidence
Each moved behavior has a regression test for the unopted path and one for the opted-in path. The unopted tests fail against the previous implementation: it recorded a head with no opt-in, accepted a merged-result pipeline with no opt-in, and fetched the merge-request head with no opt-in. All three suites pass with the opt-ins in place:
tests/fm-review-diff.test.sh,tests/fm-pr-check-security.test.sh, andtests/fm-pr-merge.test.sh.A command-line run on the same disposable Git fixture compared the unopted path against the current main script: its review output is byte-identical, and the opted-in path reviews the merge request's published fix instead of the stale local branch.
The head ref and the merged-result ref layout were also verified read-only against a public project on gitlab.com. No live merged-results or merge-train pipeline was exercised: both are paid-tier features and no licensed instance was available, so those cases are covered by real Git repositories with substituted GitLab responses. That limit is stated here rather than implied away.
Testing
I ran the three targeted suites (merge, pr-check-security, review-diff) and the repo lint. The suites drive the real scripts against hermetic fixtures and showed no failures. Nothing was driven against a live GitLab, forge or Herdr instance, so the scenarios are recorded as untested.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
bash tests/fm-pr-merge.test.sh(149 ok, 0 not ok; includes the gitlab-merged-results-expected-head refusal case)bash tests/fm-pr-check-security.test.sh(0 not ok)bash tests/fm-review-diff.test.sh(no not ok/fail lines; background run exited 0)bin/fm-lint.sh(exit 0)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.