commit 23beef0ef827fb1cf4d9c2b22ef2c42d3126776a
parent 03696ce101287107673e7ca0e4e3e33c94203dd2
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 20:46:44 -0500
umtool: an unmounted drive is not a missing file -- the rail's plans say which drive, and a start is refused (L5 review 2, 3)
Transcribe and persist plan 'Not now' (cost none, no Start) when the channel's media/ links to a drive that does not answer, an audio link does not resolve, or (persist) the saved video's file does not; startAction refuses the same. The Windows stage says a saved whole recording that does not answer, warns, and counts its clips as not covered. A start must echo the plan's key: a fetch body, a window's bytes, or the recording changed since the plan was shown is a 409 before the editor is asked. Evict names its window by FILE and says the set-aside twin of the span goes with it (the editor's targeted evict takes both). actions.test.mjs: a dangling media link, a gone media drive, a gone saved video, keys, the evict twin.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 241 insertions(+), 28 deletions(-)
diff --git a/umtool/components/ingredients/IngredientRail.tsx b/umtool/components/ingredients/IngredientRail.tsx
@@ -155,7 +155,7 @@ export default function IngredientRail({ data, initialStage, editorUrl }: { data
// ── the action: plan, confirm, start ─────────────────────────────────────────
-type Plan = { action: string; what: string; cost: "network" | "gpu" | "disk" | null; queue: string; start: { route: string; body: Record<string, unknown> } };
+type Plan = { action: string; what: string; cost: "network" | "gpu" | "disk" | null; queue: string; unreachable?: string; start: { route: string; body: Record<string, unknown> } | null };
const COST: Record<string, string> = { network: "costs network", gpu: "costs GPU", disk: "deletes a cached file" };
function Action({ label, body, testid }: { label: string; body: Record<string, unknown>; testid: string }) {
@@ -183,7 +183,7 @@ function Action({ label, body, testid }: { label: string; body: Record<string, u
}
};
const start = async () => {
- if (!plan) return;
+ if (!plan?.start) return;
setBusy(true);
setError(null);
try {
@@ -203,16 +203,25 @@ function Action({ label, body, testid }: { label: string; body: Record<string, u
{label}…
</button>
{plan && (
- <div className="max-w-[760px] space-y-1.5 rounded-[3px] border border-seam-2 bg-panel-2 px-3 py-2 text-[12px]" data-action-confirm={testid} data-action-cost={plan.cost ?? "none"}>
- <p className="m-0 text-text">{plan.what}</p>
- <p className="m-0 text-text-2">
- {plan.cost && <span className="mr-2 font-medium text-doubt-text">{COST[plan.cost]}</span>}
- lands on <span className="font-mono" data-action-queue="">{plan.queue}</span>
- </p>
+ <div
+ className="max-w-[760px] space-y-1.5 rounded-[3px] border border-seam-2 bg-panel-2 px-3 py-2 text-[12px]"
+ data-action-confirm={testid}
+ data-action-cost={plan.cost ?? "none"}
+ data-action-unreachable={plan.unreachable ? "1" : undefined}
+ >
+ <p className={cn("m-0", plan.unreachable ? "text-doubt-text" : "text-text")}>{plan.what}</p>
+ {!plan.unreachable && (
+ <p className="m-0 text-text-2">
+ {plan.cost && <span className="mr-2 font-medium text-doubt-text">{COST[plan.cost]}</span>}
+ lands on <span className="font-mono" data-action-queue="">{plan.queue}</span>
+ </p>
+ )}
<div className="flex gap-2">
- <button type="button" disabled={busy} onClick={start} className={buttonVariants({ variant: "outline", size: "sm" })} data-action-start={testid}>
- Start
- </button>
+ {plan.start && (
+ <button type="button" disabled={busy} onClick={start} className={buttonVariants({ variant: "outline", size: "sm" })} data-action-start={testid}>
+ Start
+ </button>
+ )}
<button type="button" disabled={busy} onClick={() => setPlan(null)} className={buttonVariants({ variant: "quiet", size: "sm" })}>
Cancel
</button>
@@ -394,7 +403,7 @@ function WindowsPanel({ s, ingredient, ch, id }: { s: WindowsStage; ingredient:
{w.serves.length ? `cuts ${w.serves.map((x) => `${x.project.split("/").pop()} ${x.clipId}`).join(", ")}` : w.orphan ? "no project uses it now" : "cuts no clip"}
</span>
<span className="ml-auto">
- <Action label="Evict" testid={`evict-${w.name}`} body={{ action: "evict", ...ingredient, window: w.name }} />
+ <Action label="Evict" testid={`evict-${w.file}`} body={{ action: "evict", ...ingredient, window: w.file }} />
</span>
</li>
))}
diff --git a/umtool/lib/ingredients.ts b/umtool/lib/ingredients.ts
@@ -78,6 +78,8 @@ export type WindowsStage = Base & {
windows: WindowRow[];
uncovered: { project: string; clipId: string; from: number | null; to: number | null }[];
savedWhole: boolean;
+ /** The saved whole recording's path when its drive does not answer, else null. */
+ savedUnreachable: string | null;
focus: { from: number; to: number; name: string; found: boolean } | null;
};
export type UsedStage = Base & { rows: UseRow[] };
diff --git a/umtool/lib/ingredients/actions.mjs b/umtool/lib/ingredients/actions.mjs
@@ -16,10 +16,12 @@
// asks before it `start`s. An action that costs neither still says what it does.
//
// Plain ESM; the route (app/api/ingredients/action) is its only caller.
+import { createHash } from "node:crypto";
+import { lstat, readlink, stat } from "node:fs/promises";
import path from "node:path";
import { resolveProject } from "../projects/core.mjs";
import { askEditorOps, postFetchWindows, projectFetchBody, summarizeAnswer } from "../report/fetchWindows.mjs";
-import { audioFilesOf, present } from "yt-dlp-transcript-common/lib/evidenceClip.mjs";
+import { audioFilesOf, present, readSavedVideoPointer } from "yt-dlp-transcript-common/lib/evidenceClip.mjs";
import { ingredientIdentity, isChannelSlug, isVideoId, listWindows } from "./stages.mjs";
export const ACTIONS = ["persist", "transcribe", "fetch", "evict", "quote-check", "links"];
@@ -47,6 +49,45 @@ function clipList(v) {
return [...new Set(list)];
}
+/**
+ * A KEY FOR WHAT THE PLAN SHOWED: `start` carries it back, and the action is re-read and refused when it no
+ * longer matches (a fetch body that changed, a window refetched or set aside since the page asked).
+ */
+const keyOf = (v) => createHash("sha256").update(JSON.stringify(v)).digest("hex").slice(0, 16);
+const fetchKey = (body) => keyOf(body.items.map((i) => [String(i.id), i.from, i.to, String(i.clipId ?? "")]).sort());
+const evictKey = (w, twins) => keyOf([w.file, w.bytes, w.mtime, ...twins.map((t) => [t.file, t.bytes, t.mtime])]);
+const plainKey = (action, idn) => keyOf([action, idn.ch, idn.dirId]);
+
+/**
+ * AN UNMOUNTED DRIVE IS NOT A MISSING FILE (AGENTS.md, "A channel's media may live on another drive"): a media
+ * link that does not resolve, the channel's media/ linked to a drive not answering, a saved video whose file does
+ * not answer. A plan that read those as "absent" would offer to download again what is only out of reach, so the
+ * plan says which drive, costs nothing and offers no Start, and a start is refused. null when everything answers.
+ * @param {Awaited<ReturnType<typeof ingredientIdentity>>} idn
+ * @param {{ saved?: boolean }} [o] also the saved-video store's file (persist)
+ */
+export async function unreachableOf(idn, { saved = false } = {}) {
+ const channelMedia = path.join(idn.dir, "..", "..", "media");
+ if (idn.mediaDrive === "missing") {
+ const to = await readlink(channelMedia).catch(() => null);
+ return `the channel's media drive does not answer (${idn.ch}/media -> ${to ?? "?"}): mount it, or re-point its location on /storage`;
+ }
+ if (!idn.exists) return null;
+ const dangling = [];
+ for (const a of await audioFilesOf(idn.dir)) {
+ const l = await lstat(a.path).catch(() => null);
+ if (l?.isSymbolicLink() && !(await stat(a.path).catch(() => null))) dangling.push(`${a.name} -> ${(await readlink(a.path).catch(() => null)) ?? "?"}`);
+ }
+ if (dangling.length) return `its media does not answer (${dangling.join(", ")}): the drive it lives on is not mounted`;
+ if (saved) {
+ const pointer = await readSavedVideoPointer(idn.dir);
+ if (pointer && !(await present(pointer.path))) return `its saved video does not answer (${pointer.path}): the saved-video store's drive is not mounted`;
+ }
+ return null;
+}
+
+const unreachablePlan = (action, why) => ({ action, what: `Not now: ${why}`, cost: null, queue: "—", unreachable: why, start: null });
+
/** The fetch-windows bodies for the named clips of one project, narrowed to this recording (one per project). */
async function fetchBodyFor(project, clips, idn) {
const { body, skipped } = await projectFetchBody(project, { localIds: true });
@@ -75,6 +116,8 @@ export async function planAction(req, ctx) {
const rumble = idn.platform === "rumble";
if (action === "persist") {
+ const away = await unreachableOf(idn, { saved: true });
+ if (away) return unreachablePlan(action, away);
const body = { items: [{ slug: idn.ch, id: idn.dirId }] };
const plan = await askEditorOps(ctx.cfg, "/api/ops/persist-videos", { method: "POST", body: { ...body, dryRun: true } });
// The editor's plan buckets each item: { saved: {count, items}, toFetch, noUrl, unknown, willFetch }.
@@ -89,11 +132,13 @@ export async function planAction(req, ctx) {
cost: already ? null : "network",
queue: `the ${idn.ch} channel's download queue (the editor's)`,
plan: { saved: already, toFetch: count("toFetch"), noUrl: count("noUrl"), unknown: count("unknown") },
- start: { route: "/api/ingredients/action", body: { action, ch: idn.ch, id: idn.dirId, step: "start" } },
+ start: self({ key: plainKey(action, idn) }),
};
}
if (action === "transcribe") {
+ const away = await unreachableOf(idn);
+ if (away) return unreachablePlan(action, away);
const audio = idn.exists ? (await Promise.all((await audioFilesOf(idn.dir)).map(async (a) => ((await present(a.path)) ? a.name : null)))).filter(Boolean) : [];
return {
action,
@@ -102,7 +147,7 @@ export async function planAction(req, ctx) {
: `Download the audio, then transcribe it (a YouTube video with English captions has those fetched instead)`,
cost: "gpu",
queue: audio.length ? `transcribe-one:${idn.ch}:${idn.dirId}` : `the ${idn.ch} channel's platform queue for the download, then transcribe-one:${idn.ch}:${idn.dirId}`,
- start: self(),
+ start: self({ key: plainKey(action, idn) }),
};
}
@@ -120,20 +165,23 @@ export async function planAction(req, ctx) {
cost: "network",
queue: queues.length ? queues.join(", ") : "the editor's paced fetch queue for the platform",
plan: { summary: summarizeAnswer(answer) },
- start: self({ project: project.id, clips }),
+ start: self({ project: project.id, clips, key: fetchKey(body) }),
};
}
if (action === "evict") {
- const name = String(req.window ?? "");
- const w = (idn.exists ? await listWindows(idn.dir) : []).find((x) => x.name === name || x.file === name);
- if (!w) throw new ActionError(`no window "${name}" in ${idn.ch}/${idn.dirId}/clips/`, 404);
+ const { w, twins } = await evictTarget(idn, req.window);
+ const mb = (b) => `${(b / 1e6).toFixed(1)} MB`;
return {
action,
- what: `Delete the cached window ${w.name} (${(w.bytes / 1e6).toFixed(1)} MB). A window is a cache: it can be fetched again, and that fetch is the cost. Nothing knows whether a project still cites it`,
+ what:
+ `Delete the cached window ${w.file} (${mb(w.bytes)})` +
+ // The editor's targeted evict names the `<from>-<to>` stem, and a set-aside twin of the span goes with it.
+ (twins.length ? `, and with it ${twins.map((t) => `${t.file} (${mb(t.bytes)})`).join(", ")}: the editor evicts a span's set-aside twin with it` : "") +
+ `. A window is a cache: it can be fetched again, and that fetch is the cost. Nothing knows whether a project still cites it`,
cost: "disk",
queue: "an evict-clips job on the editor",
- start: self({ window: w.name }),
+ start: self({ window: w.file, key: evictKey(w, twins) }),
};
}
@@ -172,6 +220,13 @@ export async function startAction(req, ctx) {
if (!["persist", "transcribe", "fetch", "evict"].includes(action)) throw new ActionError(`${action} is not started here`);
if (!isChannelSlug(req.ch) || !isVideoId(req.id)) throw new ActionError("ch and id name a recording");
const idn = await ingredientIdentity({ channelsDir: ctx.channelsDir, ch: req.ch, id: req.id });
+ if (typeof req.key !== "string" || !req.key) throw new ActionError("start carries the plan's key: ask for the plan first");
+ const changed = () => new ActionError("it changed since the plan was shown: ask again", 409);
+ if (action === "persist" || action === "transcribe") {
+ const away = await unreachableOf(idn, { saved: action === "persist" });
+ if (away) throw new ActionError(`refused: ${away}`, 409);
+ if (req.key !== plainKey(action, idn)) throw changed();
+ }
const ids = (a) => [...new Set([...(Array.isArray(a?.jobIds) ? a.jobIds : []), ...(a?.jobId ? [a.jobId] : [])].map(String))];
if (action === "persist") {
const a = await askEditorOps(ctx.cfg, "/api/ops/persist-videos", { method: "POST", body: { items: [{ slug: idn.ch, id: idn.dirId }] } });
@@ -184,16 +239,25 @@ export async function startAction(req, ctx) {
if (action === "fetch") {
const project = await projectOf(req.project, ctx.reportsRoot);
const body = await fetchBodyFor(project, clipList(req.clips), idn);
+ if (req.key !== fetchKey(body)) throw changed();
const a = await postFetchWindows(ctx.cfg, body);
return { ok: true, action, jobIds: ids(a), message: ids(a).length ? `fetch started (${ids(a).join(", ")})` : "nothing to fetch: every window is on disk or in flight", answer: summarizeAnswer(a) };
}
- const name = String(req.window ?? "");
- const w = (idn.exists ? await listWindows(idn.dir) : []).find((x) => x.name === name);
- if (!w) throw new ActionError(`no window "${name}" in ${idn.ch}/${idn.dirId}/clips/`, 404);
+ const { w, twins } = await evictTarget(idn, req.window);
+ if (req.key !== evictKey(w, twins)) throw changed();
const a = await askEditorOps(ctx.cfg, "/api/ops/evict-clips", { method: "POST", body: { slug: idn.ch, id: idn.dirId, windows: [w.name] } });
return { ok: true, action, jobIds: ids(a), message: `evicting ${w.name} (${ids(a).join(", ")})`, answer: a };
}
+/** The window a targeted evict names, EXACTLY by its file, and the set-aside twin of its span that goes with it. */
+async function evictTarget(idn, file) {
+ const f = String(file ?? "");
+ const all = idn.exists ? await listWindows(idn.dir) : [];
+ const w = all.find((x) => x.file === f);
+ if (!w) throw new ActionError(`no window file "${f}" in ${idn.ch}/${idn.dirId}/clips/`, 404);
+ return { w, twins: all.filter((x) => x !== w && x.name === w.name) };
+}
+
/** The argv of a quote check of some of a project's clips (the route runs it on the app's job runner). */
export function quoteCheckArgv(umtoolDir, project, clips) {
return [process.execPath, path.join(umtoolDir, "bin", "umtool.mjs"), "quote-check", project, "--clips", clips.join(",")];
diff --git a/umtool/lib/ingredients/actions.test.mjs b/umtool/lib/ingredients/actions.test.mjs
@@ -0,0 +1,136 @@
+// node --test umtool/lib/ingredients/actions.test.mjs
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, rm, symlink, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { planAction, startAction } from "./actions.mjs";
+import { readIngredient } from "./stages.mjs";
+
+/** An editor that records what it was asked and answers like the real one would, enough for these tests. */
+function editor() {
+ const asked = [];
+ const fetch = async (url, init) => {
+ const body = init?.body ? JSON.parse(init.body) : null;
+ const route = new URL(url).pathname;
+ asked.push({ route, body });
+ let answer = { ok: true, jobId: `job-${asked.length}` };
+ if (route === "/api/ops/fetch-windows") answer = body.dryRun ? { ok: true, dryRun: true, groups: [{ platform: "youtube", queueKey: "clips:youtube", items: body.items }], cached: [], inFlight: [], unresolved: [] } : { ok: true, jobs: [], jobIds: ["fw-1"], jobId: "fw-1", groups: [], cached: [], inFlight: [], unresolved: [], refused: [] };
+ if (route === "/api/ops/persist-videos" && body.dryRun) answer = { ok: true, dryRun: true, plan: { saved: { count: 0, items: [] }, toFetch: { count: 1, items: [] }, willFetch: 1 } };
+ return new Response(JSON.stringify(answer), { status: 200, headers: { "content-type": "application/json" } });
+ };
+ return { asked, cfg: { url: "http://editor.test", token: "t", fetch } };
+}
+
+async function corpus() {
+ const root = await mkdtemp(path.join(tmpdir(), "actions-"));
+ const channels = path.join(root, "channels");
+ const reports = path.join(root, "reports");
+ const v = path.join(channels, "chan", "data", "vid");
+ await mkdir(path.join(v, "clips"), { recursive: true });
+ await writeFile(path.join(channels, "chan", "config.json"), JSON.stringify({ platform: "youtube" }));
+ await writeFile(path.join(v, "metadata.info.json"), JSON.stringify({ id: "vid", title: "t" }));
+ await writeFile(path.join(v, "clips", "10.00-40.00.mp4"), Buffer.alloc(100));
+ await writeFile(path.join(v, "clips", "10.00-40.00.desynced.mp4"), Buffer.alloc(70));
+ await writeFile(path.join(v, "clips", "50.00-60.00.mp4"), Buffer.alloc(10));
+ const a = path.join(reports, "f", "a");
+ await mkdir(a, { recursive: true });
+ await writeFile(path.join(a, "video.manifest.json"), JSON.stringify({ provenance: { channelSlug: "chan" }, render: { fetchPad: 3 }, timeline: [{ type: "clip", id: "a1", video: "vid", start: 100, end: 110 }] }));
+ return { root, channels, reports, v, a };
+}
+
+test("an unmounted media drive: transcribe and persist plan 'not now', name the drive, offer no Start, and a start is refused", async () => {
+ const { root, channels, reports, v } = await corpus();
+ try {
+ // The channel's media/ links to a drive that is not there; the audio is a link into it.
+ await symlink(path.join(root, "gone-drive", "chan", "media"), path.join(channels, "chan", "media"));
+ await symlink("../../media/vid/audio.mp3", path.join(v, "audio.mp3"));
+ const { cfg, asked } = editor();
+ const ctx = { cfg, reportsRoot: reports, channelsDir: channels };
+ for (const action of ["transcribe", "persist"]) {
+ const plan = await planAction({ action, ch: "chan", id: "vid" }, ctx);
+ assert.equal(plan.cost, null, action);
+ assert.equal(plan.start, null, action);
+ assert.match(plan.unreachable, /media drive does not answer .*gone-drive/, action);
+ await assert.rejects(startAction({ action, ch: "chan", id: "vid", key: "x" }, ctx), (e) => e.status === 409 && /refused: the channel's media drive/.test(e.message));
+ }
+ assert.deepEqual(asked, [], "the editor was never asked");
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("a dangling audio link alone (the channel's media/ fine) is 'not now' too -- never 'download the audio'", async () => {
+ const { root, channels, reports, v } = await corpus();
+ try {
+ await mkdir(path.join(channels, "chan", "media"), { recursive: true });
+ await symlink("../../media/vid/audio.mp3", path.join(v, "audio.mp3"));
+ const { cfg } = editor();
+ const plan = await planAction({ action: "transcribe", ch: "chan", id: "vid" }, { cfg, reportsRoot: reports, channelsDir: channels });
+ assert.match(plan.what, /^Not now: its media does not answer \(audio\.mp3 -> \.\.\/\.\.\/media\/vid\/audio\.mp3\)/);
+ assert.equal(plan.start, null);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("a saved video whose drive is gone: persist is 'not now', and the Windows stage says it does not answer", async () => {
+ const { root, channels, reports, v } = await corpus();
+ try {
+ await writeFile(path.join(v, "saved-video.json"), JSON.stringify({ dir: path.join(root, "gone-store", "chan"), file: "vid.mp4" }));
+ const { cfg } = editor();
+ const plan = await planAction({ action: "persist", ch: "chan", id: "vid" }, { cfg, reportsRoot: reports, channelsDir: channels });
+ assert.match(plan.unreachable, /saved video does not answer/);
+ const r = await readIngredient({ channelsDir: channels, reportsRoot: reports, ch: "chan", id: "vid", indexFile: path.join(root, "state", "u.json") });
+ const win = r.stages.find((s) => s.key === "windows");
+ assert.equal(win.pill.kind, "warn");
+ assert.match(win.line, /the saved whole recording does not answer/);
+ assert.equal(win.savedWhole, false);
+ assert.equal(win.uncovered.length, 1, "nothing cuts from an unreachable recording: the clip is not covered");
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("start carries the plan's key: none, or a stale one, is refused before the editor is asked", async () => {
+ const { root, channels, reports, a } = await corpus();
+ try {
+ const { cfg, asked } = editor();
+ const ctx = { cfg, reportsRoot: reports, channelsDir: channels };
+ const plan = await planAction({ action: "fetch", ch: "chan", id: "vid", project: "f/a", clips: ["a1"] }, ctx);
+ assert.equal(plan.start.body.key.length, 16);
+ await assert.rejects(startAction({ ...plan.start.body, key: undefined }, ctx), /ask for the plan first/);
+ // The clip moves after the plan was shown: the fetch would differ, so the start is refused.
+ await writeFile(path.join(a, "video.manifest.json"), JSON.stringify({ provenance: { channelSlug: "chan" }, render: { fetchPad: 3 }, timeline: [{ type: "clip", id: "a1", video: "vid", start: 200, end: 210 }] }));
+ await assert.rejects(startAction(plan.start.body, ctx), (e) => e.status === 409 && /changed since the plan was shown/.test(e.message));
+ const again = await planAction({ action: "fetch", ch: "chan", id: "vid", project: "f/a", clips: ["a1"] }, ctx);
+ const r = await startAction(again.start.body, ctx);
+ assert.deepEqual(r.jobIds, ["fw-1"]);
+ const starts = asked.filter((x) => x.route === "/api/ops/fetch-windows" && !x.body.dryRun);
+ assert.equal(starts.length, 1);
+ assert.deepEqual(starts[0].body.items.map((i) => [i.from, i.to, i.clipId]), [[197, 213, "a1"]]);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("evict names one window by its FILE, says its set-aside twin goes with it, and refuses a window changed since", async () => {
+ const { root, channels, reports, v } = await corpus();
+ try {
+ const { cfg, asked } = editor();
+ const ctx = { cfg, reportsRoot: reports, channelsDir: channels };
+ await assert.rejects(planAction({ action: "evict", ch: "chan", id: "vid", window: "10.00-40.00" }, ctx), /no window file/);
+ const plan = await planAction({ action: "evict", ch: "chan", id: "vid", window: "10.00-40.00.mp4" }, ctx);
+ assert.match(plan.what, /^Delete the cached window 10\.00-40\.00\.mp4 .*and with it 10\.00-40\.00\.desynced\.mp4/);
+ const lone = await planAction({ action: "evict", ch: "chan", id: "vid", window: "50.00-60.00.mp4" }, ctx);
+ assert.doesNotMatch(lone.what, /and with it/);
+ // Refetched since (other bytes under the same name): the key no longer matches.
+ await writeFile(path.join(v, "clips", "50.00-60.00.mp4"), Buffer.alloc(99));
+ await assert.rejects(startAction(lone.start.body, ctx), (e) => e.status === 409);
+ const ok = await startAction(plan.start.body, ctx);
+ assert.equal(ok.ok, true);
+ assert.deepEqual(asked.at(-1), { route: "/api/ops/evict-clips", body: { slug: "chan", id: "vid", windows: ["10.00-40.00"] } });
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
diff --git a/umtool/lib/ingredients/stages.mjs b/umtool/lib/ingredients/stages.mjs
@@ -358,7 +358,7 @@ export async function listWindows(dir) {
const holds = (w, s) => fin(s.from) && fin(s.to) && w.from <= s.from + WIN_EPS && w.to >= s.to - WIN_EPS;
-function windowsStage({ idn, windows, rows, savedWhole, focus }) {
+function windowsStage({ idn, windows, rows, savedWhole, savedAway = null, focus }) {
const live = windows.filter((w) => !w.desynced);
const clipIds = new Set(rows.map((r) => r.clipId));
const annotated = windows.map((w) => {
@@ -376,15 +376,17 @@ function windowsStage({ idn, windows, rows, savedWhole, focus }) {
desyncedN && `${desyncedN} set aside (desynced)`,
uncovered.length && `${uncovered.length} clip${uncovered.length === 1 ? "" : "s"} not fetched`,
savedWhole && "the whole recording is saved (any span cuts from it)",
+ savedAway && `the saved whole recording does not answer (${savedAway}): its drive is not mounted, so nothing cuts from it now`,
].filter(Boolean);
return {
key: "windows",
label: "Windows",
- pill: uncovered.length || desyncedN ? pill("warn") : live.length ? pill("count", live.length) : savedWhole ? pill("ok") : pill("none"),
- line: live.length || uncovered.length || desyncedN || savedWhole ? bits.join(", ") : "No windows cut yet",
+ pill: uncovered.length || desyncedN || savedAway ? pill("warn") : live.length ? pill("count", live.length) : savedWhole ? pill("ok") : pill("none"),
+ line: live.length || uncovered.length || desyncedN || savedWhole || savedAway ? bits.join(", ") : "No windows cut yet",
windows: annotated,
uncovered,
savedWhole: !!savedWhole,
+ savedUnreachable: savedAway,
focus: focus ? { ...focus, name: windowName(focus.from, focus.to), found: !!focusedWin } : null,
};
}
@@ -542,7 +544,7 @@ export async function readIngredient({ channelsDir, reportsRoot, ch, id, window
const savedWhole = pointer ? await present(pointer.path) : false;
const [found, downloaded, transcribed, clock] = await Promise.all([foundStage({ reportsRoot, idn }), downloadedStage({ idn }), transcribedStage({ idn }), clockStage({ idn })]);
- const win = windowsStage({ idn, windows, rows: allRows, savedWhole, focus });
+ const win = windowsStage({ idn, windows, rows: allRows, savedWhole, savedAway: pointer && !savedWhole ? pointer.path : null, focus });
const used = usedStage({ rows, allRows, focus });
const [checked, rendered, published] = await Promise.all([checkedStage({ rows, dirOf }), renderedStage({ rows, dirOf }), publishedStage({ rows, dirOf, idn })]);