---
name: Coverage Tracking
---

# Story 27: Coverage Tracking

## User Story
As a user, I want the workflow to track test coverage and block acceptance when coverage regresses, so quality guardrails cannot be weakened silently.

## Acceptance Criteria
- [x] The workflow fails if coverage drops below the defined threshold.
- [x] Coverage regression is reported clearly before acceptance.

## Test Plan (Approved)

### Backend (Rust) — Unit

**AC1: Workflow fails if coverage drops below threshold**
- `workflow::check_coverage_threshold()` fails when coverage % < configured threshold
- Passes when coverage >= threshold

**AC2: Coverage regression reported clearly before acceptance**
- `workflow::evaluate_acceptance_with_coverage()` includes coverage delta when coverage dropped
- `AcceptanceDecision` extended with `coverage_report` field
- Acceptance blocked with clear message when baseline exists and current < baseline

### Frontend (Vitest + Playwright)

**AC1:** Gate panel shows "Coverage below threshold (X% < Y%)" and coverage display
**AC2:** Review/gate panels display coverage regression text and summary
**E2E:** Blocked acceptance displays coverage reasons; green coverage when above threshold

## Out of Scope
- Introducing new test frameworks beyond those listed in `specs/tech/STACK.md`.
- Large refactors solely to improve coverage.
- Path-based test file detection (not reliable for languages with inline tests like Rust).
