Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit ae84839f11cf8d89ff4656fb7c196e3786188bef
parent fc62cec31e67c7420e0d3535ad75a83c6242d774
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 17 Nov 2026 15:52:18 -0500

reads-pin.test.mjs: the ruling-3 pin over a replace in both scopes and the re-read queue

After These reads (a post's script, a thread read's own words, a screen line's said-as made, the card)
and Everywhere (a pronunciation entry), after each queue step has run and its re-reads are picked,
every post item draws byte-identically to before (the reading pin's drawn(): plain card, followed
card, blocks and hidden paragraphs, tile modes, screens) and the card keeps every field but its
narration. The one exception -- an item playing a take read before the rule -- is named in the
replace's preview, not pinned.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Aumtool/lib/report/reads-pin.test.mjs | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+), 0 deletions(-)

diff --git a/umtool/lib/report/reads-pin.test.mjs b/umtool/lib/report/reads-pin.test.mjs @@ -0,0 +1,77 @@ +// THE RULING-3 PIN FOR A VIDEO's READS (lane reads-find; operator ruling 3, 15 Nov 2026: "edits change only what is +// SPOKEN -- shown text never changes"). After a Replace in EITHER scope and after the re-read queue has run and its +// re-reads are picked, every card draws byte-identically to before: the reading pin's drawn() -- its plain card, its +// followed card, its blocks (and the paragraphs an excerpt tile hides), its thread tiles' modes, its screens -- and a +// narrated card's every field but its narration. One exception, named and not pinned: an item whose playing take was +// read BEFORE the rule (unstamped, other words) moves to the shown-text rule when its re-read is picked -- the preview +// says so (post-item.mjs LEGACY_EDIT_TEXT). Temp dirs, a stub tts, invented people; noLiveEditor first. +import "./noLiveEditor.mjs"; +import assert from "node:assert/strict"; +import { mkdtemp, rm, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { after, test } from "node:test"; +import { applyReplace, applySayOnly, replacePlan } from "./readsReplace.mjs"; +import { enqueueRereads, pickReads, readBatches, runOneItem } from "./readsQueue.mjs"; +import { postsCommand } from "./postsCli.mjs"; +import { cardNarrationCommand } from "./cardNarrationCli.mjs"; +import { projectReads } from "./reads.mjs"; +import { keepCardReading, readManifestOf, readsProject, wavOf } from "./reads.fixtures.mjs"; +import { drawn } from "../../report-to-video/post-reading-pin.fixtures.mjs"; + +const ROOT = await mkdtemp(path.join(tmpdir(), "umtool-reads-pin-")); +after(() => rm(ROOT, { recursive: true, force: true })); +delete process.env.UMTOOL_CAST_FILE; + +const stubAsk = async (body) => { + await wavOf(body.out); + return { jobId: "job", result: { wav: body.out, engine: body.engine, voice: body.voice, tuning: { temperature: 0.55, top_p: 0.85, top_k: 50, min_p: 0, repeat_penalty: 1.2, takes: 3 }, reading: body.reading ?? 0 } }; +}; +const run = (p) => async (argv) => { + if (argv[0] === "posts") return postsCommand(argv.slice(1), { root: p.root, tts: stubAsk, out: () => {}, err: () => {} }); + return cardNarrationCommand(argv.slice(1), { root: p.root, narrate: async ({ narrations }) => { + for (const n of narrations) await keepCardReading(p.dir, n, { createdAt: new Date().toISOString() }); + return new Map(narrations.map((n) => [n.id, { seconds: 1.4 }])); + }, out: () => {}, err: () => {} }); +}; +/** What every item DRAWS: a post's drawn() hashes; any other entry, every field but its narration. */ +const drawnCut = (m) => m.timeline.map((e) => (e.type === "post" ? { id: e.id, ...drawn(e) } : (({ narration: _n, ...rest }) => rest)(e))); + +test("THE PIN: replace (these reads, then everywhere), re-read every changed line, pick the new reads -- the cut draws as before", async () => { + const p = await readsProject(ROOT, "pin"); + const before = drawnCut(await readManifestOf(p)); + // These reads: a post's script, a thread read's own words, a screen line (said-as made), the card. + await applyReplace(p, "north", "northern", { reportsRoot: p.root }); + await applyReplace(p, "Tuesday", "Tuesday evening", { reportsRoot: p.root }); + await applyReplace(p, "tolls", "toll charges", { reportsRoot: p.root }); + assert.deepEqual(drawnCut(await readManifestOf(p)), before, "after These reads"); + // Everywhere: a pronunciation entry. + await applySayOnly(p, "ministry", "min-is-tree", { reportsRoot: p.root }); + assert.deepEqual(drawnCut(await readManifestOf(p)), before, "after Everywhere"); + // The re-read queue, each step as the app runs it, then Pick every new read. + const q = await enqueueRereads(p, { reportsRoot: p.root, queueDir: path.join(p.root, ".umtool-queue") }); + assert.deepEqual(q.steps.map((s) => s.item), ["p-1", "p-2", "c-1"]); + for (const s of q.steps) assert.equal((await runOneItem(p, s.item, s.reads, { reportsRoot: p.root, run: run(p), log: () => {} })).code, 0, s.item); + assert.deepEqual(drawnCut(await readManifestOf(p)), before, "after the re-reads (unpicked)"); + await pickReads(p, { which: "new", reportsRoot: p.root }); + const m = await readManifestOf(p); + assert.deepEqual(drawnCut(m), before, "after the picks"); + // The reads say the new words, and are fresh. + const rows = (await projectReads(p, { reportsRoot: p.root })).rows; + assert.deepEqual(rows.filter((r) => r.state !== "fresh" && r.state !== "recorded").map((r) => `${r.id} ${r.state}`), []); + assert.match(m.timeline[0].narration.takes.at(-1).script, /northern pier/); + assert.equal(m.timeline[0].narration.takes.at(-1).forReading, true); + assert.ok((await readBatches(p.dir)).length === 1); +}); + +test("THE EXCEPTION, named: an item playing a take read before the rule is said in the replace's preview", async () => { + const p = await readsProject(ROOT, "legacy"); + const m = await readManifestOf(p); + // His playing take says other words than the post, unstamped (made before reads were kept apart from the card). + const t = m.timeline[0].narration.takes[0]; + t.script = "The ferry leaves at noon.\n\nBring a coat."; + m.timeline[0].narration.script = t.script; + await writeFile(path.join(p.dir, "video.manifest.json"), JSON.stringify(m, null, 2)); + const plan = await replacePlan(p, "coat", "warm coat", { reportsRoot: p.root }); + assert.match(plan.notes["p-1"].join(" "), /read before reads were kept apart from the card/); +});