Repository navigation
test(experts): close the mutation gaps that survived the full suite - #509
Merged
Merged
Conversation
A fresh mutation measurement of semantic/experts.py (267 sites, rebuilt and re-validated harness) left 95 subset survivors. All 95 were re-run against the full suite: 47 were killed (every one a number/month table entry pinned by #504), 48 survived. Each survivor was then checked for observability -- original and mutant run on the same input -- before any test was written. 13 are real gaps, now each killed only by its dedicated test here: - an unbalanced "(1,200" read as the accounting negative -1.2 - a one-unit debit "($1.00)" read as 0.0; "($0.00)" as -0.0 or 0.05 - malformed grouping accepted: "$1,2,345" -> 12345, "$,123" -> 123 - a bare "hundred" defaulting to 200 - leading-zero identifier veto checking the wrong character: "05" and "0123" lost protection, "10" gained it (tests only ever used "007") - valid ISO dates rewritten to timestamps beside an unresolvable value - the partial-date review guess becoming year 0003 - resolver and expert base confidences above 1.0 (hidden by the downstream 0.999 clamp), pinned as a [0, 1] invariant, not a literal 10 are equivalent and carry exhaustive executable proofs (three reuse the existing date-branch proof). 22 are in-range confidence/evidence literals, deliberately not pinned: pinning a literal is change-detection, and a decision/risk fingerprint found no change on them (on a corpus whose low sensitivity was measured, so this is not claimed as equivalence). Every mutant classified equivalent was run against this file and leaves it passing: no false kills. No source-text tripwires: the harness writes mutants through ast.unparse, which reformats the file, so such tests fail on every mutant and would corrupt future mutation scores. 53 tests; py3.12 and py3.9; 334 passed under each of 5 random orderings with the neighbouring experts tests; full suite green on both interpreters.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What this closes
A fresh mutation measurement of
semantic/experts.py, using a rebuilt harness validated against a known baseline, gave 267 sites, 64.4% subset kill rate, 95 survivors. A subset survivor is only a candidate, so all 95 were re-run against the full suite:The survivors don't sum to 48 because some tests cover two mutants of the same line.
The real gaps
Each was shown to be observable before any test was written: the original and the mutant were run on the same input and gave different outputs.
"(1,200"(unbalanced) read as the accounting negative −1.2, flagged unambiguous"($1.00)"read as 0.0, a one-unit debit erased;"($0.00)"read as −0.0 or 0.05"$1,2,345"→ 12345,"$,123"→ 123"hundred"defaulting to 200"05"and"0123"lost protection and"10"gained it. Every existing test used"007", which has a zero in both places.[0, 1]invariant, not as literals.How the tests were checked
inspect.getsource). Those failed on every mutant, because the harness writes mutants throughast.unparse, which reformats the file, so they would have silently inflated every future mutation score. They were removed.Verification
pytest-randomlyseeds, alongside the neighbouring experts testsruff checkclean