commit 712a19dd74e0b83493b5f9c3ff5866c7f0fe361a
parent 81cc77722fd512224107a3a0c39bbfdb202be3a6
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 17 Nov 2026 10:10:55 -0500
umtool e2e: Read again on the post bench and on a screen line, the card drawn as it was
An item of the spec's own (p-31, written in the test): Read again makes reading 1 then 2 (tuned), unpicked,
marked new and played as it lands; Read edited text saves the script for reading and reads it; Pick plays it and
the card frame draws the same words, blocks and tiles as before; the previous pick one press away. A screen line
said as other words, read again alone (reading 1, the other line untouched), its reading picked. Every new control
found by its aria-label, the narration page's too.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
1 file changed, 136 insertions(+), 0 deletions(-)
diff --git a/umtool/e2e/post-narration.spec.ts b/umtool/e2e/post-narration.spec.ts
@@ -592,3 +592,139 @@ test("THE RECORDING SESSION: part by part, a reload resumes, redo one, the last
await page.keyboard.press("Enter");
await expect(s).toHaveAttribute("data-record-session", "p-12");
});
+
+// ---------------------------------------------------------------------------
+// READ AGAIN (lane line-rerun, S3 of the Orpheus re-tune plan): from the post bench a line is read again, heard as it
+// lands, and picked, with no agent -- and what the card DRAWS never changes. An item of this test's own, p-31 (written
+// into the manifest here, so the specs that share p-11 and p-13 never see it): a two-paragraph post, its script its
+// words as drafted, one take; a screenshot on it read line by line.
+// ---------------------------------------------------------------------------
+
+const OWN_TEXT = "The ferry runs at noon.\n\nBring a coat for the crossing.";
+const OWN_TAKE = "narration/posts/31/take-1.orpheus-zac.wav";
+
+function addOwnItem() {
+ const m = JSON.parse(readFileSync(MANIFEST, "utf8"));
+ const base = m.timeline.find((x: { id: string }) => x.id === "p-13");
+ m.timeline.push({
+ ...base, id: "p-31", post: "narrchan-x/31", url: "https://x.com/narrsubject/status/31", text: OWN_TEXT,
+ media: [{ src: "posts-media/narrchan-x/12/12_1.png", kind: "image", width: 320, height: 180 }],
+ screens: [{ id: "s1", media: 0, kind: "dm", read: "none", lines: [{ who: "ferryfan", text: "Is it the BRT dock?" }, { who: "narrsubject", text: "Yes, pier four." }] }],
+ narration: { script: OWN_TEXT, takes: [{ file: OWN_TAKE, engine: "orpheus", voice: "zac", seconds: 2, script: OWN_TEXT, at: "2026-11-02T00:00:00.000Z" }], pick: 0 },
+ });
+ writeFileSync(MANIFEST, JSON.stringify(m, null, 2) + "\n");
+ mkdirSync(path.join(DIR, "narration", "posts", "31"), { recursive: true });
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=300:sample_rate=48000:duration=2", "-ac", "1", "-c:a", "pcm_s16le", path.join(DIR, OWN_TAKE)]);
+}
+
+/** What the bench's card frame DRAWS of the item: its words, its blocks (their keys and words), its tiles' modes. */
+async function drawnCard(page: Page) {
+ const frame = page.frameLocator('[data-post-card-frame="read"]');
+ await expect(frame.locator("[data-post-words]")).toContainText("ferry", { timeout: 15_000 });
+ return frame.locator("body").evaluate((b) => ({
+ words: b.querySelector("[data-post-words]")?.textContent ?? null,
+ blocks: [...b.querySelectorAll("[data-post-block]")].map((x) => [x.getAttribute("data-post-block"), x.textContent]),
+ tiles: [...b.querySelectorAll("[data-thread-tile]")].map((x) => [x.getAttribute("data-thread-tile"), x.getAttribute("data-thread-mode")]),
+ follow: b.getAttribute("data-post-follow"),
+ }));
+}
+
+test("READ AGAIN (lane line-rerun): the next reading unpicked and heard as it lands, the edited text read, Pick -- and the card draws exactly what it drew", async ({ page }) => {
+ addOwnItem();
+ // Every play the page starts, recorded (a new read plays as it lands).
+ await page.addInitScript(() => {
+ const w = window as unknown as { __played: string[] };
+ w.__played = [];
+ const play = HTMLMediaElement.prototype.play;
+ HTMLMediaElement.prototype.play = function (this: HTMLMediaElement) {
+ w.__played.push(this.src);
+ return play.call(this).catch(() => undefined) as Promise<void>;
+ };
+ });
+ await page.setViewportSize({ width: 1440, height: 1400 });
+ await page.goto(urls.postBenchHref(PROJECT, "p-31"));
+ const panel = page.locator('[data-post-narration="p-31"]');
+ await expect(panel.locator("[data-post-take]")).toHaveCount(1);
+ // Every new control, by its name.
+ for (const label of ["Read again", "Read the edited text", "Tune this line only", "Read again with this tuning", "Tuning back to the defaults", "Play new reads when they land", "temperature, this line only", "top p, this line only", "top k, this line only", "min p, this line only", "repeat penalty, this line only", "takes, this line only", "Pick take 1"]) {
+ await expect(panel.locator(`[aria-label="${label}"]`), label).toHaveCount(1);
+ }
+ const before = await drawnCard(page);
+
+ // READ AGAIN: reading 1, a new take NOT picked, marked new, played as it lands.
+ await expect(panel.locator('[aria-label="Read the edited text"]')).toBeDisabled();
+ await panel.locator('[aria-label="Read again"]').click();
+ await expect(panel.locator("[data-post-take]")).toHaveCount(2, { timeout: 20_000 });
+ expect(narr("p-31").takes![1]).toMatchObject({ file: "narration/posts/31/take-2.orpheus-zac.wav", script: OWN_TEXT, reading: 1 });
+ expect(narr("p-31").pick).toBe(0);
+ await expect(panel.locator('[data-post-take-new="2"]')).toBeVisible();
+ await expect(panel.locator('[data-post-take-made="2"]')).toHaveText("reading 1");
+ await expect.poll(() => page.evaluate(() => (window as unknown as { __played: string[] }).__played.some((u) => u.includes(encodeURIComponent("take-2.orpheus-zac.wav"))))).toBe(true);
+ // Again, tuned for this line only: reading 2, the tuning sent and recorded.
+ await panel.locator('[data-read-tune] summary').click();
+ await panel.locator('[aria-label="temperature, this line only"]').fill("0.7");
+ await panel.locator('[aria-label="Read again with this tuning"]').click();
+ await expect(panel.locator("[data-post-take]")).toHaveCount(3, { timeout: 20_000 });
+ expect(narr("p-31").takes![2]).toMatchObject({ reading: 2, tuning: { temperature: 0.7 } });
+ expect(narr("p-31").pick).toBe(0);
+ // The take list says each take's words.
+ await expect(panel.locator('[data-post-take-text="3"]')).toContainText("The ferry runs at noon.");
+
+ // READ EDITED TEXT: the words changed for reading only -- saved (marked for reading), then read (reading 0).
+ const spoken = "The ferry runs at twelve noon. Bring a warm coat for the crossing.";
+ await panel.locator("[data-post-script]").fill(spoken);
+ await panel.locator('[aria-label="Read the edited text"]').click();
+ await expect(panel.locator("[data-post-take]")).toHaveCount(4, { timeout: 20_000 });
+ const n = timeline().find((e) => e.id === "p-31")!.narration as Record<string, unknown> & { takes: Array<Record<string, unknown>> };
+ expect(n.script).toBe(spoken);
+ expect(n.forReading).toBe(true);
+ expect(n.takes[3]).toMatchObject({ script: spoken });
+ expect(n.takes[3].reading ?? 0).toBe(0);
+ expect(n.pick).toBe(0);
+
+ // PICK the edited read: it plays now -- and the card draws exactly what it drew before any of this.
+ await panel.locator('[aria-label="Pick take 4"]').click();
+ await expect(panel.locator('[data-post-take="4"]')).toHaveAttribute("data-post-take-picked", "1");
+ expect(narr("p-31").pick).toBe(3);
+ await page.reload();
+ expect(await drawnCard(page)).toEqual(before);
+ // The previous pick, one press away.
+ await page.locator('[data-post-narration="p-31"] [aria-label="Pick take 1"]').click();
+ await expect.poll(() => narr("p-31").pick).toBe(0);
+});
+
+test("READ A SCREEN LINE AGAIN (lane line-rerun): said as, read again alone, its readings listed and picked -- the controls by name; the narration page's too", async ({ page }) => {
+ addOwnItem();
+ const m = JSON.parse(readFileSync(MANIFEST, "utf8"));
+ const e = m.timeline.find((x: { id: string }) => x.id === "p-31");
+ e.screens[0].read = "all";
+ e.screens[0].saidAs = { 0: "Is it the B R T dock?" };
+ writeFileSync(MANIFEST, JSON.stringify(m, null, 2) + "\n");
+ await page.setViewportSize({ width: 1440, height: 1400 });
+ await page.goto(urls.postBenchHref(PROJECT, "p-31"));
+ const line = page.locator('[data-post-screen-line="0"]');
+ for (const label of ["said as, line 0", "Read line 0 again", "Read line 0 as edited", "Tune line 0 only"]) await expect(line.locator(`[aria-label="${label}"]`), label).toHaveCount(1);
+ await expect(line.locator('[aria-label="said as, line 0"]')).toHaveValue("Is it the B R T dock?");
+ // The first read with the screens: made, picked (the bench's Make the read).
+ await page.locator("[data-post-screens-make-read]").click();
+ await expect.poll(() => (narr("p-31").takes ?? []).length, { timeout: 60_000 }).toBe(2);
+ const first = narr("p-31").takes![1] as Take & { parts?: Array<{ role?: string; text?: string; reading?: number }> };
+ expect(first.parts!.find((p) => p.role === "screen:s1:0")!.text).toContain("B R T");
+ await page.reload();
+ // Line 0 again: only it is read anew (reading 1), a new take unpicked.
+ await page.locator('[data-post-screen-line="0"] [aria-label="Read line 0 again"]').click();
+ await expect.poll(() => (narr("p-31").takes ?? []).length, { timeout: 60_000 }).toBe(3);
+ const again = narr("p-31").takes![2] as Take & { parts?: Array<{ role?: string; reading?: number }>; read?: { tuned?: Record<string, { reading?: number }> } };
+ expect(again.parts!.find((p) => p.role === "screen:s1:0")!.reading).toBe(1);
+ expect(again.parts!.find((p) => p.role === "screen:s1:1")!.reading).toBeUndefined();
+ expect(again.read!.tuned!["screen:s1:0"].reading).toBe(1);
+ expect(narr("p-31").pick).toBe(1);
+ await expect(page.locator('[data-post-screen-reading-pick="0:3"]')).toBeVisible({ timeout: 15_000 });
+ await page.locator('[aria-label="Pick take 3 for line 0"]').click();
+ await expect.poll(() => narr("p-31").pick).toBe(2);
+ // The thread read and the narration page's cards: their controls, by name.
+ await expect(page.locator('[aria-label="Read the thread again"]')).toHaveCount(0);
+ await page.goto(urls.section("reports/narration-review-fixture", "narration"));
+ await page.locator("[data-narration-link]").click();
+ for (const label of ["Read the card again", "Read the card as edited", "Tune the card only"]) await expect(page.locator(`[aria-label="${label}"]`).first(), label).toBeVisible();
+});