Public: anyone can read this; the crew can change it.

The check runs one shard at a time, so the gate can be green in a cell again #1101

Closed opened this
Closed without merging

trevato/check-serial → main 3 commits

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
5 files changed +58 −8
forge.json +15 −5
@@ -1,15 +1,25 @@
11 {
2 "egress": ["api.anthropic.com"],
2 "egress": [
3 "api.anthropic.com"
4 ],
35 "app": {
46 "run": "bun run src/main.ts",
57 "install": "",
68 "health": "/healthz",
79 "ready": 90,
8 "limits": { "memory": 2048, "cpus": 2, "disk": 8192 }
10 "limits": {
11 "memory": 2048,
12 "cpus": 2,
13 "disk": 8192
14 }
915 },
1016 "check": {
11 "run": "bun x tsc --noEmit && FORGE_CHECK_SHARDS=2 bun scripts/test-shards.ts --timeout 60000 --gate",
12 "timeout": 1800,
13 "limits": { "memory": 4096, "cpus": 4, "disk": 8192 }
17 "run": "node --max-old-space-size=1024 ./node_modules/typescript/lib/tsc.js --noEmit && FORGE_CELLS=off FORGE_CHECK_SHARDS=1 bun scripts/test-shards.ts --timeout 60000 --gate",
18 "timeout": 7200,
19 "limits": {
20 "memory": 4096,
21 "cpus": 4,
22 "disk": 8192
23 }
1424 }
1525 }
scripts/test-shards.ts +7
@@ -135,10 +135,17 @@ async function runShard(slice: string[], index: number): Promise<Timed> {
135135 const paths = slice.map((file) =>
136136 file.startsWith("/") || file.startsWith("./") ? file : `./${file}`,
137137 );
138 // The shard count is this runner's. A forge the tests boot must not read
139 // it as its own `checks.shards` setting (test/capacity.test.ts), and Bun
140 // keeps shell-inherited vars after `delete process.env.X`, so the child
141 // gets a cleaned copy.
142 const childEnv = { ...process.env };
143 delete childEnv["FORGE_CHECK_SHARDS"];
138144 const child = Bun.spawn(["bun", "test", ...flags, ...paths], {
139145 stdin: "ignore",
140146 stdout: "pipe",
141147 stderr: "pipe",
148 env: childEnv,
142149 });
143150 children.add(child);
144151 // One buffer, in arrival order: `bun test` splits its report across
test/contain.test.ts +6 −1
@@ -415,7 +415,12 @@ describe("cells hide every mount that may carry a secret", () => {
415415 });
416416 });
417417
418 const noCells = missing("bwrap", "socat") || process.platform !== "linux";
418 // A host told not to hold cells (`FORGE_CELLS=off`: a check cell, where a
419 // cell inside a cell is not a cell) is a host without cells for these.
420 const noCells =
421 process.env["FORGE_CELLS"] === "off" ||
422 missing("bwrap", "socat") ||
423 process.platform !== "linux";
419424
420425 /** What the probe tries, from inside a deploy or a check. */
421426 function probeSource(targets: {
test/sealed-release.test.ts +2
@@ -68,6 +68,8 @@ async function reportAndFix(
6868 body: `Closes #${report.number}`,
6969 baseBranch: "main",
7070 headBranch: `fix/${slug}`,
71 // A person opens the fix on the public repository on purpose (#865).
72 confirmPublic: true,
7173 }),
7274 );
7375 expect(pull.sealed).toBe(true);
test/web-apps.test.ts +28 −2
@@ -360,10 +360,36 @@ describe("apps, runs and the crew on the web", () => {
360360 expect(page).toContain('class="ln ln-forge"');
361361 expect(page).toContain('id="run-elapsed"');
362362 // The stream and the no-script refresh exist only while it is going.
363 // Match the real <meta> / data-stream= attributes — not the same
364 // strings inside studioRunJs (a bare includes("http-equiv=…") stays
365 // true after the meta is gone because the script still quotes it).
363366 const fresh = listRuns(app.db, hello.id).find((r) => r.id === run!.id)!;
364367 const going = fresh.state === "queued" || fresh.state === "running";
365 expect(page.includes("data-stream=")).toBe(going);
366 expect(page.includes('http-equiv="refresh"')).toBe(going);
368 const hasMetaRefresh = (html: string): boolean =>
369 /<meta[^>]*http-equiv="refresh"/.test(html);
370 const hasLiveMarkers = (html: string): boolean =>
371 html.includes("data-stream=") || hasMetaRefresh(html);
372 let livePage = page;
373 if (going) {
374 expect(livePage.includes("data-stream=")).toBe(true);
375 expect(hasMetaRefresh(livePage)).toBe(true);
376 } else {
377 // DB already terminal; poll until the page drops both live markers
378 // (one re-fetch was not always enough under CI timing).
379 const deadline = Date.now() + 3_000;
380 for (;;) {
381 livePage = await bodyOf(alice, `/alice/hello/runs/${run!.id}`);
382 if (!hasLiveMarkers(livePage)) break;
383 if (Date.now() >= deadline) {
384 throw new Error(
385 `run ${run!.id} is ${fresh.state} but the page still streams/refreshes after settle`,
386 );
387 }
388 await Bun.sleep(200);
389 }
390 expect(livePage.includes("data-stream=")).toBe(false);
391 expect(hasMetaRefresh(livePage)).toBe(false);
392 }
367393
368394 const door = await web(alice, `/runs/${run!.id}`);
369395 expect(door.status).toBe(303);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs