From 41adc314b653e2b0c46ee60e82991aa823b41060 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 13 Aug 2026 10:43:40 +0000 Subject: [PATCH] docs(devx): mark check-type-check-coverage.mjs's global-setup example historical MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `scripts/check-type-check-coverage.mjs` illustrates "widen a hidden test layer's include one file at a time" with `@objectstack/example-showcase`'s handling of `e2e/global-setup.ts`. PR #8178 (#8062) made both concrete claims stale: the package's tsconfig now takes the wholesale `e2e/**/*` glob directly (not the narrow `e2e/**/*.spec.ts` this file still described), and the 6 errors the narrow glob avoided are fixed at their source rather than excluded, so `global-setup.ts` is now read by the program and type-checks clean. Per the #8189 triage ruling (direction 2): keep the worked example, mark it historical at both sites (`:507` TEST_DEBT preamble, `:1705` `measureTestDebt()` docblock — the two are two halves of one worked example and move together), naming #8062 / PR #8178 as what changed. The general lesson survives unchanged: a wholesale glob can bill a hidden test layer for a non-test file it never asked to cover, so add hidden layers one file at a time and measure each. Prose-only change inside existing comments; zero behavior change. Fixes #8189 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Jqe56GnYFddggeAyfkZFVz --- scripts/check-type-check-coverage.mjs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/check-type-check-coverage.mjs b/scripts/check-type-check-coverage.mjs index e5bc85774b..3bcc81ba06 100644 --- a/scripts/check-type-check-coverage.mjs +++ b/scripts/check-type-check-coverage.mjs @@ -502,11 +502,19 @@ const EXEMPT = { // same one `packages/metadata-core` uses for the structurally identical hole. // - `@objectstack/example-showcase` took the widened-`include` route (#7312's // shape for app-crm / app-todo), because its `rootDir` is already `.` and -// nothing needed neutralising. Its glob is `e2e/**/*.spec.ts` and NOT +// nothing needed neutralising. Its glob was `e2e/**/*.spec.ts` and NOT // `e2e/**/*`, holding the same line the deleted entry's note drew: the // wholesale glob would pull in `e2e/global-setup.ts`, a fixture rather than a -// test, and bill the test layer 6 errors that are not its own. That file is -// still read by no tsc program and is filed rather than folded in here. +// test, and bill the test layer 6 errors that are not its own. +// (historical: until #8062 / PR #8178, that file sat read by no tsc program +// at all. The package's own tsconfig now takes the wholesale `e2e/**/*` +// glob directly, and the 6 errors are fixed at their source -- a file-local +// `declare const process` plus `mkdirSync`/`writeFileSync` on the `node:fs` +// shim in `examples/app-showcase/types/node-shim.d.ts` -- so +// `global-setup.ts` is now read and type-checks clean. The lesson survives +// the fix: widen a hidden test layer's `include` one file at a time and +// measure each addition, because a wholesale glob can bill the layer for a +// non-test file it never asked to cover.) // `@objectstack/cli` (188 raw across 56 files) is deliberately NOT part of that // graduation -- it is a programme rather than a sitting, and its entry stands. const TEST_DEBT = { @@ -1705,6 +1713,13 @@ function defaultTypeRoots(pkgAbs, rootAbs) { * directory glob -- `e2e/**\/*` would have pulled `e2e/global-setup.ts` into * app-showcase's measurement and billed the test layer 6 errors from a file that * is not a test. + * (historical: until #8062 / PR #8178, app-showcase held the narrow + * `e2e/**\/*.spec.ts` glob for exactly this reason. That card fixed the 6 + * errors at their source instead and moved the package to the wholesale + * `e2e/**\/*` glob directly, so `global-setup.ts` is now in the program and + * type-checks clean. The general point stands regardless: widen a hidden test + * layer one file at a time and measure each addition, because a wholesale glob + * can bill the layer for a non-test file it never asked to cover.) * * `rootDir` goes with them. It is `src` in most of these packages, so widening * `include` past it makes tsc answer with one TS6059 per added file and nothing