Scripts: coverage_gate.py ignores the sweep's exit code, so a failed sweep passes and --update can lower the baseline to match it #2250
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by itsonewi on 2026-11-25T11:42:11Z.
Summary
scripts/coverage_gate.py(426a5a7) runs the sweep and then reads only its stdout:proc.returncodeis never inspected. If the sweep exits non-zero but still printed a report line that parses - a worker that died after the summary, a panic or an OOM on the last programs, a sweep cut short with a partial count - the gate treats it as a complete sweep and compares it against the baseline.Why it matters more with
--update--updatewrites the baseline before anything is compared, and from whatever the sweep reported:So a failed sweep does not just pass once: it can replace the committed reference with the lower counts of the build that failed, and every later run compares against that. The gate then reports "no regressions" for exactly the translation loss it exists to catch.
Not #2196, #2250 or #2099
--validatenever being passed, sovalidator_failedis always 0.--xcl/--rpf, an unreadable--run-json, malformed JSON, a spawn failure. A subprocess that starts, runs and exits non-zero is not one of those - that path has no check at all.Suggested fix
right after
subprocess.run, beforesweep_json(proc.stdout).--run-jsonis unaffected (no process is started). Two tests inscripts/test_coverage_gate.pywould cover it: a sweep fixture that exits 1 with a valid report line (expect 2, and the baseline byte-for-byte unchanged with--update).Tested
426a5a7without a checkout. The claim is the absence of a read ofproc.returncodein the file.AI use
scripts/coverage_gate.pyandscripts/test_coverage_gate.pyon426a5a7and wrote this report; the human account checked the lines against the file before opening it.Imported from ivall/xcl. Originally posted by Creaa on 2026-11-25T11:48:25Z.
I’m taking this. The fix and regression test are ready locally. I’m running the full workspace suite before opening the PR.