Skip to content

Guard loops that would assert nothing, and restore a test that had shrunk - #3

Merged
Lumi-node merged 1 commit into
mainfrom
fix/loop-guarded-tests
Aug 22, 2026
Merged

Guard loops that would assert nothing, and restore a test that had shrunk#3
Lumi-node merged 1 commit into
mainfrom
fix/loop-guarded-tests

Conversation

@Lumi-node

Copy link
Copy Markdown
Owner

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_ignores documents itself as checking "across all analyzers at once", and was iterating a hardcoded one-element list:

for name, analyzer in [("architecture", ArchitectureAnalyzer())]:

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

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>
@Lumi-node
Lumi-node merged commit d5e7965 into main Aug 22, 2026
4 checks passed
@Lumi-node
Lumi-node deleted the fix/loop-guarded-tests branch August 22, 2026 23:16
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