Repository navigation
Conversation
cargo-mutants (from the flake's devshell) runs over named sets of files (`tools/mutants/sets.tsv`) only in a Linux sandbox: on a Mac, `tools/mutants/run.sh SET` runs it in Apple's `container` with the Linux Nix store read-only, no network, an unprivileged user, and bounded memory and time; in CI, `tools/ci/mutants.sh SET` runs it in a job of its own. Every test binary runs through `tools/mutants/canary-runner.sh` (`.cargo/mutants.toml`), which refuses unless the kernel is Linux, the store is not writable, and either the container's nonce canary or a CI runner is present. So a bare `cargo mutants` elsewhere fails its baseline and runs no mutant. `tools/mutants/canary.test.sh` holds the rule to its table and checks the refusal end to end. Each set's verdicts are an exact keyed manifest (`tools/mutants/manifests/<set>.txt`, `borzoi_oracle_harness::mutants`): one line per mutant, keyed without line numbers. Equivalent mutants are recorded, with their argument, in `tools/mutants/equivalent.tsv`. A failed baseline, a run that lists or catches no mutant, or a stale equivalent fails rather than writing a manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sandbox's scripts to the workspace filter The canary test now runs a bare `cargo mutants` in a crate carrying the repository's own `.cargo/mutants.toml`, outside any sandbox, and asserts that cargo-mutants' unmutated baseline is refused by the canary (exit 4) before the crate's test starts. That covers what the precedence probe cannot: that cargo-mutants itself reads the configuration. The refusal cases take a set from `sets.tsv` rather than naming one. A set's manifest or `equivalent.tsv` is read by no test, and `test-mutants` checks them on every change. So only the sandbox's scripts, its set table and `.cargo/mutants.toml` route to the `workspace` filter, and regenerating a manifest runs no crate job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tifacts, report lock errors - An `equivalent.tsv` row's site is now a fingerprint (FNV-1a over the exact text) of every line the mutation replaces, not just its first line. An edit anywhere in the code the argument covers, a literal on a later line included, fails the row until it is reviewed. - `tools/ci/mutants.sh` runs the set in a work directory of its own and stages out of it, through `tools/mutants/stage.sh`, only regular files whose real path lies inside it: the three artifacts whole, up to 64 MiB, and each log's first MiB. The job uploads, and the manifest step reads, only that staged directory. `stage.test.sh` holds the guard to links out of the run, linked directories, FIFOs and oversized files. - `--list` fails when `sets.tsv` declares no set. - `run.sh` reports why it could not take the lock when there is no lock to inspect, for example because the container service is down, and prints cargo-mutants' output when the bare-run canary case fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claim.
tools/mutants/runs cargo-mutants over a named crate and file set only inside a Linux sandbox, and pins each set's verdicts in an exact keyed manifest that a dedicated CI job checks.container: the Linux Nix store is read-only, there is no network, the user is unprivileged, memory and time are bounded, and no host path is writable by mutant code.Domain. The infrastructure, plus one pilot set that witnesses it end to end:
nuget-regular-file, 7 mutants, all caught. The first real measurement, #1114's nuget sample and #1118's harness census and filter logic, is the follow-up PR. Part of #1114 and #1118.Vacuity. The run's exit code enforces it; the manifest header does not. A missing or failed baseline (exit 94), a set naming no mutant (95), a graded set that is not the listed set, and a run that catches nothing all fail rather than write a manifest. The header holds nothing that moves, so the keyed merge driver never conflicts on it.
The CI job
.github/workflowscan't be pushed from here. The patch ismutants-ci.patch, and the user commits it onto this branch. It adds:mutants-sets, which lists the sets;test-mutants, one matrix entry per set, which runstools/ci/mutants.sh SETwithBORZOI_MUTANTS_CI_JOB=truescoped to that job,TMPDIRon/mnt,timeout-minutes: 330, and the run uploaded as an artifact;needsofall-required-checks-complete.It passes
detect-changes.test.sh, including the rule that the required aggregate includes everytest-*job, and the other workflow-shape tests.test-mutantsis ungated by the change filters, ascorpus-diffis. The heavy sets in the follow-up PR will need a per-set filter or sharding (#1170).How it works
tools/mutants/run.sh SET(macOS, outsidenix develop)HEADwithgit archive. It writes the manifest only if the checkout is still that commit, clean, when the run ends.GIT_DIRcan't redirect it.containervolumeborzoi-mutants-nix-lock.borzoi-mutants-*container remains, because a killed run's VM might still mount the ext4 store.container listconfirms its own containers are gone.nixos/nix, pinned by digest:nix print-dev-env.--network none;--memory/--cpus;timeout, so it ends on time even if the host script is killed.tools/ci/mutants.sh SETIt checks the canary before touching earlier output, then runs the same
inner.shundernix develop.--listgives the matrix.tools/mutants/inner.shIt runs with
--tests, a fixedPROPTEST_RNG_SEED, andBORZOI_UPDATE_MANIFESTScleared, so a regeneration grades the same suite a check does. It records the--listoutput that the checker matches against.The canary (
tools/mutants/canary.sh).cargo/mutants.tomlinstalls it twice:cfg(all()). A CLI--configoutranks CI'sCARGO_TARGET_<TRIPLE>_RUNNER.It allows a run only when all of these hold:
/nix/storeis not writable;GITHUB_ACTIONS,CI,RUNNER_ENVIRONMENT=github-hosted,BORZOI_MUTANTS_CI_JOB=true).It prevents accidental runs, not malicious ones: spoofing those variables gets past it, as its header says. Doctests never go through a runner, so they are left out.
tools/mutants/canary.test.shIt runs under
cargo test, in oracle-harness's suite, and the change filter routestools/mutantsand.cargoto that suite. It checks:inner.shand oftools/ci/mutants.sh, with a cargo shim recording that nothing ran and an earlier run's output surviving;mutants.toml's arguments, against a competingCARGO_TARGET_<host>_RUNNER. The canary must refuse as the wrapper, with nothing compiled. With the wrapper overridden by the one variable that outranks it, the canary must refuse as the runner. I mutation-checked both layers.The manifest (
borzoi_oracle_harness::mutants, written by themutants-manifestbin)<key>\t<verdict>.#nfor repeats in source order. A proptest follows each mutant through line shifts and report-order permutations.scope: package,scope: filesandscope: skip <filter>entries, so adding a skip moves the manifest even when no verdict moves.caught,missed,timeout,unviable, orequivalent: <reason>. Eachtools/mutants/equivalent.tsvrow names its mutant by key and by site, the source line, collapsed. A row whose key now has another site, whose site repeats, whose mutant wasn't missed, whose key or set doesn't exist, or that is a duplicate, fails the run.sets.tsvdeclares now;minimum_test_timeout = 300keeps a verdict independent of machine speed.regular_file's FIFO test catches its mutant only at its own 120 s deadline.Fixes no test can catch
These are exercised only by a run under Apple's
container, which neither CI norcargo testhas. Each was exercised by hand: a container run passed on every head from round 1 to round 9.container, and a test would need two concurrent VMs.timeout, and the five-minute export allowance. A test would need a real VM that stalls.--uid 1000). It is witnessed by the root-only baseline failure it fixed (list_committed_package_versions_errors_when_commit_marker_stat_fails), not by a test.A CI job could exercise none of these: CI runs
tools/ci/mutants.sh, notrun.sh.Codex rounds
Rounds 1–5 were at xhigh; rounds 6–13 were at high, the user's setting from 2026-11-25 22:12 UTC. Labels: R1 changes a result on realistic input, R2 needs contrived input, R3 is a test or oracle that checks less than it claims, R4 is hygiene.
Round-by-round detail.
cfg()canary, and CI sets one;Each fix that a test can catch has one: the shell tests, or
borzoi_oracle_harness::mutants's and the bin's unit tests. The CI-wiring finding, in every round, is closed bymutants-ci.patch. The final round runs once CI has run that job green on this branch.Verification
containeron every head: provision, run (--network none, read-only store, uid 1000), export, manifest check.cargo fmt --check,cargo clippy --all-targets --all-features -D warnings,cargo doc(-D warnings, private items),cargo test --no-fail-fast, plus both shell tests.walk_cost_scaling::every_flat_repetition_walks_in_linear_time(sema, untouched here) failed twice under load. It is a wall-clock ratio, and it passes alone: sema: walk_cost_scaling::every_flat_repetition_walks_in_linear_time is a wall-clock ratio and fails under load #1167.🤖 Generated with Claude Code