Repository navigation
test(experts): pin every entry of the number-word and month-name tables - #504
Merged
Merged
Conversation
Mutation testing of semantic/experts.py left 98 numeric survivors. Sorted by
syntactic context, only 7 are comparison operands; 45 are dict values, and
those are two lookup tables -- the spelled-number map (_ONES/_TENS/_BIG) and
the month-name map (_MONTHS). Only 10 of the 30 number words appeared
anywhere in tests/, and the month names not at all, so "seven": 7 -> 8 or
"march": 3 -> 4 broke nothing.
Neither table is wrong today. The gap is that a typo in either would ship as
a wrong value, silently: spelled numbers converting to the wrong integers,
or "14 March 2021" written as April 14th and reported as a low-risk,
auto-appliable repair.
Every expectation is written out literally; deriving it from the table under
test would make the test agree with any table, including a broken one.
Verified by corrupting five entries by hand ("seven", "march", "ninety",
"thousand", "dec"): each is caught.
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 was referenced Sep 28, 2026
kevincostner17
added a commit
that referenced
this pull request
Sep 28, 2026
…509) 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.
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.
Why
Mutation testing of
semantic/experts.pyleft 98 numeric-constant survivors. Classified by syntactic context, only 7 are operands of a comparison — the thresholds a mutation brief usually cares about. 45 are dict values, and they are two lookup tables:_ONES/_TENS/_BIG), used byparse_number_words_MONTHS), used by_resolve_dateOnly 10 of the 30 number words appeared anywhere in
tests/, and no month name did, so changing"seven": 7to8or"march": 3to4broke nothing.Neither table is wrong today. The gap is that a typo in either would ship as a wrong value, silently: spelled numbers converting to the wrong integers, or
"14 March 2021"written as April 14th and reported as an unambiguous, low-risk, auto-appliable repair.What
tests/test_lookup_tables.py— 91 tests, test-only:dayfirstEvery expectation is written out literally. Deriving it from the table under test would make the test agree with any table, including a broken one.
Verification
pytest-randomlyseeds together withtest_experts_date_mutants.pyandtest_semantic_cleaning.pyseven,march,ninety,thousand,dec) — each is caughtexperts.pybut not the tables; re-verified there