Archilyzer · Source

archilyzer

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

commit b6495d18033650fa5c271fc7fed7efcdbc3cbdac
parent 250435e9bd20d4f756145560850db1188edd3a6c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 03:02:02 -0500

speakers: Work through speakers refuses, in one sentence, a lane that is not narrowed to ["diarization"] (naming `pnpm ops lane --json '{"lane":"backfill","operations":["diarization"]}'`), and a lane render mode holds ("A render holds the Speakers lane (…); it is released when the render ends") -- the deck, the stage, /cleanup and `ops lane {"speakers":"work"}` alike

An un-narrowed backfill lane is every speaker operation, the text-only naming
pass over ~97,000 videos on the local model among them, so the one control
must mean speakers only; and lifting a render's hold would take the cores back
from the render. Both are checked before anything is written.

Tests: editor _speakers.test.ts (both refusals through the lane route, the
settings untouched); e2e speakers-run.spec (the refusal shown on the stage,
nothing armed). The e2e tests that press the button now narrow their lane.

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

Diffstat:
Meditor/app/api/ops/_speakers.test.ts | 42++++++++++++++++++++++++++++++++++++++++++
Meditor/app/jobs/actions.ts | 26++++++++++++++++++++++++++
Meditor/e2e/backfill.spec.ts | 14++++++++++----
Meditor/e2e/speakers-run.spec.ts | 20++++++++++++++++++--
Meditor/e2e/widget.spec.ts | 7++++++-
5 files changed, 102 insertions(+), 7 deletions(-)

diff --git a/editor/app/api/ops/_speakers.test.ts b/editor/app/api/ops/_speakers.test.ts @@ -7,9 +7,13 @@ // editor's settings. import { test } from "node:test"; import assert from "node:assert/strict"; +import { writeFileSync } from "node:fs"; +import path from "node:path"; import { callGet, callPost, setupOpsCorpus } from "./_testCorpus"; const corpus = await setupOpsCorpus(null); +const RENDER_STATE = path.join(corpus.root, "render-priority.json"); +process.env.RENDER_PRIORITY_FILE = RENDER_STATE; const { POST } = await import("./lane/route"); const { GET } = await import("./speakers/route"); const { getSettings } = await import("yt-dlp-transcript-common/lib/settings"); @@ -60,3 +64,41 @@ test("get speakers: the line, the lane's state and the two capture settings", as assert.equal(got.body.line, "waiting: 0 B in 0 videos · freed this run: 0 B · nothing left"); assert.deepEqual(got.body.channels, []); }); + +test("lane speakers:work refuses an un-narrowed lane, and a lane a render holds — writing nothing", async () => { + await corpus.writeSettings({ + minFreeDiskGB: 0, + diarization: DIARIZATION, + attribution: { enabled: true, textOnlyEnabled: true, diarizedEnabled: true }, + autoQueue: { ...getSettings().autoQueue, backfill: { ...getSettings().autoQueue.backfill, enabled: false, held: true, operations: undefined } }, + }); + const wide = await callPost(POST!, { lane: "backfill", speakers: "work" }); + assert.equal(wide.status, 400); + assert.match(String(wide.body.error), /not narrowed to speaker diarization/); + assert.match(String(wide.body.error), /"operations":\["diarization"\]/); + assert.equal(getSettings().autoQueue.backfill.held, true); + assert.equal(getSettings().autoQueue.backfill.enabled, false); + + await corpus.writeSettings({ + minFreeDiskGB: 0, + diarization: DIARIZATION, + autoQueue: { ...getSettings().autoQueue, backfill: { ...getSettings().autoQueue.backfill, enabled: false, held: true, operations: ["diarization"] } }, + }); + writeFileSync( + RENDER_STATE, + JSON.stringify({ + version: 1, + token: "tok", + since: new Date().toISOString(), + until: null, + holder: { pid: process.pid, cmd: "umtool take ember --id t1" }, + lanesHeld: ["backfill"], + editor: "http://localhost:3001", + }), + ); + const rendering = await callPost(POST!, { lane: "backfill", speakers: "work" }); + assert.equal(rendering.status, 400); + assert.match(String(rendering.body.error), /A render holds the Speakers lane \(umtool take ember --id t1\)/); + assert.equal(getSettings().autoQueue.backfill.held, true, "the render's hold stands"); +}); + diff --git a/editor/app/jobs/actions.ts b/editor/app/jobs/actions.ts @@ -6,6 +6,8 @@ import { getSettings } from "yt-dlp-transcript-common/lib/settings"; import { saveSettings } from "../settings/saveSettings"; import { startSpeakersRun } from "yt-dlp-transcript-common/lib/speakersLedger-server"; import { pauseLaneAction, resumeLaneAction } from "../operations/actions"; +import { readRenderPriority } from "yt-dlp-transcript-common/lib/renderPriority.mjs"; +import { renderModeFile } from "../operations/renderMode"; import { laneRootFromScope } from "yt-dlp-transcript-common/lib/laneMigration"; import { isDefaultChannelPriority } from "yt-dlp-transcript-common/lib/channelPriority"; import { operationsForLane } from "yt-dlp-transcript-common/lib/operations"; @@ -345,6 +347,8 @@ export async function endRenderModeAction(): Promise<{ ok: boolean; error?: stri // here (lib/speakersLedger-server.ts). export async function workThroughSpeakersAction(): Promise<ArmLaneResult> { try { + const refusal = speakersWorkRefusal(); + if (refusal) return { ok: false, error: refusal }; const before = getSettings().autoQueue.backfill; const wasWorking = before.enabled && before.held !== true; if (before.held === true) { @@ -361,6 +365,28 @@ export async function workThroughSpeakersAction(): Promise<ArmLaneResult> { } } +// WHY THE ONE CONTROL MAY NOT START THE LANE, or null. Two refusals, both +// one sentence (review): an un-narrowed backfill lane is every speaker +// operation — the text-only naming pass over ~97,000 videos on the local model +// among them — so "Work through speakers" must mean speakers only, and says how +// to narrow it; and a lane render mode holds is the render's, released when the +// render ends — lifting it here would take the cores back from the render. +function speakersWorkRefusal(): string | null { + const ops = getSettings().autoQueue.backfill.operations ?? []; + if (!(ops.length === 1 && ops[0] === "diarization")) { + return ( + "The Speakers lane is not narrowed to speaker diarization, so it would also run the naming passes — narrow it first: " + + `pnpm ops lane --json '{"lane":"backfill","operations":["diarization"]}' (autoQueue.backfill.operations).` + ); + } + const render = readRenderPriority(renderModeFile()); + if (render.held && render.state?.lanesHeld?.includes("backfill")) { + const by = render.state.holder?.cmd ?? render.state.note ?? "render mode"; + return `A render holds the Speakers lane (${by}); it is released when the render ends — see umtool render-mode status.`; + } + return null; +} + // "Pause": the gate, not the switch. The video in flight finishes; the lane // stays armed, so Work through speakers (or a restart) resumes where it was. export async function pauseSpeakersAction(): Promise<ArmLaneResult> { diff --git a/editor/e2e/backfill.spec.ts b/editor/e2e/backfill.spec.ts @@ -97,6 +97,12 @@ function backfillSettings(over: { }; } +// The Speakers lane narrowed to diarization — what Work through speakers +// requires before it will start the lane (it refuses an un-narrowed one). +function speakersOnly<T extends { autoQueue: { backfill: Record<string, unknown> } }>(s: T): T { + return { ...s, autoQueue: { ...s.autoQueue, backfill: { ...s.autoQueue.backfill, operations: ["diarization"] } } }; +} + async function seedTranscript(videoId: string): Promise<void> { await writeFile( resolvePath(dataRel(videoId, "transcript.json")), @@ -419,7 +425,7 @@ test("Work through speakers arms the lane AND lifts its hold, keeping its rules" test.setTimeout(SLOW); await resetData("one-transcribe-channel-with-audio"); // Disarmed AND held — the state the live lane shipped in, two switches off. - await writeSettings({ ...backfillSettings(), autoQueue: { backfill: { held: true } } }); + await writeSettings({ ...backfillSettings(), autoQueue: { backfill: { held: true, operations: ["diarization"] } } }); await page.goto("/"); const work = page.getByRole("button", { name: "work through speakers" }); @@ -552,7 +558,7 @@ test("a lane can be scoped to one operation from its console, and the scope is a test("an armed lane comes back after a restart", async ({ page, request }) => { test.setTimeout(SLOW); await resetData("one-transcribe-channel-with-audio"); - await writeSettings(backfillSettings()); + await writeSettings(speakersOnly(backfillSettings())); await page.goto("/"); const arm = page.getByRole("button", { name: "work through speakers" }); @@ -809,7 +815,7 @@ test("the dashboard's one control: Pause holds the lane and leaves it armed; Wor }) => { test.setTimeout(SLOW); await resetData("one-transcribe-channel-with-audio"); - await writeSettings(backfillSettings()); + await writeSettings(speakersOnly(backfillSettings())); await page.goto("/"); await page.getByRole("button", { name: "work through speakers" }).click(); @@ -847,7 +853,7 @@ test("an operation page holds the same lane the dashboard does", async ({ }) => { test.setTimeout(SLOW); await resetData("one-transcribe-channel-with-audio"); - await writeSettings(backfillSettings()); + await writeSettings(speakersOnly(backfillSettings())); // THE LANE'S GATE, on the lane. Slice 1.4 moved it off the inverted // `backfill.enabled` (deleted by S0-pause) and onto diff --git a/editor/e2e/speakers-run.spec.ts b/editor/e2e/speakers-run.spec.ts @@ -48,7 +48,7 @@ async function seedPlainDiarization(videoId: string): Promise<void> { ); } -function settings(over: { held?: boolean; diarization?: Record<string, unknown> } = {}) { +function settings(over: { held?: boolean; narrowed?: boolean; diarization?: Record<string, unknown> } = {}) { return { adminTitle: "Test Admin", maxTranscriptPageBytes: 8388608, @@ -68,7 +68,7 @@ function settings(over: { held?: boolean; diarization?: Record<string, unknown> ...over.diarization, }, backfill: { concurrency: 1, allowRedownload: false }, - autoQueue: { backfill: { held: over.held ?? false } }, + autoQueue: { backfill: { held: over.held ?? false, ...(over.narrowed === false ? {} : { operations: ["diarization"] }) } }, }; } @@ -181,3 +181,19 @@ test("the readout: the Cleanup stage names the audio held for speakers; /cleanup await page.goto("/"); await expect(page.getByLabel("speakers readout")).toContainText("waiting:", { timeout: 30_000 }); }); + +test("Work through speakers refuses an un-narrowed lane, in one sentence naming the command", async ({ page }) => { + test.setTimeout(SLOW); + await resetData("one-transcribe-channel-with-audio"); + await writeSettings(settings({ held: true, narrowed: false })); + await seedTranscript("vidA"); + await generateReport(page, SLUG); + await page.goto(channelStage(SLUG, "speakers")); + const paused = page.getByLabel("speakers lane paused"); + await paused.getByRole("button", { name: "work through speakers" }).click(); + await expect(page.getByText(/is not narrowed to speaker diarization/).first()).toBeVisible({ timeout: 30_000 }); + await expect(page.getByText(/"operations":\["diarization"\]/).first()).toBeVisible(); + expect((await lane()).held).toBe(true); + expect((await lane()).enabled ?? false).toBe(false); +}); + diff --git a/editor/e2e/widget.spec.ts b/editor/e2e/widget.spec.ts @@ -798,7 +798,12 @@ test("backfill=1 alone renders the Backfill strip", async ({ page }) => { test("the widget's controls hold and release the backfill lane", async ({ page, }) => { - await writeSettings({ ...TWO_WORKERS, ...BACKFILL_SETTINGS }); + // Narrowed to diarization: Work through speakers refuses an un-narrowed lane. + await writeSettings({ + ...TWO_WORKERS, + ...BACKFILL_SETTINGS, + autoQueue: { backfill: { held: false, operations: ["diarization"] } }, + }); // Assert the KEY, not just the label: the button writes the same // `autoQueue.backfill.held` the "Run the backfill lane" checkbox does, and