Archilyzer · Source

archilyzer

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

commit acd7f2b18d2853b79c0d83a43ced9f1572a25f44
parent d99c713381083e297016abe4a18ddc2de89e0429
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 04:52:31 -0500

cleanup: the automatic per-video clean requires the availability verdict whatever verifyAvailabilityBeforeClean says -- that setting governs the manual sweep only; with it off, clean after capture behaves exactly as with it on

The per-call verifyAvailability option is gone from cleanAudioForVideo: an
automatic delete is never unverified, and the only way past the verdict is a
URL-less channel's explicit cleanAfterCaptureUnverified. Test: setting off, no
listing -> held and one check asked; the manual sweep with the setting off
still cleans. The test corpus lists each video in a fresh verdict unless told
not to.

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

Diffstat:
Mcommon/controller/cleanAfterCapture.test.ts | 40+++++++++++++++++++++++++++++++++++++---
Mcommon/controller/cleanAudioFromTranscribed.ts | 9++++-----
2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/common/controller/cleanAfterCapture.test.ts b/common/controller/cleanAfterCapture.test.ts @@ -65,7 +65,16 @@ async function corpus() { await writeFile(path.join(paths.channelsDir, "ch", "config.json"), JSON.stringify({ handling: "transcribe", name: "ch", url: "https://www.youtube.com/@ch" })); const video = async ( id: string, - o: { transcript?: boolean; diarization?: "none" | "plain" | "voiceprints"; doNotClean?: boolean; gone?: boolean; bytes?: number } = {}, + o: { + transcript?: boolean; + diarization?: "none" | "plain" | "voiceprints"; + doNotClean?: boolean; + gone?: boolean; + bytes?: number; + // Named in a fresh availability listing of the channel (the verdict the + // automatic clean always reads). Default true; false = never listed. + listed?: boolean; + } = {}, ) => { const v = path.join(paths.channelsDir, "ch", "data", id); await mkdir(v, { recursive: true }); @@ -74,6 +83,10 @@ async function corpus() { if (o.diarization === "plain") await writeFile(path.join(v, "diarization.json"), sidecar(false)); if (o.diarization === "voiceprints") await writeFile(path.join(v, "diarization.json"), sidecar(true)); if (o.doNotClean) await writeFile(path.join(v, "do-not-clean.json"), JSON.stringify({ setAt: "now" })); + if (o.listed !== false) { + const cur = await readAvailabilityVerdict(paths, "ch"); + await writeAvailabilityVerdict(paths, "ch", { checkedAt: new Date().toISOString(), ids: [...(cur?.ids ?? []), id] }); + } if (o.gone) { await writeFile(path.join(v, "availability.json"), JSON.stringify({ checkedAt: new Date().toISOString(), availability: "deleted" })); } @@ -249,7 +262,7 @@ test("no fresh listing: N captured videos of one channel are held, and at most O await settings({}, { verifyAvailabilityBeforeClean: true }); const { paths, video } = await corpus(); const ids = ["a1", "a2", "a3", "a4", "a5"]; - for (const id of ids) await video(id, { diarization: "voiceprints" }); + for (const id of ids) await video(id, { diarization: "voiceprints", listed: false }); const started: string[] = []; const deps: CheckRequestDeps = { start: async (_p, slug) => { @@ -283,7 +296,7 @@ test("no fresh listing: N captured videos of one channel are held, and at most O test("a held platform: the video is held, nothing deleted, nothing requested", async () => { await settings({}, { verifyAvailabilityBeforeClean: true }); const { paths, video } = await corpus(); - const v = await video("v1", { diarization: "voiceprints" }); + const v = await video("v1", { diarization: "voiceprints", listed: false }); let started = 0; const logs: string[] = []; const out = await cleanAudioForVideo({ @@ -349,6 +362,27 @@ test("a whole-recording channel (Rumble): clean after capture holds its audio assert.equal((await cleanAudioForVideo({ channelSlug: "ch", paths, videoId: "v1", onLog: () => {}, checkDeps: NO_NETWORK })).outcome, "cleaned"); }); +test("the automatic clean requires the verdict even with verifyAvailabilityBeforeClean off (that setting is the manual sweep's)", async () => { + await settings({}, { verifyAvailabilityBeforeClean: false }); + const { paths, video } = await corpus(); + const v = await video("v1", { diarization: "voiceprints", listed: false }); + let started = 0; + const deps: CheckRequestDeps = { + start: async () => { + started++; + return { ok: true, jobId: "x" } as never; + }, + platformRefusal: async () => null, + }; + const out = await cleanAudioForVideo({ channelSlug: "ch", paths, videoId: "v1", onLog: () => {}, checkDeps: deps }); + assert.equal(out.gate, "awaiting-availability"); + assert.equal(started, 1); + assert.equal(await exists(path.join(v, "audio.mp3")), true); + // …while the manual sweep, with the setting off, cleans without asking. + const r = await cleanAudioFromTranscribed({ channelSlug: "ch", paths, onLog: () => {} }); + assert.equal(r.cleanedDirs, 1); +}); + test.after(() => rm(ROOT, { recursive: true, force: true })); test("concurrency stays 1: one diarization at a time, one backfill unit at a time", () => { diff --git a/common/controller/cleanAudioFromTranscribed.ts b/common/controller/cleanAudioFromTranscribed.ts @@ -301,7 +301,6 @@ export type CleanOneOptions = { channelSlug: string; paths: Paths; videoId: string; - verifyAvailability?: boolean; onLog?: (msg: string) => void; signal?: AbortSignal; // Test seam: how a check is asked for (never run) — see availabilityVerdict.ts. @@ -334,7 +333,6 @@ export async function cleanAudioForVideo({ channelSlug, paths, videoId, - verifyAvailability, onLog, signal, checkDeps, @@ -390,9 +388,10 @@ export async function cleanAudioForVideo({ log(`Kept ${videoId}'s audio: ${(err as Error).message}`); return held("media-unreachable"); } - const verify = - !unverifiedOptIn && (verifyAvailability ?? getSettings().verifyAvailabilityBeforeClean); - if (verify) { + // ALWAYS, whatever verifyAvailabilityBeforeClean says: that setting governs + // the manual sweep the operator presses. An automatic delete is never + // unverified — only a URL-less channel's explicit opt-in skips this. + if (!unverifiedOptIn) { const cached = await resolveEffectiveAvailability(videoDir); if (isPermanentlyGone(cached)) { if (!(await loadDoNotClean(videoDir))) {