// THE SECOND PIN (lane/screens-2, 13 Nov 2026): an item with ROUND-1 SCREENS and none of the round-2 keys draws, // plans, keys, validates, guards and lints BYTE-IDENTICALLY to main (7b8f5268) before a line of round 2 was written. A // change that moves any of these hashes changes what a screen made before round 2 draws, plays or is told. // // Covered over a spread of screens: DMs in a video read whole, an image email read in excerpts, a screen with lines // left out (omit) and drawn dim, a screenshot of a post with typed lines and a `ref`, a picture-only post with a screen // on its own picture, an item whose screens are not narrated, and a take with line takes (`read.lineTakes`). import assert from "node:assert/strict"; import { createHash } from "node:crypto"; import { test } from "node:test"; import { postCardHtml, postItemPlan, validatePostItem } from "./post-item.mjs"; import { postSegmentKeyOf } from "./post-render.mjs"; import { partRoles, threadReadErrors } from "./post-thread.mjs"; import { screenLineSaid, screenWarnings } from "./post-screens.mjs"; import { draftScript, postNarrationDisclosure } from "./post-narration.mjs"; const sha = (v) => createHash("sha1").update(typeof v === "string" ? v : JSON.stringify(v)).digest("hex"); const VID = { src: "posts-media/savvy-x/2117/2117_1.mp4", kind: "video", width: 1920, height: 1080, seconds: 61.742, audio: true, start: 3.3, end: 8 }; const IMG = { src: "posts-media/savvy-x/2117/2117_2.jpg", kind: "image", width: 900, height: 1400 }; const DM = { id: "s1", media: 0, at: [3.5, 8], kind: "dm", read: "all", lines: [ { who: "TheQuartering", text: "what's your email so I can refund your order", time: "11:32 AM" }, { who: "MadamSavvy", text: "where is my scale video", time: "11:53 AM" }, { who: "TheQuartering", text: "you HONESTLY believe that I have lied about weight loss?" }, { who: "TheQuartering", text: "You can't be this dumb", time: "11:58 AM" }, ], }; const MAIL = { id: "s2", media: 1, kind: "email", title: "Refund email", checked: { by: "operator", at: "2026-11-12T10:00:00.000Z" }, read: [{ line: 0 }, { line: 1, text: "Total amount refunded: $99.95" }], lines: [ { who: "coffee brand coffee", text: "Some items in your order have been refunded" }, { text: "Total amount refunded: $99.95 USD. It may take up to 10 days for this refund to appear in your account." }, { text: "Order number 4419283 ยท reply to support@coffeebrand.com" }, ], }; const POST = "Hey, @thequartering You told me your video was ready to go.\n\nYour turn."; const base = (o = {}) => ({ type: "post", id: "p-2117", post: "savvy-x/2117", platform: "x", author: "Savvy", handle: "MadamSavvy", date: "2026-11-02T01:40:36.000Z", text: POST, subjects: ["MadamSavvy"], media: [VID, IMG], screens: [DM, MAIL], ...o }); /** A thread read's take: her words, then each screen line (stored roles, lines and speakers), timed by words. */ function narrated(e, lines, extra = {}) { const parts = []; let t = 0; const add = (text, role, piece, gap, more = {}) => { t += parts.length ? gap : 0; const sec = Math.round((text.split(/\s+/).length / 3) * 100) / 100; parts.push({ n: parts.length + 1, para: piece * 100, text, voice: role === "post" ? "tara" : "leo", ...more, role, start: Math.round(t * 1000) / 1000, seconds: sec }); t += sec; }; add("Hey, at thequartering You told me your video was ready to go.", "post", 0, 0); add("Your turn.", "post", 0, 0.6); lines.forEach(([id, n], i) => { const sc = e.screens.find((s) => s.id === id); const said = screenLineSaid(sc, n); add(said, `screen:${id}:${n}`, 1 + i, i && lines[i - 1][0] === id ? 0.35 : 0.8, { line: draftScript(said).script, speaker: String(sc.lines[n].who ?? "") }); }); return { ...e, narration: { script: POST, pick: 0, takes: [{ file: "narration/posts/2117/take-1.orpheus-thread.wav", engine: "orpheus", voice: "tara+leo", seconds: Math.round(t * 1000) / 1000, script: "x", parts, ...extra }] } }; } const ALL = [["s1", 0], ["s1", 1], ["s1", 2], ["s1", 3], ["s2", 0], ["s2", 1]]; const FIXTURES = { dmAndMail: narrated(base(), ALL), omitDim: narrated(base({ screens: [{ ...DM, read: [{ line: 0 }, { line: 3, text: "this dumb" }] }, { ...MAIL, unread: "dim" }] }), [["s1", 0], ["s1", 3], ["s2", 0], ["s2", 1]]), postShot: narrated(base({ media: [IMG], screens: [{ id: "s1", media: 0, kind: "post", ref: "other-x/9001", read: "all", lines: [{ who: "other", text: "The roof repairs start on Monday." }, { who: "other", text: "Bring gloves." }] }] }), [["s1", 0], ["s1", 1]]), pictureOnly: narrated(base({ text: "@thequartering", media: [IMG], screens: [{ ...MAIL, media: 0 }] }), [["s2", 0], ["s2", 1]]), notNarrated: base(), lineTakes: (() => { const e = narrated(base(), ALL, { read: { kind: "thread", parents: "0", lineTakes: { "screen:s1:1": { n: 2, file: "narration/posts/2117/take-2.recorded-operator.wav", line: draftScript("where is my scale video").script } } } }); e.narration.takes.push({ file: "narration/posts/2117/take-2.recorded-operator.wav", engine: "recorded", voice: "operator", label: "operator", seconds: 1.4, source: { kind: "recorded", voice: "operator" }, script: "where is my scale video" }); e.narration.takes[0].parts[3] = { ...e.narration.takes[0].parts[3], voice: "operator", take: "take-2.recorded-operator", file: "narration/posts/2117/take-2.recorded-operator.wav" }; return e; })(), }; /** Every output an item with screens has: its plan, its card pages, its segment key, its validation, guard and lint. */ function outputs(e) { const render = { postNarration: { lead: 0.4 } }; const plan = postItemPlan(e, render); const box = { width: 1600, height: 900 }; const narratedNow = Array.isArray(e.narration?.takes); 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 })), checks: sha([validatePostItem(e), threadReadErrors(e, render), screenWarnings(e, { narrated: narratedNow, takeRoles: narratedNow ? partRoles(e).map((r) => r.role) : [] }), postNarrationDisclosure(e)]), }; } // Recorded on main (7b8f5268), before the round-2 code: PIN_RECORD=1 node --test this file. const PINNED = { "dmAndMail": { "plan": "25466c15390c7c605b05754660ba297f6bac9699", "plain": "968fe3cbdf8cc0982f91ea82266277afbdaf627b", "follow": "7a303b53afbf33f4bf674b147ed5f8229473f438", "key": "FAKE-TEST-VALUE", "checks": "58f994d43961a1f976b5fab4778d7b039d45aab6" }, "omitDim": { "plan": "d553ce26ea25e3286010c39bdb4767604a4dcaa9", "plain": "968fe3cbdf8cc0982f91ea82266277afbdaf627b", "follow": "66590ec6a12b6017b319b64165951345b4c37c43", "key": "FAKE-TEST-VALUE", "checks": "58f994d43961a1f976b5fab4778d7b039d45aab6" }, "postShot": { "plan": "4bed2e5bfe6fb0798c353795d926fad46f480eb2", "plain": "968fe3cbdf8cc0982f91ea82266277afbdaf627b", "follow": "c92594bc9a582206416df016c56643e92a75b812", "key": "FAKE-TEST-VALUE", "checks": "0b6e6bf545ef5f0a2066a6df455aff903e1a37c1" }, "pictureOnly": { "plan": "6be3de8f69aad67365657a31c73d6b35ec1d8213", "plain": "ce72a862e6f5d607a150a085ab60f6c9de002d7d", "follow": "6efbb3bf18f8eae5e3020fcddb0f0543a58a6b1b", "key": "FAKE-TEST-VALUE", "checks": "5c8d877bdcee8cbf71658c9ad75d8430757c0a4a" }, "notNarrated": { "plan": "335251e03af67c0374492e8c3530b0b8518b81e7", "plain": "968fe3cbdf8cc0982f91ea82266277afbdaf627b", "follow": "0d68eae2fb41c1ab32ef3ff1d702fd0b17eef034", "key": "FAKE-TEST-VALUE", "checks": "4615ef4e7c3e3669aebe789aad56c5c25554aaf3" }, "lineTakes": { "plan": "25466c15390c7c605b05754660ba297f6bac9699", "plain": "968fe3cbdf8cc0982f91ea82266277afbdaf627b", "follow": "7a303b53afbf33f4bf674b147ed5f8229473f438", "key": "FAKE-TEST-VALUE", "checks": "c301b5157774d42623aa191b3416d79e39b89857" } }; test("an item with round-1 screens and none of the round-2 keys draws, plans, keys and is checked BYTE-IDENTICALLY to main", () => { 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); }); // THE LINT AND THE READ PLAN (review round 1, h): the build's enforced lint (with and without an anonymous character), // the drawing's refusals, the lint's thread-read warnings and what a NEW thread read would read, over the same items. // Recorded at 847224ed, which the reviewer's d1.mjs shows identical to main (7b8f5268) for every one of these. import { enforcedLint } from "./build-video.mjs"; import { validateThreadReadWarnings } from "./post-thread.mjs"; import { screenDrawErrors } from "./post-screens.mjs"; import { threadReadPlan } from "../lib/report/postThreadRead.mjs"; function lintOutputs(e) { const render = { width: 1920, height: 1080, fps: 30, postNarration: { lead: 0.4 } }; const manifest = { schemaVersion: 1, slug: "x", title: "x", render, timeline: [e] }; const anon = { set: new Set(["secretkid"]), doc: { characters: [{ id: "kid", name: "Kid A", handles: ["secretkid"], anonymous: true }] } }; const plan = (() => { try { return threadReadPlan(manifest, e, {}).pieces.map((p) => ({ role: p.role, voice: p.voice, text: p.text, handle: p.handle ?? null, from: p.from ?? null })); } catch (err) { return `THROW ${String(err?.message ?? err)}`; } })(); return { lint: sha(enforcedLint(manifest, { validators: false }, { cut: manifest, anonymity: { set: new Set(), doc: null } })), lintAnon: sha(enforcedLint(manifest, { validators: false }, { cut: manifest, anonymity: anon })), draw: sha(screenDrawErrors(e)), warn: sha(validateThreadReadWarnings(manifest)), readPlan: sha(plan), }; } const LINT_PINNED = { "dmAndMail": { "lint": "2ba45145f10cbcd18f9f78839ea156686d3df020", "lintAnon": "2ba45145f10cbcd18f9f78839ea156686d3df020", "draw": "97d170e1550eee4afc0af065b78cda302a97674c", "warn": "0001f53272bdf6a9d6a211634657143bdae27be1", "readPlan": "5d24f6279d52fe58d0c62dfe004d67d66f0a74c4" }, "omitDim": { "lint": "2ba45145f10cbcd18f9f78839ea156686d3df020", "lintAnon": "2ba45145f10cbcd18f9f78839ea156686d3df020", "draw": "97d170e1550eee4afc0af065b78cda302a97674c", "warn": "0001f53272bdf6a9d6a211634657143bdae27be1", "readPlan": "776b955f61f2c44bd2688daf06ed01375508b067" }, "postShot": { "lint": "cc2cb0cff41dc543477479108d2dbe20ecf90874", "lintAnon": "cc2cb0cff41dc543477479108d2dbe20ecf90874", "draw": "97d170e1550eee4afc0af065b78cda302a97674c", "warn": "7e73eebe078bd9d686c660053fb87b5985f12789", "readPlan": "e225065294fc39aeb38519833628fa25decc7b93" }, "pictureOnly": { "lint": "93089484fb1ad7bdc6005a5017337ba1e4a3ab89", "lintAnon": "93089484fb1ad7bdc6005a5017337ba1e4a3ab89", "draw": "97d170e1550eee4afc0af065b78cda302a97674c", "warn": "b148a0c52437adc918dafda161cc7fe5c905c2e3", "readPlan": "a3773d01cc3bb65d42a76f9667fa95515a6b028e" }, "notNarrated": { "lint": "8d3287fcb8a085b6302aa66fe06b2d945e6ffa41", "lintAnon": "8d3287fcb8a085b6302aa66fe06b2d945e6ffa41", "draw": "97d170e1550eee4afc0af065b78cda302a97674c", "warn": "bcd16048b2c13d4d99a4061232aaa05fb2c8d1b3", "readPlan": "5d24f6279d52fe58d0c62dfe004d67d66f0a74c4" }, "lineTakes": { "lint": "2ba45145f10cbcd18f9f78839ea156686d3df020", "lintAnon": "2ba45145f10cbcd18f9f78839ea156686d3df020", "draw": "97d170e1550eee4afc0af065b78cda302a97674c", "warn": "0001f53272bdf6a9d6a211634657143bdae27be1", "readPlan": "5d24f6279d52fe58d0c62dfe004d67d66f0a74c4" } }; test("the same items' enforced lint, drawing refusals, thread-read warnings and new-read plan are BYTE-IDENTICAL to main", () => { const now = Object.fromEntries(Object.entries(FIXTURES).map(([k, e]) => [k, lintOutputs(e)])); if (process.env.PIN_RECORD === "1") { console.log(JSON.stringify(now, null, 1)); return; } assert.deepEqual(now, LINT_PINNED); });