commit cba9dc84b1ac3a63856770bc36715092be846495
parent dec12d8b5aeb6934094476e09a3c12be01da0d98
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 2 Nov 2026 18:45:28 -0500
umtool docs + e2e: post items -- the shape, the duration rule, the privacy rule, the knobs and the reel; post-items.spec.ts
report-video.md "Post items: a post as an entry of the cut": the entry, how it plays (the
card from the archived post, the layouts, the attachments), the duration rule's table, the
privacy rule (capture-posts' thread-parent rule applied to every other author a card
draws), `umtool posts reel` and what every writer does with one. knobs.md "A post item":
hold, mediaLayout, redact, an attachment's start/end, mute, crop, push and words, each
with its bench field, its CLI and its route. cli.md: posts reel, posts set-item, new
--from-posts, timeline insert post:<channel>/<postId>.
e2e/post-items.spec.ts on post-items-fixture (a clip and three post items from a
synthesized archive with a picture and a 4 s video with a tone): the Cut tab's mixed rows
(the glyph, what each carries, the rule's seconds); Play plays the video post -- the card's
page, the private parent blurred and never named, the video playing unmuted while the
clock advances, Edit this post and Back; the bench trims the video and saves it (a trim
under half a second refused in the build's words); `posts reel` adds only what is new.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
6 files changed, 375 insertions(+), 0 deletions(-)
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -81,6 +81,10 @@ Inbox cannot disagree about what is wrong with one.
| `scenes <project> <clip> [--black-min 0.05] [--threshold 8] [--pix-th 0.10] [--pad 30 \| --from S --to S] [--json]` | the picture's **scene cuts** (ffmpeg `scdet`, score ≥ threshold) and **black spans** (`blackdetect`) in the clip's fetched window, in SOURCE seconds — for `blur.from`/`blur.to` and trims ([knobs.md](knobs.md#a-clips-picture-blurred)). The window is the one the build would cut from (the project's `out/clips-raw`, the editor's `channels/<slug>/data/<id>/clips/`, a saved source); the extent ± `--pad` inside it is scanned. Nothing is fetched: **exit 1** with no window on disk (`fetch` first) |
| `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). 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] [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] [--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 |
+| `new <slug> --from-posts <channel> [--channel <more>…] [--since D] [--until D] [--own] [--with-media] [--replies …] [--order …] [--limit N]` | a **posts reel**: the scaffold with the deck on (no `siteOrigin`: each post's QR opens the post, `deck.qr.links: "original"`), then `posts reel` with the same filters |
+| `timeline <project> insert (--after <id\|-> \| --to-section N \| --group G) post:<channel>/<postId> [--id ID]` | **one post item** among the cut's entries, made as `posts reel` makes one |
| `modules list [--json]` · `modules apply <project> [--config FILE] [--dry-run] [--json]` · `modules apply <project> [--config FILE] --take <id> [--label L] [--at S --dur S \| --full] [--quick] [--force] [--from TAKE] [--keep-frames] [--patch-out FILE]` | the **video modules** (release 39): `list` every module, its kind, slot and where its settings live; `apply` maps the project's `module-config.json` (the modules a video wants, in MODULES-DESIGN's vocabulary) into the manifest's homes (`report-to-video/modules/config-loader.mjs`) — the preset, the deck's subtitle and QR, the counter's series and each clip's marks, the stamps, the rail's markers, the chapters, the pairs, the status ledger, the intro, the finale — and lists every field with no home, by path. Without `--take` the manifest is rewritten through `replaceManifest` (a snapshot first); with `--take` it is that take's patch (`takes/<id>.modules-patch.json`, or `--patch-out`) and the take is made from it as `take` makes one, the manifest untouched. **Exit 1** when the result would not build (the build's sentences) ([knobs.md](knobs.md#look-presets)) |
| `preset list [--json]` · `preset show <name> [--json]` · `preset save <name> --from <project> [--description D] [--force]` · `preset apply <name\|none> <project>` | the **look presets** (`umtool/presets/<name>.json`, or `UMTOOL_PRESETS_DIR`): a render block a manifest stands on (`"preset": "<name>"`), laid under it — preset → manifest → style → take patch. `save` keeps a project's look and leaves its content out; `apply` names the preset on the cut through `updatePreset` (nothing copied in), refused when the cut over it would not build ([knobs.md](knobs.md#look-presets)) |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -634,6 +634,32 @@ post** (`components/projects/review/AddPost.tsx`, `/api/report/post-cards`, `lib
| add | a captured hit: **crop** (optional, px) and **Add to <clip>** — the clip on screen (a card on screen: the clip its date picks) — through `posts add`'s own write (`addPostFromArchive`: the capture copied into `posts-media/<slug>/<postId>/`, `upsertPost`, an undo point); the playhead goes to the clip's end and the deck is composed again, so the card shows on its clip | `umtool posts add <p> <slug>/<postId> --attach <clip> [--crop <px>]` | `POST {op: "add", channel, id, attach?, crop?}` |
| crop a post in the cut | **posts in the cut**: **crop** + **Save crop** (`posts[].shotMaxHeight`, above) | `umtool posts set <p> <post> crop=<px>\|off` | `POST {op: "crop", post, crop}` |
+## A post item (a post as an entry of the cut)
+
+A post played as a timeline entry of its own -- its card and its attachments, beside clips or as a whole reel
+([report-video.md](report-video.md#post-items-a-post-as-an-entry-of-the-cut): the shape, the duration rule, the privacy
+rule). Made by `umtool posts reel` (or `umtool new <p> --from-posts <slug>`, `umtool timeline <p> insert … post:<channel>/<postId>`);
+its knobs are one writer, `updatePostItem` (`lib/report/manifest.mjs`), refused in the build's words (`validatePostItem`).
+`null` / `off` clears a knob. Its bench is `/projects/<p>/post/<id>` (the Cut tab's row **bench**, Play's **Edit this post**).
+
+| Knob | In umtool | From a terminal | Route |
+|---|---|---|---|
+| `hold` — the item's whole length in seconds (1–120; absent: the duration rule) | post bench, **hold** | `umtool posts set-item <p> <item> hold=12` (`hold=off`) | `POST /api/report/post-item {project, op: "set", id, patch: {hold}, token}` |
+| `mediaLayout` — `grid`: its 2-4 images at once (3.5 s + 1 per extra); absent: one after another | post bench, **images** | `layout=grid` (`layout=sequence`) | same, `patch: {mediaLayout}` |
+| `redact` — other authors (the posts it answers, the one it quotes, a repost's original): absent, the privacy rule (blurred unless a subject or gold/grey verified); `false` shows them (judged public); `true` blurs even the verified | post bench, **other authors** | `redact=off` · `redact=on` · `redact=auto` | same, `patch: {redact}` |
+| `media[i].start`, `media[i].end` — a video's or a GIF's in and out, its own seconds (at least 0.5 s apart) | post bench, **in / out**, **In at playhead**, **Out at playhead**, **Whole** | `media.0.start=1.5 media.0.end=6` · `media.0.trim=off` | same, `patch: {media: {"0": {start, end}}}` |
+| `media[i].mute` — `true`: the video plays silent | post bench, **its sound** | `media.0.mute=on` (`=off`) | same |
+| `media[i].crop` — `[x, y, w, h]`, fractions of the picture: what of it is shown | post bench, **crop** (none, centre 80%, top half, bottom half) | `media.0.crop=0,0.1,1,0.8` (`=off`) | same |
+| `media[i].push` — an image's slow push-in (6% over its span) | post bench, **slow push-in** | `media.0.push=on` | same |
+| `media[i].words` — a video's transcript (`{cues: [{start, end, text}]}` beside it), its words shown under it in Play and the render | post bench, **Transcribe its words (the editor)**: the editor's `transcribe` op on the file (a job on a local worker), set when it is done | `pnpm ops transcribe --json '{"path": "<project>/posts-media/…_1.mp4", "words": true, "out": "<project>/posts-media/…_1.words.json"}'`, then set `words` by the bench | `POST {op: "transcribe", id, media}` → `{jobId}` · `GET ?project&id&media&job=` |
+
+| | In umtool | From a terminal | Route |
+|---|---|---|---|
+| a posts reel: the archive's posts as post items, re-run to add only what is new (one write, one undo point) | — | `umtool posts reel <p> --channel <slug> [--channel …] [--since D] [--until D] [--own] [--with-media] [--replies include\|only\|exclude] [--order chrono\|reverse] [--limit N] [--after <id\|->] [--dry-run]` | — |
+| one post item among clips | — | `umtool timeline <p> insert --after <id\|-> post:<channel>/<postId> [--id ID]` (or `--to-section N`, `--group G`) | `POST /api/report/timeline {op: "insert", …}` with an entry |
+| move, remove, a section, a group | the Cut tab's row (⠿, ⋯, the section bars), Play's reel strip | `umtool timeline <p> move\|remove\|section-move\|section-add …` | as a clip's |
+| the card's page, an attachment, the faces | Play the cut, the post bench | — | `GET /api/report/post-item?project&id&w&h[&phase][&take]` · `?project&file=posts-media/…` · `?project&font=regular\|bold` |
+
## The source backlog (Sources · Prioritize · Re-sweep when complete)
The Overview tab's **sources** line (`components/projects/report/SourceBacklog.tsx`, `lib/report/sourceBacklog.*`): for each
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -402,6 +402,113 @@ A still **never derives** a QR target. A clip's code is derived from the archive
that serves it; a screenshot has no such archive, and a code that resolves to the
wrong place is worse than no code — so only an explicit `citeUrl` draws one.
+### Post items: a post as an entry of the cut
+
+A post card laid OVER a clip (`posts[]`, the deck's feed and popups) says what was
+posted while somebody talks. A **post item** is the post itself as an entry of the
+timeline — a slide of its own, with its attachments played in it — so a cut can be a
+reel of somebody's posts (*"a video dedicated to the Mr. Obvious tweets, playing all
+the recent ones like a slideshow and playing the attachments"*), or mix posts and clips
+freely. `report-to-video/post-item.mjs` is the model (pure: the build, Play, the writers
+and the lint read the same rules), `post-render.mjs` the render, `lib/report/postReel.mjs`
+the generator.
+
+```jsonc
+{ "type": "post", "id": "p-2116052735661654457",
+ "post": "ObviousRises-x/2116052735661654457", // <archive channel>/<postId>: where it came from
+ // The archive row, SNAPSHOTTED when it went in -- the cut renders the words and the
+ // counts it was made with, not whatever the archive says next week:
+ "platform": "x", "author": "MR. OBVIOUS", "handle": "ObviousRises",
+ "date": "2026-10-30T06:21:01.000Z", "text": "I am at my wits end …",
+ "url": "https://x.com/ObviousRises/status/2116052735661654457",
+ "engagement": { "likes": 479, "reposts": 36, "replies": 17, "quotes": 1 },
+ "subjects": ["ObviousRises"], // the accounts the cut is about (the privacy rule)
+ "repostedBy": { "author": "…", "handle": "…" }, // a repost: drawn as its original, "↻ … reposted"
+ "parents": [{ "id": "…", "author": "…", "handle": "…", "text": "…", "date": "…" }], // a reply: what it answers, nearest first (≤ 2)
+ "parentShot": "posts-media/<slug>/<id>/shot-thread.png", // …else the capture's thread shot
+ "replyingTo": "handle", // …else a "Replying to @…" line
+ "quoted": { "author": "…", "handle": "…", "text": "…" }, // the post it quotes
+ "media": [{ "src": "posts-media/ObviousRises-x/2116052735661654457/…_1.mp4", // copied INTO the project
+ "kind": "video", "seconds": 4.992, "width": 1080, "height": 1350, "audio": true,
+ "start": 0.5, "end": 4, "mute": false, // a video's or a GIF's trim, its sound
+ "crop": [0, 0.1, 1, 0.8], // [x, y, w, h], fractions of the picture
+ "push": true, // an image: a slow push-in
+ "words": "posts-media/…/…_1.words.json" }], // a video's transcript (the editor's)
+ "mediaLayout": "grid", // 2-4 images at once, not one after another
+ "hold": 12, // the item's whole length, overriding the rule
+ "redact": false } // other authors: false shows them, true blurs even verified ones
+```
+
+**How it plays.** A native card drawn from the snapshot — the author's name and
+handle, the date, the words, the counts, "reposted by", the posts it answers above it
+(a thread line down to it), the post it quotes inside it — in the deck's palette and
+faces, by the browser the build already uses for the chrome (`postCardHtml`; never a
+screenshot of the platform). Its attachments play inside it: the words are read
+first, then each attachment in turn — a video with its sound, from its trim; a GIF
+looped; an image held (pushed in on with `push`); 2-4 images at once with
+`mediaLayout: "grid"`. The layout (`postLayout`) is decided from the words: no
+attachment, the card alone; words that fit beside the attachments at a readable size,
+the card on the left and the attachments in a slot on the right, the first one's
+first frame up while the words are read; words that do not, the card alone while it
+is read, then the attachments large under a strip naming the post. Under the deck it
+is framed into the footage box like a clip, so the rail's pip, the section bars and
+the date (its day; the subtitle "author @handle on X", "reposted on X", "replying on
+X") ride over it; its QR is the post (`deckQrUrl`: its own page, or its archive's
+under `qr.links: "archive"` with a `siteChannel`).
+
+**The duration rule** (`post-item.mjs`, `POST_READ` and its neighbours):
+
+| | seconds |
+|---|---|
+| reading the post | `clamp(1 + words / 3, 3, 15)` — 3 words a second (about 180 a minute), a second to find the text first; the cap keeps a 500-word post from stalling the reel (it is shown at the size that fits, and `hold` gives it more) |
+| + each post it answers, and the post it quotes | `clamp(words / 3, 1, 4)` — context, not the post |
+| + a video | its trimmed span, `end − start` (at least 0.5) |
+| + a GIF | looped to at least 3 s (one pass when longer, at most 10) |
+| + an image | 3.5 |
+| + a grid of 2-4 images | 3.5 + 1 per image after the first |
+| `hold` | replaces the whole: a longer hold holds the last thing up, a shorter one cuts the attachments short at it |
+
+Words are runs of non-space; a link is one word; a repost's `RT @x:` prefix is its
+"reposted" line, not words.
+
+**The privacy rule** (`authorRedaction`) is the one capture-posts applies to a thread
+parent (`common/social/xThreadShot.ts`), applied to every OTHER author a card draws —
+the posts it answers, the post it quotes, a repost's original, and the post's own
+author when the item names its `subjects` and it is not one: the avatar, the name and
+the @handle are blurred (never in the page at all — a blurred stand-in is drawn) and
+so is an @mention of them in the words, UNLESS the author is a subject (the reel's
+accounts: a self-thread, his own post reposted), or the archive says they carry an
+organisation's gold check or a government's grey one (`badge`: X's blue check is
+bought, so a blue-checked private person is blurred like any other), or the item says
+`redact: false` (judged public). `redact: true` blurs even those; an author the
+archive does not name is blurred. The words of the post stay: what was said is the
+evidence, who a private person is, is not.
+
+**Made by `umtool posts reel`** ([cli.md](cli.md)): one or more channels' archives
+read as one, merged in time order, de-duplicated by post id (a profile's posts and
+its replies are two channels: `--channel ObviousRises-x --channel
+ObviousRises-x-replies`), filtered (`--since`, `--until`, `--own`, `--with-media`,
+`--replies include|only|exclude`, `--order`, `--limit`), every post the cut already
+plays skipped — by its id, as a repost's original, or reposted by one — so a re-run
+adds only what is new, and the rest put in through ONE write (`insertEntries`: one
+undo point, refused whole in the build's words). A reply's parents come from the
+archive (the replies channel carries the posts he answered), else from the capture's
+`shot-thread.png`, else a "Replying to" line. The attachments are COPIED into the
+project's `posts-media/` and measured (ffprobe: pixels, length, sound; X serves a GIF
+as a silent mp4 from `tweet_video/`). `umtool new <p> --from-posts <slug>` scaffolds a
+posts reel (the deck on; with no `siteOrigin` each QR opens the post), and `umtool
+timeline <p> insert … post:<channel>/<postId>` puts one in among clips.
+
+**Every writer takes it as it takes a clip**: move, remove, duplicate, undo; a deck
+marker may follow a post item and a section or a claim group may hold one
+(`sectionEdit`, `claimGroups`, `patchMarkers`, `reanchorAfterRemove`), and a take's
+timeline carries it as data (a take's walk opens clips only). Its knobs are `updatePostItem` (`umtool posts set-item`,
+the post bench). Play the cut plays it (the card from the same page, the attachments
+on Play's clock); the Cut tab lists it with its own glyph; the post bench
+(`/projects/<p>/post/<id>`) trims a video, sets the hold, the crop and the blur, and
+asks the editor to transcribe a video's words (`pnpm ops transcribe`'s op: a local
+file, a job; never ASR by hand), which then show under it in Play and the render.
+
## The on-screen deck (`render.chrome`)
Its knobs — the stamp's moment and count per clip, the stamp's look and words, the markers, a clip's sync and
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -53,6 +53,7 @@ import { makePlayCutFixture } from "./play-cut-fixture.mjs";
import { makeCutEditingFixture } from "./cut-editing-fixture.mjs";
import { makeReelFixture } from "./reel-fixture.mjs";
import { makeIntakeFixture } from "./intake-fixture.mjs";
+import { makePostItemsFixture } from "./post-items-fixture.mjs";
const CODE = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", "..", "song");
const dest = path.resolve(process.argv[2] ?? path.join(process.cwd(), ".e2e-song"));
@@ -1907,6 +1908,8 @@ makeCutEditingFixture({ reports, manifest, deckManifest, cachedWindow: path.join
makeReelFixture({ reports, deckManifest });
// The intake (UI notes 2026-10-30, items 13, 14, 16): the candidates inbox, the source backlog, Add post (intake specs).
makeIntakeFixture({ reports, channels: CHANNELS, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
+// Post items (report-to-video/post-item.mjs): a cut mixing a clip and posts played as items, a synthesized posts archive (post-items.spec.ts).
+makePostItemsFixture({ reports, channels: CHANNELS, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
// Gaps inside a clip and the bench waveform's zoom (gaps-zoom.spec.ts), which WRITES (gaps cut,
// undone, put back): its own project on gapvid, a recording id of its own (the fixture's vid1
// window -- tone, silences at 2.9-3.1 and 5.9-6.1 -- so nothing another spec fetches moves it).
diff --git a/umtool/e2e/fixtures/post-items-fixture.mjs b/umtool/e2e/fixtures/post-items-fixture.mjs
@@ -0,0 +1,97 @@
+// POST ITEMS (report-to-video/post-item.mjs): a cut that mixes clips and posts
+// played as items of their own (post-items.spec.ts).
+//
+// post-items-fixture c01 a clip (playvid, the fixture's synthetic window,
+// cached in out/clips-raw), then three post items from a
+// SYNTHESIZED posts archive, channels/postchan-x:
+// p-txt text only (a self-reply: its parent drawn
+// above it, the subject's, plain)
+// p-img a picture (posts-media/…/2_1.png, 320×180)
+// p-vid a video with sound (posts-media/…/3_1.mp4,
+// 4 s testsrc 320×180, a 440 Hz tone), a
+// reply to a PRIVATE account (blurred)
+// the deck on, one section after c01. The archive also
+// holds a fourth post (4, text) the reel spec adds.
+// WRITES its manifest (the bench's trim): the spec puts
+// it back before each test.
+//
+// Synthetic, like every fixture.
+import { copyFileSync, mkdirSync, writeFileSync } from "node:fs";
+import { spawnSync } from "node:child_process";
+import path from "node:path";
+
+const ff = (args) => {
+ const r = spawnSync("ffmpeg", ["-v", "error", "-y", ...args]);
+ if (r.status !== 0) throw new Error(`ffmpeg ${args.join(" ")}: ${String(r.stderr)}`);
+};
+
+export const POST_CHANNEL = "postchan-x";
+
+const row = (id, o) => ({
+ id, slug: `${POST_CHANNEL}/${id}`, channelSlug: POST_CHANNEL, author: "postsubject", authorName: "Post Subject",
+ createdAt: "2026-10-30T10:00:00.000Z", uploadDate: "20261030", text: "", url: `https://x.com/postsubject/status/${id}`,
+ platform: "twitter", isReply: false, isRepost: false, links: [], threadId: id, lang: "en", engagement: { likes: 12, reposts: 3, replies: 1, quotes: 0 }, ...o,
+});
+
+/**
+ * @param {{ reports: string, channels: string, deckManifest: Function, cachedWindow: string }} o
+ */
+export function makePostItemsFixture({ reports, channels, deckManifest, cachedWindow }) {
+ // The archive and its captures.
+ const ch = path.join(channels, POST_CHANNEL);
+ mkdirSync(path.join(ch, "posts"), { recursive: true });
+ writeFileSync(path.join(ch, "config.json"), JSON.stringify({ handling: "transcribe", sourceKind: "social", socialHandle: "postsubject", platform: "twitter", name: "Post Subject (X)" }, null, 2));
+ const rows = [
+ row("0", { createdAt: "2026-10-30T09:00:00.000Z", text: "The first thing I said about it." }),
+ row("1", { createdAt: "2026-10-30T10:00:00.000Z", text: "And a plain post with nothing but words in it, to read.", isReply: true, replyTo: { id: "0", author: "postsubject" } }),
+ row("2", { createdAt: "2026-10-30T11:00:00.000Z", text: "A picture of the thing.", mediaCount: 1 }),
+ row("9", { author: "someone_private", authorName: "Private Person", createdAt: "2026-10-30T11:30:00.000Z", text: "is this really true?" }),
+ row("3", { createdAt: "2026-10-30T12:00:00.000Z", text: "@someone_private Yes, and here is the video.", mediaCount: 1, isReply: true, replyTo: { id: "9", author: "someone_private" } }),
+ row("4", { createdAt: "2026-10-31T12:00:00.000Z", text: "One more post, a day later." }),
+ ];
+ writeFileSync(path.join(ch, "posts", "2026-10.jsonl"), rows.map((r) => JSON.stringify(r)).join("\n") + "\n");
+ const cap2 = path.join(ch, "posts-media", "2");
+ const cap3 = path.join(ch, "posts-media", "3");
+ mkdirSync(cap2, { recursive: true });
+ mkdirSync(cap3, { recursive: true });
+ ff(["-f", "lavfi", "-i", "testsrc=size=320x180:rate=1:duration=1", "-frames:v", "1", path.join(cap2, "2_1.png")]);
+ ff([
+ "-f", "lavfi", "-i", "testsrc=size=320x180:rate=30:duration=4",
+ "-f", "lavfi", "-i", "sine=frequency=440:duration=4",
+ "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", "-ar", "48000", "-ac", "2", "-shortest", path.join(cap3, "3_1.mp4"),
+ ]);
+ writeFileSync(path.join(cap2, "capture.json"), JSON.stringify({ version: 1, id: "2", media: [{ name: "2_1.png", url: "https://pbs.twimg.com/media/x" }] }));
+ writeFileSync(path.join(cap3, "capture.json"), JSON.stringify({ version: 1, id: "3", media: [{ name: "3_1.mp4", url: "https://video.twimg.com/amplify_video/3/vid/x.mp4" }] }));
+
+ // The project: one clip, then the three post items as `posts reel` writes them.
+ const name = "post-items-fixture";
+ const dir = path.join(reports, name);
+ mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true });
+ copyFileSync(cachedWindow, path.join(dir, "out", "clips-raw", "playvid_0.00-9.00.mp4"));
+ const media = path.join(dir, "posts-media", POST_CHANNEL);
+ mkdirSync(path.join(media, "2"), { recursive: true });
+ mkdirSync(path.join(media, "3"), { recursive: true });
+ copyFileSync(path.join(cap2, "2_1.png"), path.join(media, "2", "2_1.png"));
+ copyFileSync(path.join(cap3, "3_1.mp4"), path.join(media, "3", "3_1.mp4"));
+ const base = (r) => ({
+ type: "post", post: `${POST_CHANNEL}/${r.id}`, platform: "x", author: r.authorName, handle: r.author, date: r.createdAt, text: r.text, url: r.url,
+ engagement: r.engagement, subjects: ["postsubject"],
+ });
+ const timeline = [
+ { type: "clip", id: "c01", video: "playvid", start: 1.0, end: 3.0, cite: 1, section: 0, lock: true, quote: "This is a complete sentence.", onscreen: { title: "24 Oct 2020" } },
+ { ...base(rows[1]), id: "p-txt", parents: [{ id: "0", author: "Post Subject", handle: "postsubject", date: rows[0].createdAt, text: rows[0].text, url: rows[0].url }] },
+ { ...base(rows[2]), id: "p-img", media: [{ src: `posts-media/${POST_CHANNEL}/2/2_1.png`, kind: "image", width: 320, height: 180 }] },
+ {
+ ...base(rows[4]), id: "p-vid",
+ parents: [{ id: "9", author: "Private Person", handle: "someone_private", date: rows[3].createdAt, text: rows[3].text, url: rows[3].url }],
+ media: [{ src: `posts-media/${POST_CHANNEL}/3/3_1.mp4`, kind: "video", seconds: 4, width: 320, height: 180, audio: true }],
+ },
+ ];
+ const m = deckManifest(name, "The Post Items Fixture", timeline);
+ m.provenance = { ...m.provenance, channelSlug: POST_CHANNEL };
+ m.render.fetchPad = 0;
+ m.render.lockedEdges = false;
+ m.render.chrome = { ...m.render.chrome, deck: { ...(m.render.chrome?.deck ?? {}), markers: [{ after: "c01", label: "The posts" }] } };
+ writeFileSync(path.join(dir, "video.manifest.json"), JSON.stringify(m, null, 2) + "\n");
+ return { dir };
+}
diff --git a/umtool/e2e/post-items.spec.ts b/umtool/e2e/post-items.spec.ts
@@ -0,0 +1,138 @@
+import { test, expect, type Page } from "@playwright/test";
+import { execFileSync } from "node:child_process";
+import { copyFileSync, existsSync, readFileSync, rmSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// POST ITEMS (report-to-video/post-item.mjs; knobs.md, "A post item"): a cut
+// that mixes a clip with posts played as items of their own. Fixture:
+// e2e/fixtures/post-items-fixture.mjs -- c01 (a clip), p-txt (words only, a
+// self-reply under its parent), p-img (a picture), p-vid (a 4 s video with a
+// tone, a reply to a private account) from the synthesized archive postchan-x.
+//
+// The rule's seconds (reading 1 s + words / 3, at least 3; a parent 1-4 s;
+// then the attachments): p-txt 12 words + a 7-word parent = 5 + 2.33 = 7.33;
+// p-img 5 words = 3 + a picture 3.5 = 6.5; p-vid 7 words + a 4-word parent =
+// 3.33 + 1.33 = 4.67 to read, then the video's 4 s = 8.67.
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const FIXTURE = path.join(HERE, "..", ".e2e-song");
+const DIR = path.join(FIXTURE, "reports", "post-items-fixture");
+const MANIFEST = path.join(DIR, "video.manifest.json");
+const PROJECT = "reports/post-items-fixture";
+const SHOTS = process.env.POST_ITEMS_SHOTS ?? null;
+
+type Entry = { id: string; type: string; media?: { start?: number; end?: number; mute?: boolean }[]; hold?: number };
+const timeline = () => (JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: Entry[] }).timeline;
+const umtool = (args: string[]) =>
+ execFileSync("node", ["bin/umtool.mjs", ...args], {
+ cwd: path.join(HERE, ".."),
+ encoding: "utf8",
+ env: { ...process.env, REPORTS_DIR: FIXTURE, CHANNELS_DIR: path.join(FIXTURE, "channels"), UMTOOL_CACHE_DIR: path.join(FIXTURE, "cache"), UMTOOL_MEDIA_DIR: "" },
+ });
+
+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 });
+});
+
+const root = (page: Page) => page.locator("[data-play-cut]");
+
+test("the Cut tab lists the mixed cut: the clip, then post rows with their glyph, what they carry and how long they play", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ await page.goto(urls.projectHref(PROJECT, { tab: "cut" }));
+ const rows = page.locator("[data-entry]");
+ await expect(rows).toHaveCount(4);
+ expect(await rows.evaluateAll((els) => els.map((e) => `${e.getAttribute("data-entry")}:${e.getAttribute("data-kind")}`))).toEqual([
+ "c01:clip", "p-txt:post", "p-img:post", "p-vid:post",
+ ]);
+ await expect(page.locator('[data-entry="c01"] [data-post-glyph]')).toHaveCount(0);
+ for (const id of ["p-txt", "p-img", "p-vid"]) await expect(page.locator(`[data-entry="${id}"] [data-post-glyph]`)).toBeVisible();
+ await expect(page.locator('[data-entry="p-txt"] [data-post-carries]')).toHaveText("text");
+ await expect(page.locator('[data-entry="p-img"] [data-post-carries]')).toHaveText("image");
+ await expect(page.locator('[data-entry="p-vid"] [data-post-carries]')).toHaveText("video");
+ await expect(page.locator('[data-entry="p-txt"] [data-post-seconds]')).toHaveText("7.3s");
+ await expect(page.locator('[data-entry="p-img"] [data-post-seconds]')).toHaveText("6.5s");
+ await expect(page.locator('[data-entry="p-vid"] [data-post-seconds]')).toHaveText("8.7s");
+ await expect(page.locator('[data-entry="p-vid"]')).toContainText("Yes, and here is the video.");
+ // A post item takes a section's place like a clip: the bar after c01 opens on p-txt.
+ await expect(page.locator('[data-entry="p-vid"] [data-post-bench-link]')).toHaveAttribute("href", urls.postBenchHref(PROJECT, "p-vid"));
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-items-cut-tab.png"), fullPage: true });
+});
+
+test("Play plays a post item: its card, the private parent blurred, its video playing with the clock advancing", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ await page.goto(urls.playHref(PROJECT, { bare: true, clip: "p-vid" }));
+ await expect(root(page)).toHaveAttribute("data-play-state", "paused");
+ await expect(root(page)).toHaveAttribute("data-play-item", "p-vid");
+ const player = page.locator('[data-post-play="p-vid"]');
+ await expect(player).toBeVisible();
+ await expect(player).toHaveAttribute("data-post-layout", "side");
+ await expect(player).toHaveAttribute("data-post-step", "read");
+ // The card is the build's page: the post's words, its counts, the parent above it blurred.
+ const card = page.frameLocator('[data-post-card-frame="read"]');
+ await expect(card.locator('[data-post-card="p-vid"]')).toBeVisible();
+ await expect(card.locator("[data-post-words]")).toContainText("Yes, and here is the video.");
+ await expect(card.locator('[data-post-parent="0"][data-redacted]')).toHaveCount(1);
+ await expect(card.locator("body")).not.toContainText("someone_private");
+ await expect(card.locator("body")).not.toContainText("Private Person");
+ // Its first frame is up beside the card while the words are read.
+ await expect(page.locator('[data-post-video="0"]')).toHaveAttribute("data-post-video-playing", "0");
+ const t0 = Number(await root(page).getAttribute("data-play-t"));
+ await page.locator("[data-play-toggle]").click();
+ await expect(player).toHaveAttribute("data-post-step", "video", { timeout: 15_000 });
+ await expect(page.locator('[data-post-video="0"]')).toHaveAttribute("data-post-video-playing", "1");
+ await expect.poll(async () => page.locator('[data-post-video="0"]').evaluate((v: HTMLVideoElement) => v.currentTime), { timeout: 10_000 }).toBeGreaterThan(0.5);
+ expect(await page.locator('[data-post-video="0"]').evaluate((v: HTMLVideoElement) => v.muted)).toBe(false);
+ const t1 = Number(await root(page).getAttribute("data-play-t"));
+ expect(t1).toBeGreaterThan(t0 + 4);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-items-play.png") });
+ await page.locator("[data-play-toggle]").click();
+ // Edit this post opens its bench, and Back to the cut returns to it.
+ await page.locator("[data-play-edit]").click();
+ await expect(page.locator('[data-post-bench="p-vid"]')).toBeVisible();
+ await page.locator("[data-post-bench-back]").click();
+ await expect(root(page)).toHaveAttribute("data-play-item", "p-vid");
+});
+
+test("the post bench trims the video attachment and saves it; the cut's seconds follow", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ await page.goto(urls.postBenchHref(PROJECT, "p-vid"));
+ await expect(page.locator('[data-post-bench="p-vid"]')).toBeVisible();
+ await expect(page.locator("[data-post-bench-rule]")).toHaveText("8.7 s");
+ await page.locator('[data-post-bench-start="0"]').fill("1");
+ await page.locator('[data-post-bench-end="0"]').fill("3");
+ await expect(page.locator("[data-post-bench-rule]")).toHaveText("6.7 s");
+ await expect(page.locator('[data-post-bench-step="video"]')).toContainText("video 2.0 s");
+ await page.locator('[data-post-bench-sound="0"]').uncheck();
+ await page.locator("[data-post-bench-save]").click();
+ await expect(page.locator("[data-post-bench-status]")).toHaveText("saved");
+ const v = timeline().find((e) => e.id === "p-vid")!;
+ expect(v.media?.[0]).toMatchObject({ start: 1, end: 3, mute: true });
+ // A trim that leaves less than half a second is refused in the build's words, and nothing is written.
+ await page.locator('[data-post-bench-end="0"]').fill("1.2");
+ await page.locator("[data-post-bench-save]").click();
+ await expect(page.locator("[data-post-bench-error]")).toContainText("at least 0.5 s after start");
+ expect(timeline().find((e) => e.id === "p-vid")!.media?.[0]?.end).toBe(3);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-items-bench.png") });
+ await page.goto(urls.projectHref(PROJECT, { tab: "cut" }));
+ await expect(page.locator('[data-entry="p-vid"] [data-post-seconds]')).toHaveText("6.7s");
+});
+
+test("umtool posts reel adds only what the cut does not play yet, in one write", async () => {
+ const dry = JSON.parse(umtool(["posts", "reel", PROJECT, "--channel", "postchan-x", "--own", "--dry-run", "--json"])) as { entries: { id: string }[]; already: number };
+ // 0 is p-txt's parent (not an item yet), 1-3 are in the cut, 4 is new; 9 is not the subject's.
+ expect(dry.entries.map((e) => e.id)).toEqual(["p-0", "p-4"]);
+ expect(dry.already).toBe(3);
+ umtool(["posts", "reel", PROJECT, "--channel", "postchan-x", "--own", "--since", "2026-10-31"]);
+ expect(timeline().map((e) => e.id)).toEqual(["c01", "p-txt", "p-img", "p-vid", "p-4"]);
+ const again = JSON.parse(umtool(["posts", "reel", PROJECT, "--channel", "postchan-x", "--own", "--since", "2026-10-31", "--json"])) as { added: number };
+ expect(again.added).toBe(0);
+});