Rate Gitaly'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/gitaly (2009901), for gitlab-org/gitlab#638927 and gitlab-org/gitaly#7555.

The project is listed with approve: true and one flow, mr_risk, with consumer 13907518:

  • scopes: all, as gitlab-org/gitaly#7555 asks, so the flow runs on every merge request without waiting for a label. The rules from components/agents-and-flows/gitlab-merge-request!122 (merged) have one area so far, deps: go.mod and go.sum at the root and under tools/, .tool-versions, .ruby-version, and protogem's Gemfile. A merge request touching any other path is refused by name ("no area covers …"), so a person reads it. That is how gitlab-org/gitlab already treats application code. Gitaly's other areas follow in a separate gitlab-merge-request MR, and they need no change here.
  • No sample, so the Gitaly team sees every rating while the rubrics are new. If the volume should be cut while a rubric is corrected, add sample: <1-99>. It is taken from the IID, so a merge request stays in or out across its pushes.
  • low_scopes: all, as asked in review, so gitlab-bot approves each merge request the flow rates low. With one area, only a merge request that stays inside deps can rate low. Nothing approves yet: Gitaly's rules file is in test mode, and approvals start with the gitlab-merge-request change that sets mode: live in instructions/2009901/.
  • 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 !4539 (merged), so whichever merges second rebases with a conflict only in the list of pilots.

Before this is ready

  • components/agents-and-flows/gitlab-merge-request!122 (merged) is merged and in tag 0.34.0, and its catalog sync created this project's consumer for flow 1020378, 13907518. It is set in the config and in risk_pilots.
  • After the sync, @ai-mr-risk-labeler-gitlab-org is a Developer in the project. The sync adds it when it creates the consumer.
  • The mapping example passes with AI_CATALOG_MAPPING_PATH pointed at the .ai-catalog-mapping.json the 0.34.0 sync wrote. CI skips it.

Gitaly has no .gitlab/duo/agent-config.yml, so its sessions use the default image, which has the Ruby the flow's steps need. The flow creates each test- label as a project label the first time it writes it, so nothing has to be made by hand. The upstream check from components/agents-and-flows/gitlab-merge-request!119 (merged) rates a Go module bump by what the new version ships, but only once the session can reach proxy.golang.org and sum.golang.org. Until Gitaly allows both in an agent-config, as gitlab-org/gitlab-elasticsearch-indexer!982 (merged) does, no Go bump rates low.

How to validate locally

SIMPLECOV=0 bundle exec rspec spec/processor/mr_approval_flow/config_spec.rb

The mapping example runs when a gitlab-merge-request checkout sits next to triage-ops, or when AI_CATALOG_MAPPING_PATH points at its .ai-catalog-mapping.json.

🤖 Generated with Claude Code

Edited by Connor Sanders

Merge request reports

Loading
Loading