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

@ -94,6 +94,18 @@ describe("ensureTestServers", () => {
assert.deepEqual(paths, [testServerEntryPath(ROOT, "composable")]);
});
it("still asserts existence on a cache hit that names a new entry", () => {
// The build is cached; the assertion is not. A second caller asking for an
// entry the first didn't must not be handed a path tsc never emitted.
const absent = testServerEntryPath(ROOT, "composable");
const present = (p) => p !== absent;
callEnsure({ requires: ["stdio"], present });
assert.throws(
() => callEnsure({ requires: ["composable"], present }),
(e) => e.message.includes(absent),
);
});
it("builds again for a different repo root", () => {
const calls = [];
callEnsure({ calls });