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
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/9025-polls-that-run-out-of-time-and-carry-on → main 2 commits fork 2 threads · 2 unresolved
48 files
changed +65
−58
scripts/flake.ts +3 −52
| @@ -361,59 +361,10 @@ export function fallThroughWaits(name: string, source: string): string[] { | ||
| 361 | 361 | |
| 362 | 362 | /** |
| 363 | 363 | * 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. | |
| 367 | 366 | */ |
| 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([]); | |
| 417 | 368 | |
| 418 | 369 | /** The record an admitting pull carries. */ |
| 419 | 370 | 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" | ||
| 241 | 241 | if (next === undefined || next.done) continue; |
| 242 | 242 | text += new TextDecoder().decode(next.value); |
| 243 | 243 | } |
| 244 | if (!text.includes(`id: ${ids[2]}`)) throw new Error(`never came: still waiting while !text.includes(\`id: \${ids[2]}\`)`); | |
| 244 | 245 | await reader2.cancel(); |
| 245 | 246 | expect(text).not.toContain(`id: ${ids[0]}`); |
| 246 | 247 | 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", () => { | ||
| 239 | 239 | const deadline = Date.now() + 10_000; |
| 240 | 240 | while (!terminal.output().includes("j/k move") && Date.now() < deadline) |
| 241 | 241 | 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")`); | |
| 242 | 243 | // The app's own terminal drew on our pty… |
| 243 | 244 | expect(terminal.output()).toContain("hello"); |
| 244 | 245 | 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 () => { | ||
| 162 | 162 | expect(part.status).toBe(404); |
| 163 | 163 | expect((await fetch(`${servers.url}/settings/backups/live`)).status).toBeGreaterThanOrEqual(300); |
| 164 | 164 | |
| 165 | const frames = async (cookie: string): Promise<string> => { | |
| 165 | const frames = async (cookie: string, mustArrive: boolean): Promise<string> => { | |
| 166 | 166 | const ac = new AbortController(); |
| 167 | 167 | const res = await fetch(`${servers.url}/events`, { headers: { cookie }, signal: ac.signal }); |
| 168 | 168 | const reader = res.body!.getReader(); |
| @@ -179,10 +179,11 @@ test("the live part and the stream are an admin's alone", async () => { | ||
| 179 | 179 | ]); |
| 180 | 180 | if (value) got += new TextDecoder().decode(value); |
| 181 | 181 | } |
| 182 | if (mustArrive && !got.includes("backup.")) throw new Error(`never came: still waiting while !got.includes("backup.")`); | |
| 182 | 183 | ac.abort(); |
| 183 | 184 | return got; |
| 184 | 185 | }; |
| 185 | 186 | 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"); | |
| 188 | 189 | }); |
test/cell-relays-reaped.test.ts +1
| @@ -91,6 +91,7 @@ describe.skipIf(noCells)("cells: no relay outlives its cell", () => { | ||
| 91 | 91 | seen = relays(mark).length; |
| 92 | 92 | await Bun.sleep(50); |
| 93 | 93 | } |
| 94 | if (seen === 0) throw new Error(`never came: still waiting while seen === 0`); | |
| 94 | 95 | const result = await running; |
| 95 | 96 | expect(result.ok).toBe(true); |
| 96 | 97 | expect(seen).toBeGreaterThan(0); |
test/check-flake.test.ts +1
| @@ -138,6 +138,7 @@ async function mainCheck(name: string, testBody: string) { | ||
| 138 | 138 | const deadline = Date.now() + 40_000; |
| 139 | 139 | const finished = () => listRuns(app.db, repo.id, { kind: "check", limit: 50 }).find((r) => r.commitOid === oid && (r.state === "ok" || r.state === "failed")); |
| 140 | 140 | while (Date.now() < deadline && finished() === undefined) await Bun.sleep(100); |
| 141 | if (finished() === undefined) throw new Error(`never came: still waiting while finished() === undefined`); | |
| 141 | 142 | const run = finished()!; |
| 142 | 143 | return { repo, run, log: readRunLog(app.config.dataDir, run.id).lines.join("\n") }; |
| 143 | 144 | } 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 | ||
| 64 | 64 | (r) => r.commitOid === oid && isTerminal(r.state), |
| 65 | 65 | ); |
| 66 | 66 | 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()!; | |
| 69 | 69 | const lines = readRunLog(dataDir, run.id).lines; |
| 70 | 70 | const warned = lines.findIndex((l) => l.startsWith("warning: forge.json declares memory 8192 MiB")); |
| 71 | 71 | 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 | ||
| 83 | 83 | const deadline = Date.now() + 40_000; |
| 84 | 84 | const finished = () => listRuns(app.db, repo.id, { kind: "check", limit: 50 }).find((r) => r.commitOid === oid && (r.state === "ok" || r.state === "failed")); |
| 85 | 85 | while (Date.now() < deadline && finished() === undefined) await Bun.sleep(100); |
| 86 | if (finished() === undefined) throw new Error(`never came: still waiting while finished() === undefined`); | |
| 86 | 87 | const run = finished()!; |
| 87 | 88 | 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}`) }; |
| 88 | 89 | } finally { |
test/checks.test.ts +1
| @@ -868,6 +868,7 @@ describe("checks", () => { | ||
| 868 | 868 | const until = async (done: () => boolean): Promise<void> => { |
| 869 | 869 | const deadline = Date.now() + 10_000; |
| 870 | 870 | while (!done() && Date.now() < deadline) await Bun.sleep(25); |
| 871 | if (!done()) throw new Error(`never came: still waiting while !done()`); | |
| 871 | 872 | }; |
| 872 | 873 | await until(() => mine().length > 0); |
| 873 | 874 | 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 () => { | ||
| 74 | 74 | controller.abort(); |
| 75 | 75 | expect(await pending).toBe("aborted"); |
| 76 | 76 | 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`); | |
| 77 | 78 | release( |
| 78 | 79 | new Response( |
| 79 | 80 | new ReadableStream({ |
test/conflicts-tui.test.ts +1
| @@ -150,6 +150,7 @@ describe("the terminal reads a conflicted pull's blocks", () => { | ||
| 150 | 150 | expect(out).not.toContain("<<<<<<<"); |
| 151 | 151 | // The commit lands off the key's own turn: wait for the branch to move. |
| 152 | 152 | 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`); | |
| 153 | 154 | const now = await tip("refs/heads/loud"); |
| 154 | 155 | expect(now).not.toBe(was); |
| 155 | 156 | 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> = {}) => | ||
| 38 | 38 | fetch(`${servers.url}/api/v1/conversation/messages`, { method: "POST", headers: headers(t, extra), body: JSON.stringify(body) }); |
| 39 | 39 | const until = async (ok: () => boolean) => { |
| 40 | 40 | for (let i = 0; i < 100 && !ok(); i++) await Bun.sleep(10); |
| 41 | if (!ok()) throw new Error(`never came: still waiting while !ok()`); | |
| 41 | 42 | }; |
| 42 | 43 | /** Starts a turn that holds until stopped, without counting against the minute's messages. */ |
| 43 | 44 | const start = async () => { |
test/conversation-talk.test.ts +1
| @@ -489,6 +489,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Heard.","t | ||
| 489 | 489 | const settleBob = async () => { |
| 490 | 490 | // The stand-in records the message it was started with; wait for a new one, then for the end. |
| 491 | 491 | 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`); | |
| 492 | 493 | seen = readFileSync(join(dir, "first.json"), "utf8"); |
| 493 | 494 | for (let i = 0; i < 200; i++) { |
| 494 | 495 | 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", () => { | ||
| 73 | 73 | // The agent has pushed and is still working: the pull is already there. |
| 74 | 74 | const deadline = Date.now() + 20_000; |
| 75 | 75 | 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`); | |
| 76 | 77 | const early = mine()[0]!; |
| 77 | 78 | expect(early).toBeDefined(); |
| 78 | 79 | expect(early.title).toBe("Plant crocuses"); |
| @@ -130,6 +131,7 @@ describe("the crew, with a stand-in Claude Code: the early pull", () => { | ||
| 130 | 131 | ); |
| 131 | 132 | const deadline = Date.now() + 20_000; |
| 132 | 133 | 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`); | |
| 133 | 135 | const early = mine()[0]!; |
| 134 | 136 | expect( |
| 135 | 137 | 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", () => { | ||
| 211 | 213 | ); |
| 212 | 214 | const deadline = Date.now() + 20_000; |
| 213 | 215 | 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`); | |
| 214 | 217 | const early = mine()[0]!; |
| 215 | 218 | expect(addComment(app, alice, repo, early, "I like where this goes.").ok).toBe(true); |
| 216 | 219 | 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", () => { | ||
| 89 | 89 | const until = async (done: () => boolean, ms = 10_000) => { |
| 90 | 90 | const end = Date.now() + ms; |
| 91 | 91 | while (!done() && Date.now() < end) await new Promise((r) => setTimeout(r, 10)); |
| 92 | if (!done()) throw new Error(`never came: still waiting while !done()`); | |
| 92 | 93 | }; |
| 93 | 94 | const headOf = (pull: Pull) => getPull(app.db, repo.id, pull.number)!.headOid; |
| 94 | 95 | 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 | ||
| 73 | 73 | await driveRepo(e.app, e.fresh()); |
| 74 | 74 | const deadline = Date.now() + 45_000; |
| 75 | 75 | 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`); | |
| 76 | 77 | const direction = e.fresh().directionIssueId!; |
| 77 | 78 | const settled = () => |
| 78 | 79 | 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 | ||
| 173 | 174 | await driveRepo(e.app, e.fresh()); |
| 174 | 175 | const deadline = Date.now() + 45_000; |
| 175 | 176 | 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`); | |
| 176 | 178 | const direction = e.fresh().directionIssueId!; |
| 177 | 179 | const settled = () => |
| 178 | 180 | listRuns(e.app.db, e.repo.id, { kind: "agent" }).find( |
| 179 | 181 | (r) => r.issueId === direction && ["ok", "failed", "cancelled"].includes(r.state), |
| 180 | 182 | ); |
| 181 | 183 | while (settled() === undefined && Date.now() < deadline) await Bun.sleep(100); |
| 184 | if (settled() === undefined) throw new Error(`never came: still waiting while settled() === undefined`); | |
| 182 | 185 | while (!existsSync(promptFile) && Date.now() < deadline) await Bun.sleep(50); |
| 183 | 186 | expect(existsSync(promptFile)).toBe(true); |
| 184 | 187 | const told = readFileSync(promptFile, "utf8"); |
test/drill-board-line.test.ts +1
| @@ -151,6 +151,7 @@ describe("the drill's board line", () => { | ||
| 151 | 151 | expect(sent).toHaveLength(0); |
| 152 | 152 | clock = T0 + 10 * DAY + DRILL_STALE_MS + 1; |
| 153 | 153 | 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`); | |
| 154 | 155 | await n.settled(); |
| 155 | 156 | await Bun.sleep(50); |
| 156 | 157 | await n.settled(); |
test/event-order.test.ts +1
| @@ -109,6 +109,7 @@ describe("events keep their order across processes", () => { | ||
| 109 | 109 | if (next === undefined || next.done) continue; |
| 110 | 110 | text += new TextDecoder().decode(next.value); |
| 111 | 111 | } |
| 112 | if (!text.includes(`id: ${second}`)) throw new Error(`never came: still waiting while !text.includes(\`id: \${second}\`)`); | |
| 112 | 113 | await reader.cancel(); |
| 113 | 114 | return text; |
| 114 | 115 | }; |
test/explore-rank.test.ts +1
| @@ -82,6 +82,7 @@ async function seed(): Promise<void> { | ||
| 82 | 82 | new Date(now - (i % 6) * DAY).toISOString(), |
| 83 | 83 | ); |
| 84 | 84 | } |
| 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. |
||
| 85 | 86 | } |
| 86 | 87 | beforeAll(() => { |
| 87 | 88 | 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 | ||
| 96 | 96 | page = await (await fetch(`${servers.url}/bob/lib`, { headers: { cookie } })).text(); |
| 97 | 97 | if (!page.includes('value="take"')) await Bun.sleep(40); |
| 98 | 98 | } |
| 99 | if (!page.includes('value="take"')) throw new Error(`never came: still waiting while !page.includes('value="take"')`); | |
| 99 | 100 | const foot = page.match(/<div class="card-foot">([\s\S]*?)<\/div>\s*<\/div>/); |
| 100 | 101 | expect(foot).not.toBeNull(); |
| 101 | 102 | // 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", () => { | ||
| 34 | 34 | try { |
| 35 | 35 | const wait = Date.now() + 3000; |
| 36 | 36 | 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")`); | |
| 37 | 38 | const dir = mkdtempSync(join(tmpdir(), "forge-sbs-d-")); |
| 38 | 39 | const first = forgeUse(child({ placement: "cell", name: "fun", size: "small" }), dir); |
| 39 | 40 | // 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( | ||
| 20 | 20 | res: Response, |
| 21 | 21 | count: number, |
| 22 | 22 | timeoutMs = 5_000, |
| 23 | /** False when the wait is the point: nothing should come. */ | |
| 24 | mustArrive = true, | |
| 23 | 25 | ): Promise<{ id: string; data: Record<string, unknown> }[]> { |
| 24 | 26 | const reader = res.body!.getReader(); |
| 25 | 27 | const decoder = new TextDecoder(); |
| @@ -46,6 +48,7 @@ async function readEvents( | ||
| 46 | 48 | out.push({ id, data: JSON.parse(data) as Record<string, unknown> }); |
| 47 | 49 | } |
| 48 | 50 | } |
| 51 | if (mustArrive && out.length < count) throw new Error(`never came: still waiting while out.length < count`); | |
| 49 | 52 | await reader.cancel().catch(() => {}); |
| 50 | 53 | return out; |
| 51 | 54 | } |
| @@ -97,7 +100,7 @@ describe("the viewer's stream", () => { | ||
| 97 | 100 | // A stranger's stream: nothing private on it, however long they wait. |
| 98 | 101 | const stranger = await fetch(`${servers.url}/events?since=0`); |
| 99 | 102 | 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); | |
| 101 | 104 | expect(nothing.length).toBe(0); |
| 102 | 105 | |
| 103 | 106 | // 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", () => { | ||
| 436 | 436 | const light = () => |
| 437 | 437 | looksForEnv(app.db, record.id, env).filter((l) => l.commitOid === commit && l.theme === "light"); |
| 438 | 438 | 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`); | |
| 439 | 440 | await looks.idle(); |
| 440 | 441 | const rows = light(); |
| 441 | 442 | const taken = (page: string, kind: string) => |
| @@ -488,6 +489,7 @@ describe("looks of a public app", () => { | ||
| 488 | 489 | const light = () => |
| 489 | 490 | looksForEnv(app.db, record.id, env).filter((l) => l.commitOid === commit && l.theme === "light"); |
| 490 | 491 | 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`); | |
| 491 | 493 | await looks.idle(); |
| 492 | 494 | const rows = light(); |
| 493 | 495 | for (const page of pages) { |
test/merge-queue-clash.test.ts +1
| @@ -128,6 +128,7 @@ describe("the merge queue remembers clashes", () => { | ||
| 128 | 128 | const options = { depth: 2, room: () => 4 }; |
| 129 | 129 | const first = enqueue(repoId, [b], holding, options); |
| 130 | 130 | 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`); | |
| 131 | 132 | const f = entry(6, await headAdding("f", "f.txt")); |
| 132 | 133 | const second = enqueue(repoId, [f], holding, options); |
| 133 | 134 | 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", () => { | ||
| 292 | 292 | const [first, second] = [await entry(1), await entry(2)]; |
| 293 | 293 | const one = enqueue(repoId, [first], gate, options); |
| 294 | 294 | 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`); | |
| 295 | 296 | const two = enqueue(repoId, [second], gate, options); |
| 296 | 297 | // Either it gates beside the first, or it still waits in line for it. |
| 297 | 298 | 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, | ||
| 316 | 316 | await settleApp(tui); |
| 317 | 317 | await Bun.sleep(25); |
| 318 | 318 | } |
| 319 | if (!tui.screen.toText().includes("carol-gh/closed")) throw new Error(`never came: still waiting while !tui.screen.toText().includes("carol-gh/closed")`); | |
| 319 | 320 | const after = tui.screen.toText(); |
| 320 | 321 | expect(after).toContain("carol-gh/closed"); |
| 321 | 322 | 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 | ||
| 127 | 127 | await settleApp(tui); |
| 128 | 128 | await Bun.sleep(20); |
| 129 | 129 | } |
| 130 | if (!tui.screen.toText().includes(pull.title)) throw new Error(`never came: still waiting while !tui.screen.toText().includes(pull.title)`); | |
| 130 | 131 | await settleApp(tui); |
| 131 | 132 | const screen = tui.screen.toText(); |
| 132 | 133 | expect(screen.includes("red alone at")).toBe(says); |
test/quotas-storage.test.ts +3
| @@ -120,6 +120,7 @@ describe("storage quota", () => { | ||
| 120 | 120 | // The measuring is off the request path: wait for the refresh the push began. |
| 121 | 121 | for (let i = 0; i < 100 && (await accountBytes(app, bobId)) < 1_500_000; i++) |
| 122 | 122 | 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`); | |
| 123 | 124 | setQuota(app.db, "storage", 1, adaId); |
| 124 | 125 | const third = await push("bob", bobToken, "ok", 10); |
| 125 | 126 | expect(third.code).not.toBe(0); |
| @@ -332,6 +333,7 @@ describe("storage quota", () => { | ||
| 332 | 333 | expect((await push(username, token, "data", 1_500_000)).code).toBe(0); |
| 333 | 334 | for (let i = 0; i < 100 && (await accountBytes(app, made.value.id)) < 1_500_000; i++) |
| 334 | 335 | 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`); | |
| 335 | 337 | setQuota(app.db, "storage", 1, adaId); |
| 336 | 338 | return getUserById(app.db, made.value.id)!; |
| 337 | 339 | } |
| @@ -380,6 +382,7 @@ describe("storage quota", () => { | ||
| 380 | 382 | expect((await push("guild", token, "big", 1_500_000)).code).toBe(0); |
| 381 | 383 | for (let i = 0; i < 100 && (await accountBytes(app, org.value.id)) < 1_500_000; i++) |
| 382 | 384 | 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`); | |
| 383 | 386 | setQuota(app.db, "storage", 1, adaId); |
| 384 | 387 | // Gwen herself holds nothing: only the organisation is over. |
| 385 | 388 | 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 | ||
| 94 | 94 | const signalled = Date.now(); |
| 95 | 95 | old.kill("SIGTERM"); |
| 96 | 96 | 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")`); | |
| 97 | 98 | const pause = Date.now() - signalled; |
| 98 | 99 | if (pause >= 30_000) console.log(out); |
| 99 | 100 | 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", () => { | ||
| 78 | 78 | if (key !== last) return inner.get(key); |
| 79 | 79 | // Everything else has landed; wait for the file to show it was unpacked on arrival. |
| 80 | 80 | 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`); | |
| 81 | 82 | grewBeforeLast = diskBytes(dataDir); |
| 82 | 83 | await gate; |
| 83 | 84 | 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"]) => | ||
| 69 | 69 | |
| 70 | 70 | const until = async (ok: () => boolean) => { |
| 71 | 71 | for (let i = 0; i < 100 && !ok(); i++) await Bun.sleep(20); |
| 72 | if (!ok()) throw new Error(`never came: still waiting while !ok()`); | |
| 72 | 73 | }; |
| 73 | 74 | |
| 74 | 75 | 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", () => { | ||
| 53 | 53 | const child = childRuntime(parent, name)!; |
| 54 | 54 | const until = Date.now() + 150_000; |
| 55 | 55 | 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`); | |
| 56 | 57 | const summary = hostedChildApps(parent, name)!; |
| 57 | 58 | if (summary.running !== summary.total) throw new Error(`${name}: ${JSON.stringify(summary.notRunning)}`); |
| 58 | 59 | }; |
test/studio-door.test.ts +1
| @@ -1378,6 +1378,7 @@ describe("the app's live fragment: /:owner/:name/app/state", () => { | ||
| 1378 | 1378 | if (data !== undefined) event = JSON.parse(data); |
| 1379 | 1379 | } |
| 1380 | 1380 | } |
| 1381 | if (!event) throw new Error(`never came: still waiting while !event`); | |
| 1381 | 1382 | await reader.cancel().catch(() => {}); |
| 1382 | 1383 | expect(event).toBeDefined(); |
| 1383 | 1384 | expect(event?.["kind"]).toBe("app.serving"); |
test/system-stream.test.ts +1
| @@ -80,6 +80,7 @@ describe("/system over server-sent events", () => { | ||
| 80 | 80 | if (done) break; |
| 81 | 81 | text += decoder.decode(value); |
| 82 | 82 | } |
| 83 | if (!text.includes("98765")) throw new Error(`never came: still waiting while !text.includes("98765")`); | |
| 83 | 84 | await reader.cancel(); |
| 84 | 85 | expect(text).toContain("event: sample"); |
| 85 | 86 | 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> { | ||
| 70 | 70 | await h.feed(":", ..."Delete this"); |
| 71 | 71 | for (let i = 0; i < 100 && !h.text().includes("cannot be undone"); i++) |
| 72 | 72 | 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")`); | |
| 73 | 74 | await h.feed("enter"); |
| 74 | 75 | } |
| 75 | 76 |
test/tui-forks-take.test.ts +1
| @@ -115,6 +115,7 @@ describe("the terminal's forks screen takes the parent's updates with t", () => | ||
| 115 | 115 | ); |
| 116 | 116 | // Bob's fork follows by itself; put it back where it was so it is behind only. |
| 117 | 117 | 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`); | |
| 118 | 119 | await git(repoDir(app.reposRoot, "bob", "app"), "update-ref", "refs/heads/main", before); |
| 119 | 120 | expect(await behind("bob")).toBe(1); |
| 120 | 121 | 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> { | ||
| 62 | 62 | await h.feed(":", ..."Crew grants"); |
| 63 | 63 | for (let i = 0; i < 100 && !h.text().includes("which subscriptions each"); i++) |
| 64 | 64 | 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")`); | |
| 65 | 66 | await h.feed("\r"); |
| 66 | 67 | } |
| 67 | 68 |
test/tui-hooks.test.ts +1
| @@ -36,6 +36,7 @@ async function palette(h: ReturnType<typeof open>): Promise<void> { | ||
| 36 | 36 | await h.feed(":", ..."Webhooks"); |
| 37 | 37 | for (let i = 0; i < 100 && !h.text().includes("list, add and remove webhooks"); i++) |
| 38 | 38 | 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")`); | |
| 39 | 40 | await h.feed("enter"); |
| 40 | 41 | } |
| 41 | 42 |
test/tui-newapp.test.ts +1
| @@ -65,6 +65,7 @@ afterAll(async () => { | ||
| 65 | 65 | async function until(done: () => boolean): Promise<void> { |
| 66 | 66 | const deadline = Date.now() + 5000; |
| 67 | 67 | while (!done() && Date.now() < deadline) await Bun.sleep(20); |
| 68 | if (!done()) throw new Error(`never came: still waiting while !done()`); | |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | async function withScreen( |
test/tui-onyou.test.ts +1
| @@ -223,6 +223,7 @@ describe("terminal On you: mutes and many in one move", () => { | ||
| 223 | 223 | const h = await boot(); |
| 224 | 224 | // Find the row, whatever the order. |
| 225 | 225 | 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())`); | |
| 226 | 227 | await h.press("S", "right", "enter"); |
| 227 | 228 | expect(state(r.value, 1)).toBe("open"); |
| 228 | 229 | 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 | ||
| 84 | 84 | expect(app.screen.toText()).not.toContain(friendToken); |
| 85 | 85 | await key("enter"); |
| 86 | 86 | 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`); | |
| 87 | 88 | await settleApp(app); |
| 88 | 89 | |
| 89 | 90 | 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", () => { | ||
| 75 | 75 | await key("v"); |
| 76 | 76 | for (let i = 0; i < 40 && getOriginFor(forge.db, userId, originId) !== undefined && lastGuardTry(forge, originId) === undefined; i++) |
| 77 | 77 | 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`); | |
| 78 | 79 | await key("k"); |
| 79 | 80 | expect(app.screen.toText()).toContain(CHECK_WORDS.unchecked.slice(0, 30)); |
| 80 | 81 | } finally { |
test/tui-origins.test.ts +1
| @@ -121,6 +121,7 @@ describe("connected origins in the terminal", () => { | ||
| 121 | 121 | expect(listOrigins(forge.db, made.value.id)[0]!.lastError).toBe(""); |
| 122 | 122 | await h.press("s"); |
| 123 | 123 | 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`); | |
| 124 | 125 | await h.press("k"); |
| 125 | 126 | expect(listOrigins(forge.db, made.value.id)[0]!.lastSyncAt).not.toBeNull(); |
| 126 | 127 | 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", () => { | ||
| 67 | 67 | await Bun.sleep(20); |
| 68 | 68 | await press(); |
| 69 | 69 | } |
| 70 | if (!app.screen.toText().includes(text)) throw new Error(`never came: still waiting while !app.screen.toText().includes(text)`); | |
| 70 | 71 | }; |
| 71 | 72 | return { text: () => app.screen.toText(), press, open, waitFor, stop: () => app.stop() }; |
| 72 | 73 | } |
test/tui-resilience-now.test.ts +2
| @@ -96,6 +96,7 @@ describe("snapshot and mirror from the terminal's Resilience dialog", () => { | ||
| 96 | 96 | await Bun.sleep(20); |
| 97 | 97 | await h.press(); |
| 98 | 98 | } |
| 99 | if (!h.text().includes(" taken: ")) throw new Error(`never came: still waiting while !h.text().includes(" taken: ")`); | |
| 99 | 100 | const kept = await svc.list(); |
| 100 | 101 | expect(kept.length).toBe(1); |
| 101 | 102 | const lines = h.text().split("\n"); |
| @@ -152,6 +153,7 @@ describe("snapshot and mirror from the terminal's Resilience dialog", () => { | ||
| 152 | 153 | await Bun.sleep(20); |
| 153 | 154 | await h.press(); |
| 154 | 155 | } |
| 156 | if (!h.text().includes(" taken: ")) throw new Error(`never came: still waiting while !h.text().includes(" taken: ")`); | |
| 155 | 157 | (svc as { now: SnapshotsHandle["now"] }).now = take; |
| 156 | 158 | expect(asked).toBe(1); |
| 157 | 159 | expect(h.text()).toContain("n take a snapshot now"); |
test/tui-teams.test.ts +1
| @@ -141,6 +141,7 @@ describe("teams in the terminal", () => { | ||
| 141 | 141 | if (done) break; |
| 142 | 142 | text += decoder.decode(value); |
| 143 | 143 | } |
| 144 | if (!text.includes("7%")) throw new Error(`never came: still waiting while !text.includes("7%")`); | |
| 144 | 145 | await reader.cancel(); |
| 145 | 146 | h.stop(); |
| 146 | 147 | servers.stop(); |
test/tui-working-yours.test.ts +1
| @@ -59,6 +59,7 @@ async function palette(user: User, keys: string[], shows?: string): Promise<stri | ||
| 59 | 59 | await settleApp(tui); |
| 60 | 60 | text = tui.screen.toText(); |
| 61 | 61 | } |
| 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)))`); | |
| 62 | 63 | tui.stop?.(); |
| 63 | 64 | return text; |
| 64 | 65 | } |
test/web-apps.test.ts +1
| @@ -978,6 +978,7 @@ describe("apps, runs and the crew on the web", () => { | ||
| 978 | 978 | const open = () => |
| 979 | 979 | app.db.query("SELECT 1 FROM run WHERE state IN ('queued','running') LIMIT 1").get(); |
| 980 | 980 | 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`); | |
| 981 | 982 | app.db.query("UPDATE run SET serving_at = NULL WHERE env LIKE 'pull-%'").run(); |
| 982 | 983 | }; |
| 983 | 984 |
new above
offline
With the throw above, this guard is unreachable. Remove it.