Public: anyone can read this; the crew can change it.
test/crew-wrapup.test.ts runs in under 10 s, every test under 1 s, proving what it proves today #10223
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/10214-test-crew-wrapup-test-ts-runs-in-under-1 → main 1 commit fork
1 file
changed +6
−1
test/crew-wrapup.test.ts +6 −1
| @@ -66,7 +66,7 @@ describe("a run that spends its budget", () => { | ||
| 66 | 66 | run.state === "cancelled") |
| 67 | 67 | ) |
| 68 | 68 | return run; |
| 69 | await Bun.sleep(100); | |
| 69 | await Bun.sleep(20); | |
| 70 | 70 | } |
| 71 | 71 | throw new Error("agent run did not settle"); |
| 72 | 72 | } |
| @@ -135,6 +135,8 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Added CREW | ||
| 135 | 135 | concurrency: 1, |
| 136 | 136 | budgetUsd: 2, |
| 137 | 137 | runTimeoutMs: 60_000, |
| 138 | // The pump picks queued runs on a tick; 5 s by default, 20 ms here. | |
| 139 | tickMs: 20, | |
| 138 | 140 | }); |
| 139 | 141 | const a = await createUser(app.db, { origin: "seed", trusted: true, |
| 140 | 142 | username: "alice", |
| @@ -169,6 +171,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Added CREW | ||
| 169 | 171 | }); |
| 170 | 172 | |
| 171 | 173 | test("gets one wrap-up turn in the same session, on the reserve", async () => { |
| 174 | // Invariant: a run that spends its working budget resumes its session once, on the reserve, and lands a pull. | |
| 172 | 175 | const { run, number } = await assigned( |
| 173 | 176 | "Plant tulips", |
| 174 | 177 | "Along the fence. BUDGET-ME", |
| @@ -207,6 +210,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Added CREW | ||
| 207 | 210 | }, 60_000); |
| 208 | 211 | |
| 209 | 212 | test("a run that finishes on its own gets no wrap-up", async () => { |
| 213 | // Invariant: a run that completes within its working budget is invoked exactly once. | |
| 210 | 214 | const { run, number } = await assigned("Plant roses", "Along the wall."); |
| 211 | 215 | expect(run.state).toBe("ok"); |
| 212 | 216 | expect(run.summary).toMatch(/^opened pull #\d+( \([0-9a-f]{7,40}\))?$/); |
| @@ -221,6 +225,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"Added CREW | ||
| 221 | 225 | }, 60_000); |
| 222 | 226 | |
| 223 | 227 | test("a wrap-up that runs out as well lands as before, and gets no third turn", async () => { |
| 228 | // Invariant: a wrap-up that also runs out is the last turn; the leftover work is committed and opened. | |
| 224 | 229 | const { run, number } = await assigned( |
| 225 | 230 | "Plant ivy", |
| 226 | 231 | "Up the shed. BUDGET-ME-TWICE", |