Skip to content

Commit 21556a2

Browse files
committed
chore(gates): give freerange a reference-free tsconfig view of the root program
Repo Guards -> 'Check numeric ranges' OOMed (exit 134, ~4 GB) on both pushed heads. Cause (#3289 CI diagnosis): freerange's loader walks the resolved tsconfig's projectReferences recursively and keeps every project's ts.Program alive simultaneously. On main the root config had no references, so fr loaded one program (~87s, green). With the #3279 references graph it loads 26 programs / 13,461 file slots and ~2.8 GB heap BEFORE analysis begins; Node's default 4 GB heap dies. Removing only the root references array makes the gate pass (112s); upstream 0.0.5 bundles the same loader, so this is not a version to pin away. Fix at the config, not the heap: scripts/freerange/tsconfig.json extends the root tsconfig — and 'extends' does not inherit references (planted with --showConfig) — so 'fr' gets exactly the single root program it analyzed on main (verified: byte-identical findings and coverage, 971/13495 fully analyzed). tsc -b keeps using the real graph. check:freerange now runs fr from that directory; the reference-free and extends-to-root properties are pinned by a guard test with the OOM as its mutation.
1 parent 48e0f67 commit 21556a2

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"check:packaged-runner-swift": "node --experimental-strip-types scripts/check-packaged-runner-swift.ts",
171171
"check:tmpdir-leaks": "node --experimental-strip-types scripts/check-tmpdir-leaks.ts",
172172
"check:tmpdir-leaks:test": "node --experimental-strip-types scripts/node-test-tmpdir.ts --experimental-strip-types --test --test-concurrency=1 scripts/check-tmpdir-leaks-model.test.ts scripts/vitest-tmpdir-global-setup.test.ts scripts/node-test-tmpdir.test.ts scripts/swift-toolchain-tmpdir.test.ts",
173-
"check:freerange": "fr",
173+
"check:freerange": "cd scripts/freerange && fr",
174174
"check:quick": "pnpm lint && pnpm typecheck",
175175
"sync:mcp-metadata": "node scripts/sync-mcp-metadata.mjs",
176176
"check:mcp-metadata": "node scripts/sync-mcp-metadata.mjs --check",

‎scripts/freerange/tsconfig.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
// Freerange's own view of the root program (#3289 CI OOM). `fr` resolves a tsconfig from the
3+
// process cwd and then loads EVERY `references` project as a full simultaneous ts.Program —
4+
// 26 programs / ~13.5k file slots / >2.8 GB heap before its analysis even starts — so running
5+
// it from the repo root against the reference-bearing tsconfig.json exhausts Node's default
6+
// 4 GB heap (exit 134). `extends` does not inherit `references`, so this file hands fr the
7+
// single root program (includes and options resolve through the base config below, and
8+
// package sources still reach the program transitively through the exports-map `.ts` targets
9+
// exactly as they did before project references existed) while `tsc -b` keeps using the real
10+
// graph. Keep this config reference-free: adding `references` here reintroduces the OOM.
11+
"extends": "../../tsconfig.json"
12+
}

‎scripts/layering/project-references.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ test('the root manifest declares every workspace package as a workspace dependen
6666
);
6767
});
6868

69+
test('the freerange config stays a reference-free view of the root program', () => {
70+
// `fr` loads every `references` project as a full simultaneous ts.Program (~26 programs,
71+
// >2.8 GB heap before analysis) and OOMs Node's default 4 GB on this workspace (#3289 CI).
72+
// The wrapper at scripts/freerange/tsconfig.json exists only because `extends` does not
73+
// inherit references (planted with --showConfig); if someone adds references to it, the
74+
// gate reintroduces the OOM, so the absence is pinned here rather than trusted to the comment.
75+
const config = readTsconfig('scripts/freerange/tsconfig.json');
76+
assert.equal(config.references, undefined, 'references on the freerange config OOM gate');
77+
assert.equal(
78+
config.extends,
79+
'../../tsconfig.json',
80+
'the freerange view must stay the root program itself (no include/exclude drift)',
81+
);
82+
});
83+
6984
test('every package tsconfig references exactly its manifest workspace dependencies', () => {
7085
// The per-package half of the same single-source-of-truth claim (#3279 requirement 1):
7186
// references are DERIVED from the manifest DAG, so an import a manifest gains must add the

0 commit comments

Comments
 (0)