Loading
Read each project's test or live mode from its own rules
What does this MR do and why?
Gives the MR Risk Labeler a test or live mode per project, as Karan asked for item 4 of gitlab-org/gitlab#638236. Test mode keeps the test- labels, and live mode writes the same labels with no prefix, so a project starts counting through one reviewed change to its own folder. It is stacked on !128 (merged), whose record takes mode= from the prefix the labels went on with.
- The field.
mode: liveat the top of a project'smr-risk-rules.yml. Anything else, or nothing, is test, so a misspelt mode stays inert, andinstructions_specfails any value buttestorlive. The mode decides whether anything acts on the rating, not the rating: the tiers, the action and every check are the same in either mode. - The steps.
classify_areaswrites the mode intogate.json.Manifest.documentreplacesManifest.read, so one parse gives the areas and the mode.decide_labelscomposes its labels unprefixed, the action and the decisive tier once, and addstest-unless the mode is live.build_noteis unchanged: itsmode=follows the applied prefix.plan_removalstakes off the labels of the mode the gate read. With no gate, or with rules the gate could not read, it takes offtest-ones alone, because an unprefixedgitlab-bot::label may then be the older flow's.
- The older flow. Live labels share the MR Approval Action Labeler's
gitlab-bot::scopes, so a project goes live only once that flow no longer labels it.docs/specs/mr-risk.mdsays so, with requirement 10 and invariant 13, andinstructions/README.mdhas a "Test mode and live mode" section. - gitlab-merge-request goes live here. The last commit puts
mode: livein its own rules. Once the code that reads the mode is tagged, its merge requests get live labels andmode=liverecords. Nothing approves on them until gitlab-org/quality/triage-ops!4549 (merged) is deployed, which approves this project's low ratings. The MR Approval Action Labeler has no consumer here;bin/live_testruns it on its own fixtures alone. - Every other project stays in test mode. gitlab-org/gitlab goes live with the triage-ops switch in gitlab-org/quality/triage-ops!4551 (merged), which moves its approvals onto live ratings.
- Going live takes a person. The catalogue's own rubric rates a rules file that says
mode: livehigh, in a new folder as much as an existing one, and the schema example showsmode: test. - A check on the older flow.
instructions_specfails a live project the MR Approval Action Labeler still lists underconsumers:. It reads the flow's own list, not the catalog mapping, which a sync rewrites only on a tag, so the change that takes a project live can pass in the same merge request. Once the older flow is retired and its file is gone, no project is listed and the suite still loads. - The suite runs on a rules change.
instructions/is added to the pre-commitspechook's file filter. A project goes live through a change to its rules file alone, and such a change ran no spec before. - The docs. The README's onboarding steps describe
low_scopesand the record, which arrive with gitlab-org/quality/triage-ops!4549 (merged).instructions/README.mdsays going back to test is not a stop, and thatapprove: falsein triage-ops is.
Size under the catalog's limit
The mode alone would grow the flow, so this drops output nothing reads:
gate.json'sfiles,additions,deletions,diff_bytes,unsupported_pathsandcomplete_list, and itschecksandfailed_checks. The steps readeligible,areas,mode,head_shaandrules_path; the status line has its own copies, the session log still names the failed checks, andbin/live_testruns the older flow.Diffs.changed_line_count, which only fed them, andDiffs.text, which had one caller left.DecideLabels::FIXED, which only a spec read.
flows/mr-risk.yml now has a 40,762-byte definition, 198 under the catalog's 40,960-byte limit (40,790 after !128 (merged)).
Not done here
- Labels from the other mode stay on open merge requests when a project changes mode. Nothing acts on a
test-label, and a refusal takes off the labels of the mode it read. Cleaning them up is not in this change. - Karan to confirm the rules file as where the mode lives, rather than a list compiled into the flow.
- The rubric change is not scored with
bin/eval: no suite covers the catalogue's own rules.
How to set up and validate locally
make checkEdited by Connor Sanders