feat(coverage): pnpm coverage:aggregate + L2 implementation
Lands L2 of the agent-first coverage architecture (ADR-020) — the
aggregated trend store.
Script: scripts/coverage/aggregate.mjs (zero-dep Node ESM)
- discoverLcovs: walks packages/* and apps/* for coverage/lcov.info
- normalizeLcov: rewrites SF entries from package-relative (vitest's
output) to repo-relative, so the merged file matches git diff paths
- summarizeLcov: computes statement/branch/function/line percentages
from LF/LH/BRF/BRH/FNF/FNH summary records
- aggregate: merges all lcovs and returns mergedLcov + summary
- Writes coverage/lcov.info (gitignored — large) and
coverage/summary.json (committed — trend via git log -- ...) with
timestamp, short commit SHA, repo + per-package percentages
Test surface: scripts/coverage/aggregate.test.mjs (10 tests, all green)
- Fixtures at __fixtures__/aggregate-pkg-a.lcov +
aggregate-pkg-b.lcov (synthetic, structured to make percentages
deterministic)
- Covers: path normalization (prefix, absolute, double-prefix
avoidance), summary computation (percentages, zero-division,
rounding), discovery (packages + apps, missing dirs), full
aggregation in a tmp repo
Wired:
- root package.json adds "coverage:aggregate" script
- .gitignore restructured: per-package coverage/ stays ignored,
aggregated /coverage/ ignored EXCEPT summary.json (committed for
trend) and .gitkeep markers
L1 allowlist fix folded in (scripts/coverage/diff.mjs):
- The previous (^|/)coverage/ regex accidentally caught
scripts/coverage/* — replaced with anchored patterns
(^coverage/, ^packages/*/coverage/, ^apps/*/coverage/)
- Allowlist scripts/ and turbo/generators/ since they're dev tooling
tested via node --test, outside vitest's v8 lcov pipeline
Smoke-tested end-to-end:
- pnpm coverage:aggregate merged 3 lcovs (auth + media + navigation
from this session's earlier runs), repo coverage 95.22% statements
- pnpm coverage:diff against HEAD~1 with the new merged lcov reports
PASS — all 6 diff files correctly allowlisted
First committed snapshot of coverage/summary.json lands with this
commit, anchoring the trend history at this state.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
62
coverage/summary.json
Normal file
62
coverage/summary.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"generatedAt": "2026-05-13T12:08:33.303Z",
|
||||
"commit": "412d994",
|
||||
"repo": {
|
||||
"statements": 95.22,
|
||||
"branches": 90.52,
|
||||
"functions": 98.77,
|
||||
"lines": 95.22,
|
||||
"counts": {
|
||||
"lf": 1633,
|
||||
"lh": 1555,
|
||||
"brf": 232,
|
||||
"brh": 210,
|
||||
"fnf": 81,
|
||||
"fnh": 80
|
||||
}
|
||||
},
|
||||
"byPackage": {
|
||||
"@repo/auth": {
|
||||
"statements": 93.77,
|
||||
"branches": 90.82,
|
||||
"functions": 100,
|
||||
"lines": 93.77,
|
||||
"counts": {
|
||||
"lf": 787,
|
||||
"lh": 738,
|
||||
"brf": 98,
|
||||
"brh": 89,
|
||||
"fnf": 44,
|
||||
"fnh": 44
|
||||
}
|
||||
},
|
||||
"@repo/media": {
|
||||
"statements": 96.72,
|
||||
"branches": 89.47,
|
||||
"functions": 100,
|
||||
"lines": 96.72,
|
||||
"counts": {
|
||||
"lf": 548,
|
||||
"lh": 530,
|
||||
"brf": 95,
|
||||
"brh": 85,
|
||||
"fnf": 24,
|
||||
"fnh": 24
|
||||
}
|
||||
},
|
||||
"@repo/navigation": {
|
||||
"statements": 96.31,
|
||||
"branches": 92.31,
|
||||
"functions": 92.31,
|
||||
"lines": 96.31,
|
||||
"counts": {
|
||||
"lf": 298,
|
||||
"lh": 287,
|
||||
"brf": 39,
|
||||
"brh": 36,
|
||||
"fnf": 13,
|
||||
"fnh": 12
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user