Commit ae79c77
fix(scripts): ask the four per-package clauses of the ROOT workspace package (#15516)
`check-type-check-coverage.mjs` built its subject list two ways and only one
of them was walked: `workspacePackages()` ran `testCoverage(dir, scripts)` over
the 79 enumerated dirs, while `observed()` built the root from its manifest
alone -- `{ name, scripts }`, with none of the four observation fields. The
per-package invariants are asked inside `for (const pkg of packages)`, so
TESTS_COVERED, SOURCES_COVERED, PINS_CHECKED and GENERATED_COVERED were asked
of 79 packages and never of the root, while the file's own header said the root
is counted "like any other package's".
Measured on main @ 5023630 before deciding: the root walk reaches 106
directories in 11ms, 0 test files, 0 `@ts-expect-error` pins and 14 non-test
source files, and 0 of them sit outside the root program -- so the root can
join the population with zero new findings, and the repair is a guard rather
than a burn-down.
- `perPackageClauses(pkg, state)` extracts the four clauses out of the loop, so
the loop is no longer what defines their population; `evaluate` asks it of
every package and once of the root.
- The root is walked by `testCoverage('.')`, whose `walk` already skips any
subdirectory carrying a `package.json` at depth > 0, so the 79 are not
re-walked and nothing is billed twice.
- The clauses are decided against the root's COVERAGE script (`typecheck:root`)
rather than its `typecheck` aggregator, carried as `coverageScript` /
`coverageScriptName`. Anchoring PINS_CHECKED and GENERATED_COVERED on
`turbo run typecheck` would manufacture findings instead of finding them, and
a finding now quotes the slot its reader has to edit.
- The RECONCILED sweeps and the three layer figures read the same subject list,
so a root ledger row cannot read as stale the moment it is written.
- `SCOPED_CLAUSES.asked` reads `coverageScript`: the root's manifest `typecheck`
is always defined, so the old predicate would have reported the root as ASKED
on a run where the clause was not asked of it.
- The `SCOPE_LINE_BOUNDARY` sentence naming this card is replaced by the
population sentence -- it stops being true -- and the line's count is now 80,
which is why the sentence stays printed: the headline counts 79.
Self-test: five new cases (one red per clause planted on the root, plus the
RECONCILED half) and one scope case pinning that a root with no `typecheck:root`
is named in the skipped list. 55 semantic + 75 observation cases; battery roster
and floor moved with them.
Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4e8416f commit ae79c77
1 file changed
Lines changed: 399 additions & 184 deletions
0 commit comments