commit 6acdfab86aa933c6fc8b15031e987ce3dd2d7985
parent 844c9b0b53f8d522fcca26036179ba26f5672009
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 17 Nov 2026 17:07:14 -0500
a thread read's piece plays its own parts, old and new (review 1, SHOULD 5, the model)
takeView carried the thread take's file, so Listen through played the whole joined read once per
piece and old and new could not be compared line by line. A piece's row now carries its parts'
files in order (`files`; `file` the first), and `takeFile` the take's own (what a Pick finds the take
by). The fixture's thread parts are files on disk; the tests check a screen line's and his own words'
files, and a Pick back on a thread item.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
5 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/umtool/lib/report/reads.fixtures.mjs b/umtool/lib/report/reads.fixtures.mjs
@@ -37,7 +37,9 @@ export function singlePost() {
/** The reading pin's thread item as p-2, its parent one paragraph long (so its read says it whole, as a press would). */
export function threadPost() {
const e = threadItem();
- return { ...e, id: "p-2", parents: e.parents.map((x) => ({ ...x, text: x.text.split("\n\n")[0] })) };
+ // Each part its own file in the parts cache, as a thread read keeps them (made on disk by readsProject).
+ const takes = e.narration.takes.map((t) => ({ ...t, parts: t.parts.map((x) => ({ ...x, file: `narration/parts-cache/fixture-${x.n}.wav` })) }));
+ return { ...e, id: "p-2", parents: e.parents.map((x) => ({ ...x, text: x.text.split("\n\n")[0] })), narration: { ...e.narration, takes } };
}
export function recordedPost() {
@@ -64,7 +66,10 @@ export async function readsProject(root, name, { cast = castDoc(), timeline = nu
await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(manifest, null, 2));
// A project of the reports root `top` (projects/core.mjs walks it): `umtool … p` finds it there.
await writeFile(path.join(dir, "project.json"), `${JSON.stringify({ kind: PROJECT_KINDS.find((k) => k.makesTakes).id, title: name })}\n`);
- for (const e of tl) for (const t of e?.narration?.takes ?? []) await wavOf(path.join(dir, ...t.file.split("/")));
+ for (const e of tl) for (const t of e?.narration?.takes ?? []) {
+ await wavOf(path.join(dir, ...t.file.split("/")));
+ for (const x of t.parts ?? []) if (typeof x.file === "string") await wavOf(path.join(dir, ...x.file.split("/")));
+ }
for (const n of narrationsOf(manifest)) await keepCardReading(dir, n);
return { id: "p", dir, root: top };
}
diff --git a/umtool/lib/report/reads.mjs b/umtool/lib/report/reads.mjs
@@ -15,7 +15,8 @@
// storedAt where `spoken` is kept; `shownSpoken`: it is still the SHOWN text (a replace creates its override)
// editable whether These reads can rewrite it (a parent, the quoted or a linked post has no spoken-only words:
// "said as shown: only Everywhere changes this"; a recorded read is yours)
-// take the take that plays: `{ index, file, key, reading, tuning, tunedBy: "line" | "character" | null }`
+// take the take that plays: `{ index, takeFile, file, files, key, reading, tuning, tunedBy: "line" | "character" |
+// null }` -- `takeFile` the take's own file, `files` what THIS read plays (a thread piece: its parts' files)
// ask the tuning a plain press asks for it now (tuneAsk.mjs plainPressAskOf: only what its line owned; the
// character's and the settings' resolved anew) -- what its re-read asks (readAgainArgv.mjs)
// newTake (state unpicked) the newer take that would be fresh if picked
@@ -110,7 +111,7 @@ function plainAskOf(made, own, want, names) {
}
/** A take as a read row carries it. */
-const takeView = (t, extra = {}) => (t ? { index: Number.isInteger(t.index) ? t.index : null, file: t.file ?? null, key: null, reading: Number.isInteger(t.reading) ? t.reading : 0, tuning: isObj(t.tuning) ? t.tuning : null, tunedBy: tunedByOf(t), ...extra } : null);
+const takeView = (t, extra = {}) => (t ? { index: Number.isInteger(t.index) ? t.index : null, takeFile: t.file ?? null, file: t.file ?? null, files: typeof t.file === "string" ? [t.file] : [], key: null, reading: Number.isInteger(t.reading) ? t.reading : 0, tuning: isObj(t.tuning) ? t.tuning : null, tunedBy: tunedByOf(t), ...extra } : null);
/**
* THE CONTEXT a project's reads are judged in, loaded once: the manifest, the redaction (its lexicon), the lexicon,
@@ -220,11 +221,13 @@ async function threadRows(ctx, m, vs, e, take, base) {
const editable = own || !!sc;
const want = pc.handle ? vs.resolve(e, pc.role, pc.handle, take) : null;
const part = parts.find((p) => p?.role === pc.role && typeof p?.take !== "string") ?? null;
+ const roleFiles = parts.filter((p) => p?.role === pc.role && typeof p?.take !== "string" && typeof p?.file === "string").map((p) => p.file);
const row = {
...base, id: readIdOf(e.id, pc.role), kind, role: pc.role, character: characterRow(vs, pc.character ?? want?.character),
voice: `${pc.engine ?? take.engine ?? "?"}:${pc.voice ?? "?"}`, spoken: sc ? (as ?? screenLineSaid(screen, sc.n)) : str(pc.written), said: pc.text,
storedAt, shownSpoken: own ? !str(e.narration?.script) : sc ? as === null : true, editable: editable && !pc.take, why: pc.take ? "read from a take (a recording): record it again" : editable ? null : SAID_AS_SHOWN,
- take: takeView(take, part ? { reading: Number.isInteger(part.reading) ? part.reading : 0, tuning: isObj(part.tuning) ? part.tuning : null, tunedBy: tunedByOf(part) ?? tunedByOf(take) } : {}), newTake: null,
+ // ITS PART's files (a paragraph each), in order -- what it says in the take, never the whole joined read.
+ take: takeView(take, part ? { file: roleFiles[0] ?? take.file, files: roleFiles, reading: Number.isInteger(part.reading) ? part.reading : 0, tuning: isObj(part.tuning) ? part.tuning : null, tunedBy: tunedByOf(part) ?? tunedByOf(take) } : {}), newTake: null,
ask: pc.take ? null : plainAskOf(part ? { tuning: part.tuning, tuningAsked: part.tuningAsked ?? take.tuningAsked } : null, pieceOwnOf(take, pc.role), want ?? { engine: pc.engine, character: pc.character, tuning: pc.tuningAsked === "preset" ? pc.tuning : null }, vs.names),
};
if (pc.take) {
diff --git a/umtool/lib/report/reads.test.mjs b/umtool/lib/report/reads.test.mjs
@@ -42,6 +42,11 @@ test("every kind: a post's script, a thread read's pieces and screen lines, a re
assert.equal(by["c-1"].state, "fresh");
assert.equal(by["c-1"].storedAt, "narration.text");
assert.deepEqual(counts, { fresh: 7, stale: 0, unpicked: 0, none: 0, recorded: 1 });
+ // REVIEW 1, SHOULD 5: a thread read's piece plays ITS part (its paragraphs' parts, in order), never the joined take.
+ assert.equal(by["p-2/screen:s1:0"].take.file, "narration/parts-cache/fixture-5.wav");
+ assert.deepEqual(by["p-2/screen:s1:0"].take.files, ["narration/parts-cache/fixture-5.wav"]);
+ assert.deepEqual(by["p-2/post"].take.files, ["narration/parts-cache/fixture-3.wav", "narration/parts-cache/fixture-4.wav"]);
+ assert.equal(by["p-1"].take.file, "narration/posts/1/take-1.orpheus-tara.wav");
});
test("stale: the words changed (post, screen, card), the lexicon, the character's settings -- and none, unpicked", async () => {
diff --git a/umtool/lib/report/readsQueue.mjs b/umtool/lib/report/readsQueue.mjs
@@ -306,7 +306,7 @@ export async function pickReads(project, { which = "new", only = null, token = n
const last = (await readBatches(project.dir)).at(-1);
for (const r of last?.rows ?? []) {
if (!r.before || (keep && !keep.has(r.read))) continue;
- picks.set(r.item, r.before.key ? { item: r.item, key: r.before.key } : { item: r.item, take: r.before.index, file: r.before.file });
+ picks.set(r.item, r.before.key ? { item: r.item, key: r.before.key } : { item: r.item, take: r.before.index, file: r.before.takeFile ?? r.before.file });
}
}
if (!picks.size) throw new QueueError(which === "new" ? "no read waits for a pick (no unpicked re-read)" : "no re-read to go back from (the newest batch has none)");
diff --git a/umtool/lib/report/readsQueue.test.mjs b/umtool/lib/report/readsQueue.test.mjs
@@ -133,9 +133,10 @@ test("the queue runs to done, ONE step at a time; each re-read joins unpicked; a
let after = Object.fromEntries((await projectReads(p, { reportsRoot: p.root })).rows.map((r) => [r.id, r.state]));
assert.deepEqual([after["p-1"], after["p-2/post"], after["p-2/screen:s1:1"]], ["fresh", "fresh", "fresh"]);
// And back to the old ones (the card's words with its old reading).
- await pickReads(p, { which: "old", only: ["p-1", "c-1"], reportsRoot: p.root });
+ await pickReads(p, { which: "old", only: ["p-1", "c-1", "p-2/post"], reportsRoot: p.root });
const m2 = await readManifestOf(p);
assert.equal(m2.timeline[0].narration.pick, 0);
+ assert.equal(m2.timeline[1].narration.pick, 0, "a thread item back to its take (by the take's file, not a part's)");
assert.equal(m2.timeline[3].narration.text, "Six months later, the north pier reopened.");
after = Object.fromEntries((await projectReads(p, { reportsRoot: p.root })).rows.map((r) => [r.id, r.state]));
assert.deepEqual([after["p-1"], after["c-1"]], ["unpicked", "fresh"]);