fix: no-default sim phantom-exclude + gate template crates under -D warnings#152
Merged
Merged
Conversation
…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
This comment has been minimized.
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
`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
This comment has been minimized.
This comment has been minimized.
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.
Two mutation/CI-lane hygiene fixes, each a separate commit.
1.
fix(mutants)— stop the no-default surface grading the cfg-gatedsimtree (phantom survivors)store/sim/**is entirely#[cfg(feature = "dangerous-test-hooks")]-gated(
store/mod.rs:55), so under--no-default-featuresthe whole tree is compiledout. cargo-mutants (27.1.0) does not evaluate cfg —
cargo mutants --listreports 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/**/*.rsfor theno-default surface only. All-features keeps mutating
sim(itsdangerous-test-hookstests do the catching), so zero real coverage lost — only phantoms stripped.
store/sim/Also corrected a stale
plan.rscomment that credited theciprofile'sterminate-after; the runner pins themutantsprofile whosefail-fast = trueis the load-bearing lever.
Not a gate weakening (checked, not assumed): not a
--exclude-reequivalenceclaim →
mutation-exclusion-registryuntouched; a plain file-glob, not a raw-regexallowlist element → ran
meta-gate-checkon this exact diff: "ok (no unapprovedweakening detected)"; touches no
*_MUTANT_FILESinclude glob →glob-coverageuntouched.
2.
feat(templates)— gate every template crate under-D warningsEach crate under
templates/*is its own cargo workspace, not a root-workspacemember, so the root
cargo clippy --workspace -- -D warningsgate never reaches it.The per-PR template lane (
cargo xtask templates) compiled + tested each templateunder plain
cargo test, which does not deny warnings — exactly how a dropped#[must_use]AppendReceipt warning slipped into two templates (fixed earlier ine5b89da9) with nothing automated to catch it.Fix: run
cargo clippy --all-features --all-targets -- -D warningsper templateinside the existing loop (before its test, sharing the smoke
--target-dirso coreis checked once). Every template is now held to the same
-D warningsbar as theworkspace.
cargo xtask templatesruns all 10 templates through clippy-D warningsclosed (
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. newno_default_surface_excludes_the_cfg_gated_sim_treepin) ·
cargo xtask templatesgreen + bite-proven ·structural-check: ok ·meta-gate-check: ok ·cargo fmt --check: clean ·cargo clippy -p xtask -- -D warnings: clean.🤖 Generated with Claude Code