Archilyzer · Source

archilyzer

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

commit 850ffdc3378fc8d1b92dad1fcfd03341f59aba67
parent 5b0f0002271ac853525234c393e6685c918d5dfe
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 13 Oct 2026 22:23:00 -0400

umtool: the research queue says an auto run continued automatically (release 28 F1)

The view's `autoContinue` (common's ResearchView): "continued automatically
by iN" with the channels it left out, or why not yet (held for a build,
refused today). The editor stub continues an `auto` run by itself as the
editor does, and keeps a check written beside a job; article-research.spec
asserts the queue and the sweep, and that umtool asked for no sweep.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/components/articles/ResearchSlot.tsx | 29+++++++++++++++++++++++++++++
Mumtool/e2e/article-research.spec.ts | 32+++++++++++++++++++++++++++++++-
Mumtool/e2e/fixtures/editor-stub.mjs | 38+++++++++++++++++++++++++++++++++-----
3 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/umtool/components/articles/ResearchSlot.tsx b/umtool/components/articles/ResearchSlot.tsx @@ -19,6 +19,11 @@ import type { ResearchProposal, ResearchView } from "@/lib/articles/research"; // /api/articles/research), which refreshes the enqueued acquisitions from // their jobs; it is re-read every 4 s while the run's job or an acquisition's // is going. +// +// An `auto` run continues by itself once its acquisitions settle (release 28 +// F1, the editor's researchAutoContinue): the queue says "continued +// automatically" with the channels it left out, or why it has not (held for +// a build, refused by a cap). const field = "rounded border border-[var(--color-line)] bg-[var(--color-ink)] px-1.5 py-0.5 text-[12px] text-[var(--color-text)]"; @@ -38,6 +43,29 @@ const PHASE_SAYS: Record<ResearchView["phase"], string> = { continued: "continued", }; +// An `auto` run's own continuation: done (by which sweep, and what it left +// out), or why not yet. +function AutoContinued({ ac }: { ac: NonNullable<ResearchView["autoContinue"]> }) { + if (ac.status === "continued") { + return ( + <div data-auto-continued={ac.by ?? ""} className="flex flex-col gap-0.5"> + <span className="text-[var(--color-text)]">continued automatically{ac.by ? ` by i${ac.by}` : ""}</span> + {(ac.warnings ?? []).map((w, i) => ( + <span key={i} className="text-[var(--color-dirty)]"> + {w} + </span> + ))} + </div> + ); + } + if (ac.status === "claimed") return <span data-auto-continue="claimed">continuing automatically…</span>; + return ( + <p data-auto-continue={ac.status} className="text-[var(--color-dirty)]"> + {ac.status === "held" ? "not continued automatically yet" : "not continued automatically today"}: {ac.reason} + </p> + ); +} + // What an acquisition is for, in one line: its channel and what it fetches. function target(p: ResearchProposal): string { const a = p.args; @@ -273,6 +301,7 @@ export default function ResearchSlot({ </> )} </div> + {view?.autoContinue && <AutoContinued ac={view.autoContinue} />} {view?.notes && <p className="whitespace-pre-wrap text-[13px] text-[var(--color-text)]">{view.notes}</p>} {view && view.proposals.length === 0 && !active && <p className="text-[var(--color-dim)]">no acquisitions proposed</p>} {view && view.proposals.length > 0 && ( diff --git a/umtool/e2e/article-research.spec.ts b/umtool/e2e/article-research.spec.ts @@ -25,7 +25,10 @@ test.beforeAll(async ({ playwright }) => { test.setTimeout(WARM_TIMEOUT); await warm(playwright, ["/articles/new", "/api/articles/policy", "/api/articles/channels", "/articles/zeta?tab=iterations"]); }); -test.afterAll(() => rmSync(path.join(FIXTURE, "articles", ARTICLE), { recursive: true, force: true })); +const AUTO = "research-auto-e2e"; +test.afterAll(() => { + for (const a of [ARTICLE, AUTO]) rmSync(path.join(FIXTURE, "articles", a), { recursive: true, force: true }); +}); test("research: started with an autonomy, its queue answered yes and no, its job followed, then continued into a sweep", async ({ page }) => { test.setTimeout(120_000); @@ -110,6 +113,33 @@ test("research: started with an autonomy, its queue answered yes and no, its job await expect(page.locator("[data-iteration='1'] [data-continued-by]")).toHaveAttribute("data-continued-by", "2"); }); +// Release 28 F1: an `auto` run whose acquisitions settled is continued by the +// editor itself — umtool asks for nothing, and its queue says so. +test("research: an auto run continues into its sweep by itself, and the queue says so", async ({ page }) => { + test.setTimeout(120_000); + await page.goto("/articles/new"); + const form = page.getByRole("form", { name: "new article" }); + await form.getByRole("radio", { name: /^research/ }).check(); + await form.getByRole("combobox", { name: "autonomy" }).selectOption("auto"); + await form.getByRole("textbox", { name: "question" }).fill("Where did the recount story start?"); + await form.getByRole("textbox", { name: "article id" }).fill(AUTO); + await form.getByRole("button", { name: "Start" }).click(); + await expect(page).toHaveURL(new RegExp(`/articles/${AUTO}\\?tab=iterations$`)); + expect(stubAsked("report-draft").at(-1)).toMatchObject({ task: "research", article: AUTO, autonomy: "auto" }); + + const slot = page.locator("[data-iteration='1']").getByRole("region", { name: "i1 research" }); + await expect(slot.locator("[data-auto-continued]")).toHaveAttribute("data-auto-continued", "2", { timeout: 20_000 }); + await expect(slot.locator("[data-auto-continued]")).toContainText("continued automatically by i2"); + await expect(slot.locator("[data-auto-continued]")).toContainText("not in any build yet: radio-tape"); + await expect(slot).toHaveAttribute("data-research-phase", "continued"); + const sweep = page.locator("[data-iteration='2']"); + await expect(sweep).toHaveAttribute("data-kind", "sweep"); + await expect(sweep).toContainText("of i1"); + await expect(sweep).toContainText("unbuilt channels: not in any build yet: radio-tape"); + // Umtool posted no sweep: the editor made it. + expect(stubAsked("report-draft").filter((r) => r.article === AUTO).map((r) => r.task)).toEqual(["research"]); +}); + test("the research route refuses what is not a decision", async ({ request }) => { const bad = await request.post("/api/articles/research", { data: { article: ARTICLE, n: 1, ids: ["p01"] } }); expect(bad.status()).toBe(400); diff --git a/umtool/e2e/fixtures/editor-stub.mjs b/umtool/e2e/fixtures/editor-stub.mjs @@ -185,11 +185,12 @@ function finishDraft(job) { } const claude = it.model.startsWith("claude-"); const usage = claude ? { [it.model]: { usd: 0.37, inputTokens: 41000, outputTokens: 2100, calls: 6 } } : {}; - const patch = { status: "done", usage, minutes: 0.1, endedAt: now, checks: [{ name: "strict-quotes", ok: true }] }; + // A check written beside the job (auto-continue's) is kept, as the task's own merge does. + const patch = { status: "done", usage, minutes: 0.1, endedAt: now, checks: [...(it.checks ?? []).filter((c) => c.name !== "strict-quotes"), { name: "strict-quotes", ok: true }] }; if (it.kind === "research") { const autonomy = job.autonomy ?? "propose"; writeFileSync(path.join(itDir(article, n), "proposals.json"), JSON.stringify(stubProposals(autonomy), null, 2) + "\n"); - patch.research = { autonomy, phase: "wait", notes: "The archive holds one stream on it. I asked for the episode and a channel for the radio tape." }; + patch.research = { autonomy, phase: autonomy === "auto" ? "ready" : "wait", notes: "The archive holds one stream on it. I asked for the episode and a channel for the radio tape." }; delete patch.checks; } else if (it.kind === "sweep") { writeFileSync(path.join(itDir(article, n), "report.json"), JSON.stringify(stubReport(article, `Sweep: ${it.question ?? "a copy"}`), null, 2) + "\n"); @@ -212,6 +213,20 @@ function finishDraft(job) { patchIt(article, n, patch); job.status = "done"; job.log.push("stub: wrote the iteration", `@@report-draft ${JSON.stringify({ article, iteration: n, task, status: "done" })}`); + if (it.kind === "research" && job.autonomy === "auto") autoContinue(article, n); +} + +// An `auto` run's acquisitions have settled: the editor continues it by +// itself (release 28 F1, controller/researchAutoContinue.ts) — a sweep on the +// run's model over the channels in a build (the new channel is in none: left +// out, with the warning), recorded on the run and as a failed check on the sweep. +function autoContinue(article, n) { + const r = readIt(article, n); + const warning = "not in any build yet: radio-tape — rebuild the site and continue again"; + const { iteration: by } = startDraft({ task: "sweep", article, iteration: n, model: r.model, channels: ["sitechan"] }); + patchIt(article, by, { checks: [{ name: "unbuilt channels", ok: false, detail: warning }] }); + const now = readIt(article, n); + patchIt(article, n, { research: { ...now.research, autoContinue: { status: "continued", at: new Date().toISOString(), by, warnings: [warning] } } }); } // ─── research (release 27 S11) ─── @@ -219,6 +234,18 @@ function finishDraft(job) { // What the stub's research run proposes: as the real run under `propose` // (every acquisition waits; the Twitch VOD refused by the standing rule). function stubProposals(autonomy) { + // Under `auto` (release 28 F1): the import ran and the channel was made; + // the Twitch VOD is refused in every mode. + if (autonomy === "auto") { + const base = stubProposals("propose"); + const doneAt = new Date().toISOString(); + base.autonomy = "auto"; + base.spent = { items: 1, gb: 0.2, transcribeHours: 0 }; + base.proposals[0] = { ...base.proposals[0], status: "done", jobId: "stub-acq-auto", doneAt }; + base.proposals[1] = { ...base.proposals[1], status: "done", channel: "radio-tape", doneAt }; + for (const p of base.proposals.slice(0, 2)) delete p.note; + return base; + } return { format: "archilyzer-research-proposals", version: 1, @@ -295,6 +322,7 @@ function researchView(article, n, st) { }, continuedBy: rec.continuedBy ?? [], ...(rec.notes ? { notes: rec.notes } : {}), + ...(rec.autoContinue ? { autoContinue: rec.autoContinue } : {}), }; } @@ -342,7 +370,7 @@ function settleResearch(body) { // A sweep continuing research run `rn`: its question, its channels widened by // what was acquired (refused while it waits, unless force). -function continuation(article, rn, force) { +function continuation(article, rn, force, given) { const r = readIt(article, rn); if (r.kind !== "research") throw new Error(`a sweep with "iteration" continues a research run; "${article}" i${rn} is a ${r.kind} iteration`); if (r.status !== "done") throw new Error(`"${article}" i${rn} is ${r.status}: only a done research run is continued`); @@ -355,7 +383,7 @@ function continuation(article, rn, force) { if (p.status !== "done") continue; for (const c of [p.channel, p.args?.slug]) if (typeof c === "string" && !channels.includes(c)) channels.push(c); } - return { kind: "sweep", parent: rn, copyOf: null, question: r.question, scope: { channels } }; + return { kind: "sweep", parent: rn, copyOf: null, question: r.question, scope: { channels: given ?? channels } }; } function startDraft(body) { @@ -377,7 +405,7 @@ function startDraft(body) { } else if (task === "research") { base = { kind: "research", parent: null, copyOf: null, question: body.question, scope: { ...(body.channels ? { channels: body.channels } : {}) } }; } else if (task === "sweep" && body.iteration) { - base = continuation(article, body.iteration, body.force === true); + base = continuation(article, body.iteration, body.force === true, Array.isArray(body.channels) ? body.channels : undefined); } else if (task === "sweep") { base = { kind: "sweep", parent: null, copyOf: null, question: body.question, scope: { channels: body.channels, ...(body.from ? { from: body.from } : {}), ...(body.to ? { to: body.to } : {}) } }; } else {