// The RESEARCH fixture (plans/umtool-redesign.md, R1): a composed public dir // the e2e server reads as its local corpus (TRANSCRIPT_LOCAL_DIR, set in // playwright.config.ts), the way the MCP's --local reads one, plus a few // channel dirs in the fixture's CHANNELS_DIR for the inventory's "held" // numbers when the editor cannot be asked. // // INVENTED, every word: no channel, recording or line here is real. The // phrase the specs search for is RESEARCH_PHRASE. // // /research-public/ // corpus.json site.url ARCHIVE so citations are viewer links // summaries/ every recording's state (one deleted, one unlisted) // transcripts// one shard per channel // duplicates.json one cross-platform cluster (the Rumble mirror) // /harbor-radio, night-desk config.json + data//metadata.info.json // // Channels and what RESEARCH_PHRASE finds (8 recordings, 1 mirror folded): // harbor-radio 6 recordings 2019–2026; 5 match (hr-2021a twice); // captions and transcriptions; hr-2024a deleted, // hr-2026a unlisted // harbor-radio-rumble v1abcd mirrors hr-2024a (folded); v2efgh matches // night-desk 3 recordings, transcribed; nd-2023 matches // candace-owens a LOCAL-ONLY slug (lib/research/rules.mjs): 1 match // // R2 (boards): hr-2022b's primary track is `en-orig` and it carries a served // `en` alternate that rewrites one line (EN_REWRITE, at 900 s) -- the hazard // re-verify checks for. makeBoardFixture writes a case whose quotes are a // drifted one (the words changed since it was pinned), an intact one, and // one quoted from the `en` track. import { mkdirSync, writeFileSync } from "node:fs"; import path from "node:path"; export const ARCHIVE = "https://archive.example"; export const RESEARCH_PHRASE = "lighthouse budget"; const FILLER = [ "okay so where were we", "the tide was out again this morning", "we got a lot of letters about the ferry", "somebody asked about the harbor master", "let me read the next one", "the council meets on thursday", "that is not what they told us last year", "anyway the boats are still running", "the fog came in early tonight", "we will put the numbers on the website", "thanks to everyone who called in", "the weather looks rough for the weekend", ]; // Cues every 4 s from `start` for `n` lines, the lines from FILLER, with the // `say` lines put at their exact seconds. function cues(duration, say) { const out = []; const at = new Map(say.map(([t, text]) => [t, text])); const times = new Set([0, 4, 8, 12, 16]); for (const [t] of say) for (let d = -40; d <= 40; d += 4) if (t + d >= 0 && t + d < duration) times.add(t + d); let i = 0; for (const t of [...times].sort((a, b) => a - b)) { out.push({ start: t, end: t + 3.8, text: at.get(t) ?? FILLER[i++ % FILLER.length] }); } return out; } const rec = (channelSlug, channel, platform, id, title, uploadDate, fmt, duration, say, extra = {}) => ({ transcriptFormat: fmt, slug: `${channelSlug}/${id}`, id, channelSlug, title, uploadDate, duration, channel, description: "", tags: [], isLivestream: false, ageRestricted: false, platform, webpageUrl: platform === "rumble" ? `https://rumble.com/${id}-${title.toLowerCase().replace(/[^a-z0-9]+/g, "-")}.html` : `https://www.youtube.com/watch?v=${id}`, cues: cues(duration, say), ...extra, }); const P = RESEARCH_PHRASE; export const RESEARCH_CHANNELS = [ { slug: "harbor-radio", name: "Harbor Radio", records: [ rec("harbor-radio", "Harbor Radio", "youtube", "hr-2019a", "Harbor Radio 1: the old pier", "20190314", "vtt", 1800, [[600, `the ${P} was never approved`]]), rec("harbor-radio", "Harbor Radio", "youtube", "hr-2021a", "Harbor Radio 52: storm season", "20210907", "vtt", 2400, [ [1212, `who signed off on the ${P}`], [1500, `I asked twice about the ${P} and got nothing`], ]), rec("harbor-radio", "Harbor Radio", "youtube", "hr-2022a", "Harbor Radio 80: the council vote", "20220211", "whisper-json", 3600, [[2044, `they voted the ${P} down eight to one`]]), rec("harbor-radio", "Harbor Radio", "youtube", "hr-2022b", "Harbor Radio 91: call-in night", "20221103", "vtt", 5400, [[900, "the lighthouse keeper called in"]]), rec("harbor-radio", "Harbor Radio", "youtube", "hr-2024a", "Harbor Radio 140: the audit", "20240520", "vtt", 7880, [[4972, `How much was the ${P}? You cut it all,`]]), rec("harbor-radio", "Harbor Radio", "youtube", "hr-2026a", "Harbor Radio 200: looking back", "20260119", "whisper-json", 3000, [[96, `looking back the ${P} was the whole story`]]), ], }, { slug: "harbor-radio-rumble", name: "Harbor Radio (Rumble)", platform: "rumble", records: [ rec("harbor-radio-rumble", "Harbor Radio (Rumble)", "rumble", "v1abcd", "Harbor Radio 140: the audit", "20240521", "vtt", 7880, [[4972, `How much was the ${P}? You cut it all,`]]), rec("harbor-radio-rumble", "Harbor Radio (Rumble)", "rumble", "v2efgh", "Harbor Radio clips: budget fight", "20250302", "vtt", 300, [[32, `the ${P} fight in one clip`]]), ], }, { slug: "night-desk", name: "Night Desk", records: [ rec("night-desk", "Night Desk", "youtube", "nd-2022", "Night Desk: ferries", "20220615", "whisper-json", 2000, [[300, "the ferry budget is a different story"]]), rec("night-desk", "Night Desk", "youtube", "nd-2023", "Night Desk: the keeper", "20230901", "whisper-json", 2400, [[400, `the keeper never saw the ${P}`]]), rec("night-desk", "Night Desk", "youtube", "nd-2025", "Night Desk: winter", "20251201", "whisper-json", 1500, [[200, "winter on the coast is long"]]), ], }, { slug: "candace-owens", name: "Local Only Fixture", records: [rec("candace-owens", "Local Only Fixture", "youtube", "lo-2025", "Local-only fixture episode", "20250610", "vtt", 600, [[12, `a word on the ${P}`]])], }, ]; // The served `en` track's rewrite of hr-2022b's line at 900 s (its en-orig // says "the lighthouse keeper called in"). export const EN_REWRITE = { at: 900, orig: "the lighthouse keeper called in", en: "the lighthouse keeper rang in" }; { const r = RESEARCH_CHANNELS[0].records.find((x) => x.id === "hr-2022b"); r.track = "en-orig"; r.altTracks = [{ track: "en", cues: r.cues.map((c) => (c.start === EN_REWRITE.at ? { ...c, text: EN_REWRITE.en } : { ...c })) }]; } const STATES = { "harbor-radio/hr-2024a": "deleted", "harbor-radio/hr-2026a": "unlisted" }; // The editor's disk for the "held" column: harbor-radio holds five of its six // (hr-2022b not downloaded) and night-desk all three. The other two channels // are not held at all. const HELD = { "harbor-radio": ["hr-2019a", "hr-2021a", "hr-2022a", "hr-2024a", "hr-2026a"], "night-desk": ["nd-2022", "nd-2023", "nd-2025"], }; const page = (n) => `page-${String(n).padStart(4, "0")}.json`; const write = (file, value) => { mkdirSync(path.dirname(file), { recursive: true }); writeFileSync(file, typeof value === "string" ? value : JSON.stringify(value)); }; /** Write the composed public dir under `dest` and the held channel dirs under `channels`. */ export function makeResearchFixture({ dest, channels }) { const pub = path.join(dest, "research-public"); const all = RESEARCH_CHANNELS.flatMap((c) => c.records); write(path.join(pub, "corpus.json"), { spec: 5, kind: "site", generatedAt: "2026-10-14T00:00:00.000Z", site: { id: "fixture", title: "Fixture archive", url: ARCHIVE }, totals: { channels: RESEARCH_CHANNELS.length, videos: all.length }, channels: RESEARCH_CHANNELS.map((c) => ({ slug: c.slug, name: c.name, videoCount: c.records.length, groupId: "default" })), }); for (const c of RESEARCH_CHANNELS) { write(path.join(pub, "transcripts", c.slug, "manifest.json"), { version: 1, channelSlug: c.slug, pageCount: 1, maxPageBytes: 8_000_000, generatedAt: "2026-10-14", slugToPage: Object.fromEntries(c.records.map((r) => [r.id, 0])), }); write(path.join(pub, "transcripts", c.slug, page(0)), c.records); } write(path.join(pub, "summaries", "manifest.json"), { version: 3, totalCount: all.length, pageSize: 1000, pageCount: 1, generatedAt: "2026-10-14T00:00:00.000Z", channels: RESEARCH_CHANNELS.map((c) => ({ slug: c.slug, name: c.name, count: c.records.length })), }); write( path.join(pub, "summaries", page(0)), all.map((r) => { const state = STATES[r.slug]; return { slug: r.slug, id: r.id, channelSlug: r.channelSlug, title: r.title, uploadDate: r.uploadDate, date: r.uploadDate, duration: String(r.duration), channel: r.channel, isLivestream: false, ageRestricted: false, isDeleted: state === "deleted", isUnlisted: state === "unlisted", ...(state ? { state } : {}), platform: r.platform, webpageUrl: r.webpageUrl, }; }), ); const ref = (r) => ({ slug: r.slug, id: r.id, channelSlug: r.channelSlug, channel: r.channel, platform: r.platform, title: r.title, duration: r.duration, uploadDate: r.uploadDate, hasTranscript: true }); const a = all.find((r) => r.slug === "harbor-radio/hr-2024a"); const b = all.find((r) => r.slug === "harbor-radio-rumble/v1abcd"); write(path.join(pub, "duplicates.json"), { version: 1, generatedAt: "2026-10-14T00:00:00.000Z", runConfig: {}, totals: { videosScanned: all.length, clusters: 1, videosInClusters: 2 }, clusters: [ { clusterId: "fixture-audit", matchKind: "transcript", score: 1, contained: false, durationBucket: 7880, crossPlatform: true, crossChannel: true, videoRefs: [ref(a), ref(b)], canonicalSlug: a.slug, }, ], }); for (const [slug, ids] of Object.entries(HELD)) { const c = RESEARCH_CHANNELS.find((x) => x.slug === slug); write(path.join(channels, slug, "config.json"), `${JSON.stringify({ handling: "youtube", name: c.name }, null, 2)}\n`); for (const id of ids) { const r = c.records.find((x) => x.id === id); write(path.join(channels, slug, "data", id, "metadata.info.json"), { id, title: r.title, upload_date: r.uploadDate }); } } return { pub }; } // The words a drifted quote was pinned with: hr-2022a says "eight to one" now. export const DRIFTED_QUOTE = { video: "hr-2022a", at: 2044, was: `they voted the ${P} down nine to one`, now: `they voted the ${P} down eight to one` }; export const BOARD_CASE = "fixture-board"; /** * R2: a research case under `reportsRoot` (REPORTS_ROOT/.umtool/research/), * as the board store writes one: three quotes pinned from the local corpus at * `pub` -- one whose words have drifted since, one intact, one quoted from the * served `en` track where en-orig says otherwise. */ export function makeBoardFixture({ reportsRoot, pub }) { const source = `local:${pub}`; const cite = (channel, channelName, id, title, date, t, extra = {}) => ({ kind: "video", source, channel, channelKey: channel, channelName, video: id, title, date, t, end: t + 3.8, clock: `${Math.floor(t / 60)}:${String(t % 60).padStart(2, "0")}`, track: "captions", url: `${ARCHIVE}/?v=${channel}%2F${id}&t=${t}`, ...extra, }); const at = "2026-10-13T12:00:00.000Z"; write(path.join(reportsRoot, ".umtool", "research", BOARD_CASE, "case.json"), `${JSON.stringify( { format: "umtool-research-case", version: 1, id: BOARD_CASE, title: "Fixture board", scope: { source, query: P }, search: null, sessions: [], sections: [{ id: "s1", title: "The vote" }], quotes: [ { id: "q1", section: "s1", text: DRIFTED_QUOTE.was, cite: cite("harbor-radio", "Harbor Radio", "hr-2022a", "Harbor Radio 80: the council vote", "20220211", DRIFTED_QUOTE.at, { track: "transcript" }), claim: "The council vote on the budget", note: "", speakerChecked: false, pinnedAt: at }, { id: "q2", section: null, text: `the keeper never saw the ${P}`, cite: cite("night-desk", "Night Desk", "nd-2023", "Night Desk: the keeper", "20230901", 400, { track: "transcript" }), claim: "", note: "the keeper's side", speakerChecked: true, pinnedAt: at }, { id: "q3", section: null, text: EN_REWRITE.en, cite: cite("harbor-radio", "Harbor Radio", "hr-2022b", "Harbor Radio 91: call-in night", "20221103", EN_REWRITE.at, { trackId: "en" }), claim: "", note: "", speakerChecked: false, pinnedAt: at }, ], notes: "", handoffs: [], counters: { quote: 3, section: 1 }, createdAt: at, updatedAt: at, }, null, 2, )}\n`); return { id: BOARD_CASE }; }