|
| 1 | +// The TEST-layer type-check program (#12511), adopting the mechanism #5286 set |
| 2 | +// for `packages/spec` and #5449 generalised. `tsconfig.json` beside this file |
| 3 | +// stays exactly as it is: it is the BUILD config, and its `**/*.test.ts` |
| 4 | +// exclusion has a reason — ci.yml gates that no test file reaches the published |
| 5 | +// artifact. This sibling puts the excluded layer back in front of tsc, and |
| 6 | +// `package.json`'s `typecheck` script NAMES it (via `check:test-typecheck |
| 7 | +// --project`), because a config no script invokes is exactly the phantom this |
| 8 | +// whole mechanism is about. |
| 9 | +// |
| 10 | +// BEFORE THIS FILE, NO tsc PROGRAM COMPILED A SINGLE TEST FILE HERE, measured |
| 11 | +// rather than read off the config. At 6a1e38244 with the workspace closure |
| 12 | +// built first, `tsc --noEmit --listFiles -p tsconfig.json` — the only config |
| 13 | +// this package's `typecheck` named — puts 349 files in the program, 4 of |
| 14 | +// them this package's own `src/**`, and **0** of its 3 `src/**/*.test.ts`. |
| 15 | +// So the zero is the `exclude` line and not a probe that sees nothing. Positive |
| 16 | +// controls in the SAME run, same binary, same worktree: `packages/rest`'s test |
| 17 | +// program 186 test files, `packages/metadata-core`'s 15, |
| 18 | +// `packages/drivers/driver-memory`'s build config 44 — without them every zero |
| 19 | +// above is unfalsifiable. Under this file the count is **3 of 3** |
| 20 | +// (418 files in the program). |
| 21 | +// |
| 22 | +// What differs from the build config, and what deliberately does NOT: |
| 23 | +// - MODULE SEMANTICS. This package is NOT `"type": "module"`, so the |
| 24 | +// inherited NodeNext compiles as CommonJS the files vitest executes as ESM. |
| 25 | +// Matching vitest is fidelity, not laxity. ⚠️ Measured subtraction on |
| 26 | +// today's tree: **zero** — no test file here reaches for `import.meta` or |
| 27 | +// writes an extension-less relative import, so on THIS tree the mismatch |
| 28 | +// costs nothing. Of the seven packages onboarded by this card only |
| 29 | +// `packages/formula` measured a subtraction (TS1470 x2), which is exactly |
| 30 | +// why eight mechanical copies of one config would not have been eight |
| 31 | +// correct configs. The override is declared anyway, because the alternative |
| 32 | +// is that the first test file to use either construct gets a config-tier |
| 33 | +// diagnostic ledgered as though it were a defect. ⚠️ `bundler` resolution |
| 34 | +// also stops requiring `.js` on this package's own `src` relative imports IN |
| 35 | +// THIS PROGRAM; nothing is lost by that, because leg 1 of `typecheck` still |
| 36 | +// compiles `src` under the build config's NodeNext and is where that rule is |
| 37 | +// enforced. |
| 38 | +// - `lib: ["ES2022"]`, for the reason `packages/rest` and `packages/lint` |
| 39 | +// state: the root config's `lib` is ES2020 while vitest runs these files on |
| 40 | +// a Node with ES2022 builtins, so the gap is reported as TS2550 about the |
| 41 | +// CHECK rather than about the code. ⚠️ Measured effect today: **zero** — |
| 42 | +// this layer carries no TS2550 either way. Fidelity to the runtime, not |
| 43 | +// error reduction, and it is stated that way rather than claimed as a |
| 44 | +// subtraction. It is also the exact trap the card that ordered this file was |
| 45 | +// filed about: `Object.hasOwn` in a new test is TS2550 against a pre-ES2022 |
| 46 | +// lib, and the package's advertised `typecheck` said nothing about it. No |
| 47 | +// `DOM`: nothing in this layer touches a browser global. |
| 48 | +// - ⛔ STRICTNESS IS UNTOUCHED. `strict`, `noUnusedLocals`, |
| 49 | +// `noUnusedParameters`, `noImplicitReturns`, `noFallthroughCasesInSwitch`, |
| 50 | +// `types: ["node"]` and `rootDir` are inherited from `tsconfig.json` and |
| 51 | +// through it the root config, and none of them is re-declared here. |
| 52 | +// `rootDir` (`./src`) needs no widening: every test file here lives under |
| 53 | +// `src` and none reaches outside the package, so the TS6059 pile |
| 54 | +// `packages/cli`'s sibling had to widen `rootDir` to clear does not arise — |
| 55 | +// measured, the raw program carries no TS6059. ⚠️ A child that declared its |
| 56 | +// own `paths` would REPLACE the parent map rather than merge into it, |
| 57 | +// silently sending a source-resolved specifier back to `dist/`, so this file |
| 58 | +// declares none. Nothing here may loosen a type rule; if a test does not |
| 59 | +// compile, that is the finding. |
| 60 | +// |
| 61 | +// MEASURED at 6a1e38244 with the dependency closure built (an error count taken |
| 62 | +// against an unbuilt closure is not a reading — unresolved-import cascades |
| 63 | +// inflate it): this layer reports **5 errors across 1 file**, which is the same 5 that |
| 64 | +// `scripts/check-type-check-coverage.mjs` recorded for this package in its |
| 65 | +// per-PACKAGE `TEST_DEBT` ledger, reproduced class for class (TS2339 x5) and |
| 66 | +// file for file. That entry GRADUATES in this change rather than being paid |
| 67 | +// down: the identical population is now held one level finer, per file and per |
| 68 | +// signature, in `test-typecheck-debt.json` beside this config. There is no |
| 69 | +// config-tier subtraction here and nothing was exposed behind one, so the |
| 70 | +// attribution has no remainder in either direction. |
| 71 | +// |
| 72 | +// // All 5 sit in `src/mcp-provider.test.ts` and carry ONE signature — |
| 73 | +// `Property 'then' does not exist on type 'ConnectorMaterialization | |
| 74 | +// Promise<ConnectorMaterialization>'` — so this package and |
| 75 | +// `packages/connectors/connector-openapi` measure the identical population |
| 76 | +// against the same connector contract. One narrowing at the call site is the |
| 77 | +// whole ledger. |
| 78 | +// |
| 79 | +// Every one of the 5 is PRE-EXISTING: this change edits no test file, and each |
| 80 | +// would have been reported on `origin/main` had this program always existed. |
| 81 | +// They are ledgered EXACT and shrink-only — a file that gains an error is red, |
| 82 | +// one that loses one is red until re-recorded, one that reaches zero is red |
| 83 | +// until its entry is deleted, a signature that ARRIVES or VANISHES is red even |
| 84 | +// at an unchanged file total, and a file NOT listed there may have no errors at |
| 85 | +// all. ⛔ The 5 are NOT repaired here: seeding the ledger is the deliverable, |
| 86 | +// and turning an onboarding into a cleanup is how it stops landing at all. |
| 87 | +// |
| 88 | +// ⚠️ 2 of the 3 files carry NO ledger entry, and that is load-bearing |
| 89 | +// rather than incidental: any error any one of them ever gains is red on |
| 90 | +// arrival. That is the half of this gate that starts working today. This layer |
| 91 | +// also holds ZERO `@ts-expect-error` directives (grepped with a positive control |
| 92 | +// — the same grep hits `packages/spec/src`), so no pin here was silently dead; |
| 93 | +// what the gap cost was the other half. |
| 94 | +{ |
| 95 | + "extends": "./tsconfig.json", |
| 96 | + "compilerOptions": { |
| 97 | + "noEmit": true, |
| 98 | + "module": "esnext", |
| 99 | + "moduleResolution": "bundler", |
| 100 | + "lib": ["ES2022"] |
| 101 | + }, |
| 102 | + "include": ["src/**/*"], |
| 103 | + "exclude": ["node_modules", "dist"] |
| 104 | +} |
0 commit comments