Loading
Let bin/eval score the MR Risk Labeler and its rules
What does this MR do and why?
bin/eval can now score the MR Risk Labeler. A change to its rules or rubrics under instructions/, or to src/mr-risk/, can be scored git:origin/main against the working tree, as AGENTS.md asks for a prompt change. Until now, a cut mr-risk flow stopped at its first read of the catalogue (get_repository_file), so no run reached the rater.
ruby bin/eval run mr-risk-deps --variant main=git:origin/main --variant branch=flows/mr-risk.ymlHow it works
- A variant carries its rules.
git:REFreadsflows/mr-risk.ymlandinstructions/at the ref. A file source reads theinstructions/of the checkout the file is in, as they are on disk. The variant's digest covers its rules, so a resumed run refuses a label whose rules changed. - The rubric slots are worked out before the run. The gate picks each slot's rubric from the case alone. So for each variant and case, the variant's own compiled
locate_rulesandclassify_areasrun outside the sandbox first, on the replayed merge request and that variant's rules. Then eachget_repository_fileread becomes aread_fileof a snapshot, and its consumer gets the reply as a literal, in the{"content": …}shape and through Duo's filters. A read the run never reaches, or whose file the tree lacks, gets no snapshot, so it fails as a fetch of a missing file would. - The answer file. mr-risk writes
answer.txtitself, so the cut flow keeps that step instead of adding a second save that would fail. - Scoring. Decisions and the scorecard read labels with or without the
test-prefix. The decisive tier,test-gitlab-bot::risk::<tier>, is the scored tier, and a new "Per area" section shows the tier each area a case touched was labelled. Reports for the deps and flow suites are unchanged.--classifier-onlyis refused for mr-risk, because such a run never writes labels. - A suite,
mr-risk-deps. It reads deps-gitlab's 30 saved dependency-bot MRs (saved: deps-gitlab) rather than copying them.- It replays each one as opened from the project it targets (
unforked: true). Every one comes from the bot's fork, which the mr-risk gate refuses whatever the rules say, so the suite scores the rules and the rater, not the fork rule. - As in deps-gitlab, only the below-1.0 runtime group is labelled.
- It replays each one as opened from the project it targets (
- Locale. The offline steps run with
RUBYOPT=-EUTF-8. Without it, on Ruby 3.4 the gate refuses any merge request holding non-ASCII as unreadable. A spec fails if that setting goes.
Validation
make checkstops only atmain's own RuboCop offense insrc/mr-risk/scripts/payload.rb, which !106 (closed) fixes. The specs pass: 167 deps, 390 flow, 162 mr-risk and 165 eval examples, with 0 failures.bin/compile --checkand yamllint pass.--show-flowfor gitlab-261992 (a CI image) and gitlab-258858 (a qa gem). Both variants' cut flows have 33 steps and keepclassify_riskanddecide_labels, with no writing step. Each variant replays its owndeps.md.- A full run, used to score a rewritten
deps.md(in !112 (merged)):- 30 cases, three passes, 180 sessions;
mainwith !110 (merged)'s tip at the time, on both sides, with the olddeps.mdagainst the new one;- no run unreadable or refused, and no wrong
low. The new rubric gave the samedepstier in every pass of all 19 cases that reach it.
Not in this MR
!112 (merged) carries this MR merged in, and builds on it:
- The upstream check's replay. !112 (merged) adds the check to mr-risk, and extends this harness to run it outside the sandbox.
- The fork rule itself. In production, mr-risk refuses every dependency-bot MR in gitlab-org/gitlab as a fork. !112 (merged) also lets the bot's own fork through.
- The suite's upstream labels. !112 (merged) gives
mr-risk-depsthe deps-gitlab design's label for each case.
Edited by Connor Sanders