Skip to content

feat(engine): add test coverage regression gate (fixes #520)#533

Open
mickume wants to merge 1 commit intodevelopfrom
fix/issue-520-coverage-regression-gate
Open

feat(engine): add test coverage regression gate (fixes #520)#533
mickume wants to merge 1 commit intodevelopfrom
fix/issue-520-coverage-regression-gate

Conversation

@mickume
Copy link
Copy Markdown
Contributor

@mickume mickume commented Apr 23, 2026

Summary

Adds a test coverage regression gate to the engine's session lifecycle. Before coder sessions launch, baseline per-file coverage is captured. After successful sessions, coverage is re-measured and compared on modified files. If any file's coverage decreased, a blocking finding is emitted, preventing the quality regression pattern described in issue #520.

Closes #520

Changes

File Change
agent_fox/engine/coverage.py New module: multi-language coverage tool detection (pytest-cov, cargo-tarpaulin, go-cover), measurement, regression comparison, JSON serialization
agent_fox/engine/dispatch.py Capture coverage baseline before coder session launch (serial + parallel dispatchers)
agent_fox/engine/result_handler.py Post-session coverage regression check; blocking finding emission via review_findings table
agent_fox/engine/state.py Add coverage_data field to SessionOutcomeRecord for trend tracking
agent_fox/knowledge/migrations.py Migration v20: add coverage_data TEXT column to session_outcomes
tests/unit/engine/test_coverage.py 35 new tests covering all coverage module functionality

Tests

  • Tool detection: pytest-cov, cargo-tarpaulin, go-cover, unknown project, precedence, error handling
  • Coverage measurement: pytest-cov/tarpaulin/go-cover output parsing, timeout handling, result file cleanup
  • Regression detection: increase, unchanged, decrease, multiple files, missing files, zero-line files
  • Result handler integration: baseline capture, regression blocking, no-baseline path
  • Migration v20: column addition verification

Verification

  • All existing tests pass: ✅ (4399 total, +35 new)
  • New tests pass: ✅
  • Linter / formatter: ✅
  • No regressions: ✅

Auto-generated by af-fix.

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