Skip to content

Commit f200310

Browse files
committed
test(javascript): keep the trigger fixture inside the worker's fact budget
The acceptance trigger taken from #3545 used a 30,000-line first source. Its complete static facts serialize to 9,824,883 bytes against the worker's 8 MiB complete-fact budget, so the worker raises a transport constraint before the parent can retain anything: the source becomes a per-file observation failure and the run stops on the next source's checkpoint instead. The message the test asserted named z-tiny.mjs only through that failure; with a first source inside the budget, the same 256 MiB heap stops the run on a-large.mjs. The parent result budget was therefore not the limit the test was exercising. Reduce the first source to 5,000 lines, whose complete facts come to 1,613,878 bytes, 19% of that budget, and assert the source the message names now. The parent result budget is then the only limit in play, and the constrained-heap public CLI trigger #3545 supplied is otherwise unchanged. Verified: the test passes on this branch, and with the two changed source files restored to origin/main it fails on the reported advice, `Review the reported worker memory lim...` not containing `parent result budget`. A 4096 MiB parent heap completes the same fixture, so no complete-fact budget is reached.
1 parent 9e73670 commit f200310

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎tests/acceptance/applications/javascriptStaticCheckpointBudgetCli.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ import { z } from "zod";
66
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
77
import { cliTest } from "../../support/cli/cliFixture.js";
88

9-
// A 256 MiB parent heap leaves a result budget that the large file's static
10-
// checkpoint exhausts, so the next file's checkpoint stops the analysis.
9+
// A 256 MiB parent heap leaves the parent with no result budget to retain
10+
// complete static facts, so the first source's checkpoint stops the analysis
11+
// before the remaining sources are read. The fixture's own complete static
12+
// facts stay well inside the worker's complete-fact byte budget, so the
13+
// transport limit is not what stops the run.
1114
cliTest.skipIf(process.versions.bun !== undefined)(
1215
"explains parent budget exhaustion after a static checkpoint",
1316
{ timeout: 120_000 },
1417
async ({ cli }) => {
1518
const root = await createTestTempDirectory("rea-js-static-budget-");
1619
const source = Array.from(
17-
{ length: 30_000 },
20+
{ length: 5_000 },
1821
(_, index) =>
1922
`import x${String(index)} from "./m${String(index % 50)}.js"; export const s${String(index)} = "literal-${String(index)}-" + x${String(index)}; fetch("/api/e${String(index)}");`,
2023
).join("\n");
@@ -41,7 +44,7 @@ cliTest.skipIf(process.versions.bun !== undefined)(
4144
})
4245
.parse(response.json);
4346
expect(failure.message).toContain(
44-
"exhausted after retaining static facts for z-tiny.mjs",
47+
"exhausted after retaining static facts for a-large.mjs",
4548
);
4649
expect(failure.remediation.action).toContain("parent result budget");
4750
expect(failure.remediation.action).toContain(

0 commit comments

Comments
 (0)