Guard loops that would assert nothing, and restore a test that had shrunk - #3
Merged
Conversation
Completes the vacuity pass. 24 tests looped over a computed collection with no check that it contained anything, so each would have reported success against an implementation that returned nothing at all. Mutation-verified: emptying the language registry now fails 17 of them, and suppressing orphan detection fails two more. Both previously passed. The remaining seven loop over locally-defined literals of four to six elements, which cannot be empty by accident, and are left alone -- a guard there would be noise rather than protection. Also restores a test that had quietly shrunk. `test_no_analyzer_declares_an_option_it_ignores` documents itself as checking "across all analyzers at once" and was iterating a hardcoded one-element list, so it verified a tenth of what it claimed while still passing. It reads the registry again, asserts the registry is fully populated, and now fails when a dead option is added to any analyzer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Completes the test-vacuity pass started in #2.
The problem
A test whose assertions only run inside a loop reports success when that loop never executes. 24 tests iterated a computed collection with no check that it contained anything, so each would have passed against an implementation returning nothing at all.
Mutation-verified: making the language registry return
{}now fails 17 of them, and suppressing orphan detection fails two more. Before this change, both mutations passed clean.Seven others loop over locally-defined literals of four to six elements. Those cannot be empty by accident and are deliberately left alone — a guard there is noise, not protection.
One test had quietly shrunk
test_no_analyzer_declares_an_option_it_ignoresdocuments itself as checking "across all analyzers at once", and was iterating a hardcoded one-element list:It verified a tenth of what its own docstring claimed, and passed. It now reads the registry, asserts the registry is fully populated, and fails when a dead option is added to any analyzer.
Why this class keeps appearing
This is the fourth instance of one shape in this codebase: something applied on some paths but not all, where the path that skips it is invisible. Diagram escaping at call sites, catalog identifier expansion at call sites, an analyzer option colliding with a shared flag, and now assertions that only sometimes run. Each was found by attacking rather than by confirming the happy path.
522 tests, green on 3.10–3.13.
🤖 Generated with Claude Code