Skip to content

fix: no-default sim phantom-exclude + gate template crates under -D warnings#152

Merged
heyoub merged 3 commits into
mainfrom
fix/mutants-no-default-sim-phantom-exclude
Jun 30, 2026
Merged

fix: no-default sim phantom-exclude + gate template crates under -D warnings#152
heyoub merged 3 commits into
mainfrom
fix/mutants-no-default-sim-phantom-exclude

Conversation

@heyoub

@heyoub heyoub commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Two mutation/CI-lane hygiene fixes, each a separate commit.


1. fix(mutants) — stop the no-default surface grading the cfg-gated sim tree (phantom survivors)

store/sim/** is entirely #[cfg(feature = "dangerous-test-hooks")]-gated
(store/mod.rs:55), so under --no-default-features the whole tree is compiled
out. cargo-mutants (27.1.0) does not evaluate cfg — cargo mutants --list
reports the same 3976 mutants for both surfaces, 359 of them under store/sim/.
On the no-default surface every one of those 359 lands in dead code: build + tests
pass unchanged, so the mutant is scored a phantom "missed" that can never be
caught there — ~9% of the population dragging the score down. (The "15 sim missed"
seen during the #121 cure was just the slice one shard surfaced.)

Fix: a surface-specific --exclude crates/core/src/store/sim/**/*.rs for the
no-default surface only. All-features keeps mutating sim (its dangerous-test-hooks
tests do the catching), so zero real coverage lost — only phantoms stripped.

surface total mutants store/sim/
no-default, before 3976 359 phantom
no-default, after 3617 (−359) 0
all-features (unchanged) 3976 359 (caught)

Also corrected a stale plan.rs comment that credited the ci profile's
terminate-after; the runner pins the mutants profile whose fail-fast = true
is the load-bearing lever.

Not a gate weakening (checked, not assumed): not a --exclude-re equivalence
claim → mutation-exclusion-registry untouched; a plain file-glob, not a raw-regex
allowlist element → ran meta-gate-check on this exact diff: "ok (no unapproved
weakening detected)"
; touches no *_MUTANT_FILES include glob → glob-coverage
untouched.

2. feat(templates) — gate every template crate under -D warnings

