|
| 1 | +--- |
| 2 | +"@objectstack/service-automation": patch |
| 3 | +--- |
| 4 | + |
| 5 | +fix(service-automation): put the test layer in front of tsc, and repair the TS2341 x3 it was hiding (#15048) |
| 6 | + |
| 7 | +`packages/services/service-automation` had **no `typecheck` script at all** — |
| 8 | +its scripts were `build` and `test` — so no tsc program anywhere read this |
| 9 | +package (`turbo run typecheck` selects only packages that declare the task, so |
| 10 | +it skipped this one silently). `tsup` transpiles with esbuild and `vitest` |
| 11 | +runs through esbuild type-**stripping**; neither type-checks. The package's |
| 12 | +own `tsconfig.json` does include the tests and always did, so the program that |
| 13 | +would have read them already existed and was simply never invoked. This is |
| 14 | +the `packages/services/**` sibling of `@objectstack/service-cluster`'s same |
| 15 | +graduation (#14181 / PR #15032), reached by the same road in. |
| 16 | + |
| 17 | +What that hid was three `TS2341`s, all in |
| 18 | +`src/nested-region-parity.test.ts` (lines 95/151/180): |
| 19 | + |
| 20 | +``` |
| 21 | +error TS2341: Property 'flows' is private and only accessible within class 'AutomationEngine'. |
| 22 | +``` |
| 23 | + |
| 24 | +Three tests dot-read the private `AutomationEngine#flows` map directly |
| 25 | +instead of going through the class's own public accessor, |
| 26 | +`await engine.getFlow(name)` — already the idiom every other test file in |
| 27 | +this package uses. The fix replaces the three private reads with that |
| 28 | +existing public call (making the two synchronous test bodies `async` where |
| 29 | +they were not already); no source signature was widened, no cast was added. |
| 30 | + |
| 31 | +Wired by the route the `packages/plugins/**` family settled on in #14062 and |
| 32 | +`service-cluster` carried into `packages/services/**` in #14181: a sibling |
| 33 | +`tsconfig.test.json` that changes **module semantics only** (`esnext` / |
| 34 | +`bundler` / `lib: ES2022`, matching how vitest actually executes these files) |
| 35 | +with **strictness inherited and untouched**, named by a new `typecheck` |
| 36 | +script through the shared `check:test-typecheck` gate. Measured before the |
| 37 | +repair: 3 errors under build semantics (`tsc -p tsconfig.json`, which already |
| 38 | +included the tests), 3 under the new config — the two readings agree, so this |
| 39 | +package carried no config-tier pile, and all 3 were genuinely code-tier from |
| 40 | +the start. After: 0 and 0, across a 555-file program covering all 103 of its |
| 41 | +`src/**/*.test.ts`. |
| 42 | + |
| 43 | +No `test-typecheck-debt.json` is added, and its **absence is the zero**: the |
| 44 | +gate reads a missing ledger as `{ entries: {} }`, under which any error in any |
| 45 | +file here is red immediately. The package's `DEBT` entry in |
| 46 | +`scripts/check-type-check-coverage.mjs` (`errors: 3`) is deleted in this PR |
| 47 | +rather than lowered — that is the graduation the ratchet's own invariant |
| 48 | +requires, and it is why the errors were fixed rather than ledgered. |
| 49 | + |
| 50 | +`scripts/check-type-source-resolution.mjs` also gains a registry entry for |
| 51 | +this package: onboarding `tsconfig.test.json` moved the package's tsc program |
| 52 | +set (per that gate's documented onboarding-limb terms), exposing 9 workspace |
| 53 | +deps whose types resolve through `dist/` with no pre-existing program for them |
| 54 | +to have been laundered through. `paths` was measured and rejected as the |
| 55 | +alternative — it takes this package's test layer from 0 errors to 648, nearly |
| 56 | +all billed to other packages' source. |
| 57 | + |
| 58 | +No runtime code changes: `src/**` (excluding the one edited test file, whose |
| 59 | +own assertions are unchanged — only how it reaches the flow moved) is |
| 60 | +otherwise byte-identical, so no shipped behaviour moves. The `patch` level |
| 61 | +reflects the published `package.json` gaining `typecheck` / |
| 62 | +`check:test-typecheck` scripts and a `tsx` devDependency. |
0 commit comments