Skip to content

test: per-detector contract tests#19

Merged
LueBangs-coder merged 3 commits into
mainfrom
tests-detector-contracts
Jun 14, 2026
Merged

test: per-detector contract tests#19
LueBangs-coder merged 3 commits into
mainfrom
tests-detector-contracts

Conversation

@LueBangs-coder

Copy link
Copy Markdown
Owner

Closes the coverage gap from the review: only 1 of 20 detectors had a dedicated test file; the rest were exercised only in aggregate via the eval loop.

Adds tests/detectors/test_detector_contracts.py — a data-driven suite that:

  • tests each of the 20 detectors individually with hand-built RunArtifacts (not the SyntheticAgent → not circular with eval fixtures)
  • asserts each fires with evidence on its own signal and stays silent on a clean artifact
  • includes a parity guard (test_every_detector_has_a_contract_case) that fails CI if a detector is added without a case

+41 tests (71 → 112), all green; ruff + black pass.

Design note: one data-driven file rather than 19 near-identical per-file stubs — same per-detector coverage, far more maintainable, and the parity guard enforces completeness.

🤖 Generated with Claude Code

Adds tests/detectors/test_detector_contracts.py: a data-driven suite that
tests each of the 20 detectors individually against hand-built RunArtifacts
(not the SyntheticAgent), so the checks are not circular with the eval
fixtures. Each detector must fire with evidence on its own signal and stay
silent on a clean artifact. A parity guard fails if a detector is added
without a corresponding case, so coverage cannot silently regress.

Closes the gap where only 1 of 20 detectors had a dedicated test file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread tests/detectors/test_detector_contracts.py Fixed
LueBangs-coder and others added 2 commits June 14, 2026 14:59
Importing from nemesis.detectors.base already pulls in the nemesis.detectors
package __init__, which registers all 20 detectors — so the explicit
`import nemesis.detectors` was redundant. Removing it clears the CodeQL
py/unused-import finding. Verified the parity guard still sees all 20.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LueBangs-coder
LueBangs-coder merged commit cb9bd88 into main Jun 14, 2026
7 checks passed
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