|
| 1 | +// The TEST-layer type-check program (#15048 — the `packages/services/**` |
| 2 | +// instance of the class #14062 settled for `packages/plugins/**` and #14181 |
| 3 | +// carried to `service-cluster` (PR #15032), itself adopting the mechanism |
| 4 | +// #5286 set for `packages/spec`, #5449 generalised, #12542 carried to |
| 5 | +// `packages/rest` and #13176 to `packages/plugins/plugin-security`). |
| 6 | +// `tsconfig.json` beside this one stays exactly as it is: it is the BUILD |
| 7 | +// config. This sibling puts the test layer in front of tsc under the module |
| 8 | +// semantics vitest really executes it with, and `package.json`'s `typecheck` |
| 9 | +// script NAMES it (via `check:test-typecheck --project`), because a config no |
| 10 | +// script invokes is exactly the phantom this whole change is about. |
| 11 | +// |
| 12 | +// ⚠️ WHY THIS PACKAGE COPIES `plugin-webhooks` / `service-cluster` RATHER THAN |
| 13 | +// `plugin-auth` / `plugin-sharing` / `core`: the deciding property is what the |
| 14 | +// BUILD config does with tests. `service-automation`'s `tsconfig.json` does |
| 15 | +// NOT exclude `src/**/*.test.ts` and never did — its `include` is `["src"]` |
| 16 | +// with no test exclusion — so the program that would have read them already |
| 17 | +// existed; it was simply never invoked (no `typecheck` script at all, only |
| 18 | +// `build` and `test`). That is the `plugin-webhooks`/`service-cluster` shape, |
| 19 | +// not the `exclude`-and-compensate shape the other three packages carry, and |
| 20 | +// AGENTS.md forbids ADDING such an exclusion, so their route does not |
| 21 | +// transfer here. |
| 22 | +// |
| 23 | +// What differs from the build config, and what deliberately does NOT: |
| 24 | +// - MODULE SEMANTICS ONLY, plus `lib`. The tests are written and executed as |
| 25 | +// ESM by vitest (esbuild/vite). Matching that is FIDELITY, not laxity: it |
| 26 | +// is the same subtraction `packages/spec`, `packages/rest`, |
| 27 | +// `plugin-security`, `plugin-webhooks` and `service-cluster` each made. |
| 28 | +// - ⛔ STRICTNESS IS UNTOUCHED. `strict`, `noUnusedLocals`, |
| 29 | +// `noUnusedParameters`, `noImplicitReturns`, `noFallthroughCasesInSwitch`, |
| 30 | +// `rootDir`, `paths` and `types` are all INHERITED from `tsconfig.json` |
| 31 | +// (and through it the root config), and none of them is re-declared here. |
| 32 | +// ⚠️ A child that declared its own `paths` would REPLACE the parent map |
| 33 | +// rather than merge into it, silently sending a source-resolved specifier |
| 34 | +// back to `dist/` — a BUILD ARTIFACT — so this file declares none. |
| 35 | +// Nothing here may loosen a type rule; if a test does not compile, that is |
| 36 | +// the finding. |
| 37 | +// - `lib: ["ES2022"]`, for the same reason `packages/rest` states: the root |
| 38 | +// config's `lib` is ES2020 and vitest runs on a Node that has es2022 |
| 39 | +// builtins, so the gap is reported as TS2550 about the CHECK. No `DOM`: |
| 40 | +// nothing in this layer touches a browser global. |
| 41 | +// |
| 42 | +// MEASURED at 2cc4610304 (origin/main), workspace closure built first |
| 43 | +// (`pnpm --filter '@objectstack/service-automation^...' build`, then |
| 44 | +// `tsc --noEmit --pretty false --listFiles -p tsconfig.test.json`, and the |
| 45 | +// same command without `--listFiles`), BEFORE any fix: |
| 46 | +// |
| 47 | +// files in this program 555 |
| 48 | +// own `src/**/*.test.ts` in it 103 |
| 49 | +// errors under BUILD semantics (tsc -p tsconfig.json, which already |
| 50 | +// included the tests) 3 |
| 51 | +// errors under THIS config 3 |
| 52 | +// |
| 53 | +// The two readings AGREE, so this package carried no config-tier pile at all |
| 54 | +// — unlike `@objectstack/core` (#14916: 98 undivided -> 4 after the split, |
| 55 | +// nearly all TS7006 cascading from one unresolved import) — and the 3 were |
| 56 | +// genuinely code-tier from the start: all TS2341 ("Property 'flows' is |
| 57 | +// private…"), all in `src/nested-region-parity.test.ts` (lines 95/151/180), |
| 58 | +// where three tests dot-read the PRIVATE `AutomationEngine#flows` map |
| 59 | +// directly instead of going through the class's own public accessor. That |
| 60 | +// accessor already exists and is already the idiom every other test file in |
| 61 | +// this package uses — `await engine.getFlow(name)` (defined at |
| 62 | +// `src/engine.ts`, returns `this.flows.get(name) ?? null`) — so the fix is |
| 63 | +// not a workaround: it replaces three private-internals reads with the public |
| 64 | +// surface the class was already offering, exactly as the rest of the suite |
| 65 | +// does. AFTER: 0 and 0, across a 555-file program covering all 103 of this |
| 66 | +// package's `src/**/*.test.ts`. |
| 67 | +// |
| 68 | +// There is NO `test-typecheck-debt.json` beside this config, and its ABSENCE |
| 69 | +// is the zero: `check:test-typecheck` reads a missing ledger as |
| 70 | +// `{ entries: {} }`, under which ANY error in ANY file here is red |
| 71 | +// immediately, with no entry to be added to. That is strictly stronger than a |
| 72 | +// ledger holding nothing, and it is the same call `plugin-webhooks`, |
| 73 | +// `plugin-security` (#13176) and `service-cluster` (#14181) each recorded for |
| 74 | +// themselves. If this package ever acquires residue that cannot be fixed in |
| 75 | +// the PR that causes it, THAT is when a ledger and a `gen:test-typecheck-debt` |
| 76 | +// script are owed — and adding one is maintainer-only (#5286), exactly as the |
| 77 | +// gate says when it refuses. |
| 78 | +{ |
| 79 | + "extends": "./tsconfig.json", |
| 80 | + "compilerOptions": { |
| 81 | + "noEmit": true, |
| 82 | + "module": "esnext", |
| 83 | + "moduleResolution": "bundler", |
| 84 | + "lib": ["ES2022"] |
| 85 | + }, |
| 86 | + "include": ["src/**/*"], |
| 87 | + "exclude": ["node_modules", "dist"] |
| 88 | +} |
0 commit comments