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

Full suite red: 3 files in check run 01m7hwq0f78jse7kcmg3y0h9ax #14187

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

torque/forge:torque/14182-full-suite-red-3-files-in-check-run-01m7 → main 2 commits fork 4 threads · 4 unresolved

  • Merged. torque/14182-full-suite-red-3-files-in-check-run-01m7 was merged into main as 5b502f7.

Review

Sign in to review this change.
4 files changed +29 −10
scripts/gate.ts +1 −1
@@ -193,7 +193,7 @@ export const SLOW: readonly Exclusion[] = [
193193 { file: "test/spawn-move-cell-e2e.test.ts", reason: "moves a running child forge into a real cell with its data, repository and app; 13.1 s a test on the gate box", issue: 1242 },
194194 { file: "test/spawn-small-cell.test.ts", reason: "spawns a Small child in a real cell, stops it and waits for its recovery in one hook; 32.7 s the file on the gate box", issue: 12648 },
195195 { file: "test/looks.test.ts", reason: "renders the same page light and dark in a real capture to compare pixels; 2.2 s a test on the gate box", issue: 12747 },
196 { file: "test/ssh-port-taken.test.ts", reason: "boots main.ts as a real process with its SSH port already held; 14.2 s a test on the gate box", issue: 1242 },
196 { file: "test/ssh-port-taken.test.ts", reason: "boots main.ts as a real process with its SSH port already held; 2.5 s a test alone here (boot 2.5 to 4.7 s), the old graceful stop added 10 s", issue: 1242 },
outdated

Reason says "3 s alone" for a file the builder did not time alone. Measure and write real figures, or restructure the test (shared setup in beforeAll) instead of excluding it.

197197 { file: "test/standby-restore.test.ts", reason: "boots a restored snapshot read-only as a real process; 3.1 s a test on the gate box", issue: 1242 },
outdated

"2.2 s alone" is admitted to be a guess. Do not commit unmeasured numbers as the reason; measure alone and under load, or make apps-idle fit the budget.

198198 { file: "test/subscriptions.test.ts", reason: "runs stand-in agents on granted accounts, waiting for a refusal and a handover; 10.4 s a test on the gate box", issue: 1242 },
199199 { file: "test/tui-ask-data.test.ts", reason: "drives a real terminal session through rule and model answers; 2.2 s a test on the gate box", issue: 1242 },
test/apps-idle.test.ts +9 −1
@@ -38,6 +38,8 @@ describe("previews of idle pulls sleep", () => {
3838 let fresh: number;
3939 let idle: number;
4040 let later: number;
41 /** The pull the wake test woke, for the test that pushes to it. */
42 let woken: number | undefined;
4143 /** The pull nothing ever asks for, and the head it was last pushed to. */
4244 let calm: { number: number; head: string };
4345 const DOMAIN = "apps.test";
@@ -227,7 +229,13 @@ describe("previews of idle pulls sleep", () => {
227229 expect(envOf(number)?.state).toBe("running");
228230 expect(envOf(number)?.commitOid).toBe(head);
229231 expect(checkouts(number)).toEqual([head.slice(0, 7)]);
230 // In use now: a push to it deploys the new head, as a push always did to a preview that is up.
232 woken = number;
233 }, 120_000);
234
235 test("a push to a woken preview deploys the new head, as a push always did to a preview that is up", async () => {
236 // Invariant: once in use, a preview follows its pull's pushes. Its own test: a wake and a
237 // redeploy are two builds, and a test holds to the time budget of one.
238 const number = woken!;
231239 const next = await push("asked", [{ path: "asked.md", content: "again\n" }]);
232240 await until(() => (envOf(number)?.state === "running" && envOf(number)?.commitOid === next ? true : undefined));
233241 expect(deploys(number).map((r) => r.reason).sort()).toEqual(["push", "wake"]);
test/snapshot-hosted-inside.test.ts +9 −5
@@ -85,12 +85,15 @@ describe("a host's snapshot of the forges it hosts", () => {
8585 let made = 0;
8686 const fresh = (what: string): string => join(root, `${what}-${++made}`);
8787 const snap = (only: readonly string[], more: Partial<Parameters<typeof takeSnapshot>[0]> = {}, at = "2026-11-16T08:00:00Z") => {
88 // Only the named forges are hosted for this snapshot: each test has its own.
88 // The copy runs in this process unless a test sets `hostedCopy: undefined`: a child bun costs
89 // hundreds of ms a snapshot. No passphrase unless a test asks: wrapping a key costs scrypt,
90 // several times a snapshot, and most tests are not about the key. Only the named forges are
91 // hosted for this snapshot: each test has its own.
8992 const spawn = join(host.config.dataDir, "spawn");
9093 for (const name of ledgers.keys()) rmSync(join(spawn, `${name}.json`), { force: true });
9194 for (const name of only) writeFileSync(join(spawn, `${name}.json`), ledgers.get(name)!);
9295 const store = memStore();
93 return takeSnapshot({ db: host.db, dataDir: host.config.dataDir, reposRoot: host.reposRoot, version: "t", passphrase: PASS, ...more }, store, new Date(at)).then((manifest) => ({ store, manifest }));
96 return takeSnapshot({ db: host.db, dataDir: host.config.dataDir, reposRoot: host.reposRoot, version: "t", hostedCopy: copyInProcess, ...more }, store, new Date(at)).then((manifest) => ({ store, manifest }));
9497 };
9598 const ledgers = new Map<string, string>();
9699 const filesOf = (m: Manifest, name: string): string[] => m.files.filter((f) => f.path.startsWith(`children/${name}/`)).map((f) => f.path.slice(`children/${name}/`.length)).sort();
@@ -191,7 +194,7 @@ describe("a host's snapshot of the forges it hosts", () => {
191194 const trap = repoDir(repos, "stacks", "trap");
192195 writeFileSync(join(trap, "config"), `${readFileSync(join(trap, "config"), "utf8")}\n[core]\n\tfsmonitor = /bin/true\n`);
193196 writeFileSync(join(repoDir(repos, "stacks", "borrow"), "objects", "info", "alternates"), `"${join(root, "outside-dir")}"\n`);
194 const { store, manifest } = await snap(["stacks"]);
197 const { store, manifest } = await snap(["stacks"], { passphrase: PASS });
195198 const entry = manifest.hosted![0]!;
196199 expect(entry.why).toBeUndefined();
197200 expect(entry.repos).toBe(1);
@@ -272,7 +275,7 @@ describe("a host's snapshot of the forges it hosts", () => {
272275 db.run("ALTER TABLE repo RENAME TO repo_kept");
273276 db.run("CREATE VIEW repo AS SELECT * FROM repo_kept");
274277 db.close();
275 const { manifest } = await snap(["views"]);
278 const { manifest } = await snap(["views"], { passphrase: PASS, hostedCopy: undefined });
276279 // Its repositories are then the ones on its disk.
277280 expect(manifest.hosted).toMatchObject([{ name: "views", repos: 1, key: "wrapped" }]);
278281 expect(manifest.hosted?.[0]?.why).toBeUndefined();
@@ -296,7 +299,7 @@ describe("a host's snapshot of the forges it hosts", () => {
296299 const bare = new Database(join(killed, "forge.db"), { readonly: true });
297300 expect(bare.query("SELECT name FROM sqlite_master WHERE name = 'last_words'").all()).toEqual([]);
298301 bare.close();
299 const { store, manifest } = await snap(["asleep"]);
302 const { store, manifest } = await snap(["asleep"], { passphrase: PASS, hostedCopy: undefined });
300303 expect(manifest.hosted?.map((h) => [h.name, h.why])).toEqual([["asleep", undefined]]);
301304 const one = fresh("asleep-back");
302305 await restoreHosted(store, manifest.name, "asleep", one, { passphrase: PASS });
@@ -323,6 +326,7 @@ describe("a host's snapshot of the forges it hosts", () => {
323326 const total = (): number => (db.query("SELECT n FROM pair_total").get() as { n: number }).n;
324327 const wrote = { before: 0, during: 0 };
325328 const { store, manifest } = await snap(["awake"], {
329 passphrase: PASS,
326330 // The real copy, in its own process, while the forge's process goes on committing: until
327331 // the copy's file is there, and then two hundred times more.
328332 hostedCopy: async (job, ms) => {
test/ssh-port-taken.test.ts +10 −3
@@ -32,6 +32,11 @@ test("startForgeSsh returns an Err instead of throwing when the port is taken",
3232 }
3333 });
3434
35 /** Boot is 4.7 s alone on the gate box (the child's imports), so this is four times that. */
36 const BOOT_DEADLINE_MS = 20_000;
37 /** What tearing the child down may take once it is up. */
38 const TEARDOWN_MS = 5_000;
39
3540 test("main.ts keeps serving / when the SSH port is taken", async () => {
3641 const dataDir = await mkdtemp(join(tmpdir(), "forge-sshboot-"));
3742 const squatter = Bun.listen({
@@ -55,7 +60,8 @@ test("main.ts keeps serving / when the SSH port is taken", async () => {
5560 });
5661 try {
5762 let status = 0;
58 for (let i = 0; i < 100 && status === 0; i++) {
63 const deadline = Date.now() + BOOT_DEADLINE_MS;
64 while (status === 0 && Date.now() < deadline && proc.exitCode === null) {
5965 try {
6066 status = (await fetch(`http://127.0.0.1:${web}/`)).status;
6167 } catch {
@@ -64,9 +70,10 @@ test("main.ts keeps serving / when the SSH port is taken", async () => {
6470 }
6571 expect(status).toBe(200);
6672 } finally {
67 proc.kill();
73 // Not a drain: the test is about the answer, and a graceful stop takes ten seconds.
outdated

A 60 s timeout hides a real hang for a minute and keeps this file slow. Size it from the measured boot time plus headroom.

74 proc.kill("SIGKILL");
6875 await proc.exited;
6976 squatter.stop(true);
7077 await rm(dataDir, { recursive: true, force: true });
7178 }
72 });
79 }, BOOT_DEADLINE_MS + TEARDOWN_MS);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs