commit 524b66aa6e5417253911378f931b784beed1d6e5
parent 09154fce3b00ab106be50ccf430e83d600bcd6e4
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 4 Nov 2026 00:49:21 -0500
umtool docs + e2e: thread reads -- report-video.md (the roles, the card's tiles, the modes, the motion, the guard, the render), knobs.md (the cut's and a post's thread knobs, a part's role: bench, CLI, route), cli.md (posts roles, set-item thread.*, narrate --cut thread.*); thread-reads.spec.ts: in Play the post it answers in full, lit and in the window while each of its parts plays, his reply hidden under it; at his first part the parent shrinks and dims above while the reply comes in lit; the bench lists the pieces and refuses hiding a post the read reads
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 250 insertions(+), 2 deletions(-)
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -83,8 +83,9 @@ Inbox cannot disagree about what is wrong with one.
| `posts set <project> <post> thread=on\|off [hide=on\|off] [attach=<clipId>\|auto] [crop=<px>\|off] [--json]` | the Posts table's writer (`updatePosts`, `PUT /api/report/posts`) from a terminal: `<post>` is the manifest's id (`x-<postId>`) or the bare `<postId>`; `thread=on` draws a reply with the post it answers above it (`shot-thread.png` beside its `shot`, taken by `capture-posts` `"thread": true`; its own shot while there is none), `off` removes the key.; `crop=<px>` the post's own crop of its screenshot (`shotMaxHeight`, 120–1080: its top that tall, never panned; `off` removes it) ([knobs.md](knobs.md#add-post-a-post-card-from-play-the-cut)). Refused in the build's words (a post with no `shot`, an `attach` that is not a clip) — **exit 1** |
| `posts add <project> <archive-channel>/<postId> [--attach <clipId>] [--flag F] [--author A] [--id ID] [--thread] [--crop <px>] [--dry-run] [--json]` | a **post card** from the corpus's posts archive (`channels/<slug>/posts/*.jsonl`): its words, date, link and handle; id `x-<postId>` (`bsky-`, `post-`); the author an earlier post by the same handle carries in the cut, else the archive's. Its capture (`posts-media/<postId>/`: `shot.png`, `capture.json`, the post's pictures) is copied to the project's `posts-media/<slug>/<postId>/` — or used where it is, when that folder links the channel's captures; never copied through a link anywhere else. Then `upsertPost` (a post with the id is replaced, its `attachTo` kept). **Exit 1** with no screenshot, naming the `pnpm ops capture-posts` to run. `--thread`: the entry gets `thread: true` (a reply drawn with the post it answers; `shot-thread.png` is copied with the rest, and with none yet it prints the `"thread": true` capture to run). `--crop <px>`: the post's own crop (`shotMaxHeight`). A post that quotes another, reposts one or carries media is added with a `WARNING:` line (`--json`: `warnings`) — its screenshot shows them, by the post's own data. Play the cut's **Add post** runs this same write ([knobs.md](knobs.md#add-post-a-post-card-from-play-the-cut)) |
| `posts reel <project> --channel <slug> [--channel <slug> …] [--since YYYY-MM-DD] [--until YYYY-MM-DD] [--own] [--with-media] [--replies include\|only\|exclude] [--order chrono\|reverse] [--limit N] [--after <id\|->] [--dry-run] [--json]` | **POST ITEMS** ([report-video.md](report-video.md#post-items-a-post-as-an-entry-of-the-cut)): each archived post an entry of the cut -- its card drawn from the archive row (snapshotted), its attachments copied into `posts-media/` and played in it. The channels are read as one archive, merged in time order, de-duplicated by post id (`--channel ObviousRises-x --channel ObviousRises-x-replies`); `--own` the accounts' own posts (their config's `socialHandle`, no reposts); `--with-media` only posts whose capture holds an attachment; `--replies` keeps, keeps only or drops replies (a reply carries the posts it answers from the archive, else the capture's thread shot, else a "Replying to" line; the quoted post and the parent the archive lacks come from the capture's `context`, as `posts context` fills them). A post the cut already plays (by its id, a repost's original, a repost of it) is skipped, so a **re-run adds only what is new**; the rest goes in in ONE write (one undo point: `timeline <p> undo`), at the end unless `--after` |
-| `posts set-item <project> <item> [hold=<s>\|off] [layout=sequence\|grid] [redact=on\|off\|auto] [fit=read[:<linger>]] [media.<i>.start=<s>] [media.<i>.end=<s>] [media.<i>.trim=off] [media.<i>.mute=on\|off] [media.<i>.crop=x,y,w,h\|off] [media.<i>.push=on\|off] [media.<i>.blur=on\|off] [media.<i>.blur.strength=1–10] [media.<i>.blur.label="…"\|off] [media.<i>.blur.boxes=x,y,w,h;…\|off] [quoted.paraphrase="…"\|off] [parent.<i>.paraphrase="…"\|off] [follow=on\|off\|auto] [follow.dim=<0.2-1>] [follow.ease=<s>] [--json]` | a **post item's knobs** (the post bench's writer, `updatePostItem`; [knobs.md](knobs.md#a-post-item-a-post-as-an-entry-of-the-cut)): `<item>` is its id or the post's id; refused in the build's words. `quoted.paraphrase` / `parent.<i>.paraphrase`: your retelling of a long context post (≤ 600 characters), drawn in place of its words with a "paraphrased" label (its text kept); `off` or empty clears it. `follow=`: its read-follow ([knobs.md](knobs.md#read-follow-the-block-being-read-lit-the-card-panned-to-it)) -- `off`, `on`, `auto` (the cut's); `follow.dim=` / `follow.ease=` over the cut's `media.<i>.blur…` CENSORS the attachment in the render (a real blur of the whole frame or of its boxes, labelled "Censored"; the file untouched; merged key by key, `blur=off` keeps the settings) |
-| `posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script "…"] [--pick <n>] [--approve\|--unapprove] [--off\|--on] [lead= tail= ramp= linger= clip=read\|full wet= lowpass= duck=on\|off short=hold\|loop attach=under\|after lufs=]` · `<item> --take [--note "…"] [--voice v] [--engine e] [--speed s] [--script "…"]` · `<item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…` | a **narrated post item** ([report-video.md](report-video.md#narrated-post-items), [knobs.md](knobs.md#a-narrated-post-item)): `--import` reads `narration/posts/index.json` (`[{id, entry, script, takes: [{file, engine, voice, seconds}], pick}]`, and a take's `take-<n>.parts.json`) into the cut in ONE write, measuring each take (length, loudness); a re-run adds only takes not there. `--take` asks the EDITOR for a new take (`POST /api/ops/tts`, its `out` the next `narration/posts/<postId>/take-<n>.<engine>-<voice>.wav`; a job, waited for; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and picks it, its `--note` kept with it; `--pick <n>` is the take's number as `--list` shows it. `--derive <n>` makes a NEW take from take n through the editor's `voice-enhance` / `voice-convert` op (a stock synthetic voice; "not installed" until the editor has the engine), the original kept; `--delete <n>` moves a take's file to the post's `.trash/`. A new script or pick takes the approval away. `--all --draft-scripts` writes every post's words as its script, VERBATIM (cleaned only to be spoken: @handles, links, emoji dropped; `plan(s)` → plans, `w/` → with, `&` → and; paragraphs kept). `--cut` sets `render.postNarration` (and its read-follow: `follow=on\|off`, `follow.dim=`, `follow.ease=`). Refused in the build's words (**exit 1**) |
+| `posts set-item <project> <item> [hold=<s>\|off] [layout=sequence\|grid] [redact=on\|off\|auto] [fit=read[:<linger>]] [media.<i>.start=<s>] [media.<i>.end=<s>] [media.<i>.trim=off] [media.<i>.mute=on\|off] [media.<i>.crop=x,y,w,h\|off] [media.<i>.push=on\|off] [media.<i>.blur=on\|off] [media.<i>.blur.strength=1–10] [media.<i>.blur.label="…"\|off] [media.<i>.blur.boxes=x,y,w,h;…\|off] [quoted.paraphrase="…"\|off] [parent.<i>.paraphrase="…"\|off] [follow=on\|off\|auto] [follow.dim=<0.2-1>] [follow.ease=<s>] [thread.parent[.<i>]=auto\|full\|excerpt\|context\|carry\|hidden] [thread.quoted=…] [thread.carry=auto\|on\|off] [thread.reveal=on\|off] [thread.shrink=<0.3-1>] [thread.dim=<0.15-1>] [thread.seconds=<s>] [thread.pan=<s>] [thread=auto] [--json]` | a **post item's knobs** (the post bench's writer, `updatePostItem`; [knobs.md](knobs.md#a-post-item-a-post-as-an-entry-of-the-cut)): `<item>` is its id or the post's id; refused in the build's words. `quoted.paraphrase` / `parent.<i>.paraphrase`: your retelling of a long context post (≤ 600 characters), drawn in place of its words with a "paraphrased" label (its text kept); `off` or empty clears it. `follow=`: its read-follow ([knobs.md](knobs.md#read-follow-the-block-being-read-lit-the-card-panned-to-it)) -- `off`, `on`, `auto` (the cut's); `follow.dim=` / `follow.ease=` over the cut's. `thread.*`: its THREAD READ ([knobs.md](knobs.md#thread-reads-every-part-of-a-read-on-screen-while-it-is-said)) -- what each context post is on screen (`thread.parent.<i>` one parent, nearest first), the shrink, dim and their seconds, the pan's; `thread=auto` the cut's; a setting that would narrate a post the card hides is refused (**exit 1**). `media.<i>.blur…` CENSORS the attachment in the render (a real blur of the whole frame or of its boxes, labelled "Censored"; the file untouched; merged key by key, `blur=off` keeps the settings) |
+| `posts roles <project> [<item> …] [--write] [--set <n>=<role>,…] [--json]` | a narrated read **piece by piece** ([knobs.md](knobs.md#thread-reads-every-part-of-a-read-on-screen-while-it-is-said), [report-video.md](report-video.md#thread-reads)): the text each part of the picked take reads -- `parent:<i>`, `quoted`, `post`, `media:<i>` -- stored or inferred, what the card shows for each, and the build's guard (a part read off a post the card hides is refused). `--write` stores the inferred roles on the picked takes' parts (one write; the import stores them for every new take); `<item> --set n=role,…` sets parts' roles by hand (`off`: inferred again); a part out of range or an unknown role is refused (**exit 1**) |
+| `posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script "…"] [--pick <n>] [--approve\|--unapprove] [--off\|--on] [lead= tail= ramp= linger= clip=read\|full wet= lowpass= duck=on\|off short=hold\|loop attach=under\|after lufs=]` · `<item> --take [--note "…"] [--voice v] [--engine e] [--speed s] [--script "…"]` · `<item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…` | a **narrated post item** ([report-video.md](report-video.md#narrated-post-items), [knobs.md](knobs.md#a-narrated-post-item)): `--import` reads `narration/posts/index.json` (`[{id, entry, script, takes: [{file, engine, voice, seconds}], pick}]`, and a take's `take-<n>.parts.json`) into the cut in ONE write, measuring each take (length, loudness); a re-run adds only takes not there. `--take` asks the EDITOR for a new take (`POST /api/ops/tts`, its `out` the next `narration/posts/<postId>/take-<n>.<engine>-<voice>.wav`; a job, waited for; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and picks it, its `--note` kept with it; `--pick <n>` is the take's number as `--list` shows it. `--derive <n>` makes a NEW take from take n through the editor's `voice-enhance` / `voice-convert` op (a stock synthetic voice; "not installed" until the editor has the engine), the original kept; `--delete <n>` moves a take's file to the post's `.trash/`. A new script or pick takes the approval away. `--all --draft-scripts` writes every post's words as its script, VERBATIM (cleaned only to be spoken: @handles, links, emoji dropped; `plan(s)` → plans, `w/` → with, `&` → and; paragraphs kept). `--cut` sets `render.postNarration` (and its read-follow: `follow=on\|off`, `follow.dim=`, `follow.ease=`; its thread reads: `thread.parent=`, `thread.quoted=`, `thread.carry=`, `thread.reveal=`, `thread.shrink=`, `thread.dim=`, `thread.seconds=`, `thread.pan=`). Refused in the build's words (**exit 1**) |
| `posts fx <project> <item> [ls]` · `add word-zoom --match "…" [--target post\|quoted\|parent:<i>] [--occurrence n] [--at s] [--scale s] [--hold s] [--lead s] [--ease out\|inOut\|snap] [--highlight #rrggbb\|off]` · `set <n> [those flags; default clears one]` · `remove <n>` · `posts narrate <project> <item> --words [--worker <id>]` | a post item's **word zoom** ([report-video.md](report-video.md#a-word-zoom), [knobs.md](knobs.md#a-word-zoom-a-post-items-card-pushed-in-on-a-word-as-it-is-read)): the card pushed in on a word as it is read, a highlight under it, then back out -- through `updatePostFx`, refused in the build's words (a match not in the words, a knob out of bounds; **exit 1**). Its time is `--at`, else the word's start in the picked take's word timings; `ls` prints each zoom's time and where it came from. An un-narrated post's `add` fills `at` with the reading estimate. `--words` asks the EDITOR's transcribe op (`words: true`, a job per take or per part file; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and keeps the words heard, aligned to the script, on the take (`takes[i].words`) |
| `posts fit <project> [--all \| <item> …] [--linger <s>] [--dry-run] [--json]` · `posts set-item <project> <item> fit=read[:<linger>]` | narrated posts' video attachments cut to their **best part** for the read (lead + take + tail + linger): a scored scan of the sound (loudness, its peaks), the speech (a transcript) and the scene cuts, the start snapped to a pause or a cut, recorded with why (`narration.window`) -- ONE write; each post's old and new length printed. A video no longer than the read is left as it is |
| `posts avatar <project> [<handle> <image-file> \| <handle> off] [--json]` · `posts avatars <project> [--dry-run] [--json]` | the **authors' pictures** (`postAvatars`): `avatar` copies a picture into `posts-media/_avatars/` for every card that draws that handle (manual; never replaced by the archive's), `off` clears it, no handle lists them; `avatars` copies the archive's (the channels' `posts-media/_avatars/avatars.json`, capture-posts') for every author the cut's cards draw unblurred that it has none of. A blurred author never shows one |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -792,6 +792,24 @@ the card live on the same states the build shoots.
| `follow` on a post item — `false` (off on this post), or `{on, dim, ease}` over the cut's | post bench, **read-follow**: the cut's / on / off, **dim**, **ease** (saved with the bench's other knobs) | `umtool posts set-item <p> <item> follow=off` (`follow=on`, `follow=auto`: the cut's) · `follow.dim=0.7 follow.ease=0.4` | `POST /api/report/post-item {project, op: "set", id, patch: {follow}, token}` (an object merges; `null` clears) |
| the block map — each block of the card's words, its text, the part that reads it, its start on the item's clock | post bench, **read-follow**: the map's rows (click one: the playhead at its start; the one being read is marked) | — (`postItemPlan(entry, render).follow`) | — |
+## Thread reads (every part of a read on screen while it is said)
+
+A narrated post item that reads the post it answers or quotes draws the conversation
+([report-video.md](report-video.md#thread-reads): the roles, the modes, the motion, the guard;
+`report-to-video/post-thread.mjs`). The cut's knobs ride on `render.postNarration.thread`
+(`updatePostNarrationRender`), one post's on the item (`updatePostItem`), each refused in the
+build's words (`threadKnobErrors`); a `thread`/`follow` change that would narrate a post the card
+hides is refused with the fix. Its bench is the post bench's **thread read** block; Play the cut
+draws the same states the build shoots.
+
+| Knob | In umtool | From a terminal | Route |
+|---|---|---|---|
+| `render.postNarration.thread.parent` / `.quoted` — what a context post is on screen: `auto` (default: full when read, carried in when it is the item before, else context), `full`, `excerpt`, `context`, `carry` (parents), `hidden` | — | `umtool posts narrate <p> --cut thread.parent=full thread.quoted=context` (`default` clears one) | — |
+| `render.postNarration.thread.carry` — carry a parent that is the item before: `auto` (default), `true`, `false` · `.reveal` — the post read next fades in under the one before (default true) | — | `umtool posts narrate <p> --cut thread.carry=off thread.reveal=off` | — |
+| `render.postNarration.thread.shrink` — a context post's size, 0.3–1 (default 0.62) · `.dim` — its opacity, 0.15–1 (default 0.5) · `.seconds` — the change, 0–3 s (default 0.7) · `.pan` — the column's move, 0.1–3 s (default 0.7) | — | `umtool posts narrate <p> --cut thread.shrink=0.55 thread.dim=0.4 thread.seconds=0.9 thread.pan=1` | — |
+| `thread` on a post item — `{parent?, quoted?, carry?, reveal?, shrink?, dim?, seconds?, pan?}` over the cut's (`parent` one mode, or a list, nearest parent first) | post bench, **thread read**: the post it answers / its parent / the quoted post (the cut's, or a mode), **carry**, **shrink**, **dim**, **over**, **pan**; the guard's refusals listed before Save | `umtool posts set-item <p> <item> thread.parent=excerpt` · `thread.parent.1=hidden` · `thread.quoted=context` · `thread.carry=off` · `thread.shrink=0.5` … · `thread=auto` (the cut's) | `POST /api/report/post-item {project, op: "set", id, patch: {thread}, token}` (an object merges; `null` clears) |
+| a part's role — the text it reads: `parent:<i>`, `quoted`, `post`, `media:<i>` (stored, else inferred) | post bench, **thread read**: the read piece by piece (click one: the playhead at its start; `·` marks an inferred role) | `umtool posts roles <p> [<item> …]` (list, with the guard's verdict) · `--write` (store the inferred roles) · `<item> --set 3=parent:0,4=post` (`off`: inferred again) | — (`updatePostNarration {partRoles: {take, roles}}`) |
+
## The combo counter
A post item that plays an attachment an earlier post item of the cut already played gets a fighting-game badge,
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -762,6 +762,78 @@ at their peak). **Play** sets the same states on its card page each tick; the po
when (click: the playhead there), the one being read marked — and the post's knobs
([knobs.md](knobs.md#read-follow-the-block-being-read-lit-the-card-panned-to-it)).
+### Thread reads
+
+A narrated post item whose read reads the POST IT ANSWERS or THE POST IT QUOTES is drawn as
+the conversation, and every part of the read is on screen, legible and lit while it is said
+(`report-to-video/post-thread.mjs`; operator, 3–4 Nov: "when narrating a reply parent you're
+just narrating hidden text. Rework the thread system so you're never narrating hidden text"
+— "If it's a big reply that we're reading, show the parent in full then transition in the
+reply as the parent shrinks and goes dim"; and earlier "start with the first post in the
+chain, then reveal the rest of the thread as we read through, pushing older posts up top").
+Before it, a parent was drawn 22 px high and clamped to four lines while a voice read all of
+it, and read-follow only knew the post's own words.
+
+**The pieces and their roles.** The narration batch assembles a read as PIECES — [the post it
+answers (voice `leo`, his own `zac`)] + [the post it quotes] + [his words] (a parent that is
+the item just before in the cut is left out) — each split into parts, `para` = piece × 100 +
+paragraph. Each part has a ROLE, the text it reads: `parent:<i>` (nearest first), `quoted`,
+`post`, or `media:<i>` (words read off an attachment — the screenshot of a reply he answers).
+A part's role is its own (`parts[k].role`: the import stores the inferred role of every new
+take's parts; `umtool posts roles <p> --write` stores them on the takes before it; `--set n=role`
+sets one by hand), else INFERRED: the parts grouped by piece, each piece matched to the text it
+reads by its WORD PAIRS (a bag of words matched a short parent to a 700-word post), against
+every form of each text (as written, its paraphrase, as a voice says it — draftScript), a new
+piece taking the next text along; a piece no text holds is an attachment's when the post has a
+picture, else no text's. Checked over the three Mr. Obvious cuts (395 reads): every read's
+pieces in the batch's order, his words last.
+
+**The card.** Narrated, following (read-follow on), with a context post drawn, the card is a
+column of TILES in one flow — the parents oldest first, his post, the quoted post inside it —
+each tile's words at the size that fits it alone in the card (at least 28 px of a 1080 frame),
+whole: no line clamp. read-follow's blocks span every tile (the parts matched to their roles'
+texts), and its pan moves the whole column. What each context post is on screen is its MODE:
+
+| mode | on screen |
+|---|---|
+| `full` | in full, the frame's focus while it is read (a long one panned paragraph by paragraph) |
+| `excerpt` | as full, its paragraphs no part reads left out (labelled "excerpt") |
+| `context` | small and dim the whole item; never read |
+| `carry` | a parent the read skips because it is the item just before: it opens as that item ended — in full — and gives way as the read begins (no cold cut) |
+| `hidden` | not drawn; never read |
+| `auto` (default) | `full` when the read reads it, `carry` when it is the item before (`carry: "auto"`), else `context` |
+
+**The motion.** A tile read is in full while it is read; when the next piece starts it SHRINKS
+(`shrink`, 0.62) about its corner and DIMS (`dim`, 0.5) over `seconds` (0.7), starting 0.4 s
+before that piece, while the tile read next is REVEALED under it (`reveal`) — his reply
+fades in as the parent gives way; older up top. A quoted post is never shrunk: it dims once
+read. The column pans (`pan` s, eased, from the same moment) so a new piece sits under a strip
+(30 % of the window) of the post it answers, its first block whole in view; a later block
+running past the window's foot is brought up just far enough; a block taller than the window
+pans on through it. A conversation shorter than the window is centred in it. A part read off
+an attachment lights no block (all dim: the picture is the thing being read).
+
+```jsonc
+"render": { "postNarration": { "thread": { "parent": "auto", "quoted": "auto", "carry": "auto", "reveal": true,
+ "shrink": 0.62, "dim": 0.5, "seconds": 0.7, "pan": 0.7 } } }, // the cut's
+"thread": { "parent": ["full", "context"], "shrink": 0.5 } // one post's, over the cut's (parent: one mode, or one per parent, nearest first)
+```
+
+**The guard.** NEVER NARRATE HIDDEN TEXT: the build's lint (`validateThreadReads`) refuses a
+post item whose take reads a part of a post drawn `hidden` or `context`, a part no text on the
+card holds, or a threaded read with read-follow off — each with the fix (show it, set the
+part's role, or re-make the read without it). The item writer refuses a `thread`/`follow`
+change that would do it (`updatePostItem`: the post bench's Save, `posts set-item`), and the
+post bench's **thread read** block shows the refusal before Save.
+
+**The render and Play** are read-follow's: the state at a second carries each tile's scale and
+opacity (`tiles`), the page's slots are closed up to match (`data-thread-slot`,
+`data-thread-tile`), the geometry is measured once at full size and worked out under the scales
+(threadGeoAt), and the build shoots each distinct state once. The plan's `follow.thread` is
+the tiles' schedule; `postItemPlan(entry, render, { prev })` takes the item before it (the
+build, Play, the bench and the card route pass it). Not narrated, or with no context post
+drawn, the card is as it was.
+
### The combo counter
When a post item's attachment is one an EARLIER post item of the cut already played —
diff --git a/umtool/e2e/thread-reads.spec.ts b/umtool/e2e/thread-reads.spec.ts
@@ -0,0 +1,157 @@
+import { test, expect, type FrameLocator, 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";
+
+// ---------------------------------------------------------------------------
+// THREAD READS (report-to-video/post-thread.mjs; knobs.md, "Thread reads";
+// operator, 4 Nov: "when narrating a reply parent you're just narrating hidden
+// text ... show the parent in full then transition in the reply as the parent
+// shrinks and goes dim"). Fixture: e2e/fixtures/post-narration-fixture.mjs's
+// p-13, made a reply here: the post it answers read first (three parts), then
+// his reply (two parts) -- as the narration batch assembles a read.
+//
+// THREAD_READS_SHOTS=<dir> screenshots there
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const DIR = path.join(HERE, "..", ".e2e-song", "reports", "post-narration-fixture");
+const MANIFEST = path.join(DIR, "video.manifest.json");
+const PROJECT = "reports/post-narration-fixture";
+const SHOTS = process.env.THREAD_READS_SHOTS ?? null;
+
+const say = (i: number) => `Paragraph ${i} of the neighbour's post goes on about the noise from the street, ${"and the lights in the hall that keep going out without any warning at all, ".repeat(2)}until it stops at mark ${i}.`;
+const PARENT = [1, 2, 3].map(say).join("\n\n");
+const REPLY = "That is exactly what I was saying yesterday morning to everyone.\n\nWe should have bought the generator back in the spring.";
+
+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 });
+ // p-13 a reply, read [the post it answers] + [his words], part by part (3 s a part, the batch's pauses).
+ const m = JSON.parse(readFileSync(MANIFEST, "utf8"));
+ const e = m.timeline.find((x: { id: string }) => x.id === "p-13");
+ e.text = REPLY;
+ e.parents = [{ id: "900", author: "Some Neighbour", handle: "neighbour_one", date: "2026-10-29T10:00:00.000Z", text: PARENT }];
+ const paras = [...PARENT.split("\n\n").map((t, k) => ({ para: k, text: t })), ...REPLY.split("\n\n").map((t, k) => ({ para: 100 + k, text: t }))];
+ const starts = [0, 3.6, 7.2, 11, 14.6];
+ e.narration = {
+ script: REPLY,
+ takes: [{ file: "narration/posts/11/take-1.orpheus-zac.wav", engine: "orpheus", voice: "leo+zac", seconds: 17.6, script: `${PARENT}\n\n${REPLY}`, parts: paras.map((p, i) => ({ n: i + 1, ...p, start: starts[i], seconds: 3 })) }],
+ pick: 0,
+ };
+ writeFileSync(MANIFEST, JSON.stringify(m, null, 2) + "\n");
+});
+
+/** A block's box against the card's window (the words' window), in the card page. */
+const inWindow = (frame: FrameLocator, k: string) =>
+ frame.locator("[data-post-words]").evaluate((w, k) => {
+ const r = w.getBoundingClientRect();
+ const b = (w.querySelector(`[data-post-block="${k}"]`) as HTMLElement).getBoundingClientRect();
+ return { top: b.top - r.top, bottom: b.bottom - r.top, height: r.height, op: (w.querySelector(`[data-post-block="${k}"]`) as HTMLElement).style.opacity };
+ }, k);
+const tileOf = (frame: FrameLocator, scope: string) =>
+ frame.locator(`[data-thread-slot="${scope}"]`).evaluate((el) => {
+ const t = el.querySelector("[data-thread-tile]") as HTMLElement;
+ const w = document.querySelector("[data-post-words]")!.getBoundingClientRect();
+ const r = el.getBoundingClientRect();
+ return { state: el.getAttribute("data-thread-state"), transform: t.style.transform, opacity: t.style.opacity, top: r.top - w.top, bottom: r.bottom - w.top };
+ });
+
+/** Play opened paused `at` seconds into p-13. */
+async function playAt(page: Page, at: number) {
+ await page.goto(urls.playHref(PROJECT, { bare: true, clip: "p-13", at }));
+ const player = page.locator('[data-post-play="p-13"]');
+ await expect(player).toHaveAttribute("data-post-thread", "2", { timeout: 15_000 });
+ const frame = page.frameLocator('[data-post-card-frame="read"]');
+ await expect(frame.locator("body")).toHaveAttribute("data-post-thread", "2", { timeout: 15_000 });
+ await expect(player).toHaveAttribute("data-post-s", String(at));
+ return { player, frame };
+}
+
+test("NEVER NARRATE HIDDEN TEXT, in Play: the post it answers in full and lit while its parts play -- in the window, panned to -- his reply hidden under it", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ for (const [at, part] of [[1.5, 0], [5.5, 1], [9.2, 2]] as const) {
+ const { player, frame } = await playAt(page, at);
+ // The block being read is the parent's, part by part.
+ const k = await player.getAttribute("data-post-follow-block");
+ await expect(frame.locator(`[data-thread-tile="parent:0"] [data-post-block="${k}"]`)).toHaveCount(1);
+ const blocks = await frame.locator('[data-thread-tile="parent:0"] [data-post-block]').evaluateAll((els) => els.map((el) => el.getAttribute("data-post-block")));
+ expect(blocks[part]).toBe(k);
+ await expect(player).toHaveAttribute("data-post-thread-tiles", /parent:0=1\/1 post=1\/0/);
+ const t = await tileOf(frame, "parent:0");
+ expect(t.state).toBe("focus");
+ expect(t.transform).toBe("");
+ // Lit (full strength) and inside the window.
+ await expect.poll(async () => (await inWindow(frame, k!)).op).toBe("");
+ const b = await inWindow(frame, k!);
+ expect(b.top).toBeGreaterThanOrEqual(-1);
+ expect(b.bottom).toBeLessThanOrEqual(b.height + 1);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, `thread-parent-part-${part + 1}.png`) });
+ }
+});
+
+test("THE REPLY COMES IN: as his first part starts the parent shrinks and dims (it stays above), his reply is revealed, lit and in the window", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ // Mid-change (his part at 0.4 + 11 = 11.4 s; the change from 11.0 s over 0.7 s).
+ {
+ const { player, frame } = await playAt(page, 11.35);
+ const tiles = (await player.getAttribute("data-post-thread-tiles"))!;
+ const [, sc, op] = /parent:0=([\d.]+)\/([\d.]+)/.exec(tiles)!;
+ expect(Number(sc)).toBeGreaterThan(0.62);
+ expect(Number(sc)).toBeLessThan(1);
+ expect(Number(op)).toBeLessThan(1);
+ expect((await tileOf(frame, "parent:0")).transform).toMatch(/^scale\(0\.\d+\)$/);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "thread-transition.png") });
+ }
+ for (const [at, part] of [[12.5, 0], [16, 1]] as const) {
+ const { player, frame } = await playAt(page, at);
+ await expect(player).toHaveAttribute("data-post-thread-tiles", "parent:0=0.62/0.5 post=1/1");
+ const k = await player.getAttribute("data-post-follow-block");
+ const mine = await frame.locator('[data-thread-tile="post"] [data-post-block]').evaluateAll((els) => els.map((el) => el.getAttribute("data-post-block")));
+ expect(mine[part]).toBe(k);
+ const parent = await tileOf(frame, "parent:0");
+ expect(parent.state).toBe("context");
+ expect(parent.transform).toBe("scale(0.62)");
+ expect(parent.opacity).toBe("0.5");
+ await expect.poll(async () => (await inWindow(frame, k!)).op).toBe("");
+ const b = await inWindow(frame, k!);
+ expect(b.top).toBeGreaterThanOrEqual(-1);
+ expect(b.bottom).toBeLessThanOrEqual(b.height + 1);
+ // Older up top: the parent's foot is still in the window, above his post.
+ const post = await tileOf(frame, "post");
+ expect(parent.bottom).toBeGreaterThan(0);
+ expect(parent.bottom).toBeLessThanOrEqual(post.top + 1);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, `thread-reply-part-${part + 1}.png`) });
+ }
+});
+
+test("the bench: the read piece by piece, what each post is on screen; hiding the post it reads is shown and refused by Save", async ({ page }) => {
+ await page.setViewportSize({ width: 1500, height: 1100 });
+ await page.goto(urls.postBenchHref(PROJECT, "p-13"));
+ const panel = page.locator("[data-post-thread-panel]");
+ await expect(panel).toHaveAttribute("data-threaded", "1");
+ await expect(panel.locator("[data-post-thread-piece]")).toHaveCount(2);
+ await expect(panel.locator('[data-post-thread-piece="parent:0"]')).toContainText("the post it answers");
+ await expect(panel.locator('[data-post-thread-piece="post"]')).toContainText("his words");
+ // A piece's row puts the playhead at its start (his first part: 0.4 + 11).
+ await panel.locator('[data-post-thread-piece="post"] button').click();
+ await expect(page.locator("[data-post-bench-clock]")).toHaveText(/^11\.4 \//);
+ // Hide the post it reads: the guard says so here, and Save is refused.
+ await panel.locator('[data-post-thread-mode="parent:0"]').selectOption("hidden");
+ await expect(panel.locator("[data-post-thread-errors]")).toContainText("drawn hidden");
+ await page.locator("[data-post-bench-save]").click();
+ await expect(page.locator("[data-post-bench-error]")).toContainText("drawn hidden");
+ expect(JSON.parse(readFileSync(MANIFEST, "utf8")).timeline.find((x: { id: string }) => x.id === "p-13").thread).toBeUndefined();
+ // A shrink of its own saves.
+ await panel.locator('[data-post-thread-mode="parent:0"]').selectOption("");
+ await panel.locator('[data-post-thread-knob="shrink"]').fill("0.5");
+ await page.locator("[data-post-bench-save]").click();
+ await expect.poll(() => JSON.parse(readFileSync(MANIFEST, "utf8")).timeline.find((x: { id: string }) => x.id === "p-13").thread).toEqual({ shrink: 0.5 });
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "thread-bench.png") });
+});