fix(test): reserve heap headroom for shared CLI workers (#6941)

This commit is contained in:
gensokyo-dev authored and GitHub committed 2026-10-24 03:23:25 +00:00
1 parent 008931a178
commit d662fa54a6
3 files changed
+19 -22

No files matched your search

+9 -8
View File
@@ -169,14 +169,15 @@ rendered declarations. Keep canonical rejection checks separate from the
intentionally reduced compact advertisement, and probe actual client renderers
when changing schema representations.
The reused CLI boundary workers cap V8 old space at 384 MiB for ordinary runs
and 512 MiB with coverage enabled. Covered ADB fixtures exhaust the ordinary
384 MiB budget; those fixtures also complete with the shared CLI graph preloaded
at 512 MiB. This is a measured capacity control, not a suite-wide speedup claim.
Both profiles keep the
same bounded worker count, and spawned REA processes retain their own heap
settings. Explicitly disabling coverage retains the ordinary profile; coverage
provider options alone do not enable instrumentation.
The reused CLI boundary workers cap V8 old space at 512 MiB, with or without
coverage. Ordinary CI also exhausted the former 384 MiB budget after earlier
files loaded the shared source/contract graph, while later command registration
and schema/help rendering still needed transient allocation space. This is a
measured capacity control, not a suite-wide speedup claim. The worker count
remains bounded at two, and spawned REA processes retain their own heap settings.
Coverage enablement still controls instrumentation, test deadlines and coverage
thresholds; explicitly disabling it or selecting only a provider does not enable
instrumentation.
Vitest worker limits do not bound subprocesses launched within a test. Bound
those batches separately so repeated CLI validation cannot oversubscribe the
@@ -78,37 +78,33 @@ describe("canonical test-project ownership", () => {
});
it.each([
{ flags: [], heap: 384, timeout: 30_000, lines: 68 },
{ flags: ["--coverage"], heap: 512, timeout: 60_000, lines: 68 },
{ flags: ["--coverage.enabled"], heap: 512, timeout: 60_000, lines: 68 },
{ flags: ["--coverage=false"], heap: 384, timeout: 30_000, lines: 68 },
{ flags: [], timeout: 30_000, lines: 68 },
{ flags: ["--coverage"], timeout: 60_000, lines: 68 },
{ flags: ["--coverage.enabled"], timeout: 60_000, lines: 68 },
{ flags: ["--coverage=false"], timeout: 30_000, lines: 68 },
{
flags: ["--coverage.enabled=false"],
heap: 384,
timeout: 30_000,
lines: 68,
},
{
flags: ["--coverage.provider=v8"],
heap: 384,
timeout: 30_000,
lines: 68,
},
{
flags: ["--coverage.enabled", "--shard", "1/6"],
heap: 512,
timeout: 60_000,
lines: 0,
},
{
flags: ["--coverage.enabled=false", "--shard=1/6"],
heap: 384,
timeout: 30_000,
lines: 0,
},
])(
"resolves worker resources from actual CLI options: $flags",
async ({ flags, heap, timeout, lines }) => {
async ({ flags, timeout, lines }) => {
const root = await createTestTempDirectory("rea-vitest-worker-policy-");
const script = join(root, "worker-policy.mjs");
await writeFile(
@@ -134,7 +130,7 @@ describe("canonical test-project ownership", () => {
},
);
expect(JSON.parse(result.stdout)).toEqual({
execArgv: [`--max-old-space-size=${String(heap)}`],
execArgv: ["--max-old-space-size=512"],
timeout,
lines,
});
+4 -4
View File
@@ -66,10 +66,10 @@ const PROJECT_POLICIES = {
// CLI tests create fresh command instances or subprocesses and own their
// cleanup. Reuse the immutable graph; module mocks belong in process-global.
isolate: false,
// Coverage of the shared command/schema graph exhausts the ordinary
// 384 MiB budget. The preloaded CLI/ADB control completes with 512 MiB;
// keep both profiles bounded with the same concurrency.
execArgv: [`--max-old-space-size=${COVERAGE_ENABLED ? "512" : "384"}`],
// The shared source/contract graph also needs transient schema/help space.
// Ordinary CI exhausted 384 MiB after earlier files warmed that graph.
// Use the measured 512 MiB budget with the same bounded concurrency.
execArgv: ["--max-old-space-size=512"],
},
"process-boundary": {
pool: "forks" as const,