Replay what gitlab-bot approved through the gate's path checks
What this adds
A spec that replays the merge requests gitlab-bot approved in gitlab-org/gitlab through the MR Risk Labeler's gate, on their paths alone. It runs in make check, with no model call and no network.
spec/mr-risk/parity_spec.rbruns each saved merge request throughClassifyAreas.assesswith the project's rules. It fails when:- a merge request is refused that the fixture does not list, or one it lists is no longer refused;
- a merge request lands in an area its scope does not approve;
- a scope names an area the rules do not declare.
spec/mr-risk/fixtures/approved/278964.ymlholds the merge requests, by the scope gitlab-bot approved each in, with the paths each changed. It also holds the areas each scope approves and the refusals known today. It is keyed by project ID, so another project can add its own file.instructions/README.mdtells rules authors the suite replays these.
Why
The switch of gitlab-org/gitlab to this flow (gitlab-org/gitlab#638236) is meant to keep what gitlab-bot approves there. Nothing checked that. A change to an area's paths, or a gate check, could take a kind of merge request out of reach and nobody would see it until approvals stopped.
What the replay shows today
The fixture is every merge request gitlab-bot approved in gitlab-org/gitlab from 2026-10-28 to 2026-11-11, on the MR Approval Action Labeler's labels.
| Scope | Approved | Still fit | Refused by the gate |
|---|---|---|---|
pipeline_spec_only |
341 | 322 | 19 |
bot_dependency |
30 | 30 | 0 |
docs_only |
3 | 2 | 1 |
The 20 refusals are all allowed_subjects. The gate refuses a path that matches a legal, pricing or release subject, such as ee/spec/models/compliance_management/framework_spec.rb or spec/lib/gitlab/global_id/deprecations_spec.rb. The MR Approval Action Labeler skips that check for specs, locale and dependency bumps (subject_gated: false in src/flow/scripts/categories.rb). The MR Risk Labeler applies it to every file.
This merge request does not change the gate. The fixture lists the 20 under refused:, so the spec states what holds now and fails when it moves in either direction. Whether to narrow the gate is a decision for the flow's owner.
The four pipeline-common include pins fit because bot_dependency approves tooling, which is gitlab-org/quality/triage-ops!4551 (merged).
What it does not prove
- The tier. It replays paths. Whether the rater gives these merge requests low is not measured here.
- That the scope table matches triage-ops.
scopes:in the fixture is a second copy ofLOW_SCOPE_AREASin triage-ops. Nothing holds the two together. - Anything about a merge request whose approval was withdrawn. The set is the approvals standing when it was collected.
How the fixture was collected
From the knowledge graph, read-only: the merge requests gitlab-bot approved in project 278964 created since 2026-10-28, with the files of each one's latest diff.
glab orbit query "MATCH (u:User {username: 'gitlab-bot'})-[:APPROVED]->(mr:MergeRequest {project_id: 278964})-[:HAS_LATEST_DIFF]->(d:MergeRequestDiff)-[:HAS_FILE]->(f:MergeRequestDiffFile) WHERE mr.created_at >= '2026-10-28T00:00:00Z' RETURN mr.iid AS iid, f.new_path AS new_path, f.old_path AS old_path, count(f) AS n ORDER BY n DESC LIMIT 1000"The scope is the one triage-ops would match: docs_only for docs-only, pipeline_spec_only for ~"pipeline:spec-only", and bot_dependency for the dependency bot's merge requests with maintenancedependency and ~"automation:bot-authored".
Checks
make checkpasses.- The spec fails as it should when
toolingis taken out ofbot_dependency, when a refusal is dropped from the list, and whenee/spec/**/*is taken out of thespecsarea. - It also passes against the code on !134 (merged)'s branch.