// `umtool check`'s clip-no-cues names its fix: a video directory that is in // the corpus has its cue file built by `pnpm ops build-cues` for that one // video; one that is not there is the Rumble two-ids trap (or not archived). // // 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 } from "../projects/core.mjs"; import { walkProjects } from "../projects/walk.mjs"; test("clip-no-cues: the build-cues command for a video that is here, the Rumble hint for one that is not", async () => { const root = await mkdtemp(path.join(tmpdir(), "no-cues-fix-")); try { const channelsDir = path.join(root, "channels"); const reportsRoot = path.join(root, "reports"); // "here" is archived (its transcript, no cue file yet); "gone" has no directory at all. await mkdir(path.join(channelsDir, "chan", "data", "here"), { recursive: true }); await writeFile(path.join(channelsDir, "chan", "data", "here", "transcript.en.vtt"), "WEBVTT\n"); const dir = path.join(reportsRoot, "cut"); await mkdir(dir, { recursive: true }); 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", video: "gone", start: 10, end: 20, cite: 10 }, ], }, null, 2)); const [ref] = (await walkProjects(reportsRoot)).filter((p) => p.id === "cut"); const ds = (await decisionsFor(ref, reportsRoot)).filter((d) => d.kind === "clip-no-cues"); const by = Object.fromEntries(ds.map((d) => [d.target, d.why])); assert.match(by["chan/here"], /the build dies at a\. Build it: pnpm ops build-cues --json '\{"slug":"chan","ids":\["here"\]\}' --wait$/); assert.match(by["chan/gone"], /the build dies at b\. The corpus has no chan\/gone\. On Rumble, check `video` is the URL slug/); } finally { await rm(root, { recursive: true, force: true }); } });