ADR-0146: A round of watch is quick, advisory and keyed apart
Status: Accepted
Date: 2026-11-10
Amends: 0010: what a round of watch judges by and what it says, where local.quick is on
Amends: 0023: which test files a round of watch measures again, where local.quick is on
Amends: 0120: what a change during a round stops, and what a round prints
Context
A round of watch plans as run does (ADR-0010). After a save to a
source file it measures again every test file whose coverage entry reads
that file (ADR-0023), checks each mutant with the static analyser, and
runs each mutant's own run with its verification tail: on the quick-start
fixture, one source file and 12 mutants, a round takes 16.4 to 17.1 CPU-s
and its first result arrives about 15 s after the save.
A split stream (ADR-0117) runs the test files that cover a shard's mutants once, unmutated, and forks a mutant only where a test executes its site; its parent is the child's control, so a kill needs no other. A test that never reaches a site costs its own time and judges nothing.
The coverage map can lag a save: a call the save adds runs code no kept entry shows. The static graph (ADR-0132) places each test file that names what a source file declares, without running anything.
Decision
local.quick,trueby default, makes every round ofwatchquick.pre-push,runand CI are never quick.- A quick round takes a changed source file's coverage instead of
measuring it. After the first round, which measures as today, a round
measures again only the test files that changed since the round before,
or that the kept map holds nothing of. Every other test keeps its lines,
and each PHP source file that changed since the round before is covered
on every line by the union of every test the kept map shows running any
line of it and every test of the test files the static graph says reach
it, where
outbreak.graphis notoffand the graph answers. A test that does not run a line costs time in the stream and judges nothing. - A quick round streams its mutants and checks none statically. It
lays
splitStream.enabled: true,splitStream.sharding: sourceandstaticCheck.tool: noneover the config: each mutant is forked first at the test the ledger last saw kill it (ADR-0117 decision 8), then at every covering test, in the covering test files in suite order. A mutant no stream can judge runs its own run as before. These win over what the config sets, an explicitsplitStream.enabled: falseorstaticCheck.toolamong them: streaming is what makes a round quick, andlocal.quick: falsegives rounds that judge by the config as it stands. - Its proofs are keyed apart. The configuration part of every key a
quick round builds carries
quick(ADR-0007 item 3), sopre-push,runand CI never take a quick proof, and a later quick round does. - It never says it passed. The console report of a quick round opens
with
mutation-gate: quick, not a verdict, names its scope and says thatmutation-gate pre-pushgives the verdict; each linewatchprints of a batch as it ends starts with[quick]. - It takes the retested and the saved units first. A quick round runs
first the units whose last result is unsettled and which a test of a test
file saved since the round before runs, by the kept map; then the units
saved since the round before; then the rest in the order a budget takes
them (ADR-0008). Within a run each mutant is forked first at its last
killer, and inferred-subsumed mutants run last (ADR-0079): the order
ADR-0133 decision 8 gives
outbreak serve. A batch's controls run in the same order, those of the units it took first first (ADR-0008), and a batch takes a unit only with room for its kills' control, so a saved unit's kills stand within the round's budget. - A save cancels by unit. Where
local.cancelByUnitis on, a save during a round drops from its queue the units whose files it changed, and every other unit runs on. A batch that runs such a unit is halted: everylocal.watchPoll, a second at the least, the batch reads its units' files again, and once one has moved the gate sends itselfSIGUSR2, on which every set of processes it awaits stops each one still running. Nothing a halted batch came to is read or told: every unit of it is left unjudged, as is every dropped unit, so their mutants are pending, never judged; what every other batch judged stands, keyed by the digests it was planned on. Wherepcntlis missing a batch runs to its end. Off, a save stops the round before its next batch (ADR-0010). - Each judged mutant is an event.
watch --output=eventsprints one line of JSON per judged mutant as its batch ends,{"mutant", "site", "status", "by", "quick", "unit", "digest"}: the statuskilled,survived,timeout,pendingorequivalent,bythe killing test,digestthe digest the plan took of the unit's file; a mutant a marker ignores is no event; a survivor's verification run is inside its batch, so its event says what the verification judged. A round ends with one more line,{"round", "mutants", "why"}:roundisjudged,changedwhere a change stopped it,invalidorunjudged,mutantshow many events it printed,whythe reason of one it could not judge; so a round that reached nothing says so. A reader of mutants passes over it, as the language server does. The PHPservethatoutbreak servestarts sends the same lines to every client (ADR-0133 decision 9). The console prints one block per unit as each batch ends, and ends a round with the whole report only withwatch --whole-report, or wherelocal.streamBatchesis off;--output=problemsstill ends every round with its problems. - The first round can start from a carried map, and
watchcan end after a count of rounds.local.fromMap(watch --from-map) names the directory of a mapcoverage --intowrote. Where that map says the commit it was measured at and that its working tree was clean, the first round is quick against it as a later round is against the round before, over every file changed from that commit to the working tree; a map that cannot be read, says no commit or was measured in a dirty tree is named, and the first round measures every test.local.rounds(watch --rounds) endswatchafter that many rounds: passed where the last round judged, failed where it could not judge.
Settings
| Setting | Values | Default | Effect |
|---|---|---|---|
local.quick | true, false | true | judges or reports only; a quick round's proofs are keyed apart |
local.cancelByUnit | true, false | true | judges or reports only |
local.fromMap | a directory inside the project | none | judges or reports only; the first round is quick |
local.rounds | an integer, at least 1 | none: until stopped | judges or reports only |
Why no verdict moves
- Nothing outside
watchreads a quick result. Its proofs carryquickin their key, and no other run builds that key. - A kill is a real failure. A stream's child fails a test its parent passes; the shorter order of the covering test files can kill a mutant a whole-suite stream would not (ADR-0136), which is why the round is labelled and keyed apart.
- Survivors can only grow. No static check and a map that can lag show
more survivors, never fewer;
pre-pushjudges them all again. - A cancel judges nothing. A stopped process can read to its runner as a timeout, so nothing a halted batch came to is read; its units and the dropped ones are left as units no batch took: unjudged, never killed.
- A carried map lags no more than the round before's. It is taken only where it was measured clean at a commit, and every file changed from that commit is a change of the first round, as a save is of a later one.
- Order moves no result. It decides only which unit a budget reaches first.
Alternatives considered
| Alternative | Why not |
|---|---|
| Stream the whole suite in each round | The verdict CI gives, at seconds to minutes per save. |
| Keep today's rounds and their tail | A round stays at 15 s to its first result on a one-file fixture. |
| Lay the stream and the check only where the config leaves them unset | A config that sets staticCheck.tool or turns streams off would make every round as slow as today while it still says quick; local.quick: false already gives those rounds. |
Let pre-push take a quick kill | A quick kill can be one a whole-suite stream would not make; taking it loosens the verdict. |
| Measure every moved test file, as today | The re-measure is the largest part of a round after a source save. |
| Stop the whole round on any save, as before | A save to one unit throws away the work of every other; local.cancelByUnit: false keeps it. |
| Read what a halted batch judged before the halt | Its runner reads a stopped process as one that ran out of time, which counts as a kill; only a whole batch's result is sound. |
| Print the whole report after every round | It scrolls each round's blocks away; --whole-report gives it. |
Consequences
watchshows a save's survivors from the covering test files alone, first at each mutant's last killer.pre-pushjudges every unit a quick round judged again, by its own key.local.quick: falsegives the rounds ADR-0010 describes.- A save shows its own unit's results first and leaves every other unit's work running.
- An editor or a daemon client reads one JSON line per judged mutant.