Skip to content

fix(mutants): tell a row that did not run from one that survived - #248

Merged
aRustyDev merged 1 commit into
mainfrom
fix/mutants-summary-did-not-run
Nov 17, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
fix/mutants-summary-did-not-run

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Why

#93 still had one open criterion: scripts/mutants.sh reported every row it did not kill as SURVIVED or did not run. That
causes two problems:

What changes

scripts/lib/mutants-verdict.sh decides one verdict per row:

verdict when passes?
KILLED its tests ran and one failed (with the needle in the log, when the row has one) yes
SURVIVED its tests ran and all of them passed no
UNCLEAR tests failed, but the log never contains the needle (a setup that panics in every test, for example) no
DID NOT RUN the run stopped before its tests gave a verdict, for the reason its exit status names (below) no

The exit statuses contract.sh uses to say why a run stopped:

exit meaning
2 a precondition is missing
3 the setup failed (the build, a container, or a service)
4 the target never came up
5 the vacuity guard stopped the run
101 the tests did not build

For a cargo test row, exit 101 with no failed test also means the tests did not build.

What stays the same and what is new in scripts/mutants.sh:

  • The four kill_check* functions keep their names and arguments, so no row changed. The job still fails on anything that
    is not KILLED, or REFUSED for the guard rows.
  • New: the summary ends with the count of each verdict, for example
    killed=1 survived=1 unclear=0 did-not-run=1 refused=0 not-refused=0.
  • New: a cargo test row that is not killed now shows the end of its log. Before this change it showed nothing.

Tests

test-mutants-verdict.sh runs in ci-scripts. It is 200 generated cases: every exit status, crossed with every report
shape, crossed with three needle cases (no needle, a needle the log contains, and one it lacks). It also checks the
wiring in mutants.sh. 14 hand mutants fail it under dash. The mutant that brings back the #93 bug, where a run that never
started is called SURVIVED, fails 112 checks.

Real runs, AGENTS.md rule 8. I ran a trimmed copy of the new mutants.sh against three real rows:

row verdict
a planted mutant those tests cannot kill: mutant_unverified_email (OIDC) against the csrfoff pass SURVIVED (every test passed, exit 0)
csrf-switch-ignored-when-off, a row of the real script KILLED (3 tests failed, listed)
a target whose port is held by a listener DID NOT RUN (the target never came up, exit 4); show_why printed the AddrInUse line

plan-ci. A change to either file now runs both mutants and ci-scripts. Two new checks in test_plan_ci.py
(5027 checks pass) fail when the rule leaves out ci-scripts.

Locally. All 43 ci-scripts and deps commands pass under dash.

Docs. Recorded as D-21 in docs/src/testing/status.md.

Not changed. .agents/plans/project-skills/artifacts/skills/rust-testing/references/must-fail-controls.md is a draft
skill. It still describes the old wording, and it already predated the move to nextest.

Refs #93. With this change, every acceptance criterion of #93 is met. Whether to close it is the owner's call.

🤖 Generated with Claude Code

scripts/mutants.sh gave every row it did not kill the same label, "SURVIVED
or did not run". A server that never came up (issue #93: AddrInUse, exit 4)
therefore read like a surviving mutant, which is the very finding the job
exists to make. A real survivor could also hide among setup failures.

scripts/lib/mutants-verdict.sh now gives each row one of four verdicts:

- KILLED: its tests ran and one failed, with the needle in the log when
  the row has one.
- SURVIVED: its tests ran and all passed.
- UNCLEAR: tests failed, but the log lacks the needle.
- DID NOT RUN: the run stopped before its tests gave a verdict. The detail
  names the reason from contract.sh's exit status: 2 is a missing
  precondition, 3 a failed setup, 4 a target that never came up, 5 the
  vacuity guard, and 101 tests that did not build. For cargo rows, exit 101
  with no failed test means the tests did not build.

Only KILLED (and REFUSED, for the guard rows) passes, as before. The
summary now ends with the count of each verdict. The four kill_check*
functions keep their names and arguments, so no row changed. A row that
`cargo test` runs now shows the end of its log when it is not killed;
before, it showed nothing.

