// THE PIN (lane/screen-reads, 12 Nov 2026): with no `screens` on an item, every page and every plan is BYTE-IDENTICAL // to what main drew before screens existed. The hashes below were recorded on main (9277318c) before a line of the // screens code was written; a change that moves any of them changes what an item without screens draws or plays. // // Covered: the card page (plain, following, threaded), the plan (its steps, its follow schedule, its thread rows, // its panel and its pictures), and the segment key, over a spread of items -- text only, a video, images in a grid, // a narrated reply that reads its parent, a quoted post read first, a picture-only parent, an excerpt, a linked post. import assert from "node:assert/strict"; import { createHash } from "node:crypto"; import { test } from "node:test"; import { postCardHtml, postItemPlan } from "./post-item.mjs"; import { postSegmentKeyOf } from "./post-render.mjs"; const sha = (v) => createHash("sha1").update(typeof v === "string" ? v : JSON.stringify(v)).digest("hex"); const at = (h, m = 0) => `2026-11-02T${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}:00.000Z`; const VID = { src: "posts-media/subj-x/1/1_1.mp4", kind: "video", width: 1080, height: 1200, seconds: 46.3, audio: true, start: 2, end: 9 }; const IMG = { src: "posts-media/kir-x/7/7_1.jpg", kind: "image", width: 1127, height: 500 }; const IMG2 = { src: "posts-media/kir-x/7/7_2.jpg", kind: "image", width: 800, height: 800 }; const GIF = { src: "posts-media/furri-x/9/9_1.mp4", kind: "gif", width: 480, height: 270, seconds: 2.53 }; const WORDS = "That is exactly what I was saying yesterday morning.\n\nWe should have bought the generator in the spring."; const PARENT = "The first thing anyone notices is the noise from the street.\n\nThen the lights in the hall go out without warning."; const QUOTED = "Here is the plan for the weekend repairs on the roof."; const base = (o = {}) => ({ type: "post", id: "p-1", post: "subj-x/1001", platform: "x", author: "Subject", handle: "subject", date: at(21, 5), text: WORDS, engagement: { likes: 12, replies: 3 }, ...o }); function take(pieces) { const parts = []; let t = 0; pieces.forEach(([text, role], pi) => { text.split(/\n\n/).forEach((para, k) => { const seconds = Math.round((para.split(/\s+/).length / 3) * 100) / 100; t += parts.length ? (k === 0 ? 0.8 : 0.6) : 0; parts.push({ n: parts.length + 1, para: pi * 100 + k, text: para, start: Math.round(t * 100) / 100, seconds, role }); t += seconds; }); }); return { file: "narration/posts/1001/take-1.orpheus-thread.wav", engine: "orpheus", voice: "leo+zac", seconds: Math.round(t * 100) / 100, script: pieces.map((p) => p[0]).join("\n\n"), parts }; } const narrate = (e, pieces) => ({ ...e, narration: { script: e.text, takes: [take(pieces)], pick: 0 } }); const FIXTURES = { text: base(), video: base({ media: [VID] }), grid: base({ media: [IMG, IMG2], mediaLayout: "grid" }), narratedVideo: narrate(base({ media: [VID] }), [[WORDS, "post"]]), threadParent: narrate(base({ parents: [{ id: "900", author: "Neighbour", handle: "neighbour_one", date: at(19, 9), text: PARENT }] }), [[PARENT, "parent:0"], [WORDS, "post"]]), quotedFirst: narrate(base({ quoted: { id: "901", author: "Other", handle: "other", date: at(20, 1), text: QUOTED }, media: [IMG] }), [[QUOTED, "quoted"], [WORDS, "post"]]), picParent: narrate(base({ parents: [{ id: "9", author: "Furri", handle: "furri", date: at(20, 58), text: "@subject", media: [GIF] }] }), [[WORDS, "post"]]), excerpt: base({ excerpt: ["We should have bought the generator"] }), linked: narrate(base({ text: `${WORDS} https://x.com/other/status/902`, links: [{ id: "902", author: "Other", handle: "other", date: at(20, 30), text: QUOTED }] }), [[WORDS, "post"], [QUOTED, "linked:0"]]), }; /** Every output an item without screens has: its plan, its card pages, its segment key. */ function outputs(e) { const render = { postNarration: { lead: 0.4 } }; const plan = postItemPlan(e, render); const box = { width: 1600, height: 900 }; return { plan: sha(plan), plain: sha(postCardHtml(e, { ...box })), follow: sha(postCardHtml(e, { ...box, follow: true, thread: plan.follow?.thread ?? null })), key: sha(postSegmentKeyOf({ entry: e, box, render: { fps: 30, palette: null }, plan, take: plan.narration ? {} : null })), }; } // Recorded on main (9277318c), before the screens code: `node -e` over this file's FIXTURES (see PIN_RECORD below). const PINNED = { text: { plan: "163438f691c524bb395e1c39fd09dcc2e72f795e", plain: "e7f0130b9fbe6dc32cc5657fa0bb00c57ffe54b4", follow: "d9bbbb211005c4b9fd9bad0351a11ae50a15e46e", key: "FAKE-TEST-VALUE" }, video: { plan: "1d721cc3154e0a4f10e6711e9f8f265ed53180d7", plain: "000f4bcbfea50af05acc3dc1c15cac97663ef6c7", follow: "31c6fc090691da173a7fc4ac32894d285127a032", key: "FAKE-TEST-VALUE" }, grid: { plan: "c5353695c813395f12cd5d761a6019cbb2f536e2", plain: "2afaf9cdce76fd8233b031b0e84802b5bfcc3e7c", follow: "63689e568b23744aa90ed725c28dd034d842ecea", key: "0deaf8e92086f7f7fde3efbd7707064092e60389" }, narratedVideo: { plan: "030e22c63f5c262f5c8afe725e9c40a5f6470bc4", plain: "000f4bcbfea50af05acc3dc1c15cac97663ef6c7", follow: "31c6fc090691da173a7fc4ac32894d285127a032", key: "FAKE-TEST-VALUE" }, threadParent: { plan: "b01efeba3f9bf621538de9eefa25cd806fb963ca", plain: "6bcbf761983dbf527e2138f1f2d7c584e9cceba6", follow: "a1f25c09c2b7a7186b05552eeb6d2611bcbf73a0", key: "FAKE-TEST-VALUE" }, quotedFirst: { plan: "754b4d53adf5f47924d56a3c31a5cb44f323fb98", plain: "4c1fbde072185ee99e8480611fe5a0c21d03ef8f", follow: "c0392234597dda7834f42241072a18956e75677b", key: "FAKE-TEST-VALUE" }, picParent: { plan: "4ed61fa9691664d7fae9b1890ca7799effdf145e", plain: "98b193ab29ae5fc7276934e513b06e73fc994e91", follow: "6e68386aa3c41648d30eb928b7d989f266b4cf98", key: "FAKE-TEST-VALUE" }, excerpt: { plan: "fa0050d888b4dbd703945ac3b43a21ad8776f8ec", plain: "697905a289f7106d9bff49d023f7086980d9a7b2", follow: "79380dda1310b2c2fc23af21deacf229b1bbcd25", key: "FAKE-TEST-VALUE" }, linked: { plan: "3bc1b5e16edf0157c8c74bb3422bfa422f1f4468", plain: "becaf617d978eb6bf9444ddb5d00e977f647de17", follow: "13d8f6ab3af100545b6d50a231f5e9bb8ca1a07c", key: "FAKE-TEST-VALUE" } }; test("an item without screens draws, plans and keys BYTE-IDENTICALLY to main before screens", () => { const now = Object.fromEntries(Object.entries(FIXTURES).map(([k, e]) => [k, outputs(e)])); if (process.env.PIN_RECORD === "1") { console.log(JSON.stringify(now, null, 1)); return; } assert.deepEqual(now, PINNED); });