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

Polls that run out of time and carry on in 47 test files: make each fail saying what never came #9073

Merged opened this

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

Merged

scout/forge:scout/9025-polls-that-run-out-of-time-and-carry-on → main 2 commits fork 2 threads · 2 unresolved

  • Merged. scout/9025-polls-that-run-out-of-time-and-carry-on was merged into main as 82d2790.

Review

Sign in to review this change.
48 files changed +65 −58
scripts/flake.ts +3 −52
@@ -361,59 +361,10 @@ export function fallThroughWaits(name: string, source: string): string[] {
361361
362362 /**
363363 * The test files that held a fall-through wait when the gate began refusing
364 * one (#9017); #9025 owns making each fail saying what never came. A file
365 * leaves in the pull that fixes it, and the rule goes red on a listed file
366 * that no longer breaches, so this only shrinks. A new file is never added.
364 * one (#9017); #9025 owns making each fail saying what never came. Every file has
365 * left (#9025); a new file is never added.
367366 */
368 export const FALL_THROUGH_OWED: ReadonlySet<string> = new Set([
369 "test/act-now.test.ts",
370 "test/apps-ssh.test.ts",
371 "test/backups-live.test.ts",
372 "test/cell-relays-reaped.test.ts",
373 "test/check-flake.test.ts",
374 "test/check-memory-warning.test.ts",
375 "test/check-pull-flake.test.ts",
376 "test/checks.test.ts",
377 "test/client-abort.test.ts",
378 "test/conflicts-tui.test.ts",
379 "test/conversation-queue-api.test.ts",
380 "test/conversation-talk.test.ts",
381 "test/crew-early.test.ts",
382 "test/crew-merge-conflict.test.ts",
383 "test/crew-parks-planner.test.ts",
384 "test/drill-board-line.test.ts",
385 "test/event-order.test.ts",
386 "test/explore-rank.test.ts",
387 "test/following-card.test.ts",
388 "test/forges-side-by-side.test.ts",
389 "test/live.test.ts",
390 "test/looks-owner.test.ts",
391 "test/merge-queue-clash.test.ts",
392 "test/merge-queue-parallel.test.ts",
393 "test/migrate-token-reach.test.ts",
394 "test/pull-red-alone-path.test.ts",
395 "test/quotas-storage.test.ts",
396 "test/roll-write-pause.test.ts",
397 "test/snapshot-restore-streamed.test.ts",
398 "test/spawn-cell-socket.test.ts",
399 "test/spawn-child-runs-apps.test.ts",
400 "test/studio-door.test.ts",
401 "test/system-stream.test.ts",
402 "test/tui-delete-repo.test.ts",
403 "test/tui-forks-take.test.ts",
404 "test/tui-grants.test.ts",
405 "test/tui-hooks.test.ts",
406 "test/tui-newapp.test.ts",
407 "test/tui-onyou.test.ts",
408 "test/tui-origins-forge.test.ts",
409 "test/tui-origins-guard.test.ts",
410 "test/tui-origins.test.ts",
411 "test/tui-resilience-drill.test.ts",
412 "test/tui-resilience-now.test.ts",
413 "test/tui-teams.test.ts",
414 "test/tui-working-yours.test.ts",
415 "test/web-apps.test.ts",
416 ]);
367 export const FALL_THROUGH_OWED: ReadonlySet<string> = new Set([]);
417368
418369 /** The record an admitting pull carries. */
419370 export function admissionRecord(
test/act-now.test.ts +1
@@ -241,6 +241,7 @@ describe("a form that answers at once, and what the server says when it refuses"
241241 if (next === undefined || next.done) continue;
242242 text += new TextDecoder().decode(next.value);
243243 }
244 if (!text.includes(`id: ${ids[2]}`)) throw new Error(`never came: still waiting while !text.includes(\`id: \${ids[2]}\`)`);
244245 await reader2.cancel();
245246 expect(text).not.toContain(`id: ${ids[0]}`);
246247 expect(text).toContain(`id: ${ids[1]}`);
test/apps-ssh.test.ts +1
@@ -239,6 +239,7 @@ describe.skipIf(NO_OPENSSH)("a terminal for every app, over ssh", () => {
239239 const deadline = Date.now() + 10_000;
240240 while (!terminal.output().includes("j/k move") && Date.now() < deadline)
241241 await Bun.sleep(50);
242 if (!terminal.output().includes("j/k move")) throw new Error(`never came: still waiting while !terminal.output().includes("j/k move")`);
242243 // The app's own terminal drew on our pty…
243244 expect(terminal.output()).toContain("hello");
244245 expect(terminal.output()).toContain("j/k move");
test/backups-live.test.ts +4 −3
@@ -162,7 +162,7 @@ test("the live part and the stream are an admin's alone", async () => {
162162 expect(part.status).toBe(404);
163163 expect((await fetch(`${servers.url}/settings/backups/live`)).status).toBeGreaterThanOrEqual(300);
164164
165 const frames = async (cookie: string): Promise<string> => {
165 const frames = async (cookie: string, mustArrive: boolean): Promise<string> => {
166166 const ac = new AbortController();
167167 const res = await fetch(`${servers.url}/events`, { headers: { cookie }, signal: ac.signal });
168168 const reader = res.body!.getReader();
@@ -179,10 +179,11 @@ test("the live part and the stream are an admin's alone", async () => {
179179 ]);
180180 if (value) got += new TextDecoder().decode(value);
181181 }
182 if (mustArrive && !got.includes("backup.")) throw new Error(`never came: still waiting while !got.includes("backup.")`);
182183 ac.abort();
183184 return got;
184185 };
185186 const alice = await login("alice", "a-good-passphrase");
186 expect(await frames(alice)).toContain("backup.started");
187 expect(await frames(bob)).not.toContain("backup.started");
187 expect(await frames(alice, true)).toContain("backup.started");
188 expect(await frames(bob, false)).not.toContain("backup.started");
188189 });
test/cell-relays-reaped.test.ts +1
@@ -91,6 +91,7 @@ describe.skipIf(noCells)("cells: no relay outlives its cell", () => {
9191 seen = relays(mark).length;
9292 await Bun.sleep(50);
9393 }
94 if (seen === 0) throw new Error(`never came: still waiting while seen === 0`);
9495 const result = await running;
9596 expect(result.ok).toBe(true);
9697 expect(seen).toBeGreaterThan(0);
test/check-flake.test.ts +1
@@ -138,6 +138,7 @@ async function mainCheck(name: string, testBody: string) {
138138 const deadline = Date.now() + 40_000;
139139 const finished = () => listRuns(app.db, repo.id, { kind: "check", limit: 50 }).find((r) => r.commitOid === oid && (r.state === "ok" || r.state === "failed"));
140140 while (Date.now() < deadline && finished() === undefined) await Bun.sleep(100);
141 if (finished() === undefined) throw new Error(`never came: still waiting while finished() === undefined`);
141142 const run = finished()!;
142143 return { repo, run, log: readRunLog(app.config.dataDir, run.id).lines.join("\n") };
143144 } finally {
test/check-memory-warning.test.ts +2 −2
@@ -64,8 +64,8 @@ test("a check declaring memory above the ceiling logs the warning before its com
6464 (r) => r.commitOid === oid && isTerminal(r.state),
6565 );
6666 while (Date.now() < deadline && mine() === undefined) await Bun.sleep(100);
67 const run = mine();
68 if (run === undefined) throw new Error("the check did not finish");
67 if (mine() === undefined) throw new Error(`never came: still waiting while mine() === undefined`);
68 const run = mine()!;
outdated

With the throw above, this guard is unreachable. Remove it.

6969 const lines = readRunLog(dataDir, run.id).lines;
7070 const warned = lines.findIndex((l) => l.startsWith("warning: forge.json declares memory 8192 MiB"));
7171 const ran = lines.findIndex((l) => l.startsWith("$ "));
test/check-pull-flake.test.ts +1
@@ -83,6 +83,7 @@ async function pullCheck(name: string, names: string[], branchFiles: { path: str
8383 const deadline = Date.now() + 40_000;
8484 const finished = () => listRuns(app.db, repo.id, { kind: "check", limit: 50 }).find((r) => r.commitOid === oid && (r.state === "ok" || r.state === "failed"));
8585 while (Date.now() < deadline && finished() === undefined) await Bun.sleep(100);
86 if (finished() === undefined) throw new Error(`never came: still waiting while finished() === undefined`);
8687 const run = finished()!;
8788 return { oid, run, log: readRunLog(app.config.dataDir, run.id).lines.join("\n"), flakes: () => flakeList(app.db, Date.now()).filter((f) => f.repo === `alice/${name}`) };
8889 } finally {
test/checks.test.ts +1
@@ -868,6 +868,7 @@ describe("checks", () => {
868868 const until = async (done: () => boolean): Promise<void> => {
869869 const deadline = Date.now() + 10_000;
870870 while (!done() && Date.now() < deadline) await Bun.sleep(25);
871 if (!done()) throw new Error(`never came: still waiting while !done()`);
871872 };
872873 await until(() => mine().length > 0);
873874 expect(mine().some((r) => r.state === "queued")).toBe(true);
test/client-abort.test.ts +1
@@ -74,6 +74,7 @@ test("a body that arrives after the client left is cancelled", async () => {
7474 controller.abort();
7575 expect(await pending).toBe("aborted");
7676 for (let i = 0; i < 100 && servers.inFlight > 0; i++) await Bun.sleep(10);
77 if (servers.inFlight > 0) throw new Error(`never came: still waiting while servers.inFlight > 0`);
7778 release(
7879 new Response(
7980 new ReadableStream({
test/conflicts-tui.test.ts +1
@@ -150,6 +150,7 @@ describe("the terminal reads a conflicted pull's blocks", () => {
150150 expect(out).not.toContain("<<<<<<<");
151151 // The commit lands off the key's own turn: wait for the branch to move.
152152 for (let i = 0; i < 100 && (await tip("refs/heads/loud")) === was; i++) await Bun.sleep(50);
153 if ((await tip("refs/heads/loud")) === was) throw new Error(`never came: still waiting while (await tip("refs/heads/loud")) === was`);
153154 const now = await tip("refs/heads/loud");
154155 expect(now).not.toBe(was);
155156 const parents = await runGit(["rev-list", "--parents", "-n", "1", now], { cwd: dir });
test/conversation-queue-api.test.ts +1
@@ -38,6 +38,7 @@ const send = (body: object, t = rw, extra: Record<string, string> = {}) =>
3838 fetch(`${servers.url}/api/v1/conversation/messages`, { method: "POST", headers: headers(t, extra), body: JSON.stringify(body) });
3939 const until = async (ok: () => boolean) => {
4040 for (let i = 0; i < 100 && !ok(); i++) await Bun.sleep(10);
41 if (!ok()) throw new Error(`never came: still waiting while !ok()`);
4142 };
4243 /** Starts a turn that holds until stopped, without counting against the minute's messages. */
4344 const start = async () => {
test/conversation-talk.test.ts +1
@@ -489,6 +489,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Heard.","t
489489 const settleBob = async () => {
490490 // The stand-in records the message it was started with; wait for a new one, then for the end.
491491 for (let i = 0; i < 80 && readFileSync(join(dir, "first.json"), "utf8") === seen; i++) await Bun.sleep(25);
492 if (readFileSync(join(dir, "first.json"), "utf8") === seen) throw new Error(`never came: still waiting while readFileSync(join(dir, "first.json"), "utf8") === seen`);
492493 seen = readFileSync(join(dir, "first.json"), "utf8");
493494 for (let i = 0; i < 200; i++) {
494495 const r = (await (await fetch(`${servers.url}/api/v1/conversation/turns`, { headers: headers(bob) })).json()) as { running: boolean };
test/crew-early.test.ts +3
@@ -73,6 +73,7 @@ describe("the crew, with a stand-in Claude Code: the early pull", () => {
7373 // The agent has pushed and is still working: the pull is already there.
7474 const deadline = Date.now() + 20_000;
7575 while (mine().length === 0 && Date.now() < deadline) await Bun.sleep(100);
76 if (mine().length === 0) throw new Error(`never came: still waiting while mine().length === 0`);
7677 const early = mine()[0]!;
7778 expect(early).toBeDefined();
7879 expect(early.title).toBe("Plant crocuses");
@@ -130,6 +131,7 @@ describe("the crew, with a stand-in Claude Code: the early pull", () => {
130131 );
131132 const deadline = Date.now() + 20_000;
132133 while (mine().length === 0 && Date.now() < deadline) await Bun.sleep(100);
134 if (mine().length === 0) throw new Error(`never came: still waiting while mine().length === 0`);
133135 const early = mine()[0]!;
134136 expect(
135137 editIssue(app, alice, repo, early, { body: "My own words.\n\nCloses #1" }).ok,
@@ -211,6 +213,7 @@ describe("the crew, with a stand-in Claude Code: the early pull", () => {
211213 );
212214 const deadline = Date.now() + 20_000;
213215 while (mine().length === 0 && Date.now() < deadline) await Bun.sleep(100);
216 if (mine().length === 0) throw new Error(`never came: still waiting while mine().length === 0`);
214217 const early = mine()[0]!;
215218 expect(addComment(app, alice, repo, early, "I like where this goes.").ok).toBe(true);
216219 writeFileSync(join(dataDir, "release"), "");
test/crew-merge-conflict.test.ts +1
@@ -89,6 +89,7 @@ describe("the crew, with a pull that does not merge", () => {
8989 const until = async (done: () => boolean, ms = 10_000) => {
9090 const end = Date.now() + ms;
9191 while (!done() && Date.now() < end) await new Promise((r) => setTimeout(r, 10));
92 if (!done()) throw new Error(`never came: still waiting while !done()`);
9293 };
9394 const headOf = (pull: Pull) => getPull(app.db, repo.id, pull.number)!.headOid;
9495 const fileAt = async (oid: string, path: string) =>
test/crew-parks-planner.test.ts +3
@@ -73,6 +73,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Nothing to
7373 await driveRepo(e.app, e.fresh());
7474 const deadline = Date.now() + 45_000;
7575 while (e.fresh().directionIssueId == null && Date.now() < deadline) await Bun.sleep(50);
76 if (e.fresh().directionIssueId == null) throw new Error(`never came: still waiting while e.fresh().directionIssueId == null`);
7677 const direction = e.fresh().directionIssueId!;
7778 const settled = () =>
7879 listRuns(e.app.db, e.repo.id, { kind: "agent" }).find(
@@ -173,12 +174,14 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Nothing to
173174 await driveRepo(e.app, e.fresh());
174175 const deadline = Date.now() + 45_000;
175176 while (e.fresh().directionIssueId == null && Date.now() < deadline) await Bun.sleep(50);
177 if (e.fresh().directionIssueId == null) throw new Error(`never came: still waiting while e.fresh().directionIssueId == null`);
176178 const direction = e.fresh().directionIssueId!;
177179 const settled = () =>
178180 listRuns(e.app.db, e.repo.id, { kind: "agent" }).find(
179181 (r) => r.issueId === direction && ["ok", "failed", "cancelled"].includes(r.state),
180182 );
181183 while (settled() === undefined && Date.now() < deadline) await Bun.sleep(100);
184 if (settled() === undefined) throw new Error(`never came: still waiting while settled() === undefined`);
182185 while (!existsSync(promptFile) && Date.now() < deadline) await Bun.sleep(50);
183186 expect(existsSync(promptFile)).toBe(true);
184187 const told = readFileSync(promptFile, "utf8");
test/drill-board-line.test.ts +1
@@ -151,6 +151,7 @@ describe("the drill's board line", () => {
151151 expect(sent).toHaveLength(0);
152152 clock = T0 + 10 * DAY + DRILL_STALE_MS + 1;
153153 for (let i = 0; i < 100 && sent.length === 0; i++) await Bun.sleep(10);
154 if (sent.length === 0) throw new Error(`never came: still waiting while sent.length === 0`);
154155 await n.settled();
155156 await Bun.sleep(50);
156157 await n.settled();
test/event-order.test.ts +1
@@ -109,6 +109,7 @@ describe("events keep their order across processes", () => {
109109 if (next === undefined || next.done) continue;
110110 text += new TextDecoder().decode(next.value);
111111 }
112 if (!text.includes(`id: ${second}`)) throw new Error(`never came: still waiting while !text.includes(\`id: \${second}\`)`);
112113 await reader.cancel();
113114 return text;
114115 };
test/explore-rank.test.ts +1
@@ -82,6 +82,7 @@ async function seed(): Promise<void> {
8282 new Date(now - (i % 6) * DAY).toISOString(),
8383 );
8484 }
85 if (stopped) throw new Error("never came: the seed was torn down before all 500 repositories were made"); // teardown awaits setup.catch
outdated

This is the last statement of seed(), so the return does nothing and nothing here fails when a wait runs out. Replace it with a real never-came check on the poll the gate flagged, or remove it.

8586 }
8687 beforeAll(() => {
8788 setup = seed();
test/following-card.test.ts +1
@@ -96,6 +96,7 @@ test("the card foot holds the take and propose forms, each a post form with a bt
9696 page = await (await fetch(`${servers.url}/bob/lib`, { headers: { cookie } })).text();
9797 if (!page.includes('value="take"')) await Bun.sleep(40);
9898 }
99 if (!page.includes('value="take"')) throw new Error(`never came: still waiting while !page.includes('value="take"')`);
99100 const foot = page.match(/<div class="card-foot">([\s\S]*?)<\/div>\s*<\/div>/);
100101 expect(foot).not.toBeNull();
101102 // Prose wraps: sentences and notes are paragraphs, never a (nowrap) row title.
test/forges-side-by-side.test.ts +1
@@ -34,6 +34,7 @@ describe("what a forge uses against its size", () => {
3434 try {
3535 const wait = Date.now() + 3000;
3636 while (!cellCounters().some((c) => c.label === "forge:fun") && Date.now() < wait) await Bun.sleep(50);
37 if (!cellCounters().some((c) => c.label === "forge:fun")) throw new Error(`never came: still waiting while !cellCounters().some((c) => c.label === "forge:fun")`);
3738 const dir = mkdtempSync(join(tmpdir(), "forge-sbs-d-"));
3839 const first = forgeUse(child({ placement: "cell", name: "fun", size: "small" }), dir);
3940 // The request never walks the disk: the first reading says so, a later one has the figure.
test/live.test.ts +4 −1
@@ -20,6 +20,8 @@ async function readEvents(
2020 res: Response,
2121 count: number,
2222 timeoutMs = 5_000,
23 /** False when the wait is the point: nothing should come. */
24 mustArrive = true,
2325 ): Promise<{ id: string; data: Record<string, unknown> }[]> {
2426 const reader = res.body!.getReader();
2527 const decoder = new TextDecoder();
@@ -46,6 +48,7 @@ async function readEvents(
4648 out.push({ id, data: JSON.parse(data) as Record<string, unknown> });
4749 }
4850 }
51 if (mustArrive && out.length < count) throw new Error(`never came: still waiting while out.length < count`);
4952 await reader.cancel().catch(() => {});
5053 return out;
5154 }
@@ -97,7 +100,7 @@ describe("the viewer's stream", () => {
97100 // A stranger's stream: nothing private on it, however long they wait.
98101 const stranger = await fetch(`${servers.url}/events?since=0`);
99102 expect(stranger.headers.get("content-type")).toContain("text/event-stream");
100 const nothing = await readEvents(stranger, 1, 800);
103 const nothing = await readEvents(stranger, 1, 800, false);
101104 expect(nothing.length).toBe(0);
102105
103106 // The reader's stream, from the beginning: the opened issue is replayed.
test/looks-owner.test.ts +2
@@ -436,6 +436,7 @@ describe("looks of a public app", () => {
436436 const light = () =>
437437 looksForEnv(app.db, record.id, env).filter((l) => l.commitOid === commit && l.theme === "light");
438438 while (light().length < 6 && Date.now() < deadline) await Bun.sleep(100);
439 if (light().length < 6) throw new Error(`never came: still waiting while light().length < 6`);
439440 await looks.idle();
440441 const rows = light();
441442 const taken = (page: string, kind: string) =>
@@ -488,6 +489,7 @@ describe("looks of a public app", () => {
488489 const light = () =>
489490 looksForEnv(app.db, record.id, env).filter((l) => l.commitOid === commit && l.theme === "light");
490491 while (light().length < pages.length * 3 && Date.now() < deadline) await Bun.sleep(100);
492 if (light().length < pages.length * 3) throw new Error(`never came: still waiting while light().length < pages.length * 3`);
491493 await looks.idle();
492494 const rows = light();
493495 for (const page of pages) {
test/merge-queue-clash.test.ts +1
@@ -128,6 +128,7 @@ describe("the merge queue remembers clashes", () => {
128128 const options = { depth: 2, room: () => 4 };
129129 const first = enqueue(repoId, [b], holding, options);
130130 for (let i = 0; i < 2000 && open < 1; i++) await Bun.sleep(5);
131 if (open < 1) throw new Error(`never came: still waiting while open < 1`);
131132 const f = entry(6, await headAdding("f", "f.txt"));
132133 const second = enqueue(repoId, [f], holding, options);
133134 for (let i = 0; i < 40; i++) await Bun.sleep(5);
test/merge-queue-parallel.test.ts +1
@@ -292,6 +292,7 @@ describe("the queue's extra gates and the pull checks' slots", () => {
292292 const [first, second] = [await entry(1), await entry(2)];
293293 const one = enqueue(repoId, [first], gate, options);
294294 for (let i = 0; i < 2000 && open < 1; i++) await Bun.sleep(5);
295 if (open < 1) throw new Error(`never came: still waiting while open < 1`);
295296 const two = enqueue(repoId, [second], gate, options);
296297 // Either it gates beside the first, or it still waits in line for it.
297298 for (let i = 0; i < 100 && open < 2; i++) await Bun.sleep(5);
test/migrate-token-reach.test.ts +1
@@ -316,6 +316,7 @@ test("the terminal's migrate screen says public only, names the new-token page,
316316 await settleApp(tui);
317317 await Bun.sleep(25);
318318 }
319 if (!tui.screen.toText().includes("carol-gh/closed")) throw new Error(`never came: still waiting while !tui.screen.toText().includes("carol-gh/closed")`);
319320 const after = tui.screen.toText();
320321 expect(after).toContain("carol-gh/closed");
321322 expect(after).not.toContain(PUBLIC_ONLY);
test/pull-red-alone-path.test.ts +1
@@ -127,6 +127,7 @@ test("the terminal's checks row says it too, and not for the other pull", async
127127 await settleApp(tui);
128128 await Bun.sleep(20);
129129 }
130 if (!tui.screen.toText().includes(pull.title)) throw new Error(`never came: still waiting while !tui.screen.toText().includes(pull.title)`);
130131 await settleApp(tui);
131132 const screen = tui.screen.toText();
132133 expect(screen.includes("red alone at")).toBe(says);
test/quotas-storage.test.ts +3
@@ -120,6 +120,7 @@ describe("storage quota", () => {
120120 // The measuring is off the request path: wait for the refresh the push began.
121121 for (let i = 0; i < 100 && (await accountBytes(app, bobId)) < 1_500_000; i++)
122122 await Bun.sleep(20);
123 if ((await accountBytes(app, bobId)) < 1_500_000) throw new Error(`never came: still waiting while (await accountBytes(app, bobId)) < 1_500_000`);
123124 setQuota(app.db, "storage", 1, adaId);
124125 const third = await push("bob", bobToken, "ok", 10);
125126 expect(third.code).not.toBe(0);
@@ -332,6 +333,7 @@ describe("storage quota", () => {
332333 expect((await push(username, token, "data", 1_500_000)).code).toBe(0);
333334 for (let i = 0; i < 100 && (await accountBytes(app, made.value.id)) < 1_500_000; i++)
334335 await Bun.sleep(20);
336 if ((await accountBytes(app, made.value.id)) < 1_500_000) throw new Error(`never came: still waiting while (await accountBytes(app, made.value.id)) < 1_500_000`);
335337 setQuota(app.db, "storage", 1, adaId);
336338 return getUserById(app.db, made.value.id)!;
337339 }
@@ -380,6 +382,7 @@ describe("storage quota", () => {
380382 expect((await push("guild", token, "big", 1_500_000)).code).toBe(0);
381383 for (let i = 0; i < 100 && (await accountBytes(app, org.value.id)) < 1_500_000; i++)
382384 await Bun.sleep(20);
385 if ((await accountBytes(app, org.value.id)) < 1_500_000) throw new Error(`never came: still waiting while (await accountBytes(app, org.value.id)) < 1_500_000`);
383386 setQuota(app.db, "storage", 1, adaId);
384387 // Gwen herself holds nothing: only the organisation is over.
385388 expect(await accountBytes(app, gwen.value.id)).toBe(0);
test/roll-write-pause.test.ts +1
@@ -94,6 +94,7 @@ test("the new forge starts its queue work within 30 s of SIGTERM to the old, wit
9494 const signalled = Date.now();
9595 old.kill("SIGTERM");
9696 for (let i = 0; i < 300 && !out.includes("the other forge let go of this database"); i++) await Bun.sleep(100);
97 if (!out.includes("the other forge let go of this database")) throw new Error(`never came: still waiting while !out.includes("the other forge let go of this database")`);
9798 const pause = Date.now() - signalled;
9899 if (pause >= 30_000) console.log(out);
99100 expect(out).toContain("the other forge let go of this database");
test/snapshot-restore-streamed.test.ts +1
@@ -78,6 +78,7 @@ describe("a packed file unpacks as its parts arrive", () => {
7878 if (key !== last) return inner.get(key);
7979 // Everything else has landed; wait for the file to show it was unpacked on arrival.
8080 for (let i = 0; i < 100 && diskBytes(dataDir) === 0; i++) await Bun.sleep(20);
81 if (diskBytes(dataDir) === 0) throw new Error(`never came: still waiting while diskBytes(dataDir) === 0`);
8182 grewBeforeLast = diskBytes(dataDir);
8283 await gate;
8384 return inner.get(key);
test/spawn-cell-socket.test.ts +1
@@ -69,6 +69,7 @@ const open = (host: string, path = "/ws?x=1", protocols: string[] = ["chat"]) =>
6969
7070 const until = async (ok: () => boolean) => {
7171 for (let i = 0; i < 100 && !ok(); i++) await Bun.sleep(20);
72 if (!ok()) throw new Error(`never came: still waiting while !ok()`);
7273 };
7374
7475 test("an app's socket in a cell: frames go both ways, with the app's own Host and path", async () => {
test/spawn-child-runs-apps.test.ts +1
@@ -53,6 +53,7 @@ describe("a hosted child's apps run in the parent", () => {
5353 const child = childRuntime(parent, name)!;
5454 const until = Date.now() + 150_000;
5555 while (child.startingCount() > 0 && Date.now() < until) await Bun.sleep(100);
56 if (child.startingCount() > 0) throw new Error(`never came: still waiting while child.startingCount() > 0`);
5657 const summary = hostedChildApps(parent, name)!;
5758 if (summary.running !== summary.total) throw new Error(`${name}: ${JSON.stringify(summary.notRunning)}`);
5859 };
test/studio-door.test.ts +1
@@ -1378,6 +1378,7 @@ describe("the app's live fragment: /:owner/:name/app/state", () => {
13781378 if (data !== undefined) event = JSON.parse(data);
13791379 }
13801380 }
1381 if (!event) throw new Error(`never came: still waiting while !event`);
13811382 await reader.cancel().catch(() => {});
13821383 expect(event).toBeDefined();
13831384 expect(event?.["kind"]).toBe("app.serving");
test/system-stream.test.ts +1
@@ -80,6 +80,7 @@ describe("/system over server-sent events", () => {
8080 if (done) break;
8181 text += decoder.decode(value);
8282 }
83 if (!text.includes("98765")) throw new Error(`never came: still waiting while !text.includes("98765")`);
8384 await reader.cancel();
8485 expect(text).toContain("event: sample");
8586 expect(text).toContain("98765 processes");
test/tui-delete-repo.test.ts +1
@@ -70,6 +70,7 @@ async function prompt(h: ReturnType<typeof open>): Promise<void> {
7070 await h.feed(":", ..."Delete this");
7171 for (let i = 0; i < 100 && !h.text().includes("cannot be undone"); i++)
7272 await new Promise<void>((r) => setTimeout(r, 10)), await h.feed();
73 if (!h.text().includes("cannot be undone")) throw new Error(`never came: still waiting while !h.text().includes("cannot be undone")`);
7374 await h.feed("enter");
7475 }
7576
test/tui-forks-take.test.ts +1
@@ -115,6 +115,7 @@ describe("the terminal's forks screen takes the parent's updates with t", () =>
115115 );
116116 // Bob's fork follows by itself; put it back where it was so it is behind only.
117117 for (let i = 0; i < 100 && (await behind("bob")) !== 0; i++) await Bun.sleep(50);
118 if ((await behind("bob")) !== 0) throw new Error(`never came: still waiting while (await behind("bob")) !== 0`);
118119 await git(repoDir(app.reposRoot, "bob", "app"), "update-ref", "refs/heads/main", before);
119120 expect(await behind("bob")).toBe(1);
120121 converge = must(createIssue(app.db, { repoId: dan.id, authorId: users["dan"]!.id, title: convergeTitle(upstream) })).number;
test/tui-grants.test.ts +1
@@ -62,6 +62,7 @@ async function grants(h: ReturnType<typeof open>): Promise<void> {
6262 await h.feed(":", ..."Crew grants");
6363 for (let i = 0; i < 100 && !h.text().includes("which subscriptions each"); i++)
6464 await new Promise<void>((r) => setTimeout(r, 10)), await h.feed();
65 if (!h.text().includes("which subscriptions each")) throw new Error(`never came: still waiting while !h.text().includes("which subscriptions each")`);
6566 await h.feed("\r");
6667 }
6768
test/tui-hooks.test.ts +1
@@ -36,6 +36,7 @@ async function palette(h: ReturnType<typeof open>): Promise<void> {
3636 await h.feed(":", ..."Webhooks");
3737 for (let i = 0; i < 100 && !h.text().includes("list, add and remove webhooks"); i++)
3838 await new Promise<void>((r) => setTimeout(r, 10)), await h.feed();
39 if (!h.text().includes("list, add and remove webhooks")) throw new Error(`never came: still waiting while !h.text().includes("list, add and remove webhooks")`);
3940 await h.feed("enter");
4041 }
4142
test/tui-newapp.test.ts +1
@@ -65,6 +65,7 @@ afterAll(async () => {
6565 async function until(done: () => boolean): Promise<void> {
6666 const deadline = Date.now() + 5000;
6767 while (!done() && Date.now() < deadline) await Bun.sleep(20);
68 if (!done()) throw new Error(`never came: still waiting while !done()`);
6869 }
6970
7071 async function withScreen(
test/tui-onyou.test.ts +1
@@ -223,6 +223,7 @@ describe("terminal On you: mutes and many in one move", () => {
223223 const h = await boot();
224224 // Find the row, whatever the order.
225225 for (let i = 0; i < 8 && !/> .*Bob's chore|▸.*Bob's chore/.test(h.text()); i++) await h.press("j");
226 if (!/> .*Bob's chore|▸.*Bob's chore/.test(h.text())) throw new Error(`never came: still waiting while !/> .*Bob's chore|▸.*Bob's chore/.test(h.text())`);
226227 await h.press("S", "right", "enter");
227228 expect(state(r.value, 1)).toBe("open");
228229 expect(h.text()).toContain("1 refused (bob/bobs#1: not a change)");
test/tui-origins-forge.test.ts +1
@@ -84,6 +84,7 @@ test("c connects another forge by address and token, and the list says what did
8484 expect(app.screen.toText()).not.toContain(friendToken);
8585 await key("enter");
8686 for (let i = 0; i < 50 && listOrigins(mine.db, getUserByName(mine.db, "alice")!.id).length === 0; i++) await Bun.sleep(100);
87 if (listOrigins(mine.db, getUserByName(mine.db, "alice")!.id).length === 0) throw new Error(`never came: still waiting while listOrigins(mine.db, getUserByName(mine.db, "alice")!.id).length === 0`);
8788 await settleApp(app);
8889
8990 const [origin] = listOrigins(mine.db, getUserByName(mine.db, "alice")!.id);
test/tui-origins-guard.test.ts +1
@@ -75,6 +75,7 @@ describe("a paused origin in the terminal", () => {
7575 await key("v");
7676 for (let i = 0; i < 40 && getOriginFor(forge.db, userId, originId) !== undefined && lastGuardTry(forge, originId) === undefined; i++)
7777 await Bun.sleep(100);
78 if (getOriginFor(forge.db, userId, originId) !== undefined && lastGuardTry(forge, originId) === undefined) throw new Error(`never came: still waiting while getOriginFor(forge.db, userId, originId) !== undefined && lastGuardTry(forge, originId) === undefined`);
7879 await key("k");
7980 expect(app.screen.toText()).toContain(CHECK_WORDS.unchecked.slice(0, 30));
8081 } finally {
test/tui-origins.test.ts +1
@@ -121,6 +121,7 @@ describe("connected origins in the terminal", () => {
121121 expect(listOrigins(forge.db, made.value.id)[0]!.lastError).toBe("");
122122 await h.press("s");
123123 for (let i = 0; i < 40 && listOrigins(forge.db, made.value.id)[0]!.lastSyncAt === null; i++) await Bun.sleep(100);
124 if (listOrigins(forge.db, made.value.id)[0]!.lastSyncAt === null) throw new Error(`never came: still waiting while listOrigins(forge.db, made.value.id)[0]!.lastSyncAt === null`);
124125 await h.press("k");
125126 expect(listOrigins(forge.db, made.value.id)[0]!.lastSyncAt).not.toBeNull();
126127 expect(h.text()).toContain("Synced 0 repositories.");
test/tui-resilience-drill.test.ts +1
@@ -67,6 +67,7 @@ describe("a restore drill from the terminal's Resilience dialog", () => {
6767 await Bun.sleep(20);
6868 await press();
6969 }
70 if (!app.screen.toText().includes(text)) throw new Error(`never came: still waiting while !app.screen.toText().includes(text)`);
7071 };
7172 return { text: () => app.screen.toText(), press, open, waitFor, stop: () => app.stop() };
7273 }
test/tui-resilience-now.test.ts +2
@@ -96,6 +96,7 @@ describe("snapshot and mirror from the terminal's Resilience dialog", () => {
9696 await Bun.sleep(20);
9797 await h.press();
9898 }
99 if (!h.text().includes(" taken: ")) throw new Error(`never came: still waiting while !h.text().includes(" taken: ")`);
99100 const kept = await svc.list();
100101 expect(kept.length).toBe(1);
101102 const lines = h.text().split("\n");
@@ -152,6 +153,7 @@ describe("snapshot and mirror from the terminal's Resilience dialog", () => {
152153 await Bun.sleep(20);
153154 await h.press();
154155 }
156 if (!h.text().includes(" taken: ")) throw new Error(`never came: still waiting while !h.text().includes(" taken: ")`);
155157 (svc as { now: SnapshotsHandle["now"] }).now = take;
156158 expect(asked).toBe(1);
157159 expect(h.text()).toContain("n take a snapshot now");
test/tui-teams.test.ts +1
@@ -141,6 +141,7 @@ describe("teams in the terminal", () => {
141141 if (done) break;
142142 text += decoder.decode(value);
143143 }
144 if (!text.includes("7%")) throw new Error(`never came: still waiting while !text.includes("7%")`);
144145 await reader.cancel();
145146 h.stop();
146147 servers.stop();
test/tui-working-yours.test.ts +1
@@ -59,6 +59,7 @@ async function palette(user: User, keys: string[], shows?: string): Promise<stri
5959 await settleApp(tui);
6060 text = tui.screen.toText();
6161 }
62 if ((text.includes("searching…") || (shows !== undefined && !text.includes(shows)))) throw new Error(`never came: still waiting while (text.includes("searching…") || (shows !== undefined && !text.includes(shows)))`);
6263 tui.stop?.();
6364 return text;
6465 }
test/web-apps.test.ts +1
@@ -978,6 +978,7 @@ describe("apps, runs and the crew on the web", () => {
978978 const open = () =>
979979 app.db.query("SELECT 1 FROM run WHERE state IN ('queued','running') LIMIT 1").get();
980980 for (let i = 0; i < 200 && open() !== null; i++) await Bun.sleep(25);
981 if (open() !== null) throw new Error(`never came: still waiting while open() !== null`);
981982 app.db.query("UPDATE run SET serving_at = NULL WHERE env LIKE 'pull-%'").run();
982983 };
983984

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs