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
trevato/check-serial → main 3 commits
5 files
changed +58
−8
forge.json +15 −5
| @@ -1,15 +1,25 @@ | ||
| 1 | 1 | { |
| 2 | "egress": ["api.anthropic.com"], | |
| 2 | "egress": [ | |
| 3 | "api.anthropic.com" | |
| 4 | ], | |
| 3 | 5 | "app": { |
| 4 | 6 | "run": "bun run src/main.ts", |
| 5 | 7 | "install": "", |
| 6 | 8 | "health": "/healthz", |
| 7 | 9 | "ready": 90, |
| 8 | "limits": { "memory": 2048, "cpus": 2, "disk": 8192 } | |
| 10 | "limits": { | |
| 11 | "memory": 2048, | |
| 12 | "cpus": 2, | |
| 13 | "disk": 8192 | |
| 14 | } | |
| 9 | 15 | }, |
| 10 | 16 | "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 | } | |
| 14 | 24 | } |
| 15 | 25 | } |
scripts/test-shards.ts +7
| @@ -135,10 +135,17 @@ async function runShard(slice: string[], index: number): Promise<Timed> { | ||
| 135 | 135 | const paths = slice.map((file) => |
| 136 | 136 | file.startsWith("/") || file.startsWith("./") ? file : `./${file}`, |
| 137 | 137 | ); |
| 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"]; | |
| 138 | 144 | const child = Bun.spawn(["bun", "test", ...flags, ...paths], { |
| 139 | 145 | stdin: "ignore", |
| 140 | 146 | stdout: "pipe", |
| 141 | 147 | stderr: "pipe", |
| 148 | env: childEnv, | |
| 142 | 149 | }); |
| 143 | 150 | children.add(child); |
| 144 | 151 | // 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", () => { | ||
| 415 | 415 | }); |
| 416 | 416 | }); |
| 417 | 417 | |
| 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"; | |
| 419 | 424 | |
| 420 | 425 | /** What the probe tries, from inside a deploy or a check. */ |
| 421 | 426 | function probeSource(targets: { |
test/sealed-release.test.ts +2
| @@ -68,6 +68,8 @@ async function reportAndFix( | ||
| 68 | 68 | body: `Closes #${report.number}`, |
| 69 | 69 | baseBranch: "main", |
| 70 | 70 | headBranch: `fix/${slug}`, |
| 71 | // A person opens the fix on the public repository on purpose (#865). | |
| 72 | confirmPublic: true, | |
| 71 | 73 | }), |
| 72 | 74 | ); |
| 73 | 75 | 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", () => { | ||
| 360 | 360 | expect(page).toContain('class="ln ln-forge"'); |
| 361 | 361 | expect(page).toContain('id="run-elapsed"'); |
| 362 | 362 | // 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). | |
| 363 | 366 | const fresh = listRuns(app.db, hello.id).find((r) => r.id === run!.id)!; |
| 364 | 367 | 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 | } | |
| 367 | 393 | |
| 368 | 394 | const door = await web(alice, `/runs/${run!.id}`); |
| 369 | 395 | expect(door.status).toBe(303); |
new above
offline