Archilyzer · Source

archilyzer

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

commit 7ffe90a4ca9294e9917f5313ad2737dcab75d816
parent d6aada3c3a32b734c53705545795eba86fad8c51
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 12 Nov 2026 02:03:11 -0500

umtool: quote-check's work files go to <project>/.quote-check (by its real path), never under out/ -- a link onto the media drive, where the editor refuses to write; refused there too, umtool's own state dir, then the cache dir

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

Diffstat:
Meditor/CHANGELOG.md | 1+
Mumtool/docs/cli.md | 2+-
Mumtool/docs/knobs.md | 5++++-
Mumtool/lib/cli/groups.mjs | 2+-
Mumtool/lib/report/quoteCheck.mjs | 82++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
Mumtool/lib/report/quoteCheck.test.mjs | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 135 insertions(+), 12 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **umtool: `quote-check` works on a project whose `out/` is on the media drive.** The check asked the editor to write its word files under `<project>/out/quote-check/`; when `out/` is a link onto a media drive, that is inside the corpus and the editor refuses to write there, so every clip failed. The work files now go to `<project>/.quote-check/`, and if the editor refuses that too (the project itself is inside the corpus) to `<reports>/.umtool/quote-check/<project>/`, then `~/.cache/umtool/quote-check/<project>/`. The rows are still the project's `quote-check.json`; the editor's refusal is unchanged. - **umtool: the words under the promise clock's REFUNDED stamp can be the record's own.** The stamp always read "by <date> · no video" under REFUNDED or WITHDRAWN, whatever the outcome row said. A `promise_outcome` row may now carry `stampNote` (`umtool ledger <p> set <row> --stampNote "by her account · no receipt"`, `--stampNote null` to take it off): it is the stamp's second line, and the one-line strip over a post's card shows its first clause. Without one the words are as before. `umtool lint` warns when a note is longer than the stamp's line holds (26 characters). - **umtool: a loss goal no longer takes its base from a weight said years before.** A goal such as "lose 100" is shown against the latest weight he had given by then, however old: on the weight video that put "(FROM 368)" on a goal set eight years after he said 368. `deck.goals.baseMaxDays` (unset: as before) keeps a base only when its weight was said at most that many days before the goal; an older one is no base, so the note carries no "(FROM …)" and the dial draws no goal weight or tick from it. `umtool look <p> deck.goals.baseMaxDays=365`, and `umtool look` now takes `--take <t>` for the deck's keys, which sets them on that take alone. - **umtool: the dial's finale no longer shows the callout's labels over its hub.** With `deck.dial.rememberedAs: "callout"` the finale's dial drew every remembered weight's label box and the ghost needle and never hid them, so the boxes sat on the hub for the whole finale (take rev9-a9). They are hidden there now; the rim's marker and flag for the last remembered weight stay. diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -27,7 +27,7 @@ Inbox cannot disagree about what is wrong with one. | `cast project <project> add <id> [--name "…"] [--voice <engine:voice>] [--handles a,b] [--anonymous [--shown "…"]] [the preset flags]` · `set <id> … [--no-voice] [--no-anonymous]` · `rm <id>` · `undo` · `pool <id>` · `keep <character\|@handle> [--anonymous]` `[--json]` | **THIS VIDEO's OWN CHARACTERS** (`<project>/narration/characters.json`, [knobs.md](knobs.md#this-videos-own-characters-and-an-items-own)): the cast's shape and the cast's writer (a token, an undo point a write, atomic, a broken file never overwritten), for people who must not enter the pool. `--anonymous`: it goes by a **shown name** (`--shown`; default the next of `Anon 1`, `Anon 2` …) on the Voices page, in `cast project` and in a recording's note, and never enters the pool; **the on-screen card is not anonymised yet** (it still shows the post's author). `--voice` is optional here: a character with none leaves the voice to the layers under it. `narration/voices.json` keeps working under it (a handle in it reads as a character with only a synthetic voice) and is never rewritten by these. `pool <id>` (**Add to the pool**) moves one into the cast -- an anonymous one, or an id the cast has, is refused; `keep` (**Keep in this video only**) copies a cast character here (its presets changed for this video alone), or gives an author with no character one, in the voice they read in now. A refusal: **exit 1**, nothing written | | `cast audition <character\|@handle> --voices a,b,… [--project <p>] [--text "…" \| --item <id> \| --line <n> \| --stock] [--no-score \| --score-only] [--json] [--progress ndjson]` | **AN AUDITION**: one line read by 2-6 stock voices through the editor's tts op, levelled to -20 LUFS in `<p>/narration/auditions/` (cached), scored for closeness to the character's real voice (`speakers.json`; TitaNet, local) | | `speaker-check <project> [--clip <id> …] [--json] [--progress ndjson]` · `--set 'Name=<clip>,<channel>/<id>,channel:<slug>'` · `--remove <name>` · `--list` | which of the project's **named voices** (`speakers.json`) each clip is: TitaNet-small, local, against each voice's robust centroid → `<project>/speaker-check.json` (merged); the walk's **Speaker:** badge and **Check speaker** ([report-video.md](report-video.md#the-speaker-check-on-the-walk-which-of-several-voices)) | -| `quote-check <project> [--clips a,b] [--pad S] [--json]` · `quote-check <project> --status` | **is each clip's quote in the seconds it plays?** The cut ±15 s of the source the render would cut it from, transcribed by the editor (`pnpm ops transcribe`, words on — its transcription lane), the quote found in those words and in the cues: `ok`, `moved` (heard more than 0.5 s from where the cues have it), `not-found`; rows in `quote-check.json`, stale when the cut or the quote changes; `check` blocks on `moved`/`not-found` (`clip-quote-moved`, `clip-quote-missing`), a take refuses them, `prep --status` counts them ([knobs.md](knobs.md#the-quote-check-is-the-quote-where-the-clip-plays)) | +| `quote-check <project> [--clips a,b] [--pad S] [--json]` · `quote-check <project> --status` | **is each clip's quote in the seconds it plays?** The cut ±15 s of the source the render would cut it from, transcribed by the editor (`pnpm ops transcribe`, words on — its transcription lane), the quote found in those words and in the cues: `ok`, `moved` (heard more than 0.5 s from where the cues have it), `not-found`; rows in `quote-check.json`, stale when the cut or the quote changes; the editor's work files go to `<project>/.quote-check/`, never under `out/` (a link onto a media drive the editor will not write in); `check` blocks on `moved`/`not-found` (`clip-quote-moved`, `clip-quote-missing`), a take refuses them, `prep --status` counts them ([knobs.md](knobs.md#the-quote-check-is-the-quote-where-the-clip-plays)) | | `check-joins <project> --take <id> [--json] [--all] [--limit <n>]` | do a rendered take's **post joins carry on**: every boundary of its master where the next post item draws a post the one before showed, its planned join, the SSIM across it and the largest frame-to-frame step (read-only, ffmpeg) -- worst first ([report-video.md](report-video.md#thread-scenes-whole-threads-the-join-manual-threads-wide-attachments-context-media-link-visits-the-branch-map)) | | `link-policy <project> [--via <site id \| https://…>] [--direct <slug,…>] [--clear] [--fix] [--json]` | the project's **link policy** (`provenance.linkPolicy`): cite via site X, these channels direct. With no flag, prints it and every clip whose QR breaks it; `--fix` rewrites each one that has a fix through the window writer; new clips are written by it. **Exit 1** when a clip still breaks it ([knobs.md](knobs.md#the-link-policy)) | | `patch-markers <project> [<file>.patch.json] [--fix] [--json]` | take patches whose deck markers name a clip not in the cut (a take made with one is refused); `--fix` gives each the `after` of the cut's marker of the same label; **exit 1** when one is left ([knobs.md](knobs.md#take-patches-follow-a-removal)) | diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -107,7 +107,10 @@ misclip), and only listening caught it. `umtool quote-check <p> [--clips a,b]` l clip's cut ±15 s (`--pad`) of the source the render would use is transcribed by the editor (its transcription lane, words on), and the quote is found in those words — numbers one token however they are written, a word one letter off still a match, an ellipsis splitting it into fragments found in -order — and in the recording's cues. The rows (`quote-check.json`, one per clip, with the cut, the +order — and in the recording's cues. The editor's work files (`<clip>.words.json`) go to +`<project>/.quote-check/` — never under `out/`, which may be a link onto a media drive, where the editor +refuses to write (inside the corpus); refused there too, `<reports>/.umtool/quote-check/<project>/`, then +`~/.cache/umtool/quote-check/<project>/`. The rows (`quote-check.json`, one per clip, with the cut, the quote and the source judged): | row | means | what settles it | diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs @@ -105,7 +105,7 @@ export const GROUPS = [ ], docs: [ ["`quote-check <project> [--clips a,b] [--pad S] [--json]` · `quote-check <project> --status`", - "**is each clip's quote in the seconds it plays?** The cut ±15 s of the source the render would cut it from, transcribed by the editor (`pnpm ops transcribe`, words on — its transcription lane), the quote found in those words and in the cues: `ok`, `moved` (heard more than 0.5 s from where the cues have it), `not-found`; rows in `quote-check.json`, stale when the cut or the quote changes; `check` blocks on `moved`/`not-found` (`clip-quote-moved`, `clip-quote-missing`), a take refuses them, `prep --status` counts them ([knobs.md](knobs.md#the-quote-check-is-the-quote-where-the-clip-plays))"], + "**is each clip's quote in the seconds it plays?** The cut ±15 s of the source the render would cut it from, transcribed by the editor (`pnpm ops transcribe`, words on — its transcription lane), the quote found in those words and in the cues: `ok`, `moved` (heard more than 0.5 s from where the cues have it), `not-found`; rows in `quote-check.json`, stale when the cut or the quote changes; the editor's work files go to `<project>/.quote-check/`, never under `out/` (a link onto a media drive the editor will not write in); `check` blocks on `moved`/`not-found` (`clip-quote-moved`, `clip-quote-missing`), a take refuses them, `prep --status` counts them ([knobs.md](knobs.md#the-quote-check-is-the-quote-where-the-clip-plays))"], ], }, { diff --git a/umtool/lib/report/quoteCheck.mjs b/umtool/lib/report/quoteCheck.mjs @@ -23,7 +23,8 @@ // --quote-ruled`: heard and ruled by a person). // // Plain ESM: the CLI runs under bare node; the app reads the file. -import { mkdir, readFile, rename, writeFile } from "node:fs/promises"; +import { mkdir, readFile, realpath, rename, writeFile } from "node:fs/promises"; +import os from "node:os"; import path from "node:path"; import { createCueSource, siteOriginFromManifest } from "umtool-report-to-video/cues"; import { cueWords, findQuote, ON_TIME_S, quoteOffset } from "umtool-report-to-video/quote-in-audio"; @@ -234,16 +235,65 @@ async function editorWords(req, { emit }) { } /** + * WHERE THE EDITOR WRITES THE WORDS (12 Nov): the work files were `<project>/out/quote-check/<clip>.words.json`, and + * a project's `out/` may be a symlink onto the media drive -- inside a corpus location, where the editor rightly + * refuses to write (transcribeFile.ts: `"out" … is inside the corpus`). So the work dir is never under `out/`: + * these, in order, each by its REAL path (a link in the way is followed here, not found out by the editor), the + * next one taken when the editor refuses the one before as inside the corpus -- + * + * <project>/.quote-check/ beside the manifest + * <reports>/.umtool/quote-check/<project>/ umtool's own state, when the project dir itself is in a location + * $XDG_CACHE_HOME|~/.cache/umtool/quote-check/<project>/ + * + * The rows are the project's whichever it is: quote-check.json, beside the manifest. + * @param {string} dir the project's dir + * @param {{ reportsRoot?: string | null, env?: Record<string, string | undefined>, home?: string }} [opts] + * @returns {Promise<string[]>} + */ +export async function quoteCheckWorkDirs(dir, { reportsRoot = null, env = process.env, home = os.homedir() } = {}) { + const real = async (p) => { + // The deepest ancestor that exists, resolved; the rest as named (the dir may not be made yet). + const rest = []; + let cur = path.resolve(p); + for (;;) { + const r = await realpath(cur).catch(() => null); + if (r) return path.join(r, ...rest); + const up = path.dirname(cur); + if (up === cur) return path.resolve(p); + rest.unshift(path.basename(cur)); + cur = up; + } + }; + const name = path.basename(path.resolve(dir)); + const cache = env.XDG_CACHE_HOME && path.isAbsolute(env.XDG_CACHE_HOME) ? env.XDG_CACHE_HOME : path.join(home, ".cache"); + const all = [ + path.join(dir, ".quote-check"), + path.join(reportsRoot ?? path.dirname(path.resolve(dir)), ".umtool", "quote-check", name), + path.join(cache, "umtool", "quote-check", name), + ]; + const out = []; + for (const p of all) { + const r = await real(p); + if (!out.includes(r)) out.push(r); + } + return out; +} + +/** Is this the editor's refusal of an `out` inside the corpus (transcribeFile.ts)? */ +const insideCorpus = (e) => /is inside the corpus/.test(e instanceof Error ? e.message : String(e)); + +/** * Check the planned clips; merge the rows into quote-check.json. * @param {string} dir * @param {Record<string, any>} manifest * @param {Awaited<ReturnType<typeof planQuoteCheck>>} plan * @param {{ transcribe?: typeof editorWords, cuesOf?: (slug: string, video: string) => Promise<any[] | null>, log?: (l: string) => void, now?: () => Date }} [opts] */ -export async function runQuoteCheck(dir, manifest, plan, { transcribe = editorWords, cuesOf = null, log = () => {}, now = () => new Date() } = {}) { +export async function runQuoteCheck(dir, manifest, plan, { transcribe = editorWords, cuesOf = null, log = () => {}, now = () => new Date(), workDirs = null, reportsRoot = null } = {}) { const doc = await readQuoteCheck(dir); - const work = path.join(dir, "out", "quote-check"); - await mkdir(work, { recursive: true }); + // Never under out/ (quoteCheckWorkDirs): the first the editor does not refuse as inside the corpus. + const works = workDirs ?? (await quoteCheckWorkDirs(dir, { reportsRoot })); + let wi = 0; const cueSource = cuesOf ? null : createCueSource({ channelsDirs: channelsLayersFor(dir, manifest, { shadowExists: await hasShadowChannels(dir) }), siteOrigin: siteOriginFromManifest(manifest) }); @@ -271,10 +321,20 @@ export async function runQuoteCheck(dir, manifest, plan, { transcribe = editorWo log(rowLine(p.id, results[p.id])); continue; } - const out = path.join(work, `${p.id}.words.json`); let words; try { - words = await transcribe({ path: p.source.path, start: p.file.start, end: p.file.end, out }, { emit: () => {} }); + for (;;) { + await mkdir(works[wi], { recursive: true }); + const out = path.join(works[wi], `${p.id}.words.json`); + try { + words = await transcribe({ path: p.source.path, start: p.file.start, end: p.file.end, out }, { emit: () => {} }); + break; + } catch (e) { + if (!insideCorpus(e) || wi + 1 >= works.length) throw e; + log(`quote-check: the editor will not write in ${works[wi]} (inside the corpus) -- its work files go to ${works[wi + 1]}`); + wi += 1; + } + } } catch (e) { log(`${p.id}: the transcription failed: ${e instanceof Error ? e.message : String(e)}`); continue; @@ -287,7 +347,7 @@ export async function runQuoteCheck(dir, manifest, plan, { transcribe = editorWo } const merged = { version: 1, checkedAt: now().toISOString(), clips: { ...doc.clips, ...results } }; const file = await writeQuoteCheck(dir, merged); - return { file, doc: merged, results }; + return { file, doc: merged, results, work: works[wi] }; } // --------------------------------------------------------------------------- @@ -301,6 +361,9 @@ export const QUOTE_CHECK_USAGE = [ `Each clip's cut ±${SEARCH_PAD_S} s (--pad) of the source the render would cut it from is transcribed by the`, "editor (its transcription lane, words on), and the quote is found in those words and in the recording's", `cues: ok (within ${ON_TIME_S} s), moved (heard elsewhere: umtool window <p> <clip> --align), not-found.`, + "The editor's work files (<clip>.words.json) go to <project>/.quote-check/ -- never under out/, which may be a link", + "onto a media drive the editor will not write in; were the project itself inside the corpus, to umtool's own", + "<reports>/.umtool/quote-check/<project>/, then ~/.cache/umtool/quote-check/<project>/.", `Rows go to <project>/${QUOTE_CHECK_FILE}; umtool check reads them, and a take refuses a moved or`, "missing quote unless the clip is ruled (umtool window <p> <clip> --quote-ruled).", ].join("\n"); @@ -351,12 +414,13 @@ export async function quoteCheckCommand(args, { reportsRoot = REPORTS_ROOT, log if (!channelsDirs.length) throw new CliError("no channels directory (CHANNELS_DIR) to read the windows from"); const plan = await planQuoteCheck(project.dir, manifest, { channelsDirs, clipIds, pad }); if (clipIds.length && !plan.length) throw new CliError(`none of ${clipIds.join(", ")} is a clip of ${project.id}`); - const { file, results } = await runQuoteCheck(project.dir, manifest, plan, { + const { file, results, work } = await runQuoteCheck(project.dir, manifest, plan, { ...(transcribe ? { transcribe } : {}), ...(cuesOf ? { cuesOf } : {}), + reportsRoot, log: json ? () => {} : log, }); - if (json) log(JSON.stringify({ project: project.id, file, clips: results }, null, 1)); + if (json) log(JSON.stringify({ project: project.id, file, work, clips: results }, null, 1)); else { const count = (s) => Object.values(results).filter((x) => x.status === s).length; log(`→ ${file}: ${count("ok")} ok, ${count("moved")} moved, ${count("not-found")} not found, ${count("no-window")} with no window`); diff --git a/umtool/lib/report/quoteCheck.test.mjs b/umtool/lib/report/quoteCheck.test.mjs @@ -185,3 +185,58 @@ test("prep --status says the quote check's verdicts on the clips as they are now await rm(p.root, { recursive: true, force: true }); } }); + +test("the editor's work files are never under out/: <project>/.quote-check by its real path, and the next dir when the editor refuses one as inside the corpus", async () => { + const { quoteCheckWorkDirs } = await import("./quoteCheck.mjs"); + const { realpath, symlink, stat } = await import("node:fs/promises"); + const p = await project(); + try { + const root = await realpath(p.root); + // out/ linked onto "the media drive" (rev9-a9's project): nothing of the check is written through it. + const drive = path.join(root, "drive", "diet-out"); + await mkdir(path.dirname(drive), { recursive: true }); + const { rename } = await import("node:fs/promises"); + await rename(path.join(p.dir, "out"), drive); + await symlink(drive, path.join(p.dir, "out")); + const dirs = await quoteCheckWorkDirs(p.dir, { reportsRoot: p.root, env: { XDG_CACHE_HOME: path.join(root, "cache") } }); + assert.deepEqual(dirs, [ + path.join(root, "diet", ".quote-check"), + path.join(root, ".umtool", "quote-check", "diet"), + path.join(root, "cache", "umtool", "quote-check", "diet"), + ]); + const plan = await planQuoteCheck(p.dir, p.manifest, { channelsDirs: [p.channels] }); + const outs = []; + const seen = async (req) => { outs.push(req.out); return fakeTranscribe(req); }; + const first = await runQuoteCheck(p.dir, p.manifest, plan, { transcribe: seen, cuesOf: fakeCues, workDirs: dirs }); + assert.equal(first.work, dirs[0]); + assert.ok(outs.length >= 2 && outs.every((o) => path.dirname(o) === dirs[0]), outs.join("\n")); + assert.equal(await stat(path.join(drive, "quote-check")).catch(() => null), null, "nothing under out/"); + assert.equal(first.doc.clips.c44.status, "ok"); + + // The project dir itself inside a location: the editor refuses the first dir, the check moves on and still lands its rows. + const lines = []; + const refused = []; + const picky = async (req) => { + if (path.dirname(req.out) === dirs[0]) { + refused.push(req.out); + throw new Error(`the editor refused it (/api/ops/transcribe, HTTP 400): "out" ${req.out} is inside the corpus (/mnt/media) — this command never writes there; pick a path outside it`); + } + outs.push(req.out); + return fakeTranscribe(req); + }; + outs.length = 0; + const second = await runQuoteCheck(p.dir, p.manifest, plan, { transcribe: picky, cuesOf: fakeCues, workDirs: dirs, log: (l) => lines.push(l) }); + assert.equal(refused.length, 1, "asked once, not once per clip"); + assert.equal(second.work, dirs[1]); + assert.ok(outs.length >= 2 && outs.every((o) => path.dirname(o) === dirs[1])); + assert.match(lines.join("\n"), /the editor will not write in .*\.quote-check \(inside the corpus\) -- its work files go to .*\.umtool\/quote-check\/diet/); + assert.equal(second.doc.clips.c43.status, "moved"); + assert.deepEqual(await readQuoteCheck(p.dir), second.doc); + // Any other failure is that clip's, as before -- no hopping dirs. + const broken = await runQuoteCheck(p.dir, p.manifest, plan, { transcribe: async () => { throw new Error("no engine"); }, cuesOf: fakeCues, workDirs: dirs, log: (l) => lines.push(l) }); + assert.equal(broken.work, dirs[0]); + assert.match(lines.join("\n"), /c43: the transcription failed: no engine/); + } finally { + await rm(p.root, { recursive: true, force: true }); + } +});