codeflash-agent/packages/.claude/rules/test-coverage.md
Kevin Turcios c0a72e978d Add rules from session audit: error handling, testing, debugging
- sessions.md: hard compaction limits, no-polling, file read budget
- debugging.md: root cause first, isolated testing, subprocess logging
- github.md: strengthen MCP-first enforcement
- error-handling.md (packages): no silent swallowing, protect ast.parse
- test-coverage.md (packages): every module needs tests, known gaps
2026-04-21 21:06:15 -05:00

935 B

Test Coverage Requirements

Every module needs unit tests

If you add or modify a module, it must have a corresponding test file. No exceptions for "infrastructure" or "worker" code -- those break the hardest in E2E.

Modules that currently have zero unit tests and have broken in production:

  • pipeline/_candidate_gen.py -- candidate generation strategies
  • analysis/_discovery_worker.py -- pytest test collection subprocess

Other untested modules that need coverage:

  • codegen/_create_pr.py
  • ai/_tabulate.py
  • benchmarking/_trace_db.py
  • benchmarking/_benchmark_worker.py

Test the error paths

The happy path usually works. What breaks in E2E is:

  • Malformed input (bad XML, raw source where markdown expected, missing config keys)
  • Subprocess crashes (exit code != 0 with no output)
  • Version mismatches (pytest 9 vs 8, different config section names)

Write tests for these cases, not just the golden path.