commit 90281df8d30d2d89613363e52cc3f57c2e054c3d
parent 9a2a077f2f83a88fb568f0fa8633f3f6b9a9d9ec
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 21 Nov 2026 03:04:22 -0500
stored text, review fix F1: compress-text starts only on a person's word
A corpus-wide run is one job per channel on one queue, so all but one are
queued; the boot pass re-queued each (a fresh replayable spec), and they ran
unattended and removed originals. The kind is now startedByPerson: a queued
one is closed as `person`, an interrupted one is not resumed (no
resumeOnBoot), in any state. Tested through the real boot passes in the
order the editor runs them; no kind may be both startedByPerson and
resumeOnBoot.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
3 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/common/jobs/bootQueuedJobs.test.ts b/common/jobs/bootQueuedJobs.test.ts
@@ -616,3 +616,40 @@ test("a queued x-run is cancelled as `person`, never re-queued", async () => {
await rm(f.root, { recursive: true, force: true });
}
});
+
+// Lane text-compress (REVIEW-1 F1): `compress-text` removes originals (or, a
+// restore, stored copies), so it starts ONLY on a person's word — in every
+// state a restart can leave it. A corpus-wide run is one job per channel on
+// one queue, so all but one are QUEUED: the queued pass closes each (never a
+// re-queue, though each has a fresh replayable spec); the one RUNNING is closed
+// as interrupted, and the resume pass does not resume it. Through the real
+// boot passes, in the order instrumentation.ts runs them.
+test("compress-text in any state a restart leaves is never started by the boot", async () => {
+ const { resumeInterruptedJobs } = await import("./resumeInterrupted");
+ const spec = (slug: string): JobSpec => ({ kind: "compress-text", slug, params: {} });
+ const f = await fixture([
+ { id: "C1", kind: "compress-text", queueKey: "compress-text", status: "running", channelSlug: "a", spec: spec("a"), pid: DEAD },
+ { id: "C2", kind: "compress-text", queueKey: "compress-text", channelSlug: "b", spec: spec("b") },
+ { id: "C3", kind: "compress-text", queueKey: "compress-text", channelSlug: "c", spec: { kind: "compress-text", slug: "c", params: { restore: true } } },
+ ]);
+ try {
+ const running = await settleRunningJobMetas({ paths: f.paths, bootedAt: BOOT, log: () => {}, ...check });
+ assert.deepEqual(running.interrupted.map((j) => j.id), ["C1"]);
+ const rq = recordingRequeue();
+ const queued = await settleQueuedJobMetas({ paths: f.paths, requeue: rq.fn, bootedAt: BOOT, log: () => {}, ...check });
+ assert.deepEqual(queued.requeued, []);
+ assert.deepEqual(queued.cancelled.map((c) => [c.id, c.category]).sort(), [["C2", "person"], ["C3", "person"]]);
+ for (const id of ["C2", "C3"]) assert.equal((await f.read(id)).cancelReason, PERSON_RESTART_REASON);
+ const resumed = await resumeInterruptedJobs({
+ paths: f.paths,
+ requeue: rq.fn,
+ ids: running.interrupted.map((j) => j.id),
+ now: BOOT,
+ });
+ assert.deepEqual(resumed.map((o) => [o.id, o.action]), [["C1", "not-resumed"]]);
+ assert.deepEqual(rq.calls, [], "nothing was re-queued, in any state");
+ assert.equal((await f.read("C1")).status, "cancelled");
+ } finally {
+ await rm(f.root, { recursive: true, force: true });
+ }
+});
diff --git a/common/jobs/jobKinds.test.ts b/common/jobs/jobKinds.test.ts
@@ -460,4 +460,14 @@ test("compress-text is a drainable, replayable media kind: not ingest, never res
assert.equal(kindNeedsMedia("compress-text"), true);
assert.equal(isIngestKind("compress-text"), false);
assert.equal(kindIsNetwork("compress-text"), false);
+ // A queued one a restart left is closed, never re-queued (bootQueuedJobs.ts).
+ assert.equal(meta.startedByPerson, true);
+});
+
+// A kind a person starts is never started by a boot in ANY state: one that
+// says both would be resumed after an interruption.
+test("no kind is both startedByPerson and resumeOnBoot", () => {
+ for (const k of resumeOnBootKindIds()) {
+ assert.notEqual(getJobKind(k)?.startedByPerson, true, `${k}`);
+ }
});
diff --git a/common/jobs/jobKinds.ts b/common/jobs/jobKinds.ts
@@ -1629,8 +1629,11 @@ const JOB_KINDS: Record<string, JobKindMeta> = {
// `pnpm ops compress-text`; lane text-compress): one file at a time on the
// machine-wide `compress-text` queue, one job per channel. It opens and
// removes the big file (media). NOT an ingest kind: the index reads the same
- // cues and the same times after it (the stored form carries them). NOT
- // resumed by the boot pass: it removes originals, and a person re-runs it.
+ // cues and the same times after it (the stored form carries them). STARTED
+ // BY A PERSON ONLY, in every state: it removes originals (or, `restore`,
+ // stored copies), so a boot never runs one — a queued one is closed
+ // (`startedByPerson`), an interrupted one is not resumed (no
+ // `resumeOnBoot`); a person re-runs it, and a re-run continues.
"compress-text": {
kind: "compress-text",
label: "Compress text",
@@ -1638,6 +1641,7 @@ const JOB_KINDS: Record<string, JobKindMeta> = {
replayable: true,
queueKeyStrategy: "custom",
needsMedia: true,
+ startedByPerson: true,
},
};