ADR-0008: A run spends its time on the riskiest code first, and never passes what it did not judge
Status: Accepted Date: 2026-09-29
Context
Four things decide whether a mutation gate can be trusted day to day, beyond what it mutates.
- Time. A developer at a pre-push hook, or a CI job with a fixed slot, has minutes, not the hour a full run takes. A run that stops early must spend those minutes where a survivor is most likely. What it did not get to must never read as passed.
- Timeouts. The in-house gate’s worst shard spends fifteen to thirty minutes mostly on timeouts. Those are mutants of code every test runs through, whose covering tests take nearly as long as the limit. A timeout there is not a test saying what broke. It is the clock running out.
- Flaky tests. A test that sometimes fails kills mutants it did not detect, and a test that sometimes passes lets real survivors go. Either way the score moves between two runs of the same code.
- Equivalent mutants. Some mutants cannot be killed because they do not
change behaviour. Both runners have ignore markers (
// @pest-mutate-ignore,@infection-ignore-all, Infection’signoreSourceCodeByRegex). A marker carries no reason and no end date, and it removes the mutant from the count as if it never existed.
A framework app differs from a library in what boots, what every test runs through and which files decide how the suite runs. The approved scope ships presets for Laravel, Symfony and plain libraries.
Decision
-
A time budget orders the work by risk and stops honestly.
-
Setting it.
budget, a duration, or--budget=<duration>for one command. It applies to one process: a whole run, or one shard. There is none by default. Watch and pre-push set their own (ADR-0010). -
The order. Units are ordered by risk. Ties go by path.
- Units with changed lines, whose mutants the new-code floor judges.
- Units whose last recorded result has a survivor or a mutant too slow or too heavy to judge.
- Units never mutated.
- Units reached by a changed test or test support.
- Everything else, most recently changed first, by the newest commit on
HEADthat changed the unit (a held path by its newest file). A unit no commit changed comes after those one did.
A run that knows no change, as a full run does not, has no unit in classes 1 and 4.
-
Batches. A runner orders mutants inside one invocation itself, so the gate controls order between invocations. It runs units in batches, each sized by the cost model (ADR-0006) to fit the remaining budget. Batches are as large as the budget allows, because each one pays the runner’s opening run. Where the run controls kills (
controls.killson, and no split stream judges its mutants, ADR-0117), a unit fits only with the unmutated control its kills ask for: its file’s covering tests, of a held unit those that hold it, allowed the standard limit up totimeouts.controlMost. The batch’s controls are fitted after its mutants by the same rounds as every control, as many at once as the pool runs, each round as long as the longest. So a batch never takes a unit whose kills it has no time to control: a unit’s mutants run only where their kills can stand. When the next batch does not fit, none is started. At the deadline the runner is stopped, and a batch it could not judge once the deadline passed is left unjudged. A timeout retry or a survivor confirmation runs only as many mutants as fit in the time left, each at its whole limit, as many at once as its pool runs, round after round. -
Unjudged mutants. Every mutant the budget left without a result is unjudged. Such a mutant:
- counts as not killed (ADR-0003);
- is listed by unit in every report, with the command that judges it
(
vendor/bin/mutation-gate run --budget=<duration>, the gate named as it was started, ADR-0022); - keeps its unit out of the ledger (ADR-0007), and the run’s commit out
of its
lastRun, which the run removes, so the scope’s nextlast-runchange is read since the default branch again (ADR-0005); - means its tree’s floor is never raised by this run;
- fails the verdict, naming its unit.
Why a mutant is unjudged is one of three: the budget ran out before its unit was mutated, before its timeout could run again, or before its survival could be confirmed.
-
Units the budget never started. Each proof records, beside its key, the digests of its inputs (ADR-0007): the unit’s source, what decides its mutant set besides the source (the gate, the config, the runner, what is installed, the files that define the runner and the test bootstrap every key reads), and each test file that killed one of its mutants, with the support that file reads. A unit the budget never started counts by its newest result in the ledgers the run reads only where that result’s source and mutant-set digests equal this run’s. It fails the verdict, named with why and the command that judges it, where no ledger holds a result of it, where its newest result records no digests (a ledger of format 2), or where either digest differs. New code in such a unit is therefore never judged by a result of the code before.
Where the result counts, each of its mutants stands or is unjudged:
-
a mutant the score counts as not killed, such as a survivor, stands, which can only make the verdict stricter. An uncovered one stands only where the run’s coverage map shows no test covering its line now;
-
a kill stands only where every test that killed it is known, each of their files, with the support it reads, has the digest it had then, and either:
- the result was established at this run’s base, the one its content
keys are built on (ADR-0007). The base leaves out what the key’s
exceptions leave out, such as
proofs.ignore’s files, so a kill stands across a change to one of those; or - nothing that changed since the commit the result records (ADR-0007)
reaches the kill’s unit or a test that killed it by a name. What
changed is git’s diff from that commit itself to the working tree,
read once for each commit however many results share it. A changed
file reaches every file that names a class, interface, trait, enum
or function it declares, then or now, by the name PHP resolves in
that file’s namespace and imports, spelt in code or as a fully
qualified name in a string, or a constant it declares, by its last
segment; and every file that names what those declare in turn. A
use functionoruse constimports a name and declares none. A mutated run can reach code the unmutated run never did, so nothing narrower than what the code names bounds what a kill depended on.
A file that is not PHP is named by the words of its name, so a change to it reaches the PHP files whose strings spell one of those words, as a test that reads
fixtures/rates.jsonspellsrates, and what names those in turn. So, besides what it declares, is a PHP file that runs code when it is loaded, as a file that requiresdata/rates.phpspellsrates. A change the gate cannot follow by name reaches every kill: one to a file that decides how the gate runs (ADR-0005, rule 1, which names the runner’s definitions, each package’scomposer.json, the gate’s config, and what the presets andreach.everythingname), or to a package’scomposer.lock, which ADR-0030 narrows to a move of a packagereach.lockPackagesnames; and one to a file anycomposer.jsonof the repository lists underfilesin itsautoloadorautoload-dev, which Composer’s autoloader loads in every process, whatever names it.A kill is unjudged, and the verdict warns why, where its killer is unknown, changed or gone; where its result records no commit, since the working tree then held more than its commit; where git cannot read that commit, as a shallow clone does not hold it, which
doctornames too (ADR-0017); and where what changed since reaches it.Following names misses code reached with no name on the way: a class wired only in YAML or XML service definitions, or that a container builds for a key other than its name, a name built by concatenation, a call through
__callor__callStaticonto a class nothing names, a class in the global namespace spelt only in a string, and a file read or required by a path built from pieces none of which is a word of its name, or found by listing a directory, as a framework finds its config and route files. A kill across such a change stands. A full run judges it again; - the result was established at this run’s base, the one its content
keys are built on (ADR-0007). The base leaves out what the key’s
exceptions leave out, such as
-
a timeout or a crash, which can count as a kill but names no test that caused it, is unjudged;
-
a kill by static analysis stands as a kill does, with the file the analyser’s finding sits in, which its result records (ADR-0020), in place of the tests that killed it: where the result was established at this run’s base, or where nothing that changed since the commit it records reaches its unit or that file by a name. The mutant’s file and the finding’s are what the rejection depended on. The analyser, its version and the digest of the configuration it runs with, with every file that configuration references, such as a baseline, an included config or a bootstrap file, are in the mutation digest (ADR-0020), so a result established before a change to any of them does not count. Where the analyser cannot say its configuration, its config file’s digest stands for it, and a change to another file it reads is not followed. One whose result records no finding, as a kill Infection reports, or whose finding sits in a file outside the repository, whose changes git does not say, is unjudged.
The one assumption left is ADR-0007’s: a test’s outcome depends on the files it reads, not on state another test in the same process leaves behind.
-
-
Passing. No run records
passedfor its commit while any mutant is unjudged, whatever left it so, so a later run from the last commit that passed still reaches what this one did not judge. A budgeted run passes, and records it, only where everything it did not run stood from a result of the same inputs. Its verdict still says the budget stopped it before every mutant was judged.A budgeted run can fail for lack of time. It can never pass a mutant it did not judge.
-
-
Timeout triage tells a detection from the clock running out. Each runner sets a limit per mutant (ADR-0004). The gate’s rule,
Core\Runner\MutantLimit’s standard one, is k times the run’s measured start-up, plus k times the covering tests’ own time, with k = 3, kept between two bounds:- The floor,
timeouts.seconds: an integer, 10 by default, and 30 in the Laravel and Symfony presets. No mutant is allowed less, and one whose covering tests were not all timed is allowed exactly this. It covers the few seconds a mutant’s run spends before its first test, which a busy runner stretches. - The most,
timeouts.most: an integer, 300 by default, and never less thantimeouts.seconds, which the config refuses. No mutant is allowed more, so one mutant cannot hold a process for long.
The start-up is measured. Before its first mutant, a shard’s run times a run of no test, started as the runner starts a mutant’s own run of the shard’s first file (a unit’s own file, or the first file the map knows inside a held unit), its mutant the file unchanged: the fastest of three, as the plan times one (ADR-0006), on the machine its mutants run on. Every limit of that run, its controls’ too, is laid on it, times the same k: a busy runner stretches what a run spends before its first test as it stretches the tests, and what it spends depends on the project, which loads its test files first. A run of no test that cannot run, a shard of no file, and every run that is not a shard’s (re-checking survivors,
reproduce) measure none, and their limits keep 5 s for the start-up. A patched runner’s process is told the start-up inMUTATION_GATE_MUTANT_START_UP, beside the bounds. Loading fewer test files in each own run, by making more of them inert, is not part of the rule: the measured start-up absorbs what loading them costs, and a change to which files count as inert is a decision of its own (ADR-0004).k is fitted from runs, not guessed. A mutant that breaks nothing runs its covering tests to the end, so its limit must stay above them on the busiest runner the gate meets. Between two self-gate runs of the same code the same mutants took 1.34 times as long at the median and 2.09 times at the 99th percentile, so k = 3 clears that with margin, and the start-up keeps a mutant whose tests take a few seconds clear too. A fixed start-up does not: where each mutant’s own run loads hundreds of test files that are not inert (ADR-0004) before its first test, on four busy cores, as the gate’s own does, every run of a unit whose tests take milliseconds, its control’s too, runs out of a 10 s floor before its first test finishes. k is fitted again from a measurement run whose limits are
max(timeouts.seconds, 10 × T), which leaves every run room to finish: the 99.5th percentile, over mutants whose covering tests take 3 s or more and that ended in a verdict, of the seconds past the start-up each took over its tests’ own time, with a fifth more for load, rounded up.Per runner:
- Pest’s, under
pest.patch, is the gate’s rule, of the covering tests’ own time as the coverage map Pest loaded timed them. The patched plugin runs exactly those tests, a row of a data set alone, a class or a data set named whole where they hold every test of it the map ran, so the limit is sized from the tests the run runs. Where that filter is still too long to pass, the run passes none and runs every test of the test files it loads, and its limit is the standard limit of the own time of each of those the map timed; the plugin records that the run was unfiltered. It records each mutant’s limit in the results file, and the gate triages by what it recorded. It skips no mutant. Unpatched, it is Pest’s own: the opening run’s duration plus the larger of 5 s and 20%, which cannot be changed; and its filter runs every row of each covering test’s data set. - Infection’s, under
infection:patch(ADR-0004), is the gate’s rule, of the covering test classes’ time as Infection timed them from the JUnit log, each class counted once. It skips no mutant. Unpatched, it is Infection’s own: the smaller of 5 s plus five times that time and itstimeout, which the gate sets totimeouts.most, with no floor; Infection skips, never runs, a mutant whose covering classes take at leasttimeouts.most; and every run’s report warns of it, naminginfection:patch. - The PHPUnit runner’s is the gate’s rule, of the covering tests’ own time as the coverage map timed them. It skips no mutant.
A second limit stops a run that has gone quiet. No test of a mutant’s run may go its silence limit without finishing: the same rule, of its slowest covering test’s own time, within the same bounds. A test that never ends is stopped there, seconds before the limit of all the covering tests. The clock starts when the run starts executing tests, so its start is held only to the mutant’s own limit. A mutant stopped at its silence limit is timed out with its own limit, so the triage below judges it as any other timeout, and its reason names the silence limit. Pest applies it under
pest.patch, and the PHPUnit runner to a run that selects its tests by their ids, from warm workers too (ADR-0023), and Infection underinfection:patch, of its slowest covering test class, as Infection times each test by its class (ADR-0004). Output does not count as finishing: a test that prints without end is stopped at either limit as a quiet one is. A contract test on patched Pest proves both limits on a loop that says nothing and one that prints as fast as it can: each mutant is timed out by its file, line and mutator, with its reason, and the run’s other mutants are judged.The mutators whose mutants hang most keep their silence limit above a lower floor,
timeouts.tighter: an object ofmutators, a list of short names, andfloor, an integer of seconds, 7 by default, which applies only where it is undertimeouts.seconds. A mutator is matched by its short name, the last part of the name a runner gives it, after its last\or/, soRemoveArrayItemmatches Pest’sPest\Mutate\Mutators\Removal\RemoveArrayItemand the default set’sdefault/RemoveArrayItem. The list by default is the eight the gate’s own runs found hang most,RemoveArrayItem,DecrementInteger,IncrementInteger,ForeachEmptyIterable,UnwrapArrayValues,InstanceOfToTrue,InstanceOfToFalseandTernaryNegated, and Infection’s names for the same changes,ArrayItemRemoval,Foreach_,InstanceOf_andTernary. A layer that writestimeouts.tighterreplaces it whole, each key it leaves out taking its default. The whole limit keepstimeouts.seconds, so a mutant of a listed mutator that a test keeps busy is never cut short.For every timed-out mutant the gate runs one unmutated control: the tests that judge it, those the coverage map says cover its lines and, of a held unit, only those that hold it, as the mutant’s own run selected them (
RunnerBehaviour::selection()): exactly those, a row of a data set alone, and for an unpatched Pest every row of their data sets, the map’s tests its filter selects. The control selects them as the run did: by the run’s filter, or, where the run passed none, by the test files it loaded, or every one. The control runs exactly those tests, with its file served unmutated by the means the runner serves a mutant’s file (Pest’s override, the PHPUnit runner’sfile://override, Infection’s include interceptor), under the request’s memory cap, allowed the limit the mutant’s run was. Each runner runs it throughRunner::controls(), side by side in the request’s pool where the runner runs processes so, and two mutants of the same file, tests and limit share one. A mutant judged by a trial (ADR-0004), which no coverage marks, has run that control already: the trial’s run of its tests on their own, unmutated, under the same limit. The trials’ runs of their tests on their own go side by side, and a set that fails while another runs beside it runs once more with none beside it, its JUnit log written anew: two sets that share a fixture directory, a port or a file fail beside each other and pass apart, and what it ends as apart is how its tests end on their own. The map’s time of the tests only sets the limit; the triage weighs the timeout against the control:-
The control finished within the limit. The tests passed unmutated, served as the mutant was, inside the limit the mutant ran out of, so the mutant broke something (a loop that never ends, say), and it is killed by timeout. It counts as killed and is reported under that name, its tests’ time the control’s.
-
The control ran out of the limit too, or never ran. The limit cannot tell a hang from tests that are slow there, so the mutant is too slow to judge, counts as not killed, and its reason says which. A skipped mutant is always here. The hint points at holding the path with a group (ADR-0005) or raising
timeouts.most. -
The control failed. The tests fail with the file unmutated as well, so nothing tells the mutant from its original: its tests fail unmutated. So it goes for every control that decides a mutant: a timeout’s here, a kill’s (ADR-0014) and a mutant’s out of memory (ADR-0004). The mutant is left out of every score, and the verdict is cannot judge, exiting 2, on a line of its own that names the tests that failed,
The tests fail without any mutant: <test>, <test>, with every mutant those tests leave out listed under it, in every report. The tests are those the control’s JUnit log records failing, as PHPUnit, Pest and Infection write it, or the native runner’s own record of each test; where it records none, the line names every test the control ran. No control is run twice. -
The budget. Under a time budget the controls run after the invocation’s survivors are confirmed, as many as fit in the time left at the longest of their limits, as many at once as the request’s pool runs, round after round, those of the files the batch took first first, so the riskiest unit’s controls run before the rest (ADR-0146 decision 6); a timeout whose control did not fit is unjudged, and more time judges it.
-
No retry. A timed-out or skipped mutant is never run again, in any runner: the control judges it as its run left it. A control is no run of the mutant; it runs the tests on the original. A heavy mutant is the one exception.
-
A heavy mutant is judged in parts. A mutant that timed out at
timeouts.most, whose judging tests are more than one and whose standard limit together is above the most, has no control. Its tests are split into parts that each fit under the most:- The tests of the test file whose path shares the most leading directories with the mutant’s file come first, then the fastest, then by path. A test the runner places in no file comes last.
- A file’s tests go in one part where they fit in one, and one test at a time, the fastest first, where they do not.
Each part runs through
Runner::controls()with the mutant served in its file’s place, as the runner gives it to a static analyser:- It is allowed the standard limit of its own tests.
- It is stopped where it writes no event of its tests for the silence
limit of its slowest. The runners write the events with
--log-events-text; the native runner uses its own record of each test. - The heavy mutants’ next runs go side by side, one round after another, under the budget as controls are.
A part a test fails in kills the mutant, by those tests, and no later part runs. A part that runs out has its control, the same tests unmutated under the same limit. Where they pass, the mutant is a timeout the triage above judges. Where they run out too, the part is split in two by its test files, the first half of its files and the rest, and each half, allowed the standard limit of its own tests, runs in its place, down to one file’s tests. Where one file’s tests run out unmutated too, or a part’s fail, that part cannot judge the mutant, and the next part runs; a reason that a part ran out names its file. Where every part passes, the mutant survived. Where none killed it and a part could not judge it, it is too slow to judge, or its tests fail unmutated, its reason naming the part.
Pest’s trial of a mutant on a line that is not executable (ADR-0004) runs test files, not tests, and is split before it runs: where the tests its files hold have a standard limit above the most together, its files go in parts by the same order, each file whole in the first part that holds any of its tests, and the files that hold no test the map times in the last. Each part is a trial of its own, allowed the standard limit of its tests: it runs on its own, then with the mutant. A part that kills the mutant, or that the mutant runs out of time in while the part passes on its own, judges it, and no later part runs. A part it survives, or that runs out or fails on its own, is followed by the next. Where every part passes, the mutant survived. Where none judged it, it is what the first part that could not judge it found, a failure on its own before a run out of time.
-
The mode.
timeouts.modeisconfirmby default, as described above, orunjudged, which makes every timeout too slow to judge, for projects that want no kill they cannot see. It runs no control.
The shard result records each timeout’s limit and its control’s time, so triage is applied at verdict time, and a unit whose timeouts are too slow to judge is still recorded (ADR-0007): running it again would give the same answer.
- The floor,
-
Flaky triage: the same code giving two answers is reported, not averaged.
- Survivor confirmation. Each survived mutant is run once more, alone,
before it counts. Killed the second time means flaky. Survived again
means a confirmed survivor. A survivor static analysis kills
(ADR-0020), checked first, is not run again. Under
Pest the survivors run again in one run of their files with their
mutators, each still in a process of its own, so Pest’s opening run is
paid once rather than once for each file and mutator.
flaky.confirmSurvivorsis a boolean,trueby default; ADR-0034 says when a project may turn it off. A mutant judged by reference (ADR-0004) is run again through those same steps, against its judging tests. The confirming run takes the runner’s own test order, whatevertests.ordersays, and a survivor proven equivalent is not run again (ADR-0013). Each shard confirms its own survivors, by the tests that judged their unit, and its result file lists the flaky mutants’ ids underflakyfor the verdict. - Proofs that disagree. When two results for one key differ (the default branch’s ledger and a pull request’s, say, or two verdicts that wrote one scope), the mutants that differ are flaky, and neither result is used (ADR-0007).
- What a flaky mutant does. It counts as not killed, keeps its unit out of the ledger, and is reported with its judging tests, which are the suspects.
- On demand.
mutation-gate triage <path> --repeat=<n>runs a unit n times, 5 by default and never fewer than 2, and lists every mutant whose status varied, with the runs that gave each status and the tests that killed it in them. A mutant some runs made and others did not varied too. Each run is the runner’s own: no survivor confirmed or checked by an analyser, and nothing is recorded.--order=runner|killers-first,tests.orderby default, chooses the order of each mutant’s tests, to hunt a kill an order made (ADR-0013); killers first reads the history every ledger holds of the unit’s files. Its mutants judged by reference run through ADR-0004’s judging by reference each time. It exits 1 where a mutant varied, 0 where none did, and 2 where the unit cannot be run. This is the tool for a kill that might be flaky. A flaky kill cannot be told from a real one without re-running every killed mutant, and the gate does not do that unasked. - A failed opening run is cannot judge (exit code 2) and is not retried. A suite that fails without mutants has to be fixed first.
- Survivor confirmation. Each survived mutant is run once more, alone,
before it counts. Killed the second time means flaky. Survived again
means a confirmed survivor. A survivor static analysis kills
(ADR-0020), checked first, is not run again. Under
Pest the survivors run again in one run of their files with their
mutators, each still in a process of its own, so Pest’s opening run is
paid once rather than once for each file and mutator.
-
Equivalent mutants are ignored in the config, with a reason, and can expire.
ignores.entriesis the list:{"ignores": {"entries": [{ "mutant": "3f9a1c2b7d04", "reason": "Both branches build the same list", "expires": "2027-03-31" },{ "path": "src/Log/**", "mutator": "MethodCallRemoval", "reason": "Logging is asserted in the integration suite" }]}}- Two shapes. One mutant, by the gate’s id (ADR-0004). Or a path glob with a mutator, by its full name (ADR-0004), or a family (ADR-0009).
- Every entry needs a non-empty
reason.expires(YYYY-MM-DD) is optional.ignores.maxDays, an integer with no limit by default, requires every entry to expire within that many days of the run. - What an ignore leaves out. A survivor or an uncovered mutant that an entry matches. An entry that names one mutant by its id also leaves it out where it is unjudged because the file it mutates was loaded before the mutant was in place (ADR-0004), which no run can change. A mutant unjudged for any other reason, such as a time budget that ran out, counts as not killed whatever an entry says.
- Ignored mutants are left out of the score (ADR-0003) and listed with their reasons in every report.
- An expired ignore stops applying: the mutant counts again, and the report names the ignore and when it expired. Within 14 days of expiry the PR comment names it in advance.
- A stale ignore matched no mutant in a run that judged every unit it
could match. It fails the run (exit code 1) and says remove it, as
PHPStan’s
reportUnmatchedIgnoredErrorsdoes. Otherwise dead ignores would pile up, and one could come back to life and hide a new mutant. An ignore that matches a mutant proven equivalent is not stale: it still applies, and a notice says it can go (ADR-0013). A run narrowed to some mutators, as--securityis, checks only the ignores that name one of them by its full name: an ignore of any other mutator, of a family, or of a mutant’s id may name a mutant that run never made (ADR-0021). - Native markers are refused by default. These are
@pest-mutate-ignoreand@infection-ignore-allin source, andignoreorignoreSourceCodeByRegexundermutatorsininfection.json5. Withignores.native: refuse, the default, the run stops with exit code 2 before anything is mutated, listing each marker and the config entry that replaces it. A marker hides the mutant from the count without a reason or an end. - How native markers are found. Before anything is mutated, the gate asks
the runner for its markers in the files the run mutates (the Runner port’s
markers(), ADR-0004).- Pest’s:
@pest-mutate-ignorein any comment of those files. - Infection’s:
@infection-ignore-allin any comment of those files, and each value ofignoreorignoreSourceCodeByRegexundermutatorsin the project’s Infection config, whether under a mutator, a profile,global-ignoreorglobal-ignoreSourceCodeByRegex. - Each is listed where it is, as a file and line or as the config file and
key, with the entry that replaces it. For a marker in source or a
pattern over source, that is
{"mutant": "<id>", "reason": "…"}for each mutant it hides. For anignorepattern it is{"path": "<the file of the class it names>", "mutator": "<its mutator>", "reason": "…"}.
- Pest’s:
ignores.native: allowlets a project migrate.init --fromconverts Infection’signorepatterns into entries, and setsallowonly for the regex ignores that have no equivalent (ADR-0016).initasks before it setsallowfor markers it finds, and every run underallowsays how many markers hide mutants (ADR-0017).- Pest’s marker,
@infection-ignore-allandignorestop the runner generating the mutant at all. The report counts the markers it found, and says it cannot count what they hide. - Infection reports each mutant
ignoreSourceCodeByRegexmatched as ignored. The gate records it as ignored by a native marker, leaves it out of the score, and lists it with that reason in every report.
- Pest’s marker,
-
Framework presets are config fragments with a name.
presettakes one name or a list, applied in order (ADR-0002). A preset is registered by an extension (ADR-0001) and applied before the config file, so the project’s own settings win. When nopresetis set, it is chosen fromcomposer.json:laravelwhenlaravel/frameworkis required,symfonywhensymfony/framework-bundleis,libraryotherwise.Setting librarylaravelsymfonyTrees, when phpunit.xmlhas no<source>each autoloadpath incomposer.jsonappsrcAlso decides how the gate runs (ADR-0005, rule 1) nothing beyond the defaults bootstrap/**,config/**,routes/**,.env.testingconfig/**,.env.test,tests/bootstrap.phptimeouts.seconds10 30 30 newCode.floor100 100 100 mutators.sets, each offered (ADR-0021)securitylaravel,securitysymfony,securityFramework tests boot the application, so their covering tests are slower and their timeouts are longer. Paths every framework test runs through, such as a Laravel app’s
app/Providersand a Symfony app’ssrc/Kernel.php, stay in their trees and are found by the hot-path warning (ADR-0005) rather than listed. What is hot differs from app to app. Third-party presets (WordPress, Drupal, a company’s own) are extensions. -
A pull request’s run runs to its end, and stops once it cannot pass only where the config asks.
-
By default. Every run mutates every unit it planned, and the verdict names every survivor, so one run tells an author everything to fix. A run that stopped at its first sure survivor would leave the rest for a run after the fix, one round trip each.
-
When. With
run.failFast: stoporcancel(ADR-0103), a run on a pull request whose verdict holds its trees’ floors and the new code’s stops early. A run of the security mutators alone (--security) or of one suite’s tests alone (--suite) holds no tree to a floor, so it runs to its end. So does a run whose trees or committed baseline cannot be read. A run on a branch, a tag or a schedule also runs to its end, since later runs build on what it records. -
Doomed. The run is certain to fail once one of its mutants is a survivor the verdict will count. Static analysis does not clear it, it did not prove flaky when run again, and no ignore leaves it out: where
equivalence.staticis true it is not proven equivalent (ADR-0013), and where a static check runs (ADR-0020), its check does not kill it. And one of two floors holds it at 100:- its tree’s floor, the higher of the declared one and the baseline’s;
- or, for a mutant on a line the change added or modified, the new-code
floor that line is held to, its tree’s own or
newCode.floor.
One such survivor leaves a score below 100 in whole hundredths, so the verdict fails whatever the other mutants come to.
-
Chunks. A runner orders the mutants of one invocation itself, so the gate can stop only between invocations. A shard that can stop runs its units in the plan’s order, riskiest first. It runs them in chunks of about two minutes of the work the cost model expects (ADR-0006), opening run included. A held unit runs alone, as in a budgeted run, and a chunk always starts with its first unit, however large. After each chunk, its survivors checked by static analysis and confirmed, the shard looks for a doomed survivor, and it stops at the first. The analyser runs over the original files once for the shard, before the first chunk’s survivors are checked, and each survivor is checked once. A shard that finds none runs every unit, at the cost of one runner opening per chunk. One code path serves every runner. ADR-0032 grows the chunk to about fifteen minutes.
-
What it leaves. The shard’s result names the survivor under
doomed, with these fields:unit: the unit’s path;mutant: the survivor’s id;tree: the tree’s path;floor: the floor it fails;why:treeornewCode.
The units the shard did not run are unjudged, as a budget leaves them:
- each counts by its newest result where that result stands;
- a mutant of it whose result does not stand is unjudged;
- none reaches the ledger.
The verdict fails, naming the survivor and its floor for each shard that stopped. A run that left a unit unrun removes its
lastRun, as a budgeted run does (ADR-0005). A run in one process runs no shard after one that stopped. -
The other shards. Each shard stops on its own. The reusable workflow’s shard job ends with a step that reads the shard’s result alone, runs none of the project’s code, and fails the job where the result names a survivor under
doomed, after the result is uploaded. Its matrix does not fail fast, so the other shards run on, each to its end or to its own sure survivor. A CI may still cancel the run’s other shards where it chooses; the verdict reads each shard that left no result beside a shard that stopped as stopped too, so its units are unjudged as above. Without a doomed shard, a shard that left no result still means the verdict cannot judge. -
Trust. A forged or mistaken
doomedcan only fail the run whose shard wrote it. The verdict fails on it whatever the other shards came to, and counts a stopped unit for no more than its newest result stands for.
-
Alternatives considered
| Option | Why it lost |
|---|---|
| Count unjudged mutants as killed, or leave them out of the score | Either way, a run that stopped early reads as better than it is. The approved rule is that unjudged mutants are reported and never passed. |
| Order individual mutants by risk | Neither runner takes a mutant order. Per-unit batches are the finest order the gate controls. |
| Count every timeout as killed (both runners’ default) | Counts the clock running out as a test saying what broke, which is how the in-house gate’s slowest shard fills with timeouts. |
| Count every timeout as unjudged | Loses real detections: a mutant that makes a loop run forever is caught by the timeout and by nothing else. Kept as the strict mode. |
| Retry every killed mutant to catch flaky kills | Doubles the cost of every run to find a rare problem. Survivor confirmation is cheap. Flaky kills are hunted on demand with triage. |
| Native ignore markers, as the runners ship them | No reason, no expiry, no staleness check, and different per runner. The config holds one list for every runner. |
| Ignores by file and line | Line numbers move with every edit above them. The gate’s id does not use the line (ADR-0004). |
| Stop a doomed run inside each runner’s own mutant loop | Three runner-specific stops in the patches the gate applies, each resuming when a survivor proves flaky. The chunked stop is one code path, proved by every runner’s contract. |
| Stop every pull request’s run once it cannot pass, by default | Each run then names about one survivor, and a project with several needs a round trip through CI for each. Stopping saves runner minutes on a run that fails anyway; the round trips cost the author far more. It stays a setting, run.failFast: stop (ADR-0103). |
| Cancel a doomed run’s other shards from the shard job | The shard job runs the pull request’s code, which could then cancel or re-run workflows. A separate step that reads the result alone holds that permission. |
| Stop at any floor once a tree’s survivors outnumber what the floor allows | Needs each tree’s planned mutant total in the plan. A floor of 100, the default for new code, needs none. |
| Presets that exclude framework glue (providers, kernels) | Excluding code from mutation hides it from the gate. Holding it with the tests that assert on it keeps it judged and cheap. |
Consequences
A short budget gives the most useful minutes. Changed code runs first, then code known to have survivors, then code never mutated.
Timeouts are explained, not counted blindly. “Too slow to judge” points at the fix: hold the path with a group.
The ignore list is reviewable debt. It has reasons, end dates and no dead entries.
A pull request that cannot pass names every survivor. By default its
shards run to their end, so one run lists all there is to fix. A project that
would rather save runner minutes sets run.failFast: stop (ADR-0103): each shard then
stops within about two minutes of finding a survivor of a floor of 100, and a
pull request that can pass pays one runner opening per chunk.
A Laravel or Symfony app gets a sensible first run with no config, and the warnings say where holding groups would save time.
Related
- ADR-0003: how unjudged, flaky and ignored mutants enter the score
- ADR-0004: runner timeouts, retries and Infection’s ignored status
- ADR-0005: holding groups and the hot-path warning, and the
lastRuna run that stopped removes - ADR-0006: the cost model a doomed run’s chunks are sized by
- ADR-0009: mutator families, and how unjudged and flaky mutants are shown
- ADR-0010: the budgets of watch and pre-push
- ADR-0013: the order survivor confirmation and
triageuse, and ignores a proof makes redundant - ADR-0016: Infection’s ignores converted by
init --from - ADR-0017: native markers as an adoption bridge
- ADR-0030: the lock file, which decides by the packages it moved
- ADR-0032: the chunk, which grows to fifteen minutes
- ADR-0034: survivor confirmation, which a suite whose test files pass alone may turn off