Each crate under templates/* is its own cargo workspace, not a root-workspace
member, so the root cargo clippy --workspace -- -D warnings gate never reaches it.
The per-PR template lane (cargo xtask templates) compiled + tested each template
under plain cargo test, which does not deny warnings — exactly how a dropped
#[must_use] AppendReceipt warning slipped into two templates (fixed earlier in
e5b89da9) with nothing automated to catch it.

Fix: run cargo clippy --all-features --all-targets -- -D warnings per template
inside the existing loop (before its test, sharing the smoke --target-dir so core
is checked once). Every template is now held to the same -D warnings bar as the
workspace.

  • green: cargo xtask templates runs all 10 templates through clippy -D warnings
    • test; all pass.
  • red (gate bites): injecting an unused binding into a template makes clippy fail
    closed (error: unused variable → non-zero exit → lane fails); reverted.

This is the narrow per-PR lint slice of P1-B (#89); the rest of P1-B stays tracked there.

Verification (both)

cargo test -p xtask (incl. new no_default_surface_excludes_the_cfg_gated_sim_tree
pin) · cargo xtask templates green + bite-proven · structural-check: ok ·
meta-gate-check: ok · cargo fmt --check: clean · cargo clippy -p xtask -- -D warnings: clean.

🤖 Generated with Claude Code

…ree (phantom survivors)

The repo-wide no-default mutation surface scored ~9% of its population as
"missed" against code it never compiles. `store/sim/**` is entirely
`#[cfg(feature = "dangerous-test-hooks")]`-gated (store/mod.rs), so under
`--no-default-features` the whole tree is compiled OUT. But cargo-mutants
(27.1.0) does not evaluate cfg: `cargo mutants --list` reports the SAME 3976
mutants for both surfaces, 359 of them under `store/sim/`. On the no-default
surface every one of those 359 lands in dead code — the build and tests pass
unchanged, so the mutant is scored a phantom "missed" that can NEVER be caught
there. They are not coverage gaps; they are noise that depresses the score and
inflates the missed count (the "15 sim missed" seen during the #121 cure was
just the slice one shard happened to surface).

Fix: a surface-specific `--exclude crates/core/src/store/sim/**/*.rs` for the
no-default surface only (surface_excludes). Verified with
`cargo mutants --list --no-default-features`: 3976 -> 3617 (exactly -359), sim
count -> 0. The all-features surface keeps mutating sim — there
`dangerous-test-hooks` compiles the SimBackend and its tests run and DO catch
these mutants — so zero real coverage is lost; the exclude only strips phantoms.

- lanes.rs: surface_excludes returns the sim exclude for NoDefaultFeatures only,
  via a named const + a pinning test
  (no_default_surface_excludes_the_cfg_gated_sim_tree) so a later refactor
  cannot silently re-pollute the denominator. The test also asserts both
  surfaces' include sets still glob store/** in, proving no coverage loss.
- plan.rs: corrected a stale comment that still credited the `ci` profile's
  terminate-after; the runner now pins the `mutants` profile whose
  `fail-fast = true` is the load-bearing lever (terminate-after is the
  pure-hang backstop).

Not a gate weakening: the file-glob exclude is not a `--exclude-re` equivalence
claim (mutation-exclusion-registry untouched), is not a raw-regex allowlist
element (meta-gate clean — confirmed by running meta-gate-check on this diff),
and touches no `*_MUTANT_FILES` include glob (glob-coverage untouched).
structural-check + meta-gate-check both pass on this change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHio8XCrH89gdEcycCumr6
@blacksmith-sh

This comment has been minimized.

…he standalone-workspace lint hole)

Each crate under templates/* is its OWN cargo workspace, not a member of the root
bpk-lib workspace, so the root `cargo clippy --workspace -- -D warnings` gate never
reaches it. The template lane (`cargo xtask templates`, run per-PR via ci_fast)
compiled + TESTED each template but under plain `cargo test`, which does not deny
warnings — so a dropped `#[must_use]` AppendReceipt warning slipped into two
templates (fixed in e5b89da) with nothing automated to catch it.

Close the hole: run `cargo clippy --all-features --all-targets -- -D warnings` per
template inside the existing loop, BEFORE its test (fail fast on lint), sharing the
smoke `--target-dir` so core is checked once and reused across all ten templates.
clippy under -D warnings subsumes the rustc warning that bit us AND the workspace
clippy-lint bar, so every template is now held to the same standard as the
workspace.

Proven, not claimed:
- green: `cargo xtask templates` runs all 10 templates through clippy -D warnings +
  test; all pass (no pre-existing warnings).
- red (gate bites): injecting an unused binding into a template makes clippy fail
  closed (`error: unused variable` -> non-zero exit -> lane fails); reverted.

This is the narrow, per-PR lint slice of P1-B (#89); the rest of P1-B (cookbook
stale-path docs, etc.) stays tracked there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHio8XCrH89gdEcycCumr6
@heyoub heyoub changed the title fix(mutants): stop the no-default surface grading the cfg-gated sim tree (phantom survivors) fix: no-default sim phantom-exclude + gate template crates under -D warnings Jun 30, 2026
`mutants_full_no_default_surface_stays_xtask_owned` pins the EXACT no-default
repo-wide cargo-mutants arg vector (the "xtask owns the invocation, no drift"
guard). The sim phantom-exclude inserts `--exclude crates/core/src/store/sim/**/*.rs`
between the `--file` globs and the `--exclude-re`, so the golden must reflect it.
Updated the expected vector and documented why the exclude is no-default-only
(the all-features critical-seam golden directly above carries no such --exclude).

Caught by CI (the Blacksmith run), not locally: my local check scoped to
`commands::mutants::lanes` and never ran the `commands::mutants` mod.rs goldens.
Re-verified with the full `cargo test -p xtask --bin xtask` (124 passed, 0 failed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHio8XCrH89gdEcycCumr6
@blacksmith-sh

This comment has been minimized.

@heyoub heyoub merged commit 9f56bcf into main Jun 30, 2026
39 checks passed
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