test-mutants-verdict.sh runs in ci-scripts. It checks 200 generated
cases: every exit status x every report shape x no needle, a needle the
log contains, and one it lacks. It also checks the wiring in mutants.sh.
14 hand mutants each fail it, under dash. The mutant that reads a run
that never started as SURVIVED (the #93 bug) fails 112 checks.

Checked on real runs as well:
- an OIDC mutant against the csrfoff pass, a planted mutant those tests
  cannot kill: SURVIVED;
- csrf-switch-ignored-when-off: KILLED;
- a target whose port is held by a listener: DID NOT RUN (exit 4).

plan-ci runs mutants and ci-scripts for either file. Two new checks in
test_plan_ci.py fail when the rule leaves out ci-scripts.

Refs: #93
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 57f06d4 into main Nov 17, 2026
39 checks passed
@aRustyDev
aRustyDev deleted the fix/mutants-summary-did-not-run branch November 17, 2026 00:32
aRustyDev added a commit that referenced this pull request Nov 17, 2026
main moved while CI ran on this branch: #248 (the mutation controls tell a row that did not
run from one that survived) edits plan-ci.py, test_plan_ci.py and ci.yml, as this branch
does. The merge is textually clean and was tested before it was committed, because a clean
merge of two CI changes is not evidence that they agree (the last one was not):

- test_plan_ci.py: 6,771 checks pass
- test-ci-scripts.sh under dash: 173 cases pass
- mutate_gate.py: 53 of 53 mutants killed, none broken, both equivalent mutants survive
- lint-all-workflows.sh, lint-actionlint.sh and check-ci-index.sh exit 0
- the merged ci.yml keeps #248's test-mutants-verdict.sh beside this branch's two new tests
  and its two new deps steps

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev added a commit that referenced this pull request Nov 17, 2026
… cargo test (test-suites PR 2) (#252)

* test: run the adapter suites on nextest, so only the doctests stay on cargo test

PR 2 of the test-suites plan.

- .config/nextest.toml: an `adapters` profile for the suites that need
  Docker. It selects `binary(pg_adapter) | binary(smtp_sink)`, writes a
  JUnit report, and kills nothing, as cargo test did: the slowest test
  took 30 s here, and a runner is slower. Each test starts its own
  Postgres or Mailpit container, so nextest's process per test shares
  nothing those suites did not share before.
- CI's `pg-adapter` job installs nextest (setup-rust's `nextest` input)
  and runs each suite as
  `cargo nextest run -p thrust-adapters-selfhosted --profile adapters -E 'binary(...)'`,
  two steps as before, so a failure still names its suite.
- scripts/verify-all.sh: the same two commands.
- scripts/mutants.sh: the adapter rows run through `adapter_row` (the
  `adapters` profile with `--ignore-default-filter`, so the hermetic
  smtp_wire, smtp_config and Cloudflare email suites can be rows too).
  With every row on nextest there is one kill rule: nextest exits 100
  and the row's JUnit report counts a failure. The libtest checks are
  gone.

Every one of the 7 invocations selects the same tests as on cargo test,
name for name: pg_adapter 82, smtp_sink 7, and the rows' filtersets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: every Rust test runs on nextest except the doctests

AGENTS.md (the suites paragraph, and the commands table's adapter row), the testing chapter
(rules.md, running.md: the exit codes and the pg-adapter job; real-backends.md),
the contributing pages (standards.md: the kill rule and the Postgres row;
features.md: the planted Postgres bug's command, as mutants.sh runs it),
the rust-test-logic skill's nextest reference, and the plan's status.

Dated records that cite a run's `exit 101` (status.md, mutation.md) say
what was measured then, and stay as written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(mutants): every row on nextest, judged by verdict_suite

On top of #248's verdicts. The adapter rows (pg_adapter's two, the six
SMTP, the four Cloudflare email) run through `adapter_row`: nextest with
the `adapters` profile and `--ignore-default-filter`, the log in
`<name>.test.log` and the JUnit report beside it as `<name>.junit.xml`.
That is the shape a contract.sh pass has, so verdict_suite judges both
unchanged, and kill_check_suite and kill_check_suite_msg take every row.
adapter_row turns nextest's 4 (no test ran) into 5, as contract.sh does,
so the verdict reads it as the vacuity guard and not as "the target never
came up".

No row runs on cargo test any more, so the libtest judge goes: the
library's verdict_cargo, mutants.sh's kill_check and kill_check_msg, the
`cargo` kind of `record`, and the test's cargo section.
test-mutants-verdict.sh generates its cases for the log of a contract
pass and of an adapter row alike (286 checks), and checks the wiring:
both functions use verdict_suite, no row runs `cargo test`, and
adapter_row maps 4 to 5.

Controls, each a broken copy that must fail the test, under dash:
- the #93 bug (a run that never started read as SURVIVED): 32 bad;
- the needle ignored: 6 bad;
- adapter_row keeping nextest's 4: 1 bad;
- an SMTP row back on cargo test: 1 bad.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant