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

The checkouts sweep leaves a running check's own TMPDIR (<run>.tmp) alone (su… #17876

opened this in answer to

Merged 4h 2m ago, live in production

scout/forge:scout/17875-the-checkouts-sweep-leaves-a-running-che → main 0 commits fork

  • Merged. scout/17875-the-checkouts-sweep-leaves-a-running-che was merged into main as 8e4596d.

Review

Sign in to review this change.
2 files changed +28 −4
src/checks/sweep.ts +4 −4
@@ -116,10 +116,10 @@ export async function sweepCheckouts(app: App, now: number = Date.now()): Promis
116116 if (STORES.has(name)) continue;
117117 // A gate has no run row: its checkout is spared until no gate could still be using it.
118118 if (name.startsWith("gate-") && gateMayBeRunning(join(root, name), now)) continue;
119 // `<id>.home` is the home of run `<id>`, `<id>.seeds` what its runner is seeded with
120 // (`runner_seeds.ts`) and `<id>.hands` what its runner handed back (`runner_hands.ts`): each
121 // lives and dies with it.
122 const id = name.replace(/\.(home|seeds|hands)$/, "");
119 // `<id>.home` is the home of run `<id>`, `<id>.tmp` its TMPDIR under the floor (`floor.ts`),
120 // `<id>.seeds` what its runner is seeded with (`runner_seeds.ts`) and `<id>.hands` what its
121 // runner handed back (`runner_hands.ts`): each lives and dies with it.
122 const id = name.replace(/\.(home|tmp|seeds|hands)$/, "");
123123 const gate = GATE_DIR.exec(id);
124124 if (gate !== null) {
125125 if (!gateHolding(app.db, gate[1]!, since)) await removeRunDir(join(root, name));
test/checks-home-sweep.test.ts +24
@@ -84,6 +84,30 @@ test("a finished run's home is removed, a live run's survives", async () => {
8484 expect(existsSync(home("no-such-run"))).toBe(false);
8585 });
8686
87 test("a live run's own temp directory (`<id>.tmp`, its TMPDIR under the floor) survives the sweep; a finished run's goes", async () => {
88 // The floor (#16856) gives a check `<id>.tmp` as TMPDIR. The sweep read it as run `<id>.tmp`,
89 // found no such run and removed it under the running check every 30 seconds (#17875, #17614).
90 const live = run();
91 claimRun(app.db, live.id);
92 const done = run();
93 claimRun(app.db, done.id);
94 finishRun(app.db, done.id, { state: "ok", summary: "ok" });
95 const tmp = (id: string): string => join(dataDir, "checks", `${id}.tmp`);
96 for (const id of [live.id, done.id]) mkdirSync(join(tmp(id), "forge-test-x"), { recursive: true });
97 await sweepCheckouts(app);
98 expect(existsSync(tmp(live.id))).toBe(true);
99 expect(existsSync(tmp(done.id))).toBe(false);
100 // A gate's temp directory is held by its open row, as its checkout and home are.
101 const oid = "d".repeat(40);
102 const open = beginGate(app.db, repoId, undefined, oid);
103 mkdirSync(tmp(gateRunId(oid)), { recursive: true });
104 await sweepCheckouts(app, Date.now() + GATE_DEADLINE_MS + 60_000);
105 expect(existsSync(tmp(gateRunId(oid)))).toBe(true);
106 endGate(app.db, open);
107 await sweepCheckouts(app, Date.now() + GATE_DEADLINE_MS + 60_000);
108 expect(existsSync(tmp(gateRunId(oid)))).toBe(false);
109 });
110
87111 test("the sweep leaves what the checks keep between runs: the map, the kept results, the test times, what a pull learned, the gates' logs (#12178)", async () => {
88112 // Every store sits under <data>/checks/ beside the checkouts. Swept as a stranger's checkout,
89113 // a map kept by main's verification was gone within 30 seconds and no check was ever seeded.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs