Skip to content

Rust pack: cargo-mutants gate for validators (survivor fails, must-fail seeds, unset CARGO_TARGET_DIR, fixed proptest seed) #2102

Backlog

Description

@gerchowl

Problem

The Rust pack's checks show that tests pass. They don't show that the tests would fail if a validator broke. Mutation testing closes that gap: a validator mutant that no test notices is a validator that could be wrong unnoticed. That's the Rust analogue of a lint gate's "every rule has a must-fail seed".

Found while adopting devkit 1.19.2's Rust pack in a private workspace (2026-12-01). The first cargo-mutants run over its validators found 7 survivors in code that had full unit and property-test coverage, and a second run found more that only random proptest cases had killed.

Proposal

A cargo-mutants gate in the pack, opt-in per repo and scoped by globs:

  • .cargo/mutants.toml seeded with examine_globs for the repo's validation modules. Test machinery like proptest strategies and schema exporters goes in exclude_globs. Each equivalent mutant goes in exclude_re with a written proof.
  • just rust-mutants and a CI job that fail on any survivor. cargo-mutants exits 2 on a missed mutant, so the job just propagates the exit code.
  • Two rules the recipe enforces itself:
    • env -u CARGO_TARGET_DIR. cargo-mutants copies the tree per mutant, and a shared target dir mixes their builds; in the spike, a stale mutant build failed an unrelated test.
    • A fixed PROPTEST_RNG_SEED, so a mutant killed by a property test is killed every run, not by luck.
  • A convention for must-fail seeds: a tests/validator_seeds.rs with one named test per previously surviving mutant. It's documented in the pack.
  • Timing: it runs with --test-tool nextest, and as its own job, since it's slow (≈7 min for ~170 mutants at 2 jobs with a cold build per copy).

Acceptance

  • Deleting a validator branch's test makes the gate fail and name the surviving mutant.
  • The recipe produces the same result with and without an inherited CARGO_TARGET_DIR.

Related: #1887 (nextest), #1833.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions