feat(just): p12-night resumes a cut-off mutation step with --iterate

A mutation step stopped at P12_STOP (or by `just p12-stop`) is marked
partial and used to restart from scratch the next night: run_mutants
rm -rf'd the crate's output directory and the recipes did not pass
cargo-mutants' --iterate. A crate whose run takes longer than one night
could never finish.

cargo-mutants 27.1.0 writes caught.txt, unviable.txt, timeout.txt and
missed.txt incrementally, and --iterate reads caught.txt, unviable.txt
and previously_caught.txt before rotating the output directory. A killed
run therefore resumes: mutants already caught or found unviable are
skipped, while missed, timed-out and never-reached mutants are retested.
Verified on a scratch crate: a run killed after 19 of 42 mutants; the
--iterate rerun found 23 to test, excluded the 19, retested the mutant
killed mid-test and the unreached ones; a third run excluded 38 and
retested only the 4 missed.

A partial mutation step now keeps its output directory and the runner
sets P12_MUTANTS_ITERATE=--iterate; every mutation recipe forwards that
variable to cargo-mutants. Fresh and failed steps still rm -rf and start
over, and the empty-name guard stays before the rm. The step result
records that it resumed and how many mutants were already tested.

Also resolve cargo-mutants' output layout while here: -o NAME puts the
files in NAME/mutants.out, so the state copy, the counts and the resume
skip count now use that inner directory instead of counting zero. The
core recipe's default output is already the repo's mutants.out.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
swaitsandDeepSeek V4.1 Flash committed 2026-11-07 12:18:52 -07:00
1 parent 7aa1297840
commit 3b9899167c
3 files changed
+126 -32

No files matched your search

+15 -6
View File
@@ -4254,12 +4254,21 @@ just p12-stop # stop a live runner the way the deadline does
State is in `${XDG_CACHE_HOME:-$HOME/.cache}/wanderbooks/p12/`:
`summary.md` (rewritten after every step: status, start, end, duration,
result), `logs/<step>.log` (and `logs/fuzz-<target>.log`), `done/<step>`
markers, and `mutants/<step>/` with each run's `mutants.out` (the core) or
`mutants-<step>` output. A step with a done marker is skipped, so a night
resumes where the last one stopped; a partial or failed step has no marker
and reruns next night. Mutation runs start over after a cut-off: the
recipes as written do not pass cargo-mutants' `--iterate`, so a half-run
crate is redone rather than mixed with the old output.
markers, and `mutants/<step>/` with that run's cargo-mutants output files
(`caught.txt`, `missed.txt`, `timeout.txt`, `unviable.txt`, ...). A step with
a done marker is skipped, so a night
resumes where the last one stopped; a failed step has no marker and reruns
from scratch next night. A mutation step cut off by the deadline or by
`just p12-stop` is marked partial and keeps its output directory: the next
night reruns it with cargo-mutants' `--iterate`, which reads the `caught.txt`,
`unviable.txt` and `previously_caught.txt` that the cut-off run wrote as it
went and skips those mutants, while retesting the missed, timed-out and
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.
The knobs: `P12_FUZZ_SECONDS` (per target, default 3600), `P12_STOP`
(local time, default 07:00, the next occurrence after the start),