---
name: Test Coverage QA Gate
---

# Story 69: Test Coverage QA Gate

## User Story

As a developer, I want a `script/test_coverage` script that collects and reports test coverage for both Rust and frontend code, so that it can be run as a QA gate when a work item enters `3_qa/`.

## Acceptance Criteria

- [ ] `script/test_coverage` exists and is executable
- [ ] It runs Rust tests with coverage collection (e.g. `cargo llvm-cov` or `cargo tarpaulin`) and reports line coverage percentage
- [ ] It runs frontend tests with coverage collection (e.g. `vitest --coverage`) and reports line coverage percentage
- [ ] The script exits non-zero if coverage is below a configurable threshold (default: the current baseline, so coverage can only go up)
- [ ] The QA stage (`3_qa/`) in the server pipeline runs `script/test_coverage` as a gate check
- [ ] Work items cannot progress from `3_qa/` to `4_merge/` if the coverage gate fails

## Out of Scope

- Per-file or per-function coverage reporting
- Coverage badges or dashboards
- Branch coverage (line coverage is sufficient for now)
