Archilyzer · Source

archilyzer

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

commit 9ade87327956a2506ec0f21f5199ffbd975b1094
parent 5ba6f2b99751e2fbe71621f93195245cbf79a8df
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 24 Sep 2026 12:01:42 -0400

operations: LaneSettingsForm derives the re-acquire figures from the widget-sync payload

The re-acquire warning hardcoded a 2026-08 measurement (836 reachable,
~76,270 needing media, 91x, 45 GB free). The operation page now passes
live figures on backfill-lane pages only: reachable/needsMedia from
buildWidgetSyncPayload, free bytes from getFreeBytes on the transcripts
root (non-finite -> omitted). The old sentence stays as the fallback.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Diffstat:
Meditor/app/operations/[id]/page.tsx | 26+++++++++++++++++++++++---
Meditor/app/operations/components/settings/LaneSettingsForm.tsx | 44+++++++++++++++++++++++++++++++++++++++++---
2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/editor/app/operations/[id]/page.tsx b/editor/app/operations/[id]/page.tsx @@ -32,6 +32,9 @@ import { DigestSettingsForm } from "../components/settings/DigestSettingsForm"; import { DiarizationSettingsForm } from "../components/settings/DiarizationSettingsForm"; import { AttributionSettingsForm } from "../components/settings/AttributionSettingsForm"; import { LaneSettingsForm } from "../components/settings/LaneSettingsForm"; +import { buildWidgetSyncPayload } from "yt-dlp-transcript-common/views/widgetSync"; +import { getFreeBytes } from "yt-dlp-transcript-common/lib/diskSpace"; +import { widgetSyncInputs } from "../../widget/lib/syncInputs"; import { ChannelWorkTable } from "../../components/channelWork/ChannelWorkTable"; import { sectionsFor, @@ -211,14 +214,31 @@ export default async function OperationPage({ // which three operations share, so this same form is drawn on all three of // their pages beside the pause they also share. The digest lane has no // equivalent — its order lives on the lane policy the console already edits. - const laneSettings = - runnerKind === "backfill" ? ( + // + // THE RE-ACQUIRE FIGURES, only on a backfill page: the widget-sync payload + // is a corpus-wide fold and not free, so no other operation builds it. Free + // space is `getFreeBytes` on the transcripts root — the same statfs behind + // the jobs payload's `disk.freeBytes` — and it fails open to Infinity, which + // is "unknown" here, not "unlimited". + let laneSettings = null; + if (runnerKind === "backfill") { + const [laneSync, free] = await Promise.all([ + widgetSyncInputs().then(buildWidgetSyncPayload), + getFreeBytes(getPaths().transcriptsDir), + ]); + laneSettings = ( <LaneSettingsForm key="backfill-lane" initial={settings.backfill} held={isGateHeld(settings, "backfill")} + figures={{ + reachable: laneSync.backfill.reachable, + needsMedia: laneSync.backfill.needsMedia, + freeBytes: Number.isFinite(free) ? free : null, + }} /> - ) : null; + ); + } // THE CADENCE CONSOLE, off the descriptor's trigger. A cadence-triggered // operation has no backlog to sweep and no runner to start — its console is diff --git a/editor/app/operations/components/settings/LaneSettingsForm.tsx b/editor/app/operations/components/settings/LaneSettingsForm.tsx @@ -2,6 +2,7 @@ import { useActionState } from "react"; import type { SiteSettings } from "yt-dlp-transcript-common/lib/settings"; +import { formatBytes } from "yt-dlp-transcript-common/lib/format"; import { Field } from "../../../components/forms/Field"; import { saveBackfillLaneSettingsAction } from "../../settingsActions"; import type { SaveResult } from "../../../settings/actions"; @@ -13,6 +14,42 @@ import type { SaveResult } from "../../../settings/actions"; // shared pause and the shared sweep above it already do. // // That is why it takes no operation: there is nothing here that belongs to one. + +// The live numbers behind the re-acquire checkbox's warning. The page builds +// them from the widget-sync payload (`sync.backfill.reachable` / +// `.needsMedia`) plus one statfs of the corpus volume; absent, the copy falls +// back to the sentence measured by hand in 2026-08. +export type ReacquireFigures = { + reachable: number; + needsMedia: number; + freeBytes: number | null; +}; + +// The 2026-08 measurement, kept verbatim as the fallback for a caller that +// passes no figures. It is STALE by construction — the live copy below is +// derived from the widget-sync payload whenever the page supplies it. +function reacquireFiguresCopy(figures: ReacquireFigures | undefined): string { + if (!figures) { + return ( + "836 videos still have media on disk and ~76,270 would need " + + "re-downloading — 91× the reachable work, against 45 GB free." + ); + } + const n = (v: number) => v.toLocaleString("en-US"); + const ratio = + figures.reachable > 0 + ? ` — ${n(Math.round(figures.needsMedia / figures.reachable))}× the reachable work` + : ""; + const free = + figures.freeBytes === null + ? "" + : `, against ${formatBytes(figures.freeBytes)} free`; + return ( + `${n(figures.reachable)} videos still have media on disk and ` + + `${n(figures.needsMedia)} would need re-downloading${ratio}${free}.` + ); +} + export function LaneSettingsForm({ initial, // THE LANE'S GATE, read by the caller through `isGateHeld`. The gate is @@ -21,9 +58,11 @@ export function LaneSettingsForm({ // it — `initial` no longer has one. There is one key, and the pause button // beside this checkbox writes it too. held, + figures, }: { initial: SiteSettings["backfill"]; held: boolean; + figures?: ReacquireFigures; }) { const [state, formAction, pending] = useActionState< SaveResult | undefined, @@ -98,9 +137,8 @@ export function LaneSettingsForm({ Re-acquire media that has already been deleted </span> <span className="text-xs text-muted-foreground"> - Off by default, and that default is measured: 836 videos still - have media on disk and ~76,270 would need re-downloading — 91× - the reachable work, against 45 GB free. With this on, each file is + Off by default, and that default is measured:{" "} + {reacquireFiguresCopy(figures)} With this on, each file is fetched, used, and <strong>deleted again immediately</strong>{" "} (unless the video is marked &quot;do not clean&quot;, or the auto-transcribe policy would replace that video&apos;s