Repository navigation
fix(studio): the edit-accuracy gate says the shards did not run, not that accuracy fell - #6069
Conversation
…that accuracy fell With no shard results, ratchet.mjs threw, wrote no report, and the workflow printed "Edit accuracy fell against the base branch" for what was a build or shard failure. A shard that did not report was also counted as a drop. The gate now exits 2 with "Edit accuracy did not run: N of M shards reported results" when nothing that ran fell, writes its comment and report in that case too, and the workflow prints the gate's own verdict.
somanshreddy
left a comment
There was a problem hiding this comment.
Reviewed at 74fb2c28. No blockers.
Checked
ratchet.mjsverdict mapping:g.okfalse → 1, otherwise a shortfall → 2, otherwise 0. A real drop still outranks a missing shard, andcomment.md/gate.jsonare now written on the zero-shard path too, so the sticky-comment step has a file to post.ci.yml: the fail step runs on any non-zeroexit_code, so exit 2 still fails the job (fail-closed).jqwith2>/dev/nullplus the:-fallback covers a crash beforegate.jsonis written.- I ran the new gate-command cases plus a probe of my own against the head (scratch copy of
ratchet.mjs/report.mjs).
Non-blocking: full grid (merge queue) with a missing shard still reads as "fell"
On the full grid scope is null, so the dead shard's cases count toward basePassing but not toward headPassing. "Passing count fell" then fires, and the code is 1. Probe: base {a, b}, --shards 2, one shard reporting a and holding:
pr exit 2 | Edit accuracy did not run: 1 of 2 shards reported results; ...
full exit 1 | Edit accuracy fell against the base branch; see the PR comment. | the passing count fell from 2 to 1; 1 of 2 shards reported results
The merge queue runs 20 shards and has no PR comment to point at, so this is where a dead shard is most likely to be misread. A possible fix: when there's a shortfall, drop the passing-count reason (or count missing cases separately) and let only regressed/overclaimed make it a 1. The gate still fails closed, so this is fine as a follow-up.
Nit: VERDICTS[1] says "see the PR comment", but under merge_group there's no PR comment (that was already true before this PR).
— Somu
Edit accuracy: accurate 271 (base branch 271), smooth 186 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
What
When no Studio edit-accuracy shard produced results (for example, the build failed), the gate now says so:
Before, it said
Edit accuracy fell against the base branch; see the PR comment., with no PR comment to see, so a build failure read as an accuracy regression. The same goes for a run where some shards did not report and nothing that ran fell (1 of 2 shards reported results). A case that ran and regressed still fails as a drop, even with a shard missing.Why
ratchet.mjs gatethrewno results.json from any shardbefore writingcomment.mdorgate.json, so the step exited 1. The workflow's last step printed one fixed message for any non-zero exit. A missing shard also went through the accuracy reasons, so it exited 1 the same way.Related work
None.
How
ratchet.mjsowns the verdict. Exit 0 is "holds", exit 1 is "fell" (a case that ran regressed, or the passing count fell), and exit 2 is "did not run" (no shard, or some shards missing while nothing that ran fell).comment.mdandgate.jsonin every case, so the sticky PR comment says the gate did not run instead of being skipped.gate.jsoncarries averdictline.verdict. If the gate crashed before writing it, the step says the gate could not finish and points at its log.Test plan
ratchet.test.mjs, four new tests that runratchet.mjs gate --shards Nas CI does, on temp files:maingate.jsonwritten (the throw)verdictverdictgate.json(prints its verdict) and with none (prints the "could not finish" line).ci.ymlstill parses as YAML.Not exercised: the workflow end to end on GitHub with a failed build. The next CI run with all shards green exercises the "holds" path.