Skip to content

feat(control): pipelines-must-succeed and all-threads-resolved merge gates on the merge settings control - #677

Merged
thomasboni merged 3 commits into
mainfrom
feat/mr-settings-merge-gates
Dec 3, 2026
Merged

thomasboni merged 3 commits into
mainfrom
feat/mr-settings-merge-gates

Conversation

@thomasboni

@thomasboni thomasboni commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Why

A customer could not map the merge request settings control to GitLab's own merge request settings page, and asked for its two merge checks: "Pipelines must succeed" and "All threads must be resolved". The control (mergeRequestSettingsMustBeCompliant, ISSUE-506) compared eight settings and lacked those two.

What changes

  • Two optional expectations on the control, Free-tier, compared for exact equality like the eight others:
    • pipelinesMustSucceed: GitLab only_allow_merge_if_pipeline_succeeds ("Pipelines must succeed")
    • allThreadsMustBeResolved: GitLab only_allow_merge_if_all_discussions_are_resolved ("All threads must be resolved")
  • Collected from the same project call as the eight (no extra request), carried on the IR, rendered in the finding with GitLab's labels (Pipelines must succeed is disabled (expected enabled)).
  • Platform mode: the two are OPTIONAL in the snapshot (project_details.only_allow_merge_if_pipeline_succeeds, ..._all_discussions_are_resolved). A snapshot stored before this release keeps evaluating the eight settings; a policy that expects one of the new gates against such a snapshot reports the control not evaluable (reason snapshot_lacks_merge_gates) until the platform serves them, never a fabricated deviation.
  • Schema docs, the catalog, the default config comments and the ISSUE-506 description and remediation name the two settings.

Verification

  • make lint, make deadcode, go vet ./..., go test ./... -count=1: green.
  • Standalone e2e and linked-mode e2e: see the two comments below.

Follow-up

The platform serves the two snapshot fields and bumps its pin in the follow-ups pull request on the monorepo (same program, after this release).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR

@thomasboni

Copy link
Copy Markdown
Contributor Author

Standalone mode e2e (gitlab.com, config enables mergeRequestSettingsMustBeCompliant with pipelinesMustSucceed: false and allThreadsMustBeResolved: false), head 6e73ffa against a build of origin/main.

Project dorianturba/zero-to-ci (GitLab setting "Pipelines must succeed" ON, "All threads must be resolved" OFF), ISSUE-506 message:

origin/main (the two keys are unknown to it, it ignores them):

Merge request settings do not match the policy: Merged results pipelines are disabled (expected enabled), Resolving outdated diff discussions is disabled (expected enabled), Squash is "Allow, off by default" (expected "Allow, on by default").

this branch:

Merge request settings do not match the policy: Merged results pipelines are disabled (expected enabled), Pipelines must succeed is enabled (expected disabled), Resolving outdated diff discussions is disabled (expected enabled), Squash is "Allow, off by default" (expected "Allow, on by default").

Only difference: the new clause Pipelines must succeed is enabled (expected disabled). On getplumber/plumber (both gates OFF) the two outputs are identical, no gate clause, as expected. The old binary also prints a configuration warning for the two unknown keys.

@thomasboni

Copy link
Copy Markdown
Contributor Author

