commit edf177d5dc31295f7fd667801aabde86c2585f4a
parent c65cc7cae8a0f305e5a68f865de220224ca29b03
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 27 Oct 2026 13:23:13 -0400
autoRunner test: its own settings.json, so it passes the same in any checkout
computeLeafPending reads getSettings(); with no SETTINGS_FILE that was the
checkout's own settings.json: the operator's in the primary checkout (a
transcription tree with leaves), none in a fresh worktree (the runner lanes'
built-in empty tree), so two tests passed in one and failed in the other.
A fixture imported first (getPaths() memoizes while the test's imports load)
points SETTINGS_FILE at a temp file with one catch-all leaf on each runner lane.
28/28 with no settings.json and with a copy of the real one.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/common/controller/autoRunner.settings.fixture.ts b/common/controller/autoRunner.settings.fixture.ts
@@ -0,0 +1,33 @@
+// autoRunner.test.ts's OWN settings.json, imported FIRST by it: a module of
+// its own because getPaths() memoizes on its first call, and some module the
+// test imports makes that call while it loads — an env var set in the test's
+// body would come too late.
+//
+// computeLeafPending reads getSettings(). With no SETTINGS_FILE that is the
+// checkout's own settings.json: the operator's in the primary checkout (a
+// transcription tree with leaves), none in a fresh worktree (the runner lanes'
+// built-in EMPTY tree) — so two tests passed in one checkout and failed in the
+// other. This is the minimal tree they need: one catch-all leaf on each runner
+// lane (the digest and backfill lanes default to one already).
+
+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import path from "node:path";
+
+const dir = mkdtempSync(path.join(tmpdir(), "auto-runner-settings-"));
+process.env.SETTINGS_FILE = path.join(dir, "settings.json");
+
+const CATCH_ALL_ROOT = {
+ id: "root",
+ mode: "strict",
+ weight: 1,
+ maxWorkers: null,
+ children: [{ id: "all", match: { type: "all" }, weight: 1, maxWorkers: null }],
+};
+
+writeFileSync(
+ process.env.SETTINGS_FILE,
+ JSON.stringify({ autoQueue: { transcription: { root: CATCH_ALL_ROOT }, download: { root: CATCH_ALL_ROOT } } }),
+);
+
+process.on("exit", () => rmSync(dir, { recursive: true, force: true }));
diff --git a/common/controller/autoRunner.test.ts b/common/controller/autoRunner.test.ts
@@ -1,3 +1,5 @@
+// FIRST: this test's own settings.json, so it passes the same in any checkout.
+import "./autoRunner.settings.fixture";
import { test } from "node:test";
import assert from "node:assert/strict";
import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";