Cover the whole of gitlab-org/gitlab, application code included

What does this MR do and why?

The catalogue could rate a quarter of the merge requests in gitlab-org/gitlab and refused the rest by name. This covers the whole repository instead, application code included.

Over three days, 1021 merge requests once forks and community contributions are set aside: 255 ratable, 766 refused. Almost every refusal was a merge request that also touched something the catalogue already understands — a spec, a doc, a lockfile — so the refusal said nothing about it.

Five new areas

Area Floor Covers The question its rubric asks
db high db/, ee/db/ a migration runs once, against data that already exists
authz high app/policies/, config/authz/, lib/auth{n,z}/, lib/gitlab/auth/ who the change lets in, not whether it works
api — lib/api/, app/graphql/, config/routes* whether callers outside this repository stop working
code — app/, lib/, config/, domains/, gems/, public/ whether behaviour something outside the diff depends on changed
tooling — scripts/, qa/, rubocop/, .gitlab/, lint-todo lists, root config how far outside this merge request it is felt

The narrow three sit above code, which would otherwise read db/, app/policies/ and lib/api/ as ordinary Ruby.

No floor on code or api

A floor is a blunt answer to a weak instrument. It rates a corrected comment the same as a changed default, and an area where every tier is the same tier stops being read. The rubrics carry it instead, by saying what low means narrowly enough to check from the diff alone — for code, that nothing outside the diff can observe the change.

A floor is still right where the risk comes from the kind of file rather than from what the change does to it, which is agents and db.

Widened to keep the new areas honest

Not changes in their own right — each is forced by the new areas:

  • specs takes every file type, and the spec/ directory of each gem in gems/ and each domain in domains/. Without this, code would have rated spec files.
  • docs, docs-development and locale take every file type in their trees, plus the root .md files and locale/**/*.po.
  • deps takes the root *_VERSION pins, .ruby-version, .nvmrc, Gemfile.next and Pipfile.
  • agents takes .ai/, .agents/, .claude/ and .gitlab/duo/, which hold the same kind of text as AGENTS.md under a different filename.

The premise this reverses

instructions/README.md said no area covers application code, and that a merge request touching an unowned path is "refused by name, which is the intended answer rather than a gap". That is no longer the position, so the section says what the position is now and why agents and db keep their floors.

Coverage

Checked with the script in ../README.md against every tracked file in a fresh checkout, which is what that section asks for:

  • 0 uncovered of 115910 tracked files.
  • 11 areas of a cap of 12. Largest area 39 patterns of a cap of 40. Manifest under 7 KB of a cap of 40000.

An earlier revision of this branch missed ee/LICENSE, ee/fixtures/, and the tracked placeholder files under log/ and tmp/, because coverage had been measured against the paths that changed in a three-day sample rather than against the tree.

What the rater does with it

Every merge request opened in gitlab-org/gitlab over three days, forks and community contributions set aside: 1021. The gate refuses 214 before the rater — 87 touch more than MAX_RATED_AREAS, 97 have 20 or more files, 47 hit a refused subject, 6 are unmeasurable. The remaining 807 were rated against these rubrics.

decisive tier MRs
low 185 22.9%, auto-approve
medium 235 29.1%
high 365 45.2%
severe 22 2.7%

code accounts for 465 of the 1411 area ratings: 56 low, 219 medium, 188 high, 2 severe.

The first draft of code.md put 381 of those 465 at high, because its bands were cut on whether behaviour changes. Recutting them on what a revert leaves behind moved 164 merge requests from high to medium and 31 to low, with the rest unchanged. Areas whose rubrics did not change moved on 5.8% of ratings across the two runs, so that is the noise floor to read the difference against.

How to set up and validate locally

make spec

spec/mr-risk/instructions_spec.rb holds this to the same Manifest the flow runs, resolves every rubric: to a file, and checks no area is shadowed by one above it.

To confirm the whole tree is owned, from a checkout of gitlab-org/gitlab:

areas = Manifest.areas_from(YAML.safe_load_file("instructions/278964/mr-risk-rules.yml"))
`git ls-files`.split("\n").reject { |p| Manifest.area_for(areas, p) }

Before this runs

The label scopes are new. update_merge_request applies labels that already exist and does not create them, so db-risk::, authz-risk::, api-risk::, code-risk:: and tooling-risk:: need to exist as group labels, at every tier each area can reach.

MAX_RATED_AREAS is 3, and splitting application code into four areas makes a merge request more likely to exceed it. 87 of 1021 do. That is the direct cost of the split and the first thing to watch if refusals climb.

code at no floor means an application-code merge request can reach auto-approve on the rater's judgement alone. That is the intent, and the low tier is written to be checkable from the diff, but it is the tier to watch first.

Edited by Karan Bhatia

Merge request reports

Loading
Loading