Story 27: Coverage tracking (full-stack)

Add end-to-end coverage tracking: backend collects vitest coverage,
records metrics with threshold/baseline tracking, and blocks acceptance
on regression. Frontend displays coverage in gate/review panels with
a "Collect Coverage" button. Includes 20 Rust tests, 17 Vitest tests,
and 14 Playwright E2E tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-19 14:45:57 +00:00
parent 8f0bc971bf
commit 8f684a6ca4
20 changed files with 1216 additions and 34 deletions

View File

@@ -67,6 +67,7 @@ When the user asks for a feature, follow this 4-step loop strictly:
### Step 3: The Implementation (Code)
* **Action:** Write the code to satisfy the approved tests and Acceptance Criteria.
* **Constraint:** adhere strictly to `specs/tech/STACK.md` (e.g., if it says "No `unwrap()`", you must not use `unwrap()`).
* **Full-Stack Completion:** Every story must be completed across all components of the stack. If a feature touches the backend, frontend, and API layer, all three must be fully implemented and working end-to-end before the story can be accepted. Partial implementations (e.g., backend logic with no frontend wiring, or UI scaffolding with no real data) do not satisfy acceptance criteria.
### Step 4: Verification (Close)
* **Action:** For each Acceptance Criterion in the story, write a failing test (red), mark the criterion as tested, make the test pass (green), and refactor if needed. Keep only one failing test at a time.

View File

View File

@@ -0,0 +1,37 @@
---
name: Coverage Tracking
test_plan: approved
---
# 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).

View File

View File

@@ -1,14 +0,0 @@
# Story 27: Protect Tests and Coverage
## User Story
As a user, I want explicit safeguards around test deletion and coverage regression, so quality guardrails cannot be weakened silently.
## Acceptance Criteria
- Any deletion of test files requires explicit user approval.
- Any change that disables or neuters a test (e.g., commenting out assertions) requires explicit user approval.
- The workflow fails if coverage drops below the defined threshold.
- Coverage regression is reported clearly before acceptance.
## Out of Scope
- Introducing new test frameworks beyond those listed in `specs/tech/STACK.md`.
- Large refactors solely to improve coverage.