Skip to content

v1.2.2 — guard against mutation-patch rot

Choose a tag to compare

@Sundeepg98 Sundeepg98 released this 19 May 03:54
· 247 commits to main since this release

Preventive maintenance for the mutation gate itself: detect when an injection patch has rotted instead of silently reporting "caught" for a bug that was never actually introduced.

What

scripts/mutation_check.py now classifies each mutation into one of four outcomes (was binary caught/asleep):

Outcome Meaning
caught Patch applied, only the targeted test failed (clean catch)
stale_patch find text gone, OR patch applied but 0 tests failed
imprecise_patch Target failed AND undeclared collateral failed too
asleep_guard Patch applied, but the named guard didn't notice the bug

To distinguish, the gate now runs the full unit suite per mutation (was: targeted test only). Adds ~90s to CI's mutation job; buys collateral-damage detection.

Surfaced via gdocs_server_info

mutation_check: {
  ran, caught, status, asleep_guards,        # existing
  stale_patches:     [guard names whose patch no longer applies],
  imprecise_patches: [guard names whose patch broke unrelated tests]
}

status is "passed" only when caught == ran AND all three buckets are empty. Specific subtype values (stale_patch > imprecise_patch > asleep_guard) replace the catch-all "failed".

expected_collateral

The strict "exactly one named failure" rule punished legitimate defense in depth. Mutation now accepts expected_collateral: list[str] to declare known sibling guards; failures matching those don't flag imprecise_patch. Two siblings declared on first audit (see CHANGELOG).

Tests

17 new tests in tests/unit/test_mutation_check.py for apply_mutation, _matches_nodeid (parametrized prefix match), classify_outcome (4 outcomes + expected_collateral), and aggregate (status priority).

Acceptance verified: 8/8 mutations caught cleanly, all buckets empty.