commit d6b3f0b2116be9c5d8dd732a946200eabc6d4355
parent 87530077384f9a82410d61aafc5d0d05f0506ce7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 17 Nov 2026 15:18:17 -0500
updatePostNarrations: a script it writes is marked for reading as the single writer marks it (ruling 3)
The several-items writer called postNarrationIn without forReading, so an imported script
(`posts narrate --import`, narration/posts/index.json) that is not the post's words as drafted
landed unmarked ("legacy"): with no take playing, the card followed the edited words. Its other
callers (part roles, a character named, drafted scripts) write no edited script and are unchanged.
Pinned with the reading pin's hashes.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs
@@ -3590,7 +3590,9 @@ export async function updatePostNarration(dir, id, patch, { token = null } = {})
*/
export async function updatePostNarrations(dir, patches, { token = null, op = "post-narration" } = {}) {
if (!Array.isArray(patches) || !patches.length) throw new Error("nothing to change");
- return structural(dir, op, token, (m) => ({ ids: patches.map((p) => postNarrationIn(m, p.id, p.patch).id) }));
+ // A script among them is a spoken edit like the single writer's (lane reads-find, ruling 3): marked for reading when
+ // it is not the post's words as drafted (the import's scripts; a drafted script is not an edit, so it is unmarked).
+ return structural(dir, op, token, (m) => ({ ids: patches.map((p) => postNarrationIn(m, p.id, p.patch, { forReading: true }).id) }));
}
/**
diff --git a/umtool/lib/report/postNarrationsForReading.test.mjs b/umtool/lib/report/postNarrationsForReading.test.mjs
@@ -0,0 +1,45 @@
+// A SCRIPT WRITTEN BY THE SEVERAL-ITEMS WRITER IS MARKED FOR READING TOO (lane reads-find; operator ruling 3): the
+// import (`posts narrate --import`, narration/posts/index.json) sets a script through updatePostNarrations, and a script
+// that is not the post's words as drafted must leave the card on the shown text -- as the single writer does
+// (postNarrationIn's forReading). Pinned with the reading pin's hashes: the card draws what it drew before.
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { after, test } from "node:test";
+import { manifestToken, updatePostNarrations } from "./manifest.mjs";
+import { scriptEditOf } from "umtool-report-to-video/post-item";
+import { PINNED_SHAS, drawn, singleItem } from "../../report-to-video/post-reading-pin.fixtures.mjs";
+
+const ROOT = await mkdtemp(path.join(tmpdir(), "umtool-narrations-for-reading-"));
+after(() => rm(ROOT, { recursive: true, force: true }));
+
+async function project(timeline) {
+ const dir = path.join(ROOT, "p");
+ await mkdir(dir, { recursive: true });
+ await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify({ schemaVersion: 1, slug: "p", title: "p", render: { width: 1920, height: 1080, fps: 30 }, timeline }, null, 2));
+ return dir;
+}
+const read = async (dir) => JSON.parse(await readFile(path.join(dir, "video.manifest.json"), "utf8"));
+
+test("updatePostNarrations: an edited script (no take yet) is marked for reading, and the card draws as it did", async () => {
+ const { narration: _n, ...bare } = singleItem();
+ void _n;
+ const dir = await project([bare]);
+ const edited = "The council met on Tuesday about the new bridge, the B R I D G E.\n\nNobody from the ministry came to explain the delay.";
+ await updatePostNarrations(dir, [{ id: bare.id, patch: { script: edited } }], { token: await manifestToken(dir), op: "post-narration-import" });
+ const e = (await read(dir)).timeline[0];
+ assert.equal(e.narration.forReading, true);
+ assert.equal(scriptEditOf(e), "reading");
+ const d = drawn(e);
+ assert.equal(d.plain, PINNED_SHAS.single.plain);
+ assert.equal(d.blocks, drawn({ ...e, narration: { ...e.narration, script: singleItem().narration.script } }).blocks);
+});
+
+test("updatePostNarrations: a script that says the post's words as drafted is not marked; other patches are as before", async () => {
+ const dir = await project([singleItem()]);
+ await updatePostNarrations(dir, [{ id: "p-7003", patch: { script: singleItem().narration.script } }, { id: "p-7003", patch: { character: "teller" } }], { token: await manifestToken(dir) });
+ const e = (await read(dir)).timeline[0];
+ assert.equal("forReading" in e.narration, false);
+ assert.equal(e.narration.character, "teller");
+});