Test Coverage Scorecard
This is the single living scorecard for CRAIG’s risk coverage — the matrix of "for each critical workflow, which adversarial axes have we tested?" Distinct from line coverage (which cargo-tarpaulin and cargo-llvm-cov produce); risk coverage answers "would a regression in this workflow be caught by the existing test suite?"
Plan: test-framework-hardening.adoc §DB.2.
The 6 axes
Every workflow row tracks coverage across the canonical Test Categories taxonomy from Testing Reference (CRAIG):
| Axis | What it asserts |
|---|---|
Happy |
Documented success path returns 2xx + the expected envelope |
Sad |
Documented failure path returns the documented 4xx (e.g. 404 for unknown id, 422 for invalid body, 409 for state conflict) |
Evil |
Adversarial input — Unicode, RTLO, NUL injection, oversized strings, depth bombs — is rejected cleanly |
Concurrency |
Concurrent same-key behavior matches the documented invariant (one winner; no double-execution; no lost write) |
Replay |
Crash-and-restart / message redelivery semantics produce the documented post-recovery state |
Fault |
Dependency error handling — DB down, broker down, object-store error, upstream 5xx, malformed JSON |
Legend: ✅ covered, ⏳ planned (issue filed), ❌ gap (no plan).
Top-20 workflows
| Workflow | Happy | Sad | Evil | Concurrency | Replay | Fault |
|---|---|---|---|---|---|---|
Convert-class POST claims (cross-cutting; |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Outbox publish (cross-cutting; |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Inbox handler dedup (cross-cutting; |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Attachment upload (4 sites — cases contacts, cases reports, exchange ICPC, placement homes; ADR-062 §U generation-fenced attempts, epic &77) |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Exchange send ( |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Placement transition guard ( |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
BFF page render under upstream failure ( |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Person match ( |
✅ |
✅ |
✅ |
n/a |
n/a |
✅ |
Rules evaluation ( |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Public intake submit ( |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Partner intake submit ( |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
JWT validation across 8 services ( |
✅ |
✅ |
✅ |
✅ |
n/a |
✅ |
Cross-service FK reconciliation ( |
✅ |
✅ |
✅ |
n/a |
n/a |
✅ |
Health endpoints — /livez vs /readyz differentiation + worker/MQ gates ( |
✅ |
✅ |
n/a |
✅ |
✅ |
✅ |
Invariant sweep — outbox/inbox transport drains ( |
✅ |
✅ |
n/a |
n/a |
n/a |
✅ |
State-machine matrix ( |
✅ |
✅ |
n/a |
n/a |
n/a |
n/a |
Soft-delete activation flip (every soft-delete table — ~20 tables across services) |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Audit log emission per state mutation ( |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
Filename + Content-Disposition sanitization ( |
✅ |
✅ |
✅ |
n/a |
n/a |
n/a |
Typed-DTO contract round-trip ( |
✅ |
✅ |
n/a |
n/a |
n/a |
n/a |
Reading this scorecard
-
Cell at ✅ means there is at least one test that exercises this workflow on this axis. Test counts per cell are NOT tracked here — the runtime coverage matrix (
test-results/http/coverage-matrix.json, written by every full battery; Coverage Matrix) lists each route’s observed axes and observing tests. -
Cell at ⏳ means a tracking issue exists and the plan has a slot for the test. Click through to the issue tracker for the specific blocker.
-
Cell at ❌ means no test, no plan. These are the cells that should drive the next plan-authoring round.
-
n/a means the axis is structurally inapplicable (e.g. a typed-DTO crate has no concurrency axis because it’s a pure-Rust serde test).
When to update
-
Per-MR: when a test lands that ticks a previously-empty cell, flip the cell from ⏳/❌ to ✅ in the same MR. This is part of the delivery checklist (the
delivery-protocolstandard). -
Plan-authoring: when a new plan adds tests that fill cells, update the scorecard before the plan ships so reviewers see the projected post-plan state.
-
Quarterly: a maintainer rebuilds the scorecard from scratch by walking the 20 workflows and re-evaluating each cell. This catches drift where ✅ cells decay into stale tests that no longer exercise the axis they claim.
Drift detection
The static coverage matrix and its auto-derived scorecard are gone (#2703). Compare the hand-curated rows above against the runtime coverage matrix’s per-route axes (test-results/http/coverage-matrix.json, written by every full battery; Coverage Matrix): a ✅ cell whose workflow’s routes show no observed credit on that axis, or a ❌ cell whose routes do, is a signal that the curated scorecard has drifted.
The runtime matrix is a signal, not a replacement: it shows what the tests sent and what came back, not coverage quality. A workflow can have 5 tests on the Happy axis that all hit the same code path while leaving important branches untested. That’s exactly the kind of gap the curated scorecard surfaces.
Line coverage (Plan K F-044)
The risk-coverage matrix above is the primary scorecard. Line coverage is a complementary signal — useful for spotting whole files / branches that no test reaches, useless for arguing that a workflow is "covered".
cargo xtask coverage wraps cargo llvm-cov nextest --workspace --summary-only
for local measurement. #1208 moved the runner onto nextest: plain
cargo test (same-process test threads) races the process-global-state
tests that are safe only under nextest’s process-per-test model
(craig-common’s Prometheus-instrument OnceLock pins were the observed
casualty), and nextest is the mandated runner everywhere else.
| Invocation | Effect |
|---|---|
|
Measure + print summary, then enforce the baseline floor (#1208): FAILS
when workspace line coverage drops more than 0.5 points below the
ledger |
|
Rewrite the ledger from the last run’s measurement (it measures nothing
itself). Raises the record freely; lowers it only with |
|
Additional ABSOLUTE floor. Adds |
Local prerequisites: cargo install cargo-llvm-cov --locked (or cargo binstall cargo-llvm-cov) + cargo-nextest (already the mandated test runner).
Where the floor runs
cargo xtask coverage enforces the baseline-relative floor by default: a drop of more than 0.5 points below the ledger xtask/baselines/coverage.toml fails. The baseline is 69.40% of lines (re-recorded 2026-11-20, #2672; it had stood at 45.68% since 2026-08-09 while measured coverage rose, so the floor would have passed a 23-point drop).
-
CI: the
coverage-floorjob of the weekly scheduled pipeline runs it onmain, with no devstack (the unit tests; devstack-gated tests are skipped, as they are locally). It is advisory, like the other scheduled jobs: a failure shows on the scheduled pipeline and blocks no merge. -
Not per merge: a full instrumented run takes about ten minutes and a 67 GB build on the battery host.
-
Refreshing: when a change legitimately moves coverage, run
cargo xtask coverage, thencargo xtask baselines bless --only coverage(with--allow-lower "<why>"for a drop), and commit the file; the diff is the review. Two runs on one tree differed by 0.03 points.
The ledger holds one number, the line percentage, and no per-crate table is kept: the run prints the per-crate summary, and nothing gates on it.