Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 622b0cc8c20e9fc39f0d0d06967f296353fb94f1
parent 07535c36ebe5d87e1dfc443b78aec7d7bbc94d22
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 17 Nov 2026 21:10:46 -0500

the reads queue reads only its own batches' steps, never the whole store

waitingReason listed every step of the queue store (every old step of every project) to say what was
ahead; rereadRunningFor (the bench's 409 check) did the same for one item. Both now read only this
project's own batches' steps (narration/reads/queue.json -> getStep each); what else the queue runs
is the runner's to say (the route adds its reason). rereadRunningFor takes the project, resolved once
by the route.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/app/api/report/post-narration/route.ts | 2+-
Mumtool/lib/report/readsQueue.mjs | 30+++++++++++++++---------------
2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/umtool/app/api/report/post-narration/route.ts b/umtool/app/api/report/post-narration/route.ts @@ -411,7 +411,7 @@ async function postHere(request: Request) { // finding 4); a marker whose job ended, or one never given a job within two minutes, is stale and taken over. // ITS RE-READ IN THE READS QUEUE (lane reads-find): while that step runs, a press here would make a second read // of the same post -- said, as a sentence, never asked. - const queued = await (await import("@/lib/report/readsQueue.mjs")).rereadRunningFor(r.project.id, id, { queueDir: (await import("@/lib/queue/runner")).queueDir() }).catch(() => null); + const queued = await (await import("@/lib/report/readsQueue.mjs")).rereadRunningFor(r.project, id, { queueDir: (await import("@/lib/queue/runner")).queueDir() }).catch(() => null); if (queued) return Response.json({ error: `this post is being re-read by the Reads queue (${queued.qid}): read it again when that lands`, busy: true }, { status: 409 }); const pendingFile = pendingFileOf(r.project.dir, e); await mkdir(path.dirname(pendingFile), { recursive: true }); diff --git a/umtool/lib/report/readsQueue.mjs b/umtool/lib/report/readsQueue.mjs @@ -22,7 +22,7 @@ import { tmpPathFor } from "yt-dlp-transcript-common/lib/atomicFile.mjs"; import { postIdOf, takesDirOf } from "umtool-report-to-video/post-narration"; import { REPORTS_ROOT } from "../projects/core.mjs"; import { withNotesLock } from "../annotations/store.mjs"; -import { addStep, cancelStep, getStep, listSteps, queueDirOf, readLease, resolveStep, retryStep, TERMINAL } from "../queue/store.mjs"; +import { addStep, cancelStep, getStep, queueDirOf, readLease, resolveStep, retryStep, TERMINAL } from "../queue/store.mjs"; import { projectReads } from "./reads.mjs"; import { itemRereadArgv } from "./readAgainArgv.mjs"; @@ -246,10 +246,10 @@ async function waitingReason(project, qdir, rows, o) { const { renderWaitSentence } = await import("./renderMode.mjs"); const render = renderWaitSentence(o.env ?? process.env); if (render) return `waiting: render mode holds the machine -- ${render}`; - const all = await listSteps(qdir); - const ours = new Set(rows.map((r) => r.qid)); - const running = all.map((s) => resolveStep(s)).find((s) => s.state === "running"); - if (running && ours.has(running.qid)) { + // ONLY this project's own steps are read (its batches'): never the whole queue store, which holds every old step + // of every project (the regression of 17 Nov 2026). What else the queue runs is the runner's to say (the route adds + // its own reason: what it waits for). + if (rows.some((x) => x.state === "running")) { const { readManifest } = await import("../projects/report.mjs"); const m = await readManifest(project.dir); for (const r of rows.filter((x) => x.state === "running")) { @@ -258,10 +258,7 @@ async function waitingReason(project, qdir, rows, o) { } return null; } - if (running) return `waiting behind ${running.qid} (${running.label}) -- the queue runs one step at a time`; - const first = all.find((s) => s.state === "queued" && !ours.has(s.qid) && s.seq < Math.min(...[...ours].map((q) => all.find((x) => x.qid === q)?.seq ?? Infinity))); - if (first) return `waiting behind ${first.qid} (${first.label}) -- the queue runs one step at a time`; - return "waiting for its turn: the app starts the next step when its own job runner is free"; + return "waiting for its turn: the queue runs one step at a time, when the app's job runner is free (umtool queue ls: what is ahead)"; } /** STOP: every step of the project's batches not started is cancelled; a running one finishes. */ @@ -358,14 +355,17 @@ export async function pickReads(project, { which = "new", only = null, token = n /** * The re-read step RUNNING now for one item of a project, or null -- the bench's single-post take op says it instead - * of asking a second read of the same post (lane reads-find): `{ qid, label }`. + * of asking a second read of the same post (lane reads-find): `{ qid, label }`. Only this project's own batches' + * steps are read, never the whole queue store. + * @param {{ id: string, dir: string }} project + * @param {string} item */ -export async function rereadRunningFor(projectId, item, o = {}) { +export async function rereadRunningFor(project, item, o = {}) { const qdir = queueDirFor(o); - for (const s of await listSteps(qdir)) { - const r = resolveStep(s); - if (r.state !== "running" || r.argv?.[0] !== "reads" || r.argv?.[1] !== projectId) continue; - if (r.argv[r.argv.indexOf("--one") + 1] === item) return { qid: r.qid, label: r.label }; + const rows = (await readBatches(project.dir)).flatMap((b) => b.rows).filter((r) => r.item === item && r.qid); + for (const qid of new Set(rows.map((r) => r.qid))) { + const s = await getStep(qdir, qid); + if (s && resolveStep(s).state === "running") return { qid, label: s.label }; } return null; }