// A SYNTHETIC corpus for the generation tests (release 27): two channels of // invented recordings with cues, and a few invented posts. Nothing here is a // real transcript, channel or person — every line was written for these tests. // // It is plain JS (with corpus.d.mts beside it) so the TS suites (tsx), the // umtool `.mjs` suites (node --test) and the Playwright specs can all import it. // // CHANNELS the records, cues included // ORIGIN the citation origin the fixture sweeps link against // momentHref() `${ORIGIN}/?v=%2F&t=` // postHref() `${ORIGIN}/?v=%2F&vm=post` // cuesOf() the ConvertContext reader (`common/lib/report/convertShared.ts`) // recordOf() one record by channel and id // writeDraftCorpus a composed public dir (corpus.json + shards), the shape // the MCP reads with --local / TRANSCRIPT_LOCAL_DIR import { mkdir, writeFile } from "node:fs/promises"; import path from "node:path"; export const ORIGIN = "https://synth.example"; // One cue per line, CUE_STEP seconds apart, each 0.2 s short of the next. export const CUE_STEP = 5; const cues = (lines) => lines.map((text, i) => ({ start: i * CUE_STEP, end: i * CUE_STEP + CUE_STEP - 0.2, text })); // The lines the fixture sweeps quote are marked by comment with their second. const BREAD_DAY = [ "welcome back to the kitchen everyone", // 0 "today we are making a sourdough loaf", // 5 "the starter has been going for a week", // 10 "I would never sell the bakery to a chain", // 15 "people keep asking me about that rumor", // 20 "we never said that about the old oven", // 25 "the oven was fine it just ran hot", // 30 "let the dough rest for an hour", // 35 "fold it four times on the counter", // 40 "I paid for the new mixer myself", // 45 "nobody sponsored this kitchen", // 50 "the crust should be dark and crackly", // 55 "slice it only when it has cooled", // 60 "thanks for watching see you next week", // 65 ]; const PIE_STREAM = [ "good evening chat welcome to the pie stream", // 0 "a lot of you asked about the contest", // 5 "I did not enter the contest this year", // 10 "the judges were friends of mine so it felt wrong", // 15 "next year maybe I will enter again", // 20 "the filling is apples and a little lemon", // 25 "I have never met the other finalist", // 30 "honestly the drama around it is silly", // 35 "my lawyer told me not to talk about the lease", // 40 "so I will not talk about the lease", // 45 "the pie needs forty minutes at this heat", // 50 "that is all for tonight goodnight chat", // 55 ]; // Long enough that a quote two hundred seconds from its link is in the record // but outside the strict check's ±90 s. const QA_LONG = [ "this is the question and answer episode", // 0 "first question is about the bread machine", // 5 "I do not use a bread machine at all", // 10 ...Array.from({ length: 37 }, (_, i) => `filler line ${i + 1} about flour and water`), // 15 … 195 "the last question is about the second shop", // 200 "we opened the second shop in the spring", // 205 "it was always going to be a small place", // 210 "that is everything thank you all", // 215 ]; const OTHER_CHANNEL = [ "hello from the other kitchen", // 0 "we tried the sourdough recipe from last week", // 5 "it came out flat the first time", // 10 "the second loaf rose much better", // 15 ]; const video = (channelSlug, channel, id, title, uploadDate, lines, extra = {}) => ({ slug: `${channelSlug}/${id}`, id, channelSlug, title, uploadDate, duration: lines.length * CUE_STEP, channel, description: "", tags: [], isLivestream: false, ageRestricted: false, platform: "youtube", webpageUrl: `https://video.example/watch?v=${id}`, cues: cues(lines), ...extra, }); export const CHANNELS = [ { slug: "synth-kitchen", name: "Synth Kitchen", platform: "youtube", records: [ video("synth-kitchen", "Synth Kitchen", "bread-day-01", "Bread day", "20260105", BREAD_DAY), video("synth-kitchen", "Synth Kitchen", "pie-stream-02", "Pie stream", "20260210", PIE_STREAM, { isLivestream: true, }), video("synth-kitchen", "Synth Kitchen", "qa-long-03", "Questions and answers", "20260301", QA_LONG), ], }, { slug: "synth-other", name: "Synth Other Kitchen", platform: "youtube", records: [video("synth-other", "Synth Other Kitchen", "flat-loaf-01", "The flat loaf", "20260112", OTHER_CHANNEL)], }, ]; // Invented posts, as an archive keeps them (`?v=%2F&vm=post`). export const POSTS = [ { channelSlug: "synth-social", id: "1700000000000000001", author: "synthbaker", date: "2026-02-11", text: "No, I did not enter the pie contest. The judges are my friends.", }, { channelSlug: "synth-social", id: "1700000000000000002", author: "synthbaker", date: "2026-03-02", text: "The second shop opens in the spring. Small place, big oven.", }, ]; export const momentHref = (channel, id, seconds, encode = true) => `${ORIGIN}/?v=${encode ? encodeURIComponent(`${channel}/${id}`) : `${channel}/${id}`}&t=${seconds}`; export const postHref = (channel, id) => `${ORIGIN}/?v=${encodeURIComponent(`${channel}/${id}`)}&vm=post`; export function recordOf(channel, id) { for (const c of CHANNELS) { if (c.slug !== channel) continue; for (const r of c.records) if (r.id === id) return r; } return null; } export async function cuesOf(channel, id) { return recordOf(channel, id)?.cues ?? null; } // The shard file name the index build writes (common/lib/manifest.ts pageFileName). const pageFile = (n) => `page-${String(n).padStart(4, "0")}.json`; // A recording that is not in the corpus until a test adds it: a refresh's // "new recording" (umtool R4). export const LATE_RECORD = video("synth-kitchen", "Synth Kitchen", "contest-stream-04", "Contest results", "20261012", [ "the contest results came out today", // 0 "I was not a judge at the contest this year either", // 5 "congratulations to the winner", // 10 ]); // A recording deleted on its platform (release 29 S0): the archive kept its // cues, the platform no longer serves it (`state: "deleted"`, as a composed // record says it). Not in CHANNELS; add it with withRecords. On disk a gone // recording also carries `data//availability.json` — GONE_AVAILABILITY. // The fake Wayback (`web/fakeWayback.mjs`) has one capture of its watch page. export const GONE_RECORD = video( "synth-kitchen", "Synth Kitchen", "gone-video-05", "The old oven review", "20260120", [ "this is my honest review of the old oven", // 0 "the old oven never once burned a loaf", // 5 "I would buy the same oven again tomorrow", // 10 "that is the review thanks for watching", // 15 ], { state: "deleted", isDeleted: true }, ); // The availability.json a gone recording carries (common/lib/availability.ts). export const GONE_AVAILABILITY = { checkedAt: "2026-10-01T00:00:00.000Z", availability: "deleted", error: "Video unavailable. This video has been removed by the uploader", webpageUrl: GONE_RECORD.webpageUrl, history: [ { availability: "public", observedAt: "2026-01-21T00:00:00.000Z", source: "download" }, { availability: "deleted", observedAt: "2026-10-01T00:00:00.000Z", source: "check" }, ], }; // CHANNELS with `extra` records added to their channels (a later build). export function withRecords(extra) { return CHANNELS.map((c) => ({ ...c, records: [...c.records, ...extra.filter((r) => r.channelSlug === c.slug)] })); } // A composed public dir: corpus.json, and per channel a manifest and one shard. // `channels`: another set than CHANNELS (withRecords: a later build). export async function writeDraftCorpus(dir, opts = {}) { const CHANNELS_ = opts.channels ?? CHANNELS; await mkdir(dir, { recursive: true }); await writeFile( path.join(dir, "corpus.json"), JSON.stringify({ channels: CHANNELS_.map((c) => ({ slug: c.slug, name: c.name, videoCount: c.records.length })), }), ); for (const c of CHANNELS_) { const chDir = path.join(dir, "transcripts", c.slug); await mkdir(chDir, { recursive: true }); await writeFile( path.join(chDir, "manifest.json"), JSON.stringify({ version: 1, channelSlug: c.slug, pageCount: 1, maxPageBytes: 1_000_000, generatedAt: "2026-10-13", slugToPage: Object.fromEntries(c.records.map((r) => [r.id, 0])), }), ); await writeFile(path.join(chDir, pageFile(0)), JSON.stringify(c.records)); } return dir; }