From 455156676744858c7f742c4bde99d19f8c5cba95 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sat, 7 Nov 2026 12:26:01 -0700 Subject: [PATCH] fix(just): p12-night counts a mutation run with survivors as finished, not failed cargo-mutants exits 2 when mutants were missed and 3 when some timed out. The runner treated every non-zero exit as a failure, and a failed step starts fresh, so a crate with even one equivalent mutant would have been mutated from scratch every night and never marked done. Exits 2 and 3 now record the counts as findings to triage and mark the step done; any other exit (a usage error, a failing baseline) still fails. A resumed run's failure note now says its counts are this run's (cargo-mutants rotates earlier catches into previously_caught.txt). Review of 3b989916 (Muse), F1 and F2; checked with a stand-in just exiting 2 and 4. Co-Authored-By: Claude Opus 5.5 --- docs/testing.md | 7 +++++-- scripts/p12-night.sh | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/testing.md b/docs/testing.md index 9c6a909e..3d2094c3 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -4267,8 +4267,11 @@ never-reached ones. The step's result says it resumed and how many mutants were already tested. The runner sets `P12_MUTANTS_ITERATE=--iterate` for that rerun; the mutation recipes forward that variable to cargo-mutants, so `P12_MUTANTS_ITERATE=--iterate just mutants` resumes by hand the same way. A -run that finished (with or without misses) still starts fresh when selected -again. +run that finished is done, with or without misses: cargo-mutants exits 2 +when mutants were missed and 3 when some timed out, and the runner records +those as findings to triage, not failures, so the crate isn't redone every +night. Only another exit (a usage error, a failing baseline) is a failure, +and a failed step starts fresh the next night. The knobs: `P12_FUZZ_SECONDS` (per target, default 3600), `P12_STOP` (local time, default 07:00, the next occurrence after the start), diff --git a/scripts/p12-night.sh b/scripts/p12-night.sh index fefc485f..1b41be89 100755 --- a/scripts/p12-night.sh +++ b/scripts/p12-night.sh @@ -409,18 +409,22 @@ run_mutants() { if [ "$resume" -eq 1 ]; then note="resumed with --iterate, skipped $skipped already tested; this run: " fi - if [ "$rc" -eq 0 ]; then - if [ -n "$note" ]; then - record_result "$step" "${note}caught $caught, missed $missed, timeout $timeout, unviable $unviable" - else - record_result "$step" "caught $caught, missed $missed, timeout $timeout, unviable $unviable" - fi + # cargo-mutants exits 2 when mutants were missed and 3 when some timed + # out: the run finished and its survivors are findings to triage, not a + # failure. Marking them failed would rerun the crate from scratch every + # night. Any other non-zero (a usage error, a failing baseline) failed. + local findings="" + case $rc in + 2|3) findings=" (finished; the missed and timed-out mutants are findings to triage)" ;; + esac + if [ "$rc" -eq 0 ] || [ -n "$findings" ]; then + record_result "$step" "${note}caught $caught, missed $missed, timeout $timeout, unviable $unviable$findings" return 0 fi if [ -n "$note" ]; then - note="resumed with --iterate, skipped $skipped already tested; " + note="resumed with --iterate, skipped $skipped already tested; this run: " fi - record_result "$step" "${note}failed: caught $caught, missed $missed, timeout $timeout, unviable $unviable (see the log)" + record_result "$step" "${note}failed (cargo-mutants exit $rc): caught $caught, missed $missed, timeout $timeout, unviable $unviable (see the log)" return 1 }