commit a9f8006b98cc7bac5a793024d985d4a8378c14d7
parent fbb239a7b170a1b39e81fa22828f5171f8754c4e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 26 Oct 2026 21:53:16 -0400
umtool check: a local-media clip (src + cues, no video) no longer makes its project "unreadable"
sourcesOf sent the clip's undefined `video` into path.join() via cuePathFor, so
the whole project read as one blocking "unreadable" decision and every other
check on it was lost (candace/video and its qwen-bakeoff copy: 6 of 142 clips
local). sourcesOf now skips a clip with its own media, as the decisions already
did; cuePathFor returns null for a clip with no video; the card's source count
counts a local clip by its src rather than as chan/undefined.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/umtool/lib/projects/report.mjs b/umtool/lib/projects/report.mjs
@@ -541,7 +541,9 @@ export async function noCuesFix(m, e, file) {
export const cuePathFor = (m, e, channelsDir) => {
const chan = channelFor(m, e);
- if (!chan) return null;
+ // A clip with its own media (`src`, `cues`) names no corpus video: there is
+ // no cue file to find, and path.join(undefined) would throw.
+ if (!chan || e.video == null) return null;
// The record's directory: a Twitch v<n> is data/<n>/ (release 23 F1b).
return path.join(resolveVideoDirSync(channelsDir ?? GLOBAL_CHANNELS_DIR(), chan, e.video), "transcript.cues.json");
};
@@ -761,6 +763,9 @@ export async function sourcesOf(dir, { manifest = null } = {}) {
const byKey = new Map();
for (const e of clipsOf(m)) {
+ // A clip with its own media (`src`, `cues`) is not a corpus source: the
+ // decisions skip it for the same reason (the build checks its paths).
+ if (e.src != null) continue;
const chan = channelFor(m, e);
const key = `${chan}/${e.video}`;
if (!byKey.has(key)) byKey.set(key, { chan, video: e.video, clips: [] });
@@ -834,7 +839,7 @@ export async function summariseReport(ctx) {
const build = await buildStateOf(dir, m);
const runtime = clips.reduce((n, e) => n + Math.max(0, (e.end ?? 0) - (e.start ?? 0)), 0);
- const sources = new Set(clips.map((e) => `${channelFor(m, e)}/${e.video}`)).size;
+ const sources = new Set(clips.map((e) => (e.src != null ? `src:${e.src}` : `${channelFor(m, e)}/${e.video}`))).size;
const locked = clips.filter((e) => e.lock).length;
// The source facts the dashboard's Sources panel and /browse read. The cue
diff --git a/umtool/lib/report/local-media-clip.test.mjs b/umtool/lib/report/local-media-clip.test.mjs
@@ -0,0 +1,58 @@
+// A clip with its own media (`src` + `cues`, no `video`) is a supported shape
+// (report-to-video/local-media.mjs). The checker used to send its undefined
+// `video` into path.join() through sourcesOf -> cuePathFor, so `umtool check`
+// reported the WHOLE project as "unreadable" (blocking) and every other
+// decision on it was lost -- candace/video, 6 of 142 clips local.
+//
+// Run with: pnpm test:scripts
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import test from "node:test";
+
+import { decisionsFor, summarise } from "../projects/core.mjs";
+import { cuePathFor, readClipDetail, sourcesOf } from "../projects/report.mjs";
+import { walkProjects } from "../projects/walk.mjs";
+
+test("a local-media clip does not make the project unreadable, and is not a corpus source", async () => {
+ const root = await mkdtemp(path.join(tmpdir(), "local-media-clip-"));
+ try {
+ const channelsDir = path.join(root, "channels");
+ const reportsRoot = path.join(root, "reports");
+ await mkdir(path.join(channelsDir, "chan", "data", "here"), { recursive: true });
+ const dir = path.join(reportsRoot, "cut");
+ await mkdir(path.join(dir, "clips"), { recursive: true });
+ await writeFile(path.join(dir, "clips", "local.mp4"), "");
+ await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify({
+ schemaVersion: 1, slug: "cut", title: "Cut",
+ provenance: { channelSlug: "chan", channelsDir: path.relative(dir, channelsDir), siteOrigin: "https://example.test" },
+ render: { width: 1920, height: 1080, fps: 30, transition: 0.5 },
+ timeline: [
+ { type: "clip", id: "a", video: "here", start: 10, end: 20, cite: 10 },
+ { type: "clip", id: "b", src: "clips/local.mp4", cues: "clips/local.transcript.json", start: 0, end: 5, cite: 0 },
+ ],
+ }, null, 2));
+ const [ref] = (await walkProjects(reportsRoot)).filter((p) => p.id === "cut");
+
+ const ds = await decisionsFor(ref, reportsRoot);
+ assert.deepEqual(ds.filter((d) => d.kind === "unreadable"), [], "the project reads");
+ // The corpus clip is still checked: its cue file is missing.
+ assert.ok(ds.some((d) => d.kind === "clip-no-cues" && d.target === "chan/here"));
+ assert.ok(!ds.some((d) => String(d.target).includes("undefined")), "nothing names chan/undefined");
+
+ const card = await summarise(ref, reportsRoot);
+ assert.ok(!card.flags.some((f) => /could not be read/.test(f)), card.flags.join("; "));
+
+ const src = await sourcesOf(dir);
+ assert.deepEqual(src.rows.map((r) => r.key), ["chan/here"], "the local clip is not a corpus source row");
+
+ assert.equal(cuePathFor({ provenance: { channelSlug: "chan" } }, { src: "clips/local.mp4" }, channelsDir), null);
+
+ // The project page's clip rows read too.
+ const detail = await readClipDetail(dir);
+ assert.ok(detail, "the clip detail reads");
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});