Archilyzer · Source

archilyzer

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

commit 844c9b0b53f8d522fcca26036179ba26f5672009
parent 52bf93d301dac480ce1ca72d8a2195db75b9db21
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 17 Nov 2026 17:02:48 -0500

a piece read from a synthesized take is judged as that take is, not as a recording (review 1, SHOULD 6)

`--post-take <n>` (or a line's chosen take) may name a SYNTHESIZED take of the item, which tuningStale
follows through madeOf -- `cast stale` listed item/post while the Reads page said "a recording". The
piece is now judged by its source take's takeSourceOf: a recording (or one converted from one)
stays recorded; a synthesized one is stale or fresh by the same rows, marked not queueable (its
re-read is that take's own, on the bench). The agreement test covers it.

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

Diffstat:
Mumtool/lib/report/reads.mjs | 31++++++++++++++++++++++++++++++-
Mumtool/lib/report/readsCli.test.mjs | 23+++++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/umtool/lib/report/reads.mjs b/umtool/lib/report/reads.mjs @@ -56,6 +56,24 @@ const norm = (t) => str(t).replace(/\s+/g, " ").trim(); /** A read's id: the item's id, and the piece's role for a piece of a thread read. */ export const readIdOf = (item, role = null) => (role ? `${item}/${role}` : item); +/** + * Every id the model makes (readIdOf): an item's id -- any timeline id, no slash, no space -- and, for a piece of a + * thread read, its role (post, quoted, parent:<i>, linked:<i>, screen:<screen id>:<line>). + */ +export const READ_ID_RE = /^[^/\s]{1,200}(?:\/(?:post|quoted|parent:\d|linked:\d|screen:[a-z0-9][a-z0-9-]{0,23}:\d{1,2}))?$/; + +/** + * A list of read ids as a caller hands it (`only`): `{ ids }`, or `{ error }` naming what is refused -- not a list, + * empty, or an id no read could have. Never silently narrowed: a list that names one bad id is refused whole. + */ +export function readIdsOf(list) { + if (!Array.isArray(list)) return { error: "only is a list of read ids" }; + const bad = list.filter((x) => typeof x !== "string" || !READ_ID_RE.test(x)); + if (bad.length) return { error: `not a read's id: ${bad.slice(0, 5).map((x) => JSON.stringify(x)).join(", ")}` }; + if (!list.length) return { error: "only names no read" }; + return { ids: [...new Set(list)] }; +} + /** A thread take's `read` record as threadTake's options (as the read that plays was asked: castProject.mjs threadArgvOf). */ export function threadOptsOfRead(read, takes = []) { const r = isObj(read) ? read : {}; @@ -210,7 +228,18 @@ async function threadRows(ctx, m, vs, e, take, base) { 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) { - rows.push({ ...row, state: "recorded", because: [] }); + // A PIECE READ FROM ANOTHER TAKE of the item (`--post-take`, a line's chosen take): judged as that take is -- + // a recording, or one converted from one, is yours; a SYNTHESIZED one is stale as cast.mjs madeOf follows it + // (`cast stale` lists it), its re-read that take's own (not queued here: re-read it on the bench, then this). + const src = takes.find((t) => t?.file === pc.take.file) ?? null; + if (!src || takeSourceOf(src).kind !== "tts") { + rows.push({ ...row, state: "recorded", because: [] }); + continue; + } + const because = []; + if (vs.settings.has(vs.key(e.id, pc.role))) because.push("settings"); + if (vs.voice.has(vs.key(e.id, pc.role))) because.push("voice"); + rows.push({ ...row, why: `${pc.role === "post" ? "his line" : pc.role} is take ${pc.take.n} (synthesized): read it again on the bench, then this thread read`, queueable: false, state: because.length ? "stale" : "fresh", because }); continue; } const because = []; diff --git a/umtool/lib/report/readsCli.test.mjs b/umtool/lib/report/readsCli.test.mjs @@ -81,3 +81,26 @@ test("reread queues one step per item; queue --json says why they wait; --stop; r = await cli(p, ["bogus"]); assert.equal(r.code, 2); }); + +// REVIEW 1, SHOULD 6: a thread read whose own line is ANOTHER take of the item (`--post-take`) that was SYNTHESIZED is +// judged as that take is (madeOf follows it, so `cast stale` lists it): stale by settings here too, never "recorded". +test("SHOULD 6: his line from a synthesized take (--post-take) -- the page and `cast stale` agree it is stale", async () => { + const { postsCommand } = await import("./postsCli.mjs"); + const { wavOf } = await import("./reads.fixtures.mjs"); + const p = await readsProject(ROOT, "post-take", { cast: castDoc(LIVELY) }); + const stub = async (body) => { + await wavOf(body.out); + return { jobId: "j", 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: 0 } }; + }; + // p-1's take 1 was made with the defaults (the fixture); a thread read of it with his line from that take. + assert.equal(await postsCommand(["narrate", "p", "p-1", "--take", "--thread", "--post-take", "1"], { root: p.root, tts: stub, out: () => {}, err: () => {} }), 0); + const r = await cli(p, ["--json"]); + const row = r.json.reads.find((x) => x.id === "p-1/post"); + const logs = []; + await castCommand(["stale", "p", "--json"], { reportsRoot: p.root, log: (s) => logs.push(s), err: (s) => logs.push(s) }); + const cast = JSON.parse(logs.join("\n")); + assert.ok(cast.reads.some((x) => x.id === "p-1" && x.role === "post"), JSON.stringify(cast.reads)); + assert.deepEqual([row.state, row.because], ["stale", ["settings"]]); + assert.match(row.why, /take 1/); + assert.equal(r.json.settingsStale, cast.count); +});