Archilyzer · Source

archilyzer

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

commit 05348da09cf3062fe9d66e749c4fef9dc90ca003
parent 1407d4d2e5f948c723aad9f0fad7c2d64a393237
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 16 Oct 2026 14:35:30 -0400

Merge r31/odysee-integrity: the audio check on every Odysee download, clip windows included

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

Diffstat:
MCHANNEL.md | 4++--
Acommon/lib/audioCheckPolicy.ts | 26++++++++++++++++++++++++++
Mcommon/lib/channelConfig.ts | 4++--
Mcommon/lib/clipWindow.ts | 13+++++++++++++
Mcommon/ytdlp/downloadOneManaged.ts | 7+++++--
Acommon/ytdlp/fetchWindowAudioCheck.test.ts | 132+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommon/ytdlp/fetchWindowManaged.ts | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/CHANGELOG.md | 1+
Mplans/FACTS.md | 15+++++++++++++++
Aplans/release-31/odysee-integrity.md | 20++++++++++++++++++++
10 files changed, 287 insertions(+), 6 deletions(-)

diff --git a/CHANNEL.md b/CHANNEL.md @@ -45,7 +45,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f | `cookiesFromBrowser` | config | Per-channel override of the global cookies-from-browser spec. Trimmed; blank = inherit. | | `cookieMode` | config | Per-channel override of the global cookie mode. Absent = inherit. | | `sleepBetweenDownloadsSeconds` | config | Per-channel override for the global pause between downloads. Absent = inherit; 0 = no sleep; floored and capped at 600. | -| `audioCheck` | config | Opt-in audio-integrity checking for sources that intermittently serve corrupt audio mid-download (e.g. Odysee "original"): the managed downloader periodically validates the in-progress `.part` file and rolls back to the last known-good snapshot on corruption. transcribe-handling only. See [`audioCheck`](#audiocheck). | +| `audioCheck` | config | Audio-integrity checking for sources that intermittently serve corrupt audio mid-download: the managed downloader periodically validates the in-progress `.part` file and rolls back to the last known-good snapshot on corruption (transcribe handling), and a clip window gets the same final probe, fetched once more when malformed and never kept when malformed twice. ON BY DEFAULT for an Odysee video (`audioCheck: {"enabled": false}` turns it off); the channel's opt-in for any other platform. See [`audioCheck`](#audiocheck). | | `recordedDate` | config | For a channel that MIRRORS another's streams (a VOD archive): how to read the date a video was RECORDED from its title, since its `upload_date` is the date of the copy. The index stores the result as the record's `recordedDate` (`YYYYMMDD`), which coverage reads before the upload date. A title it does not match, a date that is not a real day, or one after the upload date gives none. Changing the rule re-derives the channel's records on the next index build. An object without a usable `titlePattern` is dropped. See [`recordedDate`](#recordeddate). | | `mirror` | config | For a channel that MIRRORS another creator's streams: the creator's channels it copies (`of`, their slugs). The mirror scan (`pnpm ops mirror-scan`) pairs each of this channel's videos with the creator's by date and title and writes `transcripts/mirrors/<slug>.json`: which videos the creator still has public, removed or never uploaded, and which of the creator's removed videos this channel holds. Private: never published. An object without a usable `of` is dropped. See [`mirror`](#mirror). | @@ -62,7 +62,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f | Key | Default | Description | |---|---|---| -| `enabled` | required | Turn the check on. Required: an `audioCheck` object without a boolean `enabled` is dropped whole. | +| `enabled` | required | Turn the check on, or (`false`) off — off matters only for Odysee, where it is on by default. Required: an `audioCheck` object without a boolean `enabled` is dropped whole. | | `intervalSeconds` | absent | Seconds between integrity probes of the in-progress `.part` file; clamped to [10, 600]. Absent = 60. The live cadence adapts (AIMD): a malformed checkpoint halves it toward the 10 s floor, clean ones step it back up. | | `maxRollbacks` | absent | Rollbacks to the last known-good snapshot before the download is given up; clamped to [1, 20]. Absent = 5. | | `copyTimeoutSeconds` | absent | Seconds allowed for the snapshot copy; clamped to [5, 120]. Absent = 30. | diff --git a/common/lib/audioCheckPolicy.ts b/common/lib/audioCheckPolicy.ts @@ -0,0 +1,26 @@ +// WHEN THE AUDIO CHECK APPLIES — one rule for every download path. +// +// The audio check (CHANNEL.md `audioCheck`; ytdlp/audioCheckedDownload.ts) exists +// because some sources intermittently serve corrupt audio mid-download. For a +// platform known to do that (AUDIO_CHECK_PLATFORMS: Odysee), it is ON by default: +// a channel turns it off only by saying `audioCheck: {enabled: false}`. Anywhere +// else it is the channel's opt-in, as before. +// +// Read by the full download (downloadOneManaged: the audio-checked downloader, on a +// transcribe-handling channel) and by a clip window (fetchWindowManaged: the +// pipeline's final probe on the fetched window, any handling). + +import type { ChannelConfig } from "./channelConfig"; +import { detectPlatform } from "./platform"; + +export const AUDIO_CHECK_PLATFORMS: readonly string[] = ["odysee"]; + +export function audioCheckApplies( + config: Pick<ChannelConfig, "audioCheck">, + videoUrl: string | null | undefined, +): boolean { + if (config.audioCheck?.enabled === true) return true; + if (config.audioCheck?.enabled === false) return false; + const platform = videoUrl ? detectPlatform(videoUrl) : null; + return platform !== null && AUDIO_CHECK_PLATFORMS.includes(platform); +} diff --git a/common/lib/channelConfig.ts b/common/lib/channelConfig.ts @@ -60,7 +60,7 @@ export type AudioCheckConfig = { export const AUDIO_CHECK_FIELD_DOCS: FieldDocs<AudioCheckConfig> = { enabled: - "Turn the check on. Required: an `audioCheck` object without a boolean `enabled` is dropped whole.", + "Turn the check on, or (`false`) off — off matters only for Odysee, where it is on by default. Required: an `audioCheck` object without a boolean `enabled` is dropped whole.", intervalSeconds: "Seconds between integrity probes of the in-progress `.part` file; clamped to [10, 600]. Absent = 60. The live cadence adapts (AIMD): a malformed checkpoint halves it toward the 10 s floor, clean ones step it back up.", maxRollbacks: @@ -207,7 +207,7 @@ export const CHANNEL_CONFIG_FIELD_DOCS: FieldDocs<ChannelConfig> = { sleepBetweenDownloadsSeconds: "Per-channel override for the global pause between downloads. Absent = inherit; 0 = no sleep; floored and capped at 600.", audioCheck: - "Opt-in audio-integrity checking for sources that intermittently serve corrupt audio mid-download (e.g. Odysee \"original\"): the managed downloader periodically validates the in-progress `.part` file and rolls back to the last known-good snapshot on corruption. transcribe-handling only.", + "Audio-integrity checking for sources that intermittently serve corrupt audio mid-download: the managed downloader periodically validates the in-progress `.part` file and rolls back to the last known-good snapshot on corruption (transcribe handling), and a clip window gets the same final probe, fetched once more when malformed and never kept when malformed twice. ON BY DEFAULT for an Odysee video (`audioCheck: {\"enabled\": false}` turns it off); the channel's opt-in for any other platform.", recordedDate: "For a channel that MIRRORS another's streams (a VOD archive): how to read the date a video was RECORDED from its title, since its `upload_date` is the date of the copy. The index stores the result as the record's `recordedDate` (`YYYYMMDD`), which coverage reads before the upload date. A title it does not match, a date that is not a real day, or one after the upload date gives none. Changing the rule re-derives the channel's records on the next index build. An object without a usable `titlePattern` is dropped.", mirror: diff --git a/common/lib/clipWindow.ts b/common/lib/clipWindow.ts @@ -161,8 +161,16 @@ export type ClipProvenance = { // archive.org mirror's file — and its URL. Absent when the window came from // the recording's own page. copy?: ClipCopy; + // THE AUDIO CHECK'S VERDICT on the window (release 31; lib/audioCheckPolicy.ts): + // the audio-checked pipeline's final probe (probeAudioStream), on a window from a + // source the check applies to, and on which fetch attempt it passed (a malformed + // window is fetched again once; twice malformed, it is never kept). Absent when + // the check does not apply. + audioCheck?: ClipAudioCheck; }; +export type ClipAudioCheck = { verdict: "clean" | "partial"; attempts: number }; + export const CLIP_COPY_SOURCES = ["wayback", "archive.org"] as const; export type ClipCopy = { from: (typeof CLIP_COPY_SOURCES)[number]; url: string }; @@ -216,6 +224,11 @@ export function parseClipProvenance(raw: unknown): ClipProvenance | null { } const copy = coerceClipCopy(r.copy); if (copy) out.copy = copy; + const ac = r.audioCheck as { verdict?: unknown; attempts?: unknown } | undefined; + if (ac && typeof ac === "object" && (ac.verdict === "clean" || ac.verdict === "partial")) { + const attempts = num(ac.attempts); + out.audioCheck = { verdict: ac.verdict, attempts: attempts !== undefined && attempts >= 1 ? attempts : 1 }; + } return out; } diff --git a/common/ytdlp/downloadOneManaged.ts b/common/ytdlp/downloadOneManaged.ts @@ -92,6 +92,7 @@ import { type AttemptOutcome, } from "./runOneYtdlp"; import { runAudioCheckedYtdlp } from "./audioCheckedDownload"; +import { audioCheckApplies } from "../lib/audioCheckPolicy"; import { DEFAULT_SOURCE_VIDEO_QUALITY, LAST_RESORT_FORMAT_SELECTOR, @@ -684,7 +685,7 @@ export async function downloadOneManaged( if ( refetch?.trigger === "damaged-held-audio" && opts.channelConfig.handling === "transcribe" && - opts.channelConfig.audioCheck?.enabled !== true + !audioCheckApplies(opts.channelConfig, opts.videoUrl) ) { opts.onLog("This channel has no audio check; the refetch of damaged held audio runs with it on.\n"); opts = { @@ -1115,9 +1116,11 @@ async function runManagedDownload( }); // ---------- Attempt 1: primary ---------- + // On by default for a platform that serves corrupt audio (Odysee), the + // channel's opt-in anywhere else (lib/audioCheckPolicy.ts). const audioCheckEnabled = opts.channelConfig.handling === "transcribe" && - opts.channelConfig.audioCheck?.enabled === true; + audioCheckApplies(opts.channelConfig, opts.videoUrl); // The shared media args for the primary + auth-retry attempts. Audio-check owns // its own args; youtube handling downloads subtitles (the persistence plan only diff --git a/common/ytdlp/fetchWindowAudioCheck.test.ts b/common/ytdlp/fetchWindowAudioCheck.test.ts @@ -0,0 +1,132 @@ +// The audio check on a clip window (release 31): a window from Odysee (or a channel +// that opts in) runs the audio-checked pipeline's final probe; a malformed window is +// fetched once more, and twice malformed it fails and nothing is kept. Fakes for +// yt-dlp and ffmpeg (the probe's verdict is ffmpeg's exit code). +// +// Run with: pnpm --filter yt-dlp-transcript-common exec tsx --test ytdlp/fetchWindowAudioCheck.test.ts + +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { chmod, mkdir, mkdtemp, readdir, readFile, writeFile } from "node:fs/promises"; +import os from "node:os"; +import path from "node:path"; +import { FetchWindowError, fetchWindowManaged } from "./fetchWindowManaged"; +import { audioCheckApplies } from "../lib/audioCheckPolicy"; +import type { Paths } from "../lib/paths"; +import type { ChannelConfig } from "../lib/channelConfig"; + +const ROOT = await mkdtemp(path.join(os.tmpdir(), "fetchwindow-ac-")); +const YTDLP = path.join(ROOT, "fake-ytdlp.mjs"); +const FFMPEG = path.join(ROOT, "fake-ffmpeg.mjs"); +const COUNT = path.join(ROOT, "ffmpeg-count"); +process.env.FAKE_FFMPEG_COUNT = COUNT; + +await writeFile( + YTDLP, + `#!/usr/bin/env node +import { writeFileSync } from "node:fs"; +const args = process.argv.slice(2); +writeFileSync(args[args.indexOf("-o") + 1], "mp4"); +`, +); +// FAKE_FFMPEG: "clean" exits 0; "malformed" exits 1 every time; "malformed-once" +// exits 1 on its first run, then 0. +await writeFile( + FFMPEG, + `#!/usr/bin/env node +import { readFileSync, writeFileSync } from "node:fs"; +const f = process.env.FAKE_FFMPEG_COUNT; +let n = 0; try { n = Number(readFileSync(f, "utf8")) || 0; } catch {} +writeFileSync(f, String(n + 1)); +const mode = process.env.FAKE_FFMPEG; +if (mode === "malformed" || (mode === "malformed-once" && n === 0)) { + process.stderr.write("[aac @ 0x1] Sample rate index in program config element does not match\\n"); + process.exit(1); +} +process.exit(0); +`, +); +await chmod(YTDLP, 0o755); +await chmod(FFMPEG, 0o755); + +let seq = 0; +async function setup() { + const videoDir = path.join(ROOT, `c${++seq}`, "data", "v1"); + await mkdir(videoDir, { recursive: true }); + await writeFile(COUNT, "0"); + return videoDir; +} +const probes = async () => Number(await readFile(COUNT, "utf8")); + +function opts(videoDir: string, videoUrl: string, channelConfig: ChannelConfig = {} as ChannelConfig) { + return { + channelSlug: "c", + channelConfig, + paths: { ytdlpBin: YTDLP, ffmpegBin: FFMPEG } as unknown as Paths, + videoDir, + videoId: "v1", + videoUrl, + from: 10, + to: 20, + provenance: { requestedBy: "test" }, + onLog: () => {}, + signal: new AbortController().signal, + corruptRetryGapMs: 0, + }; +} +const ODYSEE = "https://odysee.com/@x:1/stream:abc"; + +test("policy: on for Odysee unless the channel turns it off; elsewhere the channel's opt-in", () => { + assert.equal(audioCheckApplies({}, ODYSEE), true); + assert.equal(audioCheckApplies({ audioCheck: { enabled: false } }, ODYSEE), false); + assert.equal(audioCheckApplies({}, "https://www.youtube.com/watch?v=x"), false); + assert.equal(audioCheckApplies({ audioCheck: { enabled: true } }, "https://www.youtube.com/watch?v=x"), true); + assert.equal(audioCheckApplies({}, undefined), false); +}); + +test("an Odysee window is probed; clean, it is kept with the verdict in its provenance", async () => { + process.env.FAKE_FFMPEG = "clean"; + const dir = await setup(); + const res = await fetchWindowManaged(opts(dir, ODYSEE)); + assert.equal(await probes(), 1); + assert.deepEqual(res.provenance?.audioCheck, { verdict: "clean", attempts: 1 }); +}); + +test("malformed once: deleted, fetched again, kept on the second attempt", async () => { + process.env.FAKE_FFMPEG = "malformed-once"; + const dir = await setup(); + const logs: string[] = []; + const res = await fetchWindowManaged({ ...opts(dir, ODYSEE), onLog: (s: string) => logs.push(s) }); + assert.equal(await probes(), 2); + assert.deepEqual(res.provenance?.audioCheck, { verdict: "clean", attempts: 2 }); + assert.match(logs.join(""), /malformed; deleted, fetching it again/); + const clips = await readdir(path.join(dir, "clips")); + assert.ok(clips.some((f) => f === "10.00-20.00.mp4"), clips.join(",")); + assert.ok(!clips.some((f) => f.includes(".part")), clips.join(",")); +}); + +test("malformed twice: the fetch fails per_video and no window is kept", async () => { + process.env.FAKE_FFMPEG = "malformed"; + const dir = await setup(); + await assert.rejects(fetchWindowManaged(opts(dir, ODYSEE)), (err: unknown) => { + assert.ok(err instanceof FetchWindowError); + assert.equal(err.failureClass, "per_video"); + assert.match(err.message, /corrupt audio/); + return true; + }); + assert.equal(await probes(), 2); + const clips = await readdir(path.join(dir, "clips")).catch(() => []); + assert.ok(!clips.some((f) => f.endsWith(".mp4")), clips.join(",")); +}); + +test("no probe where the check does not apply: another platform, or Odysee turned off", async () => { + process.env.FAKE_FFMPEG = "malformed"; + let dir = await setup(); + let res = await fetchWindowManaged(opts(dir, "https://www.youtube.com/watch?v=x")); + assert.equal(await probes(), 0); + assert.equal(res.provenance?.audioCheck, undefined); + dir = await setup(); + res = await fetchWindowManaged(opts(dir, ODYSEE, { audioCheck: { enabled: false } } as ChannelConfig)); + assert.equal(await probes(), 0); + assert.equal(res.cached, false); +}); diff --git a/common/ytdlp/fetchWindowManaged.ts b/common/ytdlp/fetchWindowManaged.ts @@ -28,6 +28,8 @@ import { type ResolvedCookiePolicy, } from "../lib/cookiePolicy"; import type { ChannelConfig } from "../lib/channelConfig"; +import { audioCheckApplies } from "../lib/audioCheckPolicy"; +import { probeAudioStream } from "./ffmpegStreamProbe"; import { detectPlatform } from "../lib/platform"; import type { Paths } from "../lib/paths"; import { @@ -35,6 +37,7 @@ import { clipWindowFile, clipWindowName, type ClipCopy, + type ClipAudioCheck, type ClipProvenance, } from "../lib/clipWindow"; import { @@ -125,6 +128,9 @@ export type FetchWindowOpts = { onPlatformBackoff?: ( failureClass: "rate_limit", ) => Promise<void> | void; + // The wait before fetching a malformed window again (default + // CORRUPT_WINDOW_RETRY_GAP_MS; tests pass 0). + corruptRetryGapMs?: number; }; export type FetchWindowResult = { @@ -161,9 +167,56 @@ function cachedResult(hit: ClipWindow): FetchWindowResult { }; } +// THE AUDIO CHECK ON A WINDOW (release 31). A window from a source the check applies +// to (lib/audioCheckPolicy.ts: Odysee by default, or a channel's opt-in) runs the +// audio-checked pipeline's FINAL probe (probeAudioStream, the same verdict) on the +// fetched file before it becomes a window: a malformed one is deleted and fetched +// once more after CORRUPT_WINDOW_RETRY_GAP_MS; malformed again, the fetch fails +// (per_video) and nothing is kept — a clip is never cut from corrupt audio. The +// pipeline's periodic probe of the growing .part has nothing to do on a window of +// seconds; the final probe is the part of it that applies. +export const CORRUPT_WINDOW_RETRY_GAP_MS = 20_000; +export const CORRUPT_WINDOW_ATTEMPTS = 2; + +class MalformedWindowError extends Error {} + export async function fetchWindowManaged( opts: FetchWindowOpts, ): Promise<FetchWindowResult> { + for (let attempt = 1; ; attempt++) { + try { + return await fetchWindowOnce(opts, attempt); + } catch (err) { + if (!(err instanceof MalformedWindowError)) throw err; + if (attempt >= CORRUPT_WINDOW_ATTEMPTS) { + throw new FetchWindowError( + `${err.message}, ${attempt} times: the source serves corrupt audio for ` + + `${opts.from.toFixed(2)}–${opts.to.toFixed(2)} of ${opts.videoId}; nothing kept`, + "per_video", + "public", + ); + } + const gap = opts.corruptRetryGapMs ?? CORRUPT_WINDOW_RETRY_GAP_MS; + opts.onLog(`${err.message}; deleted, fetching it again in ${Math.round(gap / 1000)}s.\n`); + await sleepUnlessAborted(gap, opts.signal); + if (opts.signal.aborted) throw err; + } + } +} + +const sleepUnlessAborted = (ms: number, signal: AbortSignal) => + new Promise<void>((resolve) => { + if (signal.aborted) return resolve(); + const t = setTimeout(done, ms); + function done() { + clearTimeout(t); + signal.removeEventListener("abort", done); + resolve(); + } + signal.addEventListener("abort", done, { once: true }); + }); + +async function fetchWindowOnce(opts: FetchWindowOpts, attempt: number): Promise<FetchWindowResult> { const { from, to, videoDir } = opts; const policy: ResolvedCookiePolicy = opts.cookiePolicy ?? { cookies: opts.channelConfig.cookiesFromBrowser, @@ -347,6 +400,23 @@ export async function fetchWindowManaged( produced = path.join(clipsDir, stray); st = await stat(produced); } + let audioCheck: ClipAudioCheck | undefined; + if (audioCheckApplies(opts.channelConfig, opts.videoUrl)) { + const probe = await probeAudioStream({ + ffmpegBin: opts.paths.ffmpegBin, + file: produced, + signal: opts.signal, + onLog: opts.onLog, + }); + if (probe.verdict === "malformed") { + await rm(produced, { force: true }); + throw new MalformedWindowError( + `The audio check found the window ${from.toFixed(2)}–${to.toFixed(2)} of ${opts.videoId} malformed`, + ); + } + audioCheck = { verdict: probe.verdict, attempts: attempt }; + opts.onLog(`Audio check: ${probe.verdict}${attempt > 1 ? ` (attempt ${attempt})` : ""}.\n`); + } await rename(produced, dest); const provenance: ClipProvenance = { @@ -359,6 +429,7 @@ export async function fetchWindowManaged( ? { pad: opts.provenance.pad } : {}), ...(opts.provenance.copy ? { copy: opts.provenance.copy } : {}), + ...(audioCheck ? { audioCheck } : {}), bytes: st.size, fetchedAt: new Date().toISOString(), ytdlp: { args }, diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **Odysee downloads always get the audio check, clip windows included.** A video from Odysee — which intermittently serves corrupt audio — is downloaded with the audio check on unless its channel turns it off (`audioCheck: {"enabled": false}`); before, a channel had to opt in. A clip window from such a source now gets the check's final probe too: a malformed window is deleted and fetched once more, and if it is malformed again the fetch fails and nothing is kept, so a clip is never cut from corrupt audio. The verdict is recorded in the window's provenance. - **An article can correct what the transcripts mishear in its quotes.** `archilyzer reports respell <article> --heard "cake cup,cakeup" --reads K-Cup` previews every change — the article's quotes and citations, its report's own words, and its video's burned-in quotes and flip cards — as before → after, and writes nothing; `--apply` writes it, each file backed up first. `--bracket` shows the correction as an altered quote, `[K-Cup]`. The article records the respelling, and every quote check applies it to the transcript before comparing, so a corrected quote still verifies exactly; the transcript itself is untouched. A video shows the new words once it is rebuilt. - **`pnpm ops audio-audit` checks the audio already on disk, file by file.** `pnpm ops audio-audit --json '{"platform":"odysee"}'` (or `{"slug":"<channel>"}`; `"scope":"all"` for transcribed videos too, `"max"` to cap the files) decodes each audio file a channel holds with error tolerance — one file at a time, at the lowest CPU and disk priority — and writes what it found beside the file in `audio-integrity.json`: clean, damaged (part of it will not decode) or undecodable, with how much decodes and where the gaps are. Audio downloaded before the audio check existed, or on a channel without it, was never checked. The same command again skips the files already checked. A drive that stops answering ends that channel's run with a sentence that says so instead of hanging. - **Damaged held audio has its own bucket, and its Retry downloads again.** The channel's Download stage has a **Damaged held audio** card (and the report a `corruptHeldAudio` bucket) for files the audit found damaged; they are no longer handed to the transcription lane. **Retry** (or `pnpm ops retry-bucket --json '{"slug":"<channel>","bucket":"corruptHeldAudio"}'`) sets the file aside and downloads again with the audio check on: a clean copy replaces it, a copy that is malformed too keeps whichever decodes longer, and a failed download puts the file back. Transcribing such a file decodes what it can and keeps the gaps as silence. **/review**'s media scan shows the audit's verdict beside its own, and lists a file it reads as fine but the audit found damaged. diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -9899,3 +9899,18 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri paths, urls, provenance, drafted) and path/url-looking values never. Backups: `<project>/revisions/<stamp>-before- respell.{iteration-report,article-report,project-report,manifest}.json` (no iterations: `<projectsRoot>/<id>/revisions/`). +## The audio check's reach: Odysee by default, clip windows included (verified 2026-10-16, branch `r31/odysee-integrity`) + +- **One rule** `lib/audioCheckPolicy.ts` `audioCheckApplies(config, videoUrl)`: `audioCheck.enabled === true` → on; + `=== false` → off; absent → on for AUDIO_CHECK_PLATFORMS (`["odysee"]`, by the video URL's platform), off elsewhere. +- **Full downloads** (`downloadOneManaged`): the audio-checked downloader runs when `handling === "transcribe"` and the + rule says on (the damaged-held-audio refetch still forces it on). +- **Clip windows** (`fetchWindowManaged` → `fetchWindowOnce`): when the rule says on, the fetched file is probed with + the pipeline's `probeAudioStream` BEFORE it is renamed into `clips/`; malformed → deleted, fetched again after + `CORRUPT_WINDOW_RETRY_GAP_MS` (20 s; `corruptRetryGapMs` option), at most `CORRUPT_WINDOW_ATTEMPTS` (2); twice + malformed → `FetchWindowError` `per_video` ("the source serves corrupt audio…"), nothing kept. Provenance + `audioCheck: {verdict: "clean" | "partial", attempts}` (`ClipAudioCheck`, parsed tolerantly). Cached windows are + not re-probed. +- The editor's Configure form writes `audioCheck` only when its box is ticked: an Odysee channel with no `audioCheck` + shows an unticked box though the check is on (owed: show the default). + diff --git a/plans/release-31/odysee-integrity.md b/plans/release-31/odysee-integrity.md @@ -0,0 +1,20 @@ +# Release 31 — the audio check on every Odysee download, clip windows included (as shipped) + +Operator ask (2026-10-16): Odysee downloads with cookies from the browser, and always through the audio-integrity +pipeline; try to salvage clip downloads before grabbing whole streams. Ruling: a window gets the pipeline's final +probe (the periodic `.part` probe has nothing to do on seconds of media) and one re-fetch. + +## What + +- `lib/audioCheckPolicy.ts`: the audio check is on for an Odysee video unless its channel says `enabled: false`; the + channel's opt-in elsewhere. Used by the full download and by clip windows. +- `fetchWindowManaged`: a window the rule covers is probed (`probeAudioStream`) before it becomes a window; malformed → + re-fetched once after 20 s; twice malformed → a `per_video` failure, nothing kept; the verdict in the provenance. +- CHANNEL.md `audioCheck` documents the default. +- cornbreadman: `cookieMode: "always"` (inherits `cookiesFromBrowser: firefox`), set through `pnpm ops channel-config`. + +## Gates + +tsc clean; common 4448, editor 322, mcp 377, export 117, umtool 33, scripts 1042 (+3 skipped); docs checks clean. +New `ytdlp/fetchWindowAudioCheck.test.ts` (5): the policy, clean kept, malformed once then kept (attempts 2), twice +malformed failed with nothing kept, no probe off-platform or when turned off.