Skip to content

test(experts): close the mutation gaps that survived the full suite - #509

Merged
kevincostner17 merged 1 commit into
mainfrom
test/experts-confirmed-gaps
Sep 28, 2026
Merged

kevincostner17 merged 1 commit into
mainfrom
test/experts-confirmed-gaps

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

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:

outcome count
killed by the full suite (all number/month table entries — pinned by #504) 47
real gaps — observable, now each killed only by its dedicated test 13
equivalent — exhaustive executable proof 10
in-range confidence/evidence literals — deliberately not pinned 22
audit-note sampling cap — a separate finding, not pinned 1

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
  • malformed grouping accepted: "$1,2,345" → 12345, "$,123" → 123
  • a bare "hundred" defaulting to 200
  • the leading-zero identifier veto checking the wrong character: "05" and "0123" lost protection and "10" gained it. Every existing test used "007", which has a zero in both places.
  • valid ISO date strings rewritten to timestamps beside a value that can't be resolved, contrary to the code's own "no representation churn" rule
  • the partial-date review guess becoming year 0003
  • resolver and expert base confidences above 1.0, hidden by the downstream 0.999 clamp. These are pinned as a [0, 1] invariant, not as literals.

How the tests were checked

  • Kills: each targeted mutant is killed only by its own dedicated test.
  • No false kills: every mutant classified equivalent leaves the whole file passing. This check caught an early draft that used source-text tripwires (inspect.getsource). Those failed on every mutant, because the harness writes mutants through ast.unparse, which reformats the file, so they would have silently inflated every future mutation score. They were removed.
  • Equivalence proofs check a finite domain exhaustively and state their premise in prose. None relies on "tried some inputs, found no difference".
  • Confidence literals aren't pinned: pinning a literal only detects change. A decision/risk-tier fingerprint over a 10-expert corpus found no change for any of them. That corpus detects 1 of 5 known behaviour-changing mutants, so this is recorded as weak evidence, not as equivalence.

Verification

  • 53 tests, all passing on py3.12 / pandas 2.3.3 and py3.9 / pandas 1.5.3
  • 334 passed under each of 5 pytest-randomly seeds, alongside the neighbouring experts tests
  • Full suite, 0 failed: py3.12 7592 passed, py3.9 7560 passed
  • ruff check clean
  • Test-only change

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.
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: ca7ab4e4-d39c-44fd-b98e-8e2248259393


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kevincostner17
kevincostner17 merged commit 4eb6b0d into main Sep 28, 2026
19 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