chore: stop the coverage gate balancing on an unreachable line - #2
Conversation
`WindDebugRegistry._()` is a private constructor whose only job is to stop this static-only registry being instantiated, so no test can reach it. It was also one of just five executable lines in the package, which left coverage at exactly 80.00% (LH=4, LF=5) against an 80% floor: one new uncovered line anywhere would have failed CI, on a package whose next change is likely to be a v2 contract. It now carries `// coverage:ignore-line` with the reason above it, taking the count to 100.00% (LH=4, LF=4). This adds no test. It stops counting a line that cannot be tested, which is the honest way to read the number. Confirmed empirically that `flutter test --coverage` honours the pragma in this toolchain rather than assuming it: the ratio moved 80.00 -> 100.00 on the same six tests.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. Correct, and the central claim holds under test - the pragma is honoured by this toolchain and coverage really does read 100.00%; no blocking findings. I checked the one thing this PR rests on rather than taking it on trust. The The reasoning about reachability is also sound. Minor
I'd also note the PR description's "Not done here" section is right that the coverage policy is now undocumented, since this repo has no The TestsNo test added, and correctly so - the ignored line is unreachable by construction, so a test for it cannot exist. The existing 6 contract tests still cover the registry's whole public surface ( Checks I ran
|
What
WindDebugRegistry._()carries// coverage:ignore-line, with the reason on the line above it.Why
The package had five executable lines and covered four of them, so coverage sat at exactly 80.00% against an 80% floor. One new uncovered line anywhere would have failed CI, on a package whose next real change is likely to be a v2 contract.
The fifth line is a private constructor whose only job is to stop a static-only registry being instantiated. No test can reach it: it is private, and the class is never instantiated by design. So the floor was being held up by a line that could never move.
This adds no test. It stops counting a line that cannot be tested, which is the honest way to read the number, and it turns a gate with zero headroom into one with real headroom.
Verified rather than assumed
// coverage:ignore-lineis apackage:coveragepragma, and it is not obvious thatflutter test --coveragehonours it in this toolchain. Checked directly: on the same six tests the ratio moved from 80.00% to 100.00% once the comment was added, so it does.Gates
dart format --output=none --set-exit-if-changed lib/ test/: 2 files, 0 changed.dart analyze lib/ test/: No issues found.flutter test --coverage: 6 passed.ci.yml: 100.00%, PASS.Not done here
This package still has no
CLAUDE.mdor.claude/rules/, unlike its sibling packages, so the coverage policy it now relies on is not written down anywhere. That is worth adding before a v2 contract lands, but it is authoring governance rather than fixing a defect, so it is left out of this PR.