Linked (platform) mode e2e: throwaway CI job on gitlab.com bigtech-150/documentation/api-documentation (onboarded on https://demo.getplumber.tech), branch e2e/mr-gates-6e73ffa2 (deleted afterwards), pipeline 3142426716, job runs go run github.com/getplumber/plumber@6e73ffa2 analyze with PLUMBER_ANALYZE_PLATFORM=https://demo.getplumber.tech and an OIDC id_token for that audience.

Log lines:

platform: https://demo.getplumber.tech
Config     the platform's policies
ISSUE-506  MR settings are not compliant
  Merge request settings do not match the policy: Merge method is "Merge commit" (expected "Fast-forward merge"), Merged results pipelines are disabled (expected enabled), Squash is "Allow, off by default" (expected "Never").
Global score (platform): C  67 / 100 pts
Exit 0
Results pushed to the platform: https://demo.getplumber.tech
Job succeeded

The demo policy configures neither gate, so the Task 4 guard did not fire: ISSUE-506 evaluates as before, no snapshot_lacks_merge_gates anywhere in the log, and the push was accepted.

Comment thread gitlab/snapshot.go Resolved
@thomasboni

Copy link
Copy Markdown
Contributor Author

Doc PR: getplumber/getplumber.io#578

@Exypte Exypte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two fixes before merge (the gate mark copied into every platform policy, and the whole control dropped when a gate is unknown), plus four nits inline.

Comment thread control/task.go Resolved
Comment thread control/lanes.go Resolved
Comment thread gitlab/snapshot.go Resolved
Comment thread gitlab/project.go Resolved
Comment thread policies/message_style_test.go Resolved
Comment thread policies/message_style_test.go Resolved
Comment thread gitlab/collect_protection.go Resolved
thomasboni added a commit to getplumber/getplumber.io that referenced this pull request Dec 3, 2026
…ated

Follows the review of getplumber/plumber#677: a merge check the platform does not serve yet is left out of the comparison, and the control is not evaluable only when nothing deviates.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Claude PR review — findings not anchorable to the diff

None on the latest revision.

…gates on the merge settings control

Adds two optional expectations to mergeRequestSettingsMustBeCompliant (ISSUE-506), available on
every GitLab tier and compared for exact equality like the eight existing settings:

- pipelinesMustSucceed: GitLab only_allow_merge_if_pipeline_succeeds ("Pipelines must succeed")
- allThreadsMustBeResolved: only_allow_merge_if_all_discussions_are_resolved ("All threads must
  be resolved")

Both come from the project call the collector already makes. The finding names them with
GitLab's labels, for example "Pipelines must succeed is disabled (expected enabled)".

Platform mode: the two are optional in the snapshot's project_details, each tracked on its own.
A gate the snapshot did not carry is left out of the comparison, so deviations of the other
settings are still reported. The control is not evaluable (snapshot_lacks_merge_gates) only when
nothing deviates and an expected gate was not read, so it never claims a pass it could not check.

Schema docs, the catalog, the default config comments and the ISSUE-506 texts name the two
settings.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR
@thomasboni
thomasboni force-pushed the feat/mr-settings-merge-gates branch from 6519410 to e8d5cb3 Compare December 3, 2026 15:50
@thomasboni

Copy link
Copy Markdown
Contributor Author

On the unanchored finding (the wire-contract decode test not covering the two merge-gate fields): fixed, now part of the squashed commit e8d5cb3.

internal/platform/contract_v2_test.go:

  • TestSnapshotDecodesProjectDetailsSecurityPolicyRawConfigAndMergeStatus carries only_allow_merge_if_pipeline_succeeds: true and only_allow_merge_if_all_discussions_are_resolved: false in its JSON body and asserts both pointers and their values.
  • TestSnapshotProjectDetailsOptionalMergeSettingsAbsentStayNil checks both stay nil when absent.
  • TestSnapshotProjectDetailsMergeGatesAreIndependent (new): a body with only the pipeline gate decodes it and leaves the other nil.

Proven to bite: with the first tag mistyped as only_allow_merge_if_pipelines_succeeds, two of these tests fail.

The branch was also squashed into one signed commit at Thomas's request; the tree is identical to the reviewed head plus this test.

…te mark

In platform mode, the SARIF, GitLab SAST, CSV and OCSF reports read the
union of the policy runs. The union kept the first run's not-evaluable mark
for a control, so when one policy could not read its merge gates from a
pre-gate snapshot and another found a real ISSUE-506 deviation, the CSV and
OCSF status said "not evaluated" for a control that failed.

The snapshot_lacks_merge_gates mark only says that one policy's gates were
unreadable, so the union now drops it when any run reports a finding on the
same control. With no finding, the mark stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the project member quota control (ISSUE-507, #504) and the 0.7.25 release. Conflicts
were additive on both sides and keep both controls; the catalog golden is regenerated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR
@thomasboni
thomasboni merged commit daa20a9 into main Dec 3, 2026
18 checks passed
@thomasboni
thomasboni deleted the feat/mr-settings-merge-gates branch December 3, 2026 17:28
plumber-release Bot pushed a commit that referenced this pull request Dec 3, 2026
## [0.7.26](v0.7.25...v0.7.26) (2026-12-03)

### ✨ Features

* **control:** pipelines-must-succeed and all-threads-resolved merge gates on the merge settings control ([#677](#677)) ([daa20a9](daa20a9))
thomasboni added a commit to getplumber/getplumber.io that referenced this pull request Dec 3, 2026
…ntrol (ISSUE-506) (#578)

* docs(controls): the two merge checks of the merge request settings control (ISSUE-506)

Documents pipelinesMustSucceed and allThreadsMustBeResolved on mergeRequestSettingsMustBeCompliant: the configuration reference and the ISSUE-506 page, with the platform not-evaluable note.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR

* docs(controls): an unread merge check leaves the other settings evaluated

Follows the review of getplumber/plumber#677: a merge check the platform does not serve yet is left out of the comparison, and the control is not evaluable only when nothing deviates.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
thomasboni added a commit that referenced this pull request Dec 3, 2026
Conflicts with the member quota control (#504) and the merge gates (#677),
both sides kept everywhere:

- control/task.go: the engine config goes through engineConfigFor then
  omitUnreadMergeGates; the two GitLab early returns attach the member
  quota verdict and mark mise-en-place not evaluated; runRegoEngine keeps
  its error return and takes membersData; the end of the run marks the
  merge gates gap and the mise gap.
- control/packagemanagers_run_test.go: runRegoEngine call updated to the
  new signature (a compile break git did not flag).
- control/platform_call_inventory_test.go: recorder fields of both sides.
- test lists and the fingerprint golden: both controls listed.
- cmd/testdata/catalog_golden.json: regenerated with -update-catalog.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UuPoP4xPXZ8rLEDYRiKznq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants