Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 28c7df015ec21a5a8d017baf335b0d3a0a16a71b
parent 0f3c0921203ba095e0225a863c376cad713fe8de
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 17 Nov 2026 17:16:43 -0500

reads-find.spec: a thread read with a screen, Stop and Retry, Everywhere (review 1, SHOULD 5 and nits)

The fixture gains p-4, a thread read (a parent said as shown, his words, a DM screen of two lines,
each part a file of the parts cache). The spec covers: a replace making a screen line's said-as (the
line as shown untouched) and leaving the parent "said as shown"; a thread step through the queue and
the editor stub; Stop on the steps not started and Retry on the stopped ones; Listen through playing
the screen line's own new part (not the joined read); Everywhere previewed, applied and taken back.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/e2e/fixtures/reads-fixture.mjs | 39++++++++++++++++++++++++++++++++++++++-
Mumtool/e2e/reads-find.spec.ts | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 118 insertions(+), 7 deletions(-)

diff --git a/umtool/e2e/fixtures/reads-fixture.mjs b/umtool/e2e/fixtures/reads-fixture.mjs @@ -8,11 +8,15 @@ // p-2 @invented_ferry_reads picked take orpheus · tara: no match // p-3 @invented_pier_reads picked take RECORDED: "… north pier …" -- found, never replaced // c-1 a card, its narration "… the north pier reopened." (orpheus · leo), its reading kept in out/narration/ +// p-4 @invented_ferry_reads a THREAD read: its parent (said as shown: "… north pier …"), his words, a DM screen of +// two lines ("Is the north pier open?" -- a said-as made by a replace), each part a file of the parts cache // // Invented people, like every fixture. import { mkdirSync, writeFileSync } from "node:fs"; import path from "node:path"; import { narrationsOf } from "../../report-to-video/narration.mjs"; +import { draftScript } from "../../report-to-video/post-narration.mjs"; +import { screenLineSaid } from "../../report-to-video/post-screens.mjs"; export const READS = "reads-fixture"; export const READS_P1 = "The ferry leaves the north pier at noon.\n\nBring a coat for the north pier wind."; @@ -40,8 +44,15 @@ export function makeReadsFixture({ reports, manifest, ff }) { post("2", "invented_ferry_reads", "The ferry fares go up in the spring.", { file: "narration/posts/2/take-1.orpheus-tara.wav", engine: "orpheus", voice: "tara", tuning: made, reading: 0 }), post("3", "invented_pier_reads", "The north pier is closed today.", { file: "narration/posts/3/take-1.recorded.wav", engine: "recorded", voice: "operator" }), { type: "card", id: "c-1", seconds: "auto", heading: "Later", narration: { text: "Six months later, the north pier reopened.", engine: "orpheus", voice: "leo" } }, + threadPost(), ]; - for (const e of timeline) for (const t of e.narration?.takes ?? []) tone(path.join(dir, ...t.file.split("/"))); + for (const e of timeline) for (const t of e.narration?.takes ?? []) { + tone(path.join(dir, ...t.file.split("/"))); + for (const x of t.parts ?? []) tone(path.join(dir, ...x.file.split("/"))); + } + // p-4's picture (its screen is in it). + mkdirSync(path.join(dir, "posts-media", "readsx", "4"), { recursive: true }); + ff(["-f", "lavfi", "-i", "color=c=gray:s=90x140", "-frames:v", "1", path.join(dir, "posts-media", "readsx", "4", "4_1.png")]); const m = manifest(READS, "The Reads Fixture", {}, timeline); write(dir, "video.manifest.json", m); // The card's reading, kept beside the build as narrate-via-editor keeps it (out/narration/<key>.{wav,json}). @@ -56,3 +67,29 @@ export function makeReadsFixture({ reports, manifest, ff }) { }); return dir; } + +/** p-4: a thread read -- its parent, his words, a DM screen of two lines -- each part a file of the parts cache. */ +export function threadPost() { + const text = "The ferry timetable changes next week."; + const parent = { id: "41", handle: "invented_pier_reads", author: "Pier Watch", date: "2026-10-30T13:00:00.000Z", text: "They say the north pier will stay shut." }; + const dm = { id: "s1", media: 0, kind: "dm", read: "all", lines: [{ who: "invented_pier_reads", text: "Is the north pier open?" }, { who: "invented_ferry_reads", text: "Not until spring." }] }; + const parts = []; + let t = 0; + const add = (words, role, piece, more = {}) => { + t += parts.length ? 0.8 : 0; + parts.push({ n: parts.length + 1, para: piece * 100, text: words, voice: role === "post" || more.speaker === "invented_ferry_reads" ? "tara" : "leo", role, start: Math.round(t * 1000) / 1000, seconds: 2, file: `narration/parts-cache/reads-fixture-${parts.length + 1}.wav`, ...more }); + t += 2; + }; + add(draftScript(parent.text).script, "parent:0", 0); + add(draftScript(text).script, "post", 1); + dm.lines.forEach((l, n) => { + const said = draftScript(screenLineSaid(dm, n)).script; + add(said, `screen:s1:${n}`, 2 + n, { line: said, speaker: l.who }); + }); + return { + type: "post", id: "p-4", post: "readsx/4", platform: "x", author: "Ferry Teller", handle: "invented_ferry_reads", date: "2026-10-30T14:00:00.000Z", text, + url: "https://x.com/invented_ferry_reads/status/4", engagement: { likes: 1 }, section: 0, parents: [parent], + media: [{ src: "posts-media/readsx/4/4_1.png", kind: "image", width: 900, height: 1400 }], screens: [dm], + narration: { script: draftScript(text).script, pick: 0, takes: [{ file: "narration/posts/4/take-1.orpheus-thread.wav", engine: "orpheus", voice: "tara+leo", seconds: Math.round(t * 1000) / 1000, script: parts.map((p) => p.text).join("\n\n"), parts, read: { kind: "thread", parents: "0" }, at: "2026-11-02T00:00:00.000Z" }] }, + }; +} diff --git a/umtool/e2e/reads-find.spec.ts b/umtool/e2e/reads-find.spec.ts @@ -39,19 +39,21 @@ const drawn = async () => { const m = JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: Array<Record<string, unknown>> }; return m.timeline.map((e) => (e.type === "post" ? drawnOf(e) : sha(JSON.stringify(Object.fromEntries(Object.entries(e).filter(([k]) => k !== "narration")))))); }; -const pristine = { takes: [] as string[], readings: [] as string[] }; +const pristine = { takes: [] as string[], readings: [] as string[], parts: [] as string[] }; test.beforeAll(() => { if (!existsSync(`${MANIFEST}.pristine`)) copyFileSync(MANIFEST, `${MANIFEST}.pristine`); pristine.takes = files(path.join(DIR, "narration", "posts")); pristine.readings = files(path.join(DIR, "out", "narration")); + pristine.parts = files(path.join(DIR, "narration", "parts-cache")); }); const reset = () => { copyFileSync(`${MANIFEST}.pristine`, MANIFEST); - rmSync(path.join(DIR, "narration", "reads"), { recursive: true, force: true }); + for (const d of ["reads", "lexicon.json"]) rmSync(path.join(DIR, "narration", d), { recursive: true, force: true }); rmSync(path.join(DIR, "revisions"), { recursive: true, force: true }); for (const f of files(path.join(DIR, "narration", "posts"))) if (!pristine.takes.includes(f) && f.endsWith(".wav")) rmSync(path.join(DIR, "narration", "posts", f), { force: true }); for (const f of files(path.join(DIR, "out", "narration"))) if (!pristine.readings.includes(f)) rmSync(path.join(DIR, "out", "narration", f), { force: true }); + for (const f of files(path.join(DIR, "narration", "parts-cache"))) if (!pristine.parts.includes(f)) rmSync(path.join(DIR, "narration", "parts-cache", f), { force: true }); }; test.beforeEach(() => { test.setTimeout(240_000); @@ -66,7 +68,7 @@ test("Find, Replace these reads, Re-read the changed lines on the queue, Listen await page.goto(urls.readsHref(P)); const panel = page.locator(`[data-reads="${P}"]`); - await expect(panel.locator("[data-reads-rows]")).toHaveAttribute("data-reads-rows", "4", { timeout: 30_000 }); + await expect(panel.locator("[data-reads-rows]")).toHaveAttribute("data-reads-rows", "8", { timeout: 30_000 }); // Every control, by its name. for (const name of ["Find in spoken text", "Match case", "Whole word", "Show every read", "Show the stale reads", "Character"]) await expect(panel.getByLabel(name, { exact: true }).or(panel.getByRole("button", { name, exact: true })).first()).toBeVisible(); await expect(panel.getByRole("button", { name: "Re-read 0 changed lines" })).toBeDisabled(); @@ -74,8 +76,8 @@ test("Find, Replace these reads, Re-read the changed lines on the queue, Listen // FIND: a count of matches and of lines -- the spoken text only. await panel.getByLabel("Find in spoken text").fill("north pier"); - await expect(panel.locator("[data-reads-found]")).toHaveAttribute("data-reads-found", "4"); - await expect(panel.locator("[data-reads-found]")).toContainText("4 matches in 3 lines · spoken text only"); + await expect(panel.locator("[data-reads-found]")).toHaveAttribute("data-reads-found", "6"); + await expect(panel.locator("[data-reads-found]")).toContainText("6 matches in 5 lines · spoken text only"); await expect(panel.locator('[data-read="p-1"] [data-reads-match]')).toHaveCount(2); // REPLACE, these reads: previewed first, then applied -- nothing synthesized, the shown text untouched. @@ -84,12 +86,17 @@ test("Find, Replace these reads, Re-read the changed lines on the queue, Listen await panel.getByRole("button", { name: "Replace in these reads" }).click(); const preview = panel.locator('[data-reads-preview="reads"]'); await expect(preview).toBeVisible(); - await expect(preview.locator("[data-reads-preview-line]")).toHaveCount(2); + await expect(preview.locator("[data-reads-preview-line]")).toHaveCount(3); await expect(preview.locator('[data-reads-preview-line="p-1"]')).toContainText("northern pier"); + await expect(preview.locator('[data-reads-preview-line="p-4/screen:s1:0"]')).toContainText("creates its said-as (the line as shown is untouched)"); await expect(preview.locator('[data-reads-preview-skipped="p-3"]')).toContainText("a recorded read is yours"); + await expect(preview.locator('[data-reads-preview-skipped="p-4/parent:0"]')).toContainText("said as shown: only Everywhere changes this"); + // This test re-reads the post and the card; the screen line is left for the queue test below (untick it). + await preview.getByLabel("Rewrite p-4/screen:s1:0").uncheck(); expect(readFileSync(MANIFEST, "utf8")).toBe(readFileSync(`${MANIFEST}.pristine`, "utf8")); await panel.getByRole("button", { name: "Apply the replace" }).click(); await expect(panel.locator('[data-reads-undo="reads"]')).toBeVisible(); + expect((JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: Array<{ id: string; screens?: Array<{ saidAs?: unknown }> }> }).timeline.find((e) => e.id === "p-4")?.screens?.[0].saidAs).toBeUndefined(); await panel.getByLabel("Find in spoken text").fill(""); await expect(panel.locator('[data-read="p-1"]')).toHaveAttribute("data-read-state", "stale"); await expect(panel.locator('[data-read="c-1"]')).toHaveAttribute("data-read-state", "stale"); @@ -129,6 +136,73 @@ test("Find, Replace these reads, Re-read the changed lines on the queue, Listen expect(await drawn()).toEqual(cardsBefore); }); +test("a thread read: a screen line's said-as made by a replace, its re-read a queue step through the stub, Stop and Retry, Listen through per part", async ({ page }) => { + const cardsBefore = await drawn(); + await page.goto(urls.readsHref(P)); + const panel = page.locator(`[data-reads="${P}"]`); + await expect(panel.locator("[data-reads-rows]")).toHaveAttribute("data-reads-rows", "8", { timeout: 30_000 }); + await panel.getByLabel("Find in spoken text").fill("north pier"); + await panel.getByLabel("Replace with").fill("northern pier"); + await panel.getByRole("button", { name: "Replace in these reads" }).click(); + await panel.getByRole("button", { name: "Apply the replace" }).click(); + await expect(panel.locator('[data-reads-undo="reads"]')).toBeVisible(); + const m = JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: Array<{ id: string; screens?: Array<{ saidAs?: Record<string, string>; lines: Array<{ text: string }> }>; parents?: Array<{ text: string }> }> }; + const e4 = m.timeline.find((e) => e.id === "p-4")!; + expect(e4.screens![0].saidAs).toEqual({ 0: "Is the northern pier open?" }); + expect(e4.screens![0].lines[0].text).toBe("Is the north pier open?"); + expect(e4.parents![0].text).toBe("They say the north pier will stay shut."); + await panel.getByLabel("Find in spoken text").fill(""); + await expect(panel.locator('[data-read="p-4/screen:s1:0"]')).toHaveAttribute("data-read-state", "stale"); + await expect(panel.locator('[data-read="p-4/parent:0"]')).toHaveAttribute("data-read-state", "fresh"); + // Three items to re-read, queued; Stop at once: what has not started is stopped. + await panel.getByRole("button", { name: "Re-read 3 changed lines" }).click(); + await panel.getByRole("button", { name: "Stop the re-reads not started" }).click(); + await expect(panel.locator('[data-reads-queue-row][data-state="stopped"]').first()).toBeVisible({ timeout: 20_000 }); + // Retry every stopped one; then all of them done. + for (const read of ["p-1", "c-1", "p-4/screen:s1:0"]) { + const row = panel.locator(`[data-reads-queue-row="${read}"]`); + if ((await row.getAttribute("data-state")) === "stopped") await panel.getByRole("button", { name: `Retry ${read}` }).click(); + } + for (const read of ["p-1", "c-1", "p-4/screen:s1:0"]) await expect(panel.locator(`[data-reads-queue-row="${read}"]`)).toHaveAttribute("data-state", "done", { timeout: 120_000 }); + // The screen line's re-read: a new take of the item, unpicked; its own part plays, not the joined read. + await expect(panel.locator('[data-read="p-4/screen:s1:0"]')).toHaveAttribute("data-read-state", "unpicked", { timeout: 20_000 }); + const asks = ttsAsks().filter((a) => /northern pier open/.test(a.text ?? "")); + expect(asks.length).toBeGreaterThan(0); + await panel.getByRole("button", { name: "Play the new read of p-4/screen:s1:0" }).click(); + await expect(panel.locator('[data-reads-play-new="p-4/screen:s1:0"][data-playing="1"]')).toBeVisible({ timeout: 10_000 }); + const reads = (await (await page.request.get(`/api/report/reads?project=${encodeURIComponent(P)}`)).json()) as { reads: Array<{ id: string; newTake: { files: string[]; takeFile: string } | null; take: { files: string[] } }> }; + const line = reads.reads.find((r) => r.id === "p-4/screen:s1:0")!; + expect(line.newTake!.files).toHaveLength(1); + expect(line.newTake!.files[0]).toMatch(/^narration\/parts-cache\//); + expect(line.newTake!.files[0]).not.toBe(line.take.files[0]); + await panel.getByRole("button", { name: "Pick the new read of p-4/screen:s1:0" }).click(); + await expect(panel.locator('[data-read="p-4/screen:s1:0"]')).toHaveAttribute("data-read-state", "fresh", { timeout: 20_000 }); + expect(await drawn()).toEqual(cardsBefore); +}); + +test("Everywhere, from now on: a pronunciation entry previewed, applied (the reads it makes stale), taken back", async ({ page }) => { + await page.goto(urls.readsHref(P)); + const panel = page.locator(`[data-reads="${P}"]`); + await expect(panel.locator("[data-reads-rows]")).toHaveAttribute("data-reads-rows", "8", { timeout: 30_000 }); + await panel.getByLabel("Find in spoken text").fill("pier"); + await panel.getByLabel("Whole word").check(); + await panel.getByLabel("Replace with").fill("peer"); + await expect(panel.locator("[data-reads-say-limit]")).toContainText("never a card"); + await panel.getByRole("button", { name: "Add a pronunciation entry" }).click(); + const preview = panel.locator('[data-reads-preview="say"]'); + await expect(preview).toContainText("in every read of a post, present and future"); + await expect(preview.locator("[data-reads-preview-cards]")).toContainText("cards are not said through the lexicon"); + await panel.getByRole("button", { name: "Apply the replace" }).click(); + await panel.getByLabel("Find in spoken text").fill(""); + await expect(panel.locator('[data-read="p-1"]')).toHaveAttribute("data-read-state", "stale"); + await expect(panel.locator('[data-read="p-1"]')).toHaveAttribute("data-read-state", "stale"); + await expect(panel.locator('[data-read="p-1"] [data-read-because]')).toHaveAttribute("data-read-because", "lexicon"); + expect(JSON.parse(readFileSync(path.join(DIR, "narration", "lexicon.json"), "utf8"))).toEqual([{ word: "pier", say: "peer" }]); + await panel.getByRole("button", { name: "Remove the pronunciation entry" }).click(); + await expect(panel.locator('[data-read="p-1"]')).toHaveAttribute("data-read-state", "fresh", { timeout: 20_000 }); + expect(JSON.parse(readFileSync(path.join(DIR, "narration", "lexicon.json"), "utf8"))).toEqual([]); +}); + test("the bench links here: the Voices page and a post's bench", async ({ page }) => { await page.goto(urls.voicesHref(P)); await expect(page.locator("[data-voices-reads]").first()).toHaveAttribute("href", urls.readsHref(P));