Skip to content

test(detector): cover the report branch for a detector with no blind … - #238

Merged
evkir merged 1 commit into
mainfrom
w3/detector-coverage-tail
Aug 27, 2026
Merged

test(detector): cover the report branch for a detector with no blind …#238
evkir merged 1 commit into
mainfrom
w3/detector-coverage-tail

Conversation

@evkir

@evkir evkir commented Aug 27, 2026

Copy link
Copy Markdown
Owner

…spots

Codecov found the only uncovered statement in eval_corpus: the else in render_report that says so when blind_subclasses comes back empty.

Two wrong answers were available. Deleting the branch, which a working detector reaches by definition and which W3 exists to make reachable. Or covering it with a mock, which proves the formatter can be called rather than that the product ever arrives there.

So it is exercised through the production path: a scorer that flags everything empties the blind list, and evaluate and render_report do the rest. The opposite case is asserted in the same commit, because a test that only ever sees one side of a branch cannot tell that the branch exists.

Mutation-tested, three mutants, all killed: both branches made to print the same text, the blind-subclass filter made to return nothing ever, and the else emptied. The second fails four tests, which is the right shape -- the blind list is quoted in the report, in the baseline pin, and in the subclass tally.

What this changes

How it was measured

Checklist

  • ruff format --check cyberai/ tests/ and ruff check cyberai/ tests/ pass
  • pytest -W ignore::DeprecationWarning -m "not slow and not smoke" passes
  • New behaviour is covered by a test that fails without the change
  • I have read CLA.md and I hereby sign the CLA

…spots

Codecov found the only uncovered statement in eval_corpus: the else in
render_report that says so when blind_subclasses comes back empty.

Two wrong answers were available. Deleting the branch, which a working
detector reaches by definition and which W3 exists to make reachable. Or
covering it with a mock, which proves the formatter can be called rather
than that the product ever arrives there.

So it is exercised through the production path: a scorer that flags
everything empties the blind list, and evaluate and render_report do the
rest. The opposite case is asserted in the same commit, because a test that
only ever sees one side of a branch cannot tell that the branch exists.

Mutation-tested, three mutants, all killed: both branches made to print the
same text, the blind-subclass filter made to return nothing ever, and the
else emptied. The second fails four tests, which is the right shape -- the
blind list is quoted in the report, in the baseline pin, and in the
subclass tally.
@evkir
evkir merged commit f756501 into main Aug 27, 2026
7 checks passed
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@evkir
evkir deleted the w3/detector-coverage-tail branch August 27, 2026 19:31
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.

2 participants