Rate gitlab-org/cli's merge requests with the MR Risk Labeler, approving low ratings
What does this MR do and why?
Step 3 of onboarding a project to the MR Risk Labeler, for gitlab-org/cli (34675721), for gitlab-org/gitlab#638927.
The project is listed with approve: true and one flow, mr_risk:
- scopes:
all, so the flow runs on every merge request without waiting for a label. The project's rules (components/agents-and-flows/gitlab-merge-request!124 (merged)) cover every tracked path. - No
sample, so the CLI team sees every rating while the rubrics are new. Addsample: <1-99>to cut the volume while a rubric is corrected. low_scopes: all, as asked in review, so gitlab-bot approves each merge request the flow rates low. Nothing approves yet: CLI's rules file is in test mode, and approvals start with the gitlab-merge-request change that setsmode: liveininstructions/34675721/.excluded_labels: [automation:prevent-risk-flow], the same escape hatch as every other project the flow runs in.
config_spec.rb lists the project, holds it to the risk labeller alone, approving its low ratings, and checks the no-category and escape-hatch examples over every project the flow runs in. It is written the same way as !4530 (merged), !4537 (closed) and !4538 (merged), so whichever merges second rebases with a conflict only in the list of pilots. !4541 (merged) is written the same way for release-platform-canary, whose entry differs, so whichever of those two merges second also gives the pilot example an entry per project.
The Duo review approval pilot
gitlab-bot's approvals on Duo Code Review's behalf (GitlabCli::ApproveOnDuoReview) are gone: !4575 (merged) removed that pilot, and master is merged into this branch. So this is the change that lets the risk rating approve in CLI (step 4), and CLI has no gitlab-bot approval path until its rules go live. It needs CLI's CODEOWNERS entries for gitlab-bot, as the Duo-only path did.
Before this is ready
- components/agents-and-flows/gitlab-merge-request!124 (merged) is merged and tagged as
0.33.0, and the catalog sync has created this project's consumer for flow 1020378,13880539.consumer_idis set to it, in the config and inrisk_pilots. - gitlab-org/cli!4355 (merged) is merged. CLI's Duo session image is
debian:bookworm-slim, which has no Ruby, and every step of the flow is arubycommand. - After the sync,
@ai-mr-risk-labeler-gitlab-orgis a Developer in the project. The sync adds it when it creates the consumer. - The mapping example passes with
AI_CATALOG_MAPPING_PATHpointed at the new.ai-catalog-mapping.json. CI skips it.
The flow creates each test- label as a project label the first time it writes it. triage-ops does not start it on merge requests labelled Community contribution, which were 100 of the 225 merged in the last 30 days.
How to validate locally
SIMPLECOV=0 bundle exec rspec spec/processor/mr_approval_flow/config_spec.rbEvery example passes. The mapping check runs only where AI_CATALOG_MAPPING_PATH points at gitlab-merge-request's .ai-catalog-mapping.json, and it passes against the one tag 0.33.0 wrote.