commit e35dede9b4299b626cce44edc0ac0a3e4c4665ce
parent 98ccceb1d57770c44af3b2ea0d0b1c903f180cdd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 22 Sep 2026 16:41:20 -0400
common: the gate's default is asserted through the sanitizer, not only the default
`defaultAutoQueue()` was pinned; nothing on disk is built from it. Every
settings.json goes through `sanitizeAutoQueue`, and that is the function
S0-pause changed — it deliberately left `held` undefined so `isGateHeld` could
fall back to the four retired fields, and with the fallback gone it is the only
thing deciding what a lane naming no gate reads as. Both ways of getting it
wrong are silent: no default resumes the backfill lane on every corpus, a
blanket `true` holds all four.
The case covers lanes present but empty, lanes absent, a pre-`held` object with
every other field spelled (out at free/free/free/held, arms and orders
untouched, so it cannot pass by rebuilding the policies), and idempotence — an
explicit `false` is an answer, not an absence.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat:
1 file changed, 63 insertions(+), 0 deletions(-)
diff --git a/common/jobs/autoQueuePolicy.test.ts b/common/jobs/autoQueuePolicy.test.ts
@@ -371,6 +371,69 @@ test("sanitizeAutoQueue: empty/garbage -> defaults", () => {
assert.equal(def.transcription.root.children.length, 0);
});
+// THE GATE'S DEFAULT, THROUGH THE PATH EVERY SETTINGS.JSON TAKES.
+//
+// `defaultAutoQueue()` is asserted elsewhere, but no file on disk is built from
+// it: `getSettings` runs `sanitizeAutoQueue` over whatever the file says, and
+// before S0-pause that sanitizer deliberately left `held` UNDEFINED so
+// `isGateHeld` could fall back to the four retired pause fields. The fallback
+// is gone, so this is now the only thing that decides what a lane naming no
+// gate reads as — and getting it wrong is silent in both directions: a missing
+// default would resume the backfill lane on every corpus, a blanket `true`
+// would hold all four.
+//
+// `defaultHeldFor` is not a new policy. It is the reading the retired fields
+// gave such a file, preserved: `transcriptionsPaused`, `downloadsPaused` and
+// `digest.digestsPaused` all defaulted false (free), and `backfill.enabled`
+// defaulted false and was read INVERTED — so the backfill lane has shipped held
+// since it existed.
+test("sanitizeAutoQueue: a lane naming no gate gets the default its retired field gave it", () => {
+ // Lanes PRESENT but empty — the shape a hand-edited file has, and the one a
+ // `value == null` shortcut to `defaultAutoQueuePolicy` would never reach.
+ const bare = sanitizeAutoQueue({ backfill: {}, digest: {} });
+ assert.equal(bare.backfill.held, true, "backfill ships held");
+ assert.equal(bare.digest.held, false);
+ // And the two lanes the object did not mention at all.
+ assert.equal(bare.transcription.held, false);
+ assert.equal(bare.download.held, false);
+
+ // A PRE-`held` SETTINGS OBJECT: four real policies, every other field spelled,
+ // and no `held` key anywhere — which is every settings.json written before
+ // slice 1.4. It comes out at the defaults, the same answer the fallback used
+ // to compute, and nothing else about it moves.
+ const preHeld = {
+ transcription: { enabled: true, maxWorkers: 2, order: "listed" },
+ download: { enabled: true, maxWorkers: 1, order: "newest" },
+ digest: { enabled: false, maxWorkers: null, order: "cheapest" },
+ backfill: { enabled: true, maxWorkers: 1, order: "listed" },
+ };
+ const out = sanitizeAutoQueue(preHeld);
+ assert.deepEqual(
+ [
+ out.transcription.held,
+ out.download.held,
+ out.digest.held,
+ out.backfill.held,
+ ],
+ [false, false, false, true],
+ );
+ // The gate is the only thing the sanitizer supplied: the arms and the orders
+ // it was given survive, so this cannot pass by rebuilding the policies.
+ assert.deepEqual(
+ [out.transcription.enabled, out.download.enabled, out.digest.enabled, out.backfill.enabled],
+ [true, true, false, true],
+ );
+ assert.equal(out.download.order, "newest");
+ assert.equal(out.transcription.maxWorkers, 2);
+
+ // IDEMPOTENT. Re-sanitizing the sanitized object is identity for the gate —
+ // an explicit `false` on the backfill lane is a real answer, not an absence,
+ // so a second pass must not hold it again.
+ const twice = sanitizeAutoQueue({ ...out, backfill: { ...out.backfill, held: false } });
+ assert.equal(twice.backfill.held, false);
+ assert.equal(sanitizeAutoQueue(out).backfill.held, true);
+});
+
test("sanitizeAutoQueue: coerces a hand-written tree, assigns missing ids", () => {
const raw = {
transcription: {