fix(scripts): pin the tsbuildinfo inside build/, assert on cache hits

Two findings from review round 1, both real.

The default incremental cache path derives from `rootDir`, so it landed at
`test-servers/tsconfig.tsbuildinfo` — beside the config, OUTSIDE `build/`.
That survives the `rm -rf test-servers/build` this project documents as the
remedy for a deleted source file, leaving tsc convinced its outputs are up
to date and emitting nothing. Pinned to `./build/tsconfig.tsbuildinfo`, and
verified that removing the output dir now forces a full re-emit.

The build is memoized per repo root; the existence assertion was memoized
with it. A later caller naming an entry the first did not would be handed a
path tsc never emitted, then fail with exactly the opaque
ERR_MODULE_NOT_FOUND the helper exists to replace. The assertion now runs on
every call.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-25 01:11:10 -04:00
commit 8d193461e3

View file

@ -5,9 +5,14 @@
"moduleResolution": "NodeNext",
"outDir": "./build",
// The script consumers rebuild this project on every run (#2111), so the
// up-to-date case has to be cheap. `.tsbuildinfo` lands under `build/`,
// which is gitignored.
// up-to-date case has to be cheap.
"incremental": true,
// Pinned INSIDE the output dir. The default derives from `rootDir`, landing
// it at `test-servers/tsconfig.tsbuildinfo` — beside the config, outside
// `build/`. That would survive the `rm -rf test-servers/build` this project
// documents as the remedy for a deleted source file, leaving tsc convinced
// its outputs are up to date and emitting nothing.
"tsBuildInfoFile": "./build/tsconfig.tsbuildinfo",
"rootDir": "./src",
"declaration": false,
"sourceMap": true,