Skip to content

Carry which kind of dormancy, not a sentence about it - #374

Merged
derek73 merged 1 commit into
masterfrom
claude/dormancy-kind-detail
Aug 12, 2026
Merged

Carry which kind of dormancy, not a sentence about it#374
derek73 merged 1 commit into
masterfrom
claude/dormancy-kind-detail

Conversation

@derek73

@derek73 derek73 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Follow-up to #373, from its review. dormant_rules computed one of three distinct diagnoses — reverted / shadowed / excluded — then rendered it away into prose, so the only way to ask which one it was was to match a substring. Four tests did exactly that:

assert "shadowed by 'fix(z)'" in report.undeclared[0][1]

That fails open. Reword a diagnosis for clarity, keep the matched substring by luck, and the test still passes while checking something weaker than it was written to check. A passing test looks identical either way.

The change

_Dormant now carries the distinction the function already computed:

class _Dormant(NamedTuple):
    issue: str
    kind: Literal["reverted", "shadowed", "excluded"]
    detail: str          # the shadower's issue when kind == "shadowed", else ""

main() renders the sentence from a _DORMANT_WHY table. The computation no longer knows any wording, so rephrasing a diagnosis is a change to output alone. kind is a Literal, so mypy rejects a typo'd kind rather than letting it reach a test.

No behavior change, and here is what pins that

The two _run_main tests assert on the rendered EXPLAINED NOTHING lines and are untouched by this PR. They still pass, which is precisely what proves the output format survived a refactor that moved where the prose is built.

Both of #373's mutation proofs still fail as they should — and the first one got stronger:

Mutation Before After
Swap the reverted/excluded kinds 3 tests fail 4 tests fail
Remove dormant_rules' internal _sorted_rules call 1 test fails 1 test fails

The swap catching more is the payoff. Under substring matching it was caught only where the two kinds happened to produce visibly different sentences; under kind == every test naming a kind catches it, because the assertion is about identity rather than about text that happens to differ.

Measured

Gates unmoved: 108/0 at 1.4.0, 90/0 at 2.0.0, 1/0 at 2.1.0, all exit 0. Suite 3217, ruff and mypy clean.

🤖 Generated with Claude Code

dormant_rules computed one of three distinct diagnoses and then
rendered it away into prose, so the only way to ask which one it was
was to match a substring. Four tests did exactly that.

That fails open. Reword a diagnosis for clarity, keep the matched
substring by luck, and the test still passes while checking something
weaker than it was written to check -- the failure mode is invisible
because a passing test looks the same either way.

_Dormant now carries `kind` (a Literal, so mypy rejects a typo) and
`detail` (the shadower's issue, when there is one). main() renders the
sentence from _DORMANT_WHY. The computation no longer knows any
wording, so rephrasing a diagnosis is a change to output alone.

No behavior change. The two _run_main tests still assert on the
rendered EXPLAINED NOTHING lines and still pass, which is what pins the
output format across this refactor. Both mutation proofs still fail as
they should: swapping the reverted/excluded kinds fails 4 tests,
removing the internal _sorted_rules call fails 1. Gates unmoved at
108/0, 90/0 and 1/0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@derek73 derek73 self-assigned this Aug 12, 2026
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (e0d2123) to head (34b84a2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #374   +/-   ##
=======================================
  Coverage   98.51%   98.51%           
=======================================
  Files          44       44           
  Lines        2895     2895           
=======================================
  Hits         2852     2852           
  Misses         43       43           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@derek73
derek73 merged commit 05f6661 into master Aug 12, 2026
11 checks passed
@derek73
derek73 deleted the claude/dormancy-kind-detail branch August 12, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant