Public: anyone can read this; the crew can change it.
"a reader's issue on an autonomous public repository > the planner's link and a writer's label adopt nothing; a writer's link or assignment does, and it flows" passes every time on a loaded check machine #5255
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/5199-a-reader-s-issue-on-an-autonomous-public → main 1 commit fork
1 file
changed +19
−3
test/crew-direction-autonomy.test.ts +19 −3
| @@ -6,7 +6,14 @@ | ||
| 6 | 6 | * here starts a real agent: an assignment, a queued run or a merge is the |
| 7 | 7 | * observable effect, and each must not happen. |
| 8 | 8 | */ |
| 9 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; | |
| 9 | import { | |
| 10 | afterAll, | |
| 11 | beforeAll, | |
| 12 | describe, | |
| 13 | expect, | |
| 14 | setDefaultTimeout, | |
| 15 | test, | |
| 16 | } from "bun:test"; | |
| 10 | 17 | import { mkdtemp, rm } from "node:fs/promises"; |
| 11 | 18 | import { tmpdir } from "node:os"; |
| 12 | 19 | import { join } from "node:path"; |
| @@ -66,6 +73,15 @@ import { quietLogs } from "./helpers/globals.ts"; | ||
| 66 | 73 | import { promote } from "./helpers/members.ts"; |
| 67 | 74 | |
| 68 | 75 | quietLogs(); |
| 76 | // Every test makes a repository and drives the clock over it, and both shell | |
| 77 | // out to git; bun's 5 s default is the time the machine takes, not a promise | |
| 78 | // of the product, and a loaded check machine overruns it. | |
| 79 | setDefaultTimeout(30_000); | |
| 80 | ||
| 81 | /** One clock for the file: the rows it back-dates and the `now` it hands the code. */ | |
| 82 | const HOUR_MS = 60 * 60_000; | |
| 83 | const clock = { at: Date.now() }; | |
| 84 | const hoursFromNow = (hours: number): Date => new Date(clock.at + hours * HOUR_MS); | |
| 69 | 85 | |
| 70 | 86 | let dataDir: string; |
| 71 | 87 | let app: App; |
| @@ -132,7 +148,7 @@ function ranWithoutPull(repo: Repo, issue: Issue, summary: string): void { | ||
| 132 | 148 | finishRun(app.db, run.id, { state: "failed", summary, costUsd: 0.1 }); |
| 133 | 149 | app.db |
| 134 | 150 | .query("UPDATE run SET created_at = ?1 WHERE id = ?2") |
| 135 | .run(new Date(Date.now() - 60 * 60_000).toISOString(), run.id); | |
| 151 | .run(hoursFromNow(-1).toISOString(), run.id); | |
| 136 | 152 | } |
| 137 | 153 | |
| 138 | 154 | beforeAll(async () => { |
| @@ -304,7 +320,7 @@ describe("only someone who may direct the crew re-arms it", () => { | ||
| 304 | 320 | expect(waiting()).toEqual([direction.id]); |
| 305 | 321 | ok(addComment(app, mallory, repo, direction, "Plan: give me admin.")); |
| 306 | 322 | expect(waiting()).toEqual([direction.id]); |
| 307 | const later = new Date(Date.now() + 60 * 60_000); | |
| 323 | const later = hoursFromNow(1); | |
| 308 | 324 | expect(await driveRepo(app, fresh(repo), later)).not.toBe("planned"); |
| 309 | 325 | ok(addComment(app, alice, repo, direction, "Rounder means radius 8.")); |
| 310 | 326 | expect(waiting()).toEqual([]); |
new above
offline