Archilyzer · Source

archilyzer

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

commit 68902c63ab2bea24e508c32f2fe58f73ad6e1f58
parent cdb2c0a345a65a809e0aa9b21aaa9d664ab4192e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun, 25 Oct 2026 01:18:20 -0400

A run panel's Cancel after the hand-off cancels the transcription

The page's Audio + Whisper panel keeps showing the transcription the
whisper-video handed off, but its Cancel named the whisper-video, already done.
cancelJobAction now cancels the job doing the work (jobs/handOff.ts
jobDoingTheWork, following handedOffTo).

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

Diffstat:
Mcommon/jobs/handOff.ts | 16++++++++++++++++
Meditor/app/api/ops/transcribe-one/route.test.ts | 23+++++++++++++++++++++++
Meditor/app/jobs/actions.ts | 6+++++-
3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/common/jobs/handOff.ts b/common/jobs/handOff.ts @@ -22,6 +22,7 @@ // otherwise buffer a long transcription's whole log. Cancelling a stream never // stops a job (streamCommand.ts). +import { getRegistry } from "./registry"; import type { JobDoneResult, StreamActionResult } from "./streamCommand"; export type StartedJob = Extract<StreamActionResult, { ok: true }>; @@ -74,3 +75,18 @@ export function handOffSlot(): HandOffSlot { }, }; } + +// The job doing `id`'s work now: `id` itself, or — while it ended `done` +// having handed its work on — the job it named, followed down the chain. What +// a run panel's Cancel cancels (jobs/actions.ts cancelJobAction): the panel is +// still showing the transcription the whisper-video handed off. +export function jobDoingTheWork(id: string): string { + const registry = getRegistry(); + let target = id; + for (let hops = 0; hops < 5; hops++) { + const r = registry.get(target); + if (r?.status !== "done" || !r.handedOffTo) break; + target = r.handedOffTo; + } + return target; +} diff --git a/editor/app/api/ops/transcribe-one/route.test.ts b/editor/app/api/ops/transcribe-one/route.test.ts @@ -116,6 +116,29 @@ test("a whisper-video frees platform:youtube once its download is done; a downlo } }); +test("the run panel's Cancel, after the hand-off, cancels the transcription", async () => { + // cancelJobAction (jobs/actions.ts) is registry.cancel(jobDoingTheWork(id)) + // and a revalidation, which needs a request. + const { jobDoingTheWork } = await import("yt-dlp-transcript-common/jobs/handOff"); + await video("cancelHHHHH"); + getWorkerPool().pauseAll(); + try { + const res = await callPost(POST, { slug: SLUG, id: "cancelHHHHH" }); + assert.equal(res.status, 200, JSON.stringify(res.body)); + const w = String(res.body.jobId); + await until("the audio download", () => ended(w)); + const t = job(w).handedOffTo; + assert.ok(t); + assert.equal(jobDoingTheWork(w), t); + assert.equal(getRegistry().cancel(jobDoingTheWork(w)), true); + await until("the transcription to stop", () => ended(t)); + assert.equal(job(t).status, "cancelled"); + assert.equal(job(w).status, "done", "the download it did stays done"); + } finally { + getWorkerPool().resumeAll(); + } +}); + test("with audio on disk the job is a transcribe-one on the video's own queue, with \"file\" or without", async () => { await video("ondiskCCCCC", {}, { "audio.mp3": "fake audio\n" }); const withFile = await callPost(POST, { slug: SLUG, id: "ondiskCCCCC", file: "audio.mp3" }); diff --git a/editor/app/jobs/actions.ts b/editor/app/jobs/actions.ts @@ -15,6 +15,7 @@ import { } from "yt-dlp-transcript-common/controller/autoRunner"; import { pruneJobLogs } from "yt-dlp-transcript-common/jobs/listJobs"; import { getRegistry } from "yt-dlp-transcript-common/jobs/registry"; +import { jobDoingTheWork } from "yt-dlp-transcript-common/jobs/handOff"; import { readJobMeta } from "yt-dlp-transcript-common/jobs/jobMeta"; import type { JobSpec } from "yt-dlp-transcript-common/jobs/jobSpec"; import type { StreamActionResult } from "yt-dlp-transcript-common/jobs/streamCommand"; @@ -22,7 +23,10 @@ import { runJobSpec } from "./runJobSpec"; import { stuckJobIds } from "./active/buildActiveJobs"; export async function cancelJobAction(id: string): Promise<{ ok: boolean }> { - const ok = getRegistry().cancel(id); + // A run panel's Cancel names the job it started. One that ended handing its + // work on (a whisper-video, once its audio is down: JobRecord.handedOffTo) + // cancels the job doing that work now — the panel is still showing it. + const ok = getRegistry().cancel(jobDoingTheWork(id)); revalidatePath("/jobs"); return { ok }; }