Archilyzer · Source

archilyzer

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

commit 296d2595c3ce7b603e45b8b70dc7e01bd774440f
parent 6131fcc28046bba80a1e49b17da8db75f34fa824
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 16 Oct 2026 02:00:16 -0400

plans: release 31 lane C — the find-copy-all record (plans/release-31/find-copy-all.md), FACTS

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

Diffstat:
Mplans/FACTS.md | 35+++++++++++++++++++++++++++++++++++
Aplans/release-31/find-copy-all.md | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 131 insertions(+), 0 deletions(-)

diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -9716,3 +9716,38 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri edit makes it the operator's), `frameEvents`, and a top-level `frameScan {profile, file, channel, video, tournaments, overlay: [{clip, points: [{at, …frameTotals}]}]}` no render reads yet. + +## Release 31 lane C: a gone video's whole audio from a copy (verified 2026-10-16, branch `r31/find-copy-all`) + +- **find-copy's scope mode** (`publish/findCopy.ts` `enumerateGoneVideos` / `findWholeCopies` / + `runFindWholeCopies`; `pnpm ops find-copy {slug | siteId, gone: "no-transcript" | "all", dryRun?, max?, + retryFailed?}`): a candidate is a video DIR of the channel (or of `site.json` `channels`, in its order) that holds no + media (`ytdlp/fetchCopyManaged.ts` `holdsMedia`: `audio.<ext>`, `source-media.<ext>`, `saved-video.json`), has no + transcript (`isVideoTranscribed`) for "no-transcript", and is gone by `sourceGoneState`; untranscribed first. The + lookups are the article mode's (`lookForCopy`, shared), at most `max` YouTube ones per run (default 10, ≤ 200; a + non-YouTube record costs none and is listed `not-youtube`). The `{siteId}` body WITHOUT `gone` is still the article + mode (the site's reports). +- **`copy-attempts.json` has two lists** (`lib/copyAttempts-server.ts`): `failed` (release 29, a copy fetch-windows or + fetch-copies failed from at its source — never picked again) and `attempts` (release 31): `{at, outcome: fetched | + none-found | failed, source?: "wayback" | "archive.org", url?, identifier?, file?, captureTs?, audioFile?, detail?, + error?}`, newest 20. Both writers update under the file's lock and keep the other list. The scope mode skips a video + whose NEWEST attempt is terminal (none-found, failed) and younger than `COPY_ATTEMPT_RETRY_DAYS` (30) unless + `retryFailed`; a dry run and a lookup error record nothing. +- **fetch-copies** (job kind, drainable, needsMedia, an ingest kind; queue `platform:archiveorg`; + `controller/fetchCopies.ts`, `ytdlp/fetchCopyManaged.ts`): yt-dlp `-f ba/b -x --audio-format <channel audioFormat, + default mp3>` on the copy's URL, no cookies, none of the channel's platform or extra args, `--sleep-requests 2`, + `-o data/<id>/audio.copy-part.%(ext)s`, renamed to `audio.<fmt>` and tiered (`tierMediaFile`). It never writes + `metadata.info.json`: the record stays the original's. Then `wayback.json` (`ensureWaybackProvenance`, from the URL; + none when the URL has no capture timestamp) or `archiveorg.json` (`ensureArchiveOrgProvenanceSidecar`, the item's + metadata — the standard `ArchiveOrgProvenance`, `mirror` included), and a `fetched` attempt. Paced as platform + `archiveorg` (hold and cooldown before each fetch, a 429 → backoff + stop), 30 s between fetches. +- **A YouTube record can now carry `archiveorg.json` without being archive.org's.** `refreshArchiveOrgRecords` skips + a record whose metadata is not archive.org's (`isArchiveOrgRecordInfo`: extractor `ArchiveOrg` or an archive.org + page). A `wayback.json` on the original makes compose cite it as "Original (may be gone)" + the Wayback copy + (`waybackCitationLinks`), and hides the video page's Refresh metadata (as for any copy). +- **The transcription lane takes the audio as is**: a gone video with `audio.<ext>` is in `downloadedNoTranscript` + (no availability filter there) and so in `backfill.transcription.ids`; it stays in `excludedFromDownload.deleted`. + fetch-copies asks each changed channel's report (`requestChannelSnapshot`). +- **The video page** reads `latestFetchedCopy(copy-attempts.json)`: "Audio from a copy: Wayback Machine, <date>" / + "… archive.org <identifier>", linking the copy, in place of (and under the label of) the source's own provenance + line ("Wayback provenance" / "archive.org provenance"). diff --git a/plans/release-31/find-copy-all.md b/plans/release-31/find-copy-all.md @@ -0,0 +1,96 @@ +# Release 31, lane C — find a copy of every gone video (as shipped) + +Branch `r31/find-copy-all` from `main` `3ef1b558`. Brief: `r31c-brief.md` (the plan of record for this lane). +FACTS: "Release 31 lane C: a gone video's whole audio from a copy". + +## What and why + +find-copy (release 29 E2 and the r29/fix-copy follow-up) fetched only the cited WINDOWS of gone recordings an +article cites. The hole on Jeralyzer is gone videos with no transcript at all. This lane brings a gone video's WHOLE +audio home from its copy — the Wayback Machine holding the video, or an archive.org mirror of the upload — into the +video's own record, where the transcription lane transcribes it like any downloaded audio. + +- **The scope mode** (`publish/findCopy.ts` `enumerateGoneVideos`, `findWholeCopies`, `runFindWholeCopies`): + `pnpm ops find-copy {slug | siteId, gone: "no-transcript" | "all", dryRun?, max?, retryFailed?}`. Candidates are the + video dirs of the channel (or of every channel in `site.json` `channels`, in its order) that hold no media + (`holdsMedia`: finished audio, a `source-media.*` container, a `saved-video.json` pointer), have no transcript for + `no-transcript` (`isVideoTranscribed`), and are gone by THE reading (`sourceGoneState`: deleted or private); + untranscribed first, then (for `all`) the transcribed ones. A video whose newest copy attempt is terminal + (none-found, failed) and younger than `COPY_ATTEMPT_RETRY_DAYS` (30) is left out unless `retryFailed`. A channel + whose text cannot be read is named and skipped. The lookups are the article mode's, factored into `lookForCopy` + (Wayback when it holds the video, then an archive.org mirror of the upload of its length, never a copy that failed + before) — at most `max` YouTube lookups per run (default 10, ceiling 200); a non-YouTube record costs none and is + listed `not-youtube`; archive.org refusing stops the run. Not a dry run: a video neither source holds is recorded + `none-found`, and every copy found goes to ONE fetch-copies job. A dry run asks the same paced questions and + records and fetches nothing. The `{siteId}` body without `gone` is still the article mode (the site's reports). +- **fetch-copies** (new job kind: drainable, needsMedia, an ingest kind, not replayable; queue `platform:archiveorg`; + `controller/fetchCopies.ts`, per item `ytdlp/fetchCopyManaged.ts`): yt-dlp `-f ba/b -x --audio-format <the + channel's audioFormat, default mp3>` on the copy URL, no cookies and none of the channel's platform or extra args, + `--sleep-requests 2`, the writers negated, `-o data/<id>/audio.copy-part.%(ext)s` → renamed `audio.<fmt>` and + tiered (`tierMediaFile`). `metadata.info.json` is never written. Then the copy's provenance through the existing + writers — `wayback.json` (`ensureWaybackProvenance`, from the URL) or `archiveorg.json` + (`ensureArchiveOrgProvenanceSidecar`, the standard `ArchiveOrgProvenance`) — and a `fetched` attempt. A + source-side failure is recorded in `failed` and as a `failed` attempt; ours (the extraction, a disk) is not. Paced + as platform `archiveorg`: hold and cooldown asked before every fetch, a 429 records the backoff and stops the run, + 30 s between fetches. A video holding media by its turn is skipped; each channel's media guard is asked once. The + editor action asks each channel that gained audio for its report (`requestChannelSnapshot`). +- **`copy-attempts.json`** (`lib/copyAttempts-server.ts`): `{failed: [...], attempts?: [{at, outcome: fetched | + none-found | failed, source?, url?, identifier?, file?, captureTs?, audioFile?, detail?, error?}]}`, newest 20 each; + both writers update under the file's lock and keep the other list (release 29's `recordFailedCopy` rewrote the file + with `failed` alone). +- **The transcription lane picks it up**: a gone video with `audio.<ext>` lands in `downloadedNoTranscript` (the + snapshot applies no availability filter there) and so in `backfill.transcription.ids`; `whisperBatch` asks only + "transcribed?" and "downloaded?". It stays in `excludedFromDownload.deleted`. Pinned by a unit test over + `generateChannelSnapshot` (noTranscript → downloadedNoTranscript). +- **The video page**: `latestFetchedCopy(copy-attempts.json)` → "Audio from a copy: Wayback Machine, <capture date>" + or "… archive.org <identifier>", linking the copy, IN PLACE of the source's own provenance line and under its label + (`Wayback provenance` / `archive.org provenance`) — the brief's "extend it rather than add a second". A record that + IS a copy (no fetched attempt) keeps its line. +- **archive.org refresh** (`refreshArchiveOrgRecords`) now skips a record whose metadata is not archive.org's + (`isArchiveOrgRecordInfo`), so a YouTube original carrying a copy's `archiveorg.json` is never re-titled from it. + +| Commit | What | +| --- | --- | +| `243b25c0` | common: the scope mode, `lookForCopy`, fetch-copies (controller + managed fetch), copy-attempts' `attempts`, the job kind, the archive.org refresh guard; tests | +| `f57d1ccf` | editor, scripts: the route's scope mode, `findWholeCopiesAction` / `fetchCopiesJobAction`, the video page's copy line; ops help, COMMANDS.md, CHANGELOG; the route test and `e2e/find-copy-whole.spec.ts` | +| (this commit) | this record, FACTS | + +## Gates (from the worktree root, every heavy step through the shared lock) + +- `pnpm -r --no-bail --workspace-concurrency=1 exec tsc --noEmit`: clean before each commit. +- common 4362 → 4379/4379 (+17: `lib/copyAttempts.test.ts` +2, `ytdlp/fetchCopyManaged.test.ts` 4, + `controller/fetchCopies.test.ts` 6, `publish/findCopyScope.test.ts` 4, `controller/archiveOrgRefresh.test.ts` +1; + `jobs/jobKinds.test.ts` pins the new kind). `publish/findCopy.test.ts` (the article mode, over the refactored + lookup) unchanged and green. +- editor unit 319 → 320/320 (`_research.test.ts`: the scope mode's refusals at the door, nothing queued). +- `docs cli --check`, `docs files --check`, `docs env --check`: clean (COMMANDS.md regenerated). +- e2e (editor, one spec, through the lock): `find-copy-whole.spec.ts` 1/1 passed (17.2 s; its start-mode build 332 s in the heavy slot, 5 GB cap; 395 s in all). The spec writes the sidecars as fetch-copies does and checks the Wayback and archive.org copy lines, their links, and that a record that IS a Wayback copy keeps "Archived copy (…) of". +- MCP not touched (lane D owns its tool definitions); no settings, env or file-schema doc changed. + +## Rulings and calls + +- **One whole-copy path for both sources, not downloadOneManaged for Wayback.** The brief suggested Wayback "through + downloadOneManaged as today", and also "do not overwrite metadata.info.json from the copy": the managed download's + prefetch rewrites that file from the Wayback extractor's answer (keepProvenanceFields keeps only fields a provenance + writer set — a YouTube original's title and date are not), and it would also fetch subtitles and write an archive + line. So both sources go through `fetchCopyManaged` (audio only, `-x`), which never writes metadata; Wayback's id + unwrapping is not needed because the record is explicit. +- **`archiveorg.json` keeps its one declared shape** (`ArchiveOrgProvenance`, identifier, file, downloadUrl, + fetchedAt and the item's fields) rather than a second, ClipCopy-like shape under the same name, which the existing + coerce would reject (the page line and the refresh read it). The attempt in `copy-attempts.json` carries the + ClipCopy-like fields (source, url, identifier, file, captureTs). +- **`source` uses the file's existing vocabulary** (`"wayback" | "archive.org"`, as `failed` and the windows' + `copy.from`), not the brief's `archiveorg`. +- **No cookies and no channel args to a copy**; pace `--sleep-requests 2` (archive.org's client gap); 30 s between + whole fetches; queue `platform:archiveorg` (one stream to archive.org, behind its imports). +- **Terminal = the NEWEST attempt** (none-found or failed) within 30 days; a lookup error and a dry run record + nothing; a failure on our side is never terminal. +- **A YouTube original with `wayback.json`** is now cited by compose as "Original (may be gone)" plus the Wayback copy + (the existing `waybackCitationLinks`) — the copy plays where the original does not. Nothing is published by this + lane; it takes effect at a site's next compose after a live run. +- `max` counts YouTube lookups; a non-YouTube gone record costs no request and is listed, never fetched. + +## Not done + +- No editor button for the scope mode (ops only, as the article mode). No replay handler for fetch-copies (a re-run of + find-copy is the retry). Nothing ran against the real archives (the orchestrator's live run).