fix(tooling): restore L0 coverage sweep across all packages

The template baseline shipped 9 packages without @vitest/coverage-v8
and documented an L0 invocation turbo cannot parse — the full coverage
sweep had never run. Adds the provider (pinned to the feature-package
spec), a root test:coverage script, corrects every live doc/prompt/CI
occurrence, and calibrates coverage excludes for the 4 packages whose
latent threshold failures the outage masked (framework glue only —
zero threshold numbers changed). L0 sweep now passes 21/21.

Squash of a284baa + 5c6af95 (worktree-agent-a013c67cea83b2636),
implemented and reviewed via the dispatch loop under the epic's
baseline waiver (lint pending story 03).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016j8z4VHjedXDTjEDNg7qHK
This commit is contained in:
2026-07-12 13:55:00 +02:00
parent 1d00c23604
commit 093de02711
24 changed files with 123 additions and 21 deletions

View File

@@ -8,7 +8,7 @@ The agent-first coverage architecture has four layers. This guide is the day-to-
| Layer | Question it answers | Command |
| ---------------------------------- | ------------------------------------------------ | ---------------------------------------------------- |
| **L0** Per-layer vitest thresholds | "Did the last test run meet the declared bands?" | `pnpm test -- --coverage` |
| **L0** Per-layer vitest thresholds | "Did the last test run meet the declared bands?" | `pnpm test:coverage` |
| **L1** Diff coverage | "Did this PR/slice cover its own changed lines?" | `pnpm coverage:diff` |
| **L2** Aggregate trend | "How is coverage trending across the repo?" | `pnpm coverage:aggregate``coverage/summary.json` |
| **L3** Mutation testing | "Do my tests actually assert anything?" | `pnpm mutate` _(opt-in, not in default `pnpm test`)_ |
@@ -58,7 +58,7 @@ Two readers pick this up today:
### Before pushing
```bash
pnpm test -- --coverage # L0 — per-package thresholds enforced
pnpm test:coverage # L0 — per-package thresholds enforced
pnpm coverage:aggregate # L2 — produce coverage/lcov.info + summary.json
pnpm coverage:diff # L1 — fails if changed lines aren't covered
```
@@ -255,7 +255,7 @@ Fix: read the surviving mutant's diff in `reports/mutation/index.html`, identify
**"Coverage for lines (X%) does not meet 'src/...' threshold (Y%)"** — L0 failure. Real test gap. Either write the missing test or adjust the manifest band downward (rare; band relaxation should be justified).
**`pnpm coverage:diff` says "lcov file not found"** — run `pnpm test -- --coverage && pnpm coverage:aggregate` first. The diff script reads the merged root `coverage/lcov.info`.
**`pnpm coverage:diff` says "lcov file not found"** — run `pnpm test:coverage && pnpm coverage:aggregate` first. The diff script reads the merged root `coverage/lcov.info`.
**`coverage/summary.json` differs every commit** — expected. It includes `generatedAt` (ISO timestamp) and `commit` (SHA). The snapshot workflow only commits it when the underlying numbers change; in local dev, regenerating it shows diff noise.

View File

@@ -290,7 +290,7 @@ HTML report lands at `packages/blog/coverage/index.html` — open it in a browse
To run coverage across all packages:
```bash
pnpm test -- --coverage
pnpm test:coverage
```
Coverage thresholds are enforced in `packages/core-typescript/vitest.base.ts` and inherited by every package's `vitest.config.ts` via `nodeVitestConfig` / `jsdomVitestConfig`.
@@ -655,10 +655,10 @@ Then attach Chrome DevTools at `chrome://inspect`.
**Coverage:**
```bash
pnpm test --coverage --filter @repo/blog
pnpm test --filter @repo/blog -- --coverage
# HTML report: packages/blog/coverage/index.html
pnpm test -- --coverage
pnpm test:coverage
# HTML reports: packages/*/coverage/index.html
```