OPER-124
[OPER-QA-4] CoverageCell materializer triggered on TestRun terminal transitions
Band
MEDIUM
Suggested
Justin Cooke
Body
feature_id: FEAT-studio-qa
## Context
Ship `packages/qa/src/coverage.ts` — computes and upserts `CoverageCell` rows (feature × kind) whenever a `TestRun` transitions to a terminal status (PASSED, FAILED, SKIPPED, TIMED_OUT). Reads outcomes for the target `(featureId, kind, teamId)` cell across the freshness window and writes `CoverageStatus` = GREEN | YELLOW | RED | GRAY.
Trigger point is the TestRun state machine (OPER-QA-6); this ticket ships the pure function + tests. Freshness window default is 30 days (configurable via product-level setting).
## Acceptance Criteria
- `packages/qa/src/coverage.ts` exports `materializeCoverageCell({ teamId, featureId, kind }): Promise<CoverageCell>` and `recomputeAllForFeature({ teamId, featureId }): Promise<CoverageCell[]>`
- Status rules: all recent runs PASSED → GREEN; any FAILED within freshness window → RED; mixed pass/skip → YELLOW; no runs within window → GRAY
- Freshness default 30 days; overridable via `QaProductSetting` (or hardcoded until settings ship)
- Idempotent upsert on `(teamId, featureId, kind)` unique index
- Vitest coverage: each of the 4 status branches, freshness cutoff, mixed-team isolation
- Called from OPER-QA-6's TestRun state machine when it lands the terminal write; this ticket does not modify the state machine itself
Attachments
Loading attachments…
Comments
Loading comments…