Archilyzer · Source

archilyzer

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

commit ada9255062c8aa5efe7b6d59ed57cf840d4a9ca3
parent 981dbc8ed49cb406810e97c301d172f73bfbfb53
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 12 Nov 2026 17:44:33 -0500

umtool: the post bench's screens e2e spec; read-follow's block map names a screen's line

e2e/post-screens.spec.ts (post-narration-fixture's p-11, rewritten in the spec): the
bench's screens section adds a screen in the video, takes pasted lines, a line left
unread, an excerpt, the check -- saved by Save; and a read that reads the screen draws
it on the card, its line lit and its badge up. PostFollowPanel lists a screen's block
as its line's words, not "(read off the attachment)".

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

Diffstat:
Mumtool/components/projects/PostFollowPanel.tsx | 5++++-
Aumtool/e2e/post-screens.spec.ts | 121+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 125 insertions(+), 1 deletion(-)

diff --git a/umtool/components/projects/PostFollowPanel.tsx b/umtool/components/projects/PostFollowPanel.tsx @@ -4,6 +4,7 @@ import { useMemo } from "react"; import { FOLLOW_DEFAULTS, FOLLOW_LIMITS, cardScopes, followBlockAt, followKnobs } from "umtool-report-to-video/read-follow"; import { cardWordsOf } from "umtool-report-to-video/word-zoom"; import type { PostPlan } from "./review/PostItemPlayer"; +import { screenLineSaid, screenOf } from "umtool-report-to-video/post-screens"; // --------------------------------------------------------------------------- // A POST's READ-FOLLOW ON THE BENCH (report-to-video/read-follow.mjs; knobs.md, @@ -106,7 +107,9 @@ export default function PostFollowPanel({ {follow.blocks.map((b) => { const words = texts.get(b.scope) ?? []; // A part read off an attachment (post-thread.mjs: a screenshot's words) has no words on the card. - const head = b.from === null || b.to === null ? "(read off the attachment)" : words.slice(b.from, Math.min(b.to + 1, b.from + 8)).join(" "); + // A SCREEN's line (post-screens.mjs): its words, as the screen reads them. + const line = typeof (b as { line?: unknown }).line === "number" && String(b.scope).startsWith("screen:") ? screenLineSaid(screenOf(entry, String(b.scope).slice(7)), (b as { line?: number }).line) : null; + const head = line !== null ? `line ${(b as { line?: number }).line}: ${line.split(/\s+/).slice(0, 8).join(" ")}` : b.from === null || b.to === null ? "(read off the attachment)" : words.slice(b.from, Math.min(b.to + 1, b.from + 8)).join(" "); return ( <li key={b.k} data-post-follow-row={b.k} data-current={cur === b.k ? "1" : undefined} className={cur === b.k ? "rounded bg-white/10" : ""}> <button diff --git a/umtool/e2e/post-screens.spec.ts b/umtool/e2e/post-screens.spec.ts @@ -0,0 +1,121 @@ +import { test, expect, type Page } from "@playwright/test"; +import { copyFileSync, existsSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// A POST's SCREENS ON THE POST BENCH (report-to-video/post-screens.mjs; knobs.md, "Screens: a post's text screenshots"; +// operator, 12 Nov: "The 'read text screenshots as posts' ability in different variations should be first class"): +// - the bench's screens section adds a screen in the post's video, takes pasted lines, a line not read, an excerpt, +// the transcription checked -- saved by the bench's Save through the item's one writer, no model anywhere; +// - a narrated item whose read reads the screen draws it on the card after its words: typeset, its line being read +// lit, "· transcribed" in its header and on the card's badge while it is up. +// Fixture: e2e/fixtures/post-narration-fixture.mjs's p-11 (a 4 s video, a 2 s take), rewritten here. +// +// POST_SCREENS_SHOTS=<dir> screenshots there +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const REPORTS = path.join(HERE, "..", ".e2e-song", "reports"); +const DIR = path.join(REPORTS, "post-narration-fixture"); +const MANIFEST = path.join(DIR, "video.manifest.json"); +const PROJECT = "reports/post-narration-fixture"; +const SHOTS = process.env.POST_SCREENS_SHOTS ?? null; + +type Line = { who?: string; side?: string; text: string; time?: string; redact?: boolean }; +type Screen = { id: string; media: number; at?: number[]; kind: string; lines: Line[]; read: unknown; checked?: { by: string } }; +const item = (id: string) => (JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: Array<{ id: string; screens?: Screen[] }> }).timeline.find((e) => e.id === id); + +test.beforeAll(() => { + if (!existsSync(`${MANIFEST}.pristine`)) copyFileSync(MANIFEST, `${MANIFEST}.pristine`); +}); +test.beforeEach(() => { + test.setTimeout(120_000); + copyFileSync(`${MANIFEST}.pristine`, MANIFEST); + rmSync(path.join(DIR, "revisions"), { recursive: true, force: true }); + rmSync(path.join(DIR, "notes.json"), { force: true }); +}); +test.afterAll(() => { + if (existsSync(`${MANIFEST}.pristine`)) copyFileSync(`${MANIFEST}.pristine`, MANIFEST); +}); + +const panel = (page: Page) => page.locator("[data-post-screens-panel]"); + +test("the bench's screens: add one in the video, paste its lines, leave one unread, trim an excerpt, mark it checked -- Save writes it", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1100 }); + await page.goto(urls.postBenchHref(PROJECT, "p-11")); + await expect(panel(page)).toBeVisible({ timeout: 15_000 }); + await expect(panel(page)).toHaveAttribute("data-screens", "0"); + await panel(page).locator("[data-post-screens-add]").click(); + const sc = page.locator('[data-post-screen="s1"]'); + await expect(sc).toBeVisible(); + await expect(sc.locator("[data-post-screen-kind]")).toHaveValue("dm"); + // In the video: the seconds it is visible. + await sc.locator("[data-post-screen-at-from]").fill("0.5"); + await sc.locator("[data-post-screen-at-to]").fill("3.5"); + await expect(sc.locator("[data-post-screen-scrub] video")).toHaveCount(1); + // Pasted lines: who: words | time, her side by hand, a line with a shape the card masks. + await sc.locator("[data-post-screen-paste]").fill( + ["TheQuartering: what's your email so I can refund your order | 11:32 AM", "[right] narrsubject: where is my scale video | 11:53 AM", "TheQuartering: you HONESTLY believe that I have lied about weight loss?", "- reply to support@coffee.example"].join("\n"), + ); + await sc.locator("[data-post-screen-paste-add]").click(); + await expect(sc.locator("[data-post-screen-line]")).toHaveCount(4); + await expect(sc.locator('[data-post-screen-masked="3"]')).toContainText("email"); + // Line 3 not read; line 2 read as an excerpt. + await sc.locator('[data-post-screen-read="3"]').uncheck(); + await sc.locator('[data-post-screen-excerpt="2"]').fill("I have lied about weight loss"); + await sc.locator("[data-post-screen-checked]").check(); + await expect(panel(page).locator("[data-post-screens-errors]")).toHaveCount(0); + await expect(panel(page).locator("[data-post-screens-read-cmd]")).toContainText("umtool posts screen reports/post-narration-fixture p-11 read"); + if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-screens-bench.png"), fullPage: true }); + await page.locator("[data-post-bench-save]").click(); + await expect.poll(() => item("p-11")?.screens?.length ?? 0).toBe(1); + const saved = item("p-11")!.screens![0]; + expect(saved.at).toEqual([0.5, 3.5]); + expect(saved.lines.map((l) => `${l.who ?? "-"}|${l.side ?? "auto"}|${l.time ?? ""}`)).toEqual(["TheQuartering|auto|11:32 AM", "narrsubject|right|11:53 AM", "TheQuartering|auto|", "-|auto|"]); + expect(saved.read).toEqual([{ line: 0 }, { line: 1 }, { line: 2, text: "I have lied about weight loss" }]); + expect(saved.checked?.by).toBe("operator"); + // The lint's word: its read does not read it yet. + await expect(panel(page).locator("[data-post-screens-warnings]")).toContainText("does not read screen s1"); + // An excerpt that is not the line's own words is refused on the page before Save. + await page.locator('[data-post-screen="s1"] [data-post-screen-excerpt="2"]').fill("I lied about weight"); + await expect(panel(page).locator("[data-post-screens-errors]")).toContainText("is not a run of line 2's words"); +}); + +test("a read that reads the screen draws it on the card after its words: typeset, the line read lit, transcribed in its header and on the badge", async ({ page }) => { + // Its 2 s take, its parts' roles stored: his words, then the screen's two lines. + const m = JSON.parse(readFileSync(MANIFEST, "utf8")); + const e = m.timeline.find((x: { id: string }) => x.id === "p-11"); + e.screens = [{ id: "s1", media: 0, at: [0.5, 3.5], kind: "dm", read: "all", lines: [{ who: "TheQuartering", text: "hop on the scale fatso", time: "12:18 PM" }, { who: "narrsubject", text: "you first" }] }]; + e.narration.script = "The video speaks for itself."; + e.narration.takes[0].parts = [ + { n: 1, para: 0, text: "The video speaks for itself.", start: 0, seconds: 0.6, role: "post" }, + { n: 2, para: 100, text: "hop on the scale fatso", start: 0.8, seconds: 0.5, role: "screen:s1:0" }, + { n: 3, para: 200, text: "you first", start: 1.5, seconds: 0.5, role: "screen:s1:1" }, + ]; + e.redact = false; + writeFileSync(MANIFEST, JSON.stringify(m, null, 2) + "\n"); + await page.setViewportSize({ width: 1366, height: 1100 }); + await page.goto(urls.postBenchHref(PROJECT, "p-11")); + const frame = page.frameLocator('[data-post-card-frame="read"]'); + await expect(frame.locator("body")).toHaveAttribute("data-post-ready", "1", { timeout: 15_000 }); + await expect(frame.locator('[data-post-screen="s1"]')).toHaveCount(1); + await expect(frame.locator('[data-post-screen="s1"] [data-screen-transcribed]')).toContainText("transcribed"); + await expect(frame.locator('[data-post-screen="s1"] .stitle')).toContainText("DMs shown in Narr Subject's video"); + // Its second line being read (the item's 0.4 s lead + 1.5 s): lit, the badge up. + await page.locator("[data-post-bench-scrub]").fill("2.1"); + await expect(async () => { + const op = await frame.locator('[data-screen-badge="s1"]').evaluate((el) => Number(getComputedStyle(el).opacity)); + expect(op).toBeGreaterThan(0.9); + }).toPass({ timeout: 10_000 }); + await expect(frame.locator('[data-screen-badge="s1"]')).toContainText("DMs · transcribed"); + const opOf = (n: number) => frame.locator(`[data-screen-line="${n}"] .sbub`).evaluate((el) => Number(getComputedStyle(el).opacity || "1")); + await expect(async () => { + expect(await opOf(1)).toBeGreaterThan(0.95); + expect(await opOf(0)).toBeLessThan(0.9); + }).toPass({ timeout: 10_000 }); + // Shown by name: the item says redact: false. + await expect(frame.locator('[data-screen-line="0"] .sname')).toHaveText("TheQuartering"); + if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-screens-card.png") }); +});