Archilyzer · Source

archilyzer

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

commit ecbe6c92b4066853a11648317c159526527b8527
parent 65c85efb257f50329eba35e97425019893e07086
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 12 Nov 2026 21:38:19 -0500

umtool lint, review 1: only a file that reads as a ledger is named, local dates, "NEWER" only with rows the live ledger lacks, the take's count under --take (S8)

ledgerFileWarnings matched any ledger*.json (ledgerSchema.json, "[]", "{not json", a locked file each
got a warning), dated in UTC, called any later-written file "NEWER ... rows not in the cut", and
counted the project's rows under --take (review probe-ledger). Now: a file counts only when it parses
as a list of rows each with an id (or {rows|ledger: [...]}), at most 64 MB; dates are local; "NEWER"
only when the file is newer AND holds row ids the live ledger lacks (named, five at most); a stale
file says how many of its rows the live ledger lacks; under --take the live ledger is labelled the
take's. Still a warning, the file never touched. LINT_USAGE, groups.mjs (cli.md regenerated),
CHANGELOG say so.
Test: ledgerFiles.test.mjs (newer without extra rows, newer with one, schema/empty/no ids/bad JSON
skipped, {rows}, --take label).

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

Diffstat:
Meditor/CHANGELOG.md | 2+-
Mumtool/docs/cli.md | 2+-
Mumtool/lib/cli/groups.mjs | 2+-
Mumtool/lib/report/ledgerFiles.test.mjs | 23++++++++++++++++++++---
Mumtool/lib/report/lintCli.mjs | 56++++++++++++++++++++++++++++++++++++--------------------
5 files changed, 59 insertions(+), 26 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -113,7 +113,7 @@ - **umtool: the quote check can judge a take.** `umtool quote-check` only judged the project's draft, so a take with clips of its own was never checked (on 12 Nov, 25 rows blocked the draft and the take went unjudged), and a take's render was gated by the draft's rows alone. `umtool quote-check <p> --take <t>` now judges the take's clips as it renders them and keeps the rows in `takes/<t>/quote-check.json`; the project's `quote-check.json` is not touched. A take's render, the new `umtool check <p> --take <t>` and `umtool window <p> <clip> --take <t> --align` refuse what the take's own current rows refuse and what the project's current rows refuse for the same clip and cut, so checking a take can only add refusals, never remove one the project's rows make. `--status --take <t>` lists the take's rows and says which came from the project. - **umtool: editing a take from a terminal no longer says it is deprecated.** `umtool window … --take`, `timeline <p> --take <t> <verb>`, `posts <verb> … --in-take` and `take --id <t> --import-item` printed "deprecated — edits land in the draft now; open the take there first (umtool takes open …)" on stderr. They are the supported way to edit a take without touching the draft (as `set --take` and `look --take` already were): they write only the take's patch, with an undo point. The advice was the problem, since `takes open` writes the take over the draft. The line is gone; what the commands do, their stdout and `--json` are unchanged. The old take walk's route (`/api/report/takes/timeline`) still says it. - **umtool: the by-date weight chart no longer piles a recent run of weights into its right edge.** The chart's width was shared by days alone, so on rev9-a9 the nine weights said for July–November 2026 shared 31 px of a 2023–26 stretch, under a pixel apart. Now half the width goes by days and half by how many weights each stretch holds: the same run spreads over about 100 px, no two weights closer than 11 px, and a long empty stretch still reads as longer. Breaks, years, the line and the reflow are unchanged. -- **umtool: `umtool lint` says which ledger is live.** A `ledger*.json` beside a video's manifest (quartering-diet's `ledger.draft.json`: 186 rows from 30 Aug) looked like the ledger, but the build, the instruments and `umtool ledger` read only the manifest's own `ledger` (564 rows). `umtool lint` now warns once per such file, naming the manifest's ledger as the live one and the file as stale — or as newer than the manifest, with rows that are not in the cut — with both row counts and dates. The file is never changed or moved (a project's own script may still read it); it is only said when the manifest carries a ledger. +- **umtool: `umtool lint` says which ledger is live.** A `ledger*.json` beside a video's manifest (quartering-diet's `ledger.draft.json`: 186 rows from 30 Aug) looked like the ledger, but the build, the instruments and `umtool ledger` read only the manifest's own `ledger` (564 rows). `umtool lint` now warns once per such file, naming the manifest's ledger (with `--take`, the take's) as the live one and the file as stale — or as newer than the manifest when it holds row ids the live ledger lacks, which it names — with both row counts and local dates. Only a file that reads as a ledger counts: a list of rows with ids, or `{rows|ledger: […]}`; `ledgerSchema.json`, an empty list and unreadable files are not mentioned. The file is never changed or moved (a project's own script may still read it); it is only said when the manifest carries a ledger. ## [0.12.0] - 2026-10-28 - **An X post's screenshot is of the post, not of a page in the middle of laying itself out.** On 2026-10-27 a forced capture of TheQuartering's post 2114859155022389342 came out shifted about 100 px: its left edge cut off, X's menu laid over its words and the gap beside the column showing; another post once came out as a strip of the post above it. The shot was a full-page capture, which resizes the page for the moment of the capture — in the X session profile the page saw its window go to 1×1 — and X laid itself out again for that size while it was being captured, so the shot was cut from a different layout than the one measured. A post is now shot from the window as it stands: scrolled into it, the window made taller first when the post is taller than it, so nothing is resized under the shot; and the post is measured again after the shot and shot again if it moved. An X Article's shot is taken the same way. Posts taller than the tallest window (16,384 px) are still shot from a full-page capture. Needs a restart of the editor. diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -70,7 +70,7 @@ Inbox cannot disagree about what is wrong with one. | `notes …` | operator notes: list, read, reply, resolve ([notes.md](notes.md)) | | `modules list [--json]` · `modules apply <project> [--config FILE] [--dry-run] [--json]` · `modules apply <project> [--config FILE] --take <id> [--label L] [--at S --dur S \| --full] [--quick] [--force] [--from TAKE] [--keep-frames] [--patch-out FILE]` | the **video modules** (release 39): `list` every module, its kind, slot and where its settings live; `apply` maps the project's `module-config.json` (the modules a video wants, in MODULES-DESIGN's vocabulary) into the manifest's homes (`report-to-video/modules/config-loader.mjs`) — the preset, the deck's subtitle and QR, the counter's series and each clip's marks, the stamps, the rail's markers, the chapters, the pairs, the status ledger, the intro, the finale — and lists every field with no home, by path. Without `--take` the manifest is rewritten through `replaceManifest` (a snapshot first); with `--take` it is that take's patch (`takes/<id>.modules-patch.json`, or `--patch-out`) and the take is made from it as `take` makes one, the manifest untouched. **Exit 1** when the result would not build (the build's sentences) ([knobs.md](knobs.md#look-presets)) | | `preset list [--json]` · `preset show <name> [--json]` · `preset save <name> --from <project> [--description D] [--force]` · `preset apply <name\|none> <project> [--replace] [--json]` | the **look presets** (`umtool/presets/<name>.json`, or `UMTOOL_PRESETS_DIR`; built in: `plain-deck` `huck-deck` `ember-deck` `archive-catalog` `basic`): a render block a manifest stands on (`"preset": "<name>"`), laid under it — preset → manifest → style → take patch. `save` keeps a project's look and leaves its content out; `apply` names the preset on the cut through `updatePreset` (nothing copied in), refused when the cut over it would not build (a basic cut's chrome is not checked); `--replace` also clears the manifest's own value of every key the preset sets, after an undo point (`revisions/…-auto-before-preset-replace`), and prints what went ([knobs.md](knobs.md#look-presets)) | -| `lint <project> [--take <take>] [--variant sourced\|full] [--final] [--json]` | **the manifest lint** (`report-to-video/lint.mjs`, what a build runs before it renders a frame) from umtool: the project's manifest, or with `--take` the take's (its patches applied, written beside the project's manifest for the lint as its render's is, then removed) -- plus the **files its post items name**: a picked read, an attachment or a context post's media not in the project is an ERROR, another kept take a warning. A `ledger*.json` beside a manifest that carries its own `ledger` is a warning naming the live one (the manifest's: what the build and `umtool ledger` read) and the file as stale, or newer with its rows not in the cut, with both dates; the file is never touched. Run it after an import and before queueing the render. `--json`: `{ok, entries, errors, warnings}`. **Exit 0 no error · 1 an error · 2 usage** | +| `lint <project> [--take <take>] [--variant sourced\|full] [--final] [--json]` | **the manifest lint** (`report-to-video/lint.mjs`, what a build runs before it renders a frame) from umtool: the project's manifest, or with `--take` the take's (its patches applied, written beside the project's manifest for the lint as its render's is, then removed) -- plus the **files its post items name**: a picked read, an attachment or a context post's media not in the project is an ERROR, another kept take a warning. A `ledger*.json` beside a manifest that carries its own `ledger` -- one that parses as rows with ids (never `ledgerSchema.json`) -- is a warning naming the live one (the manifest's, or with `--take` the take's: what the build and `umtool ledger` read) and the file as stale, or NEWER only when it holds row ids the live ledger lacks (named), with both counts and local dates; the file is never touched. Run it after an import and before queueing the render. `--json`: `{ok, entries, errors, warnings}`. **Exit 0 no error · 1 an error · 2 usage** | | `take <project> --id <id> --label L [--group G] [--kind similar\|different] [--summary S] [--style NAME] [--patch FILE \| --patch-json JSON \| --set path=value …] [--effect NAME] [--at S --dur S \| --full] [--quick] [--force] [--progress ndjson]` | one **take**: the manifest with a montage style's patch, then an overlay effect's (`--effect`, release 35), then the take's own, rendered into `takes/<id>/` (the Takes page's New take); `--id <id> --rebuild` makes one again from its own `take.json` ([report-video.md](report-video.md#making-takes)) | | `take <project> --id <id> --label L [--patch F \| …] --draft` (`--no-render`) · `take <project> --id <id> [--full \| --at S --dur S]` · `take <project> --id <id> --rebuild [--full \| --at S --dur S]` · `take <project> --id <id> --promote [--anyway] [--json]` | a **draft** take: recorded with nothing rendered, to be walked first; a draft named with no patch flags is rendered from its stored (walked) patch, and `--rebuild` takes a window flag; **make it the cut**: the take's patch applied to the manifest now, one undo point (`revisions/…-auto-before-promote-take`), refused (exit 1) when its timeline would replace a cut that changed since, until `--anyway` ([report-video.md](report-video.md#walking-a-take-drafts-edits-into-the-take-and-making-it-the-cut)) | | `take <project> --id <id> … --uncensored` · build-video `--uncensored` | the **uncensored cut** ([knobs.md](knobs.md#the-slur-filter-slurs-masked-in-what-is-published-off-for-the-uncensored-cut)): the same cut with the post items' slur filter off -- `render.posts.slurs.on: false` in the take's patch (a `--rebuild` keeps it; a censored take is not rebuilt uncensored, **exit 2**: make a take of its own), its label gains "(uncensored)", take.json's `slurs` records `censored` or `uncensored`. The redaction of private words and censored attachments stay on | diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs @@ -570,7 +570,7 @@ export const GROUPS = [ ], docs: [ ["`lint <project> [--take <take>] [--variant sourced\\|full] [--final] [--json]`", - "**the manifest lint** (`report-to-video/lint.mjs`, what a build runs before it renders a frame) from umtool: the project's manifest, or with `--take` the take's (its patches applied, written beside the project's manifest for the lint as its render's is, then removed) -- plus the **files its post items name**: a picked read, an attachment or a context post's media not in the project is an ERROR, another kept take a warning. A `ledger*.json` beside a manifest that carries its own `ledger` is a warning naming the live one (the manifest's: what the build and `umtool ledger` read) and the file as stale, or newer with its rows not in the cut, with both dates; the file is never touched. Run it after an import and before queueing the render. `--json`: `{ok, entries, errors, warnings}`. **Exit 0 no error · 1 an error · 2 usage**"], + "**the manifest lint** (`report-to-video/lint.mjs`, what a build runs before it renders a frame) from umtool: the project's manifest, or with `--take` the take's (its patches applied, written beside the project's manifest for the lint as its render's is, then removed) -- plus the **files its post items name**: a picked read, an attachment or a context post's media not in the project is an ERROR, another kept take a warning. A `ledger*.json` beside a manifest that carries its own `ledger` -- one that parses as rows with ids (never `ledgerSchema.json`) -- is a warning naming the live one (the manifest's, or with `--take` the take's: what the build and `umtool ledger` read) and the file as stale, or NEWER only when it holds row ids the live ledger lacks (named), with both counts and local dates; the file is never touched. Run it after an import and before queueing the render. `--json`: `{ok, entries, errors, warnings}`. **Exit 0 no error · 1 an error · 2 usage**"], ], }, { diff --git a/umtool/lib/report/ledgerFiles.test.mjs b/umtool/lib/report/ledgerFiles.test.mjs @@ -38,10 +38,27 @@ test("a ledger file beside the manifest: lint says the manifest's ledger is live assert.match(out.join("\n"), /ledger\.draft\.json \(1 row, 2026-08-30\) is stale/); assert.notEqual(code, 2); assert.equal(await readFile(path.join(p.dir, "ledger.draft.json"), "utf8"), before, "the operator's file is never touched"); - // Newer than the manifest: said so -- rows there are not in the cut. - await utimes(path.join(p.dir, "ledger.draft.json"), new Date("2026-11-13T09:00:00Z"), new Date("2026-11-13T09:00:00Z")); + // Written after the manifest but holding nothing the live ledger lacks: not "NEWER" (review 1, S8). + await utimes(path.join(p.dir, "ledger.draft.json"), new Date("2026-11-13T15:00:00Z"), new Date("2026-11-13T15:00:00Z")); + const later = await ledgerFileWarnings(p.dir, p.manifest); + assert.doesNotMatch(later[0], /NEWER/); + assert.match(later[0], /ledger\.draft\.json \(1 row, 2026-11-13\) is stale/); + // Newer AND rows the manifest lacks: said so, naming them. + await writeFile(path.join(p.dir, "ledger.draft.json"), JSON.stringify([row("d1"), row("d9")])); const newer = await ledgerFileWarnings(p.dir, p.manifest); - assert.match(newer[0], /ledger\.draft\.json \(1 row, 2026-11-13\) is NEWER than the manifest/); + assert.match(newer[0], /ledger\.draft\.json \(2 rows, \d{4}-\d\d-\d\d\) is NEWER than the manifest and holds 1 row the live ledger lacks \(d9\)/); + // Not a ledger: a schema, an empty list, rows without ids, not JSON -- nothing said. + await writeFile(path.join(p.dir, "ledgerSchema.json"), JSON.stringify({ kind: "measure", fields: [] })); + await writeFile(path.join(p.dir, "ledger.empty.json"), "[]"); + await writeFile(path.join(p.dir, "ledger.noids.json"), JSON.stringify([{ date: "2026-01-01" }])); + await writeFile(path.join(p.dir, "ledger.bad.json"), "{not json"); + await writeFile(path.join(p.dir, "ledger.rows.json"), JSON.stringify({ rows: [row("d1")] })); + const names = (await ledgerFileWarnings(p.dir, p.manifest)).map((w) => w.split(" ")[0]); + assert.deepEqual(names, ["ledger.draft.json", "ledger.rows.json"]); + // Under --take the live count is the take's. + const takeW = await ledgerFileWarnings(p.dir, { ...p.manifest, ledger: [row("d1"), row("d2")] }, { take: "t1" }); + assert.match(takeW[0], /the live ledger is take t1's \(video\.manifest\.json's with its patch; 2 rows/); + for (const f of ["ledgerSchema.json", "ledger.empty.json", "ledger.noids.json", "ledger.bad.json", "ledger.rows.json"]) await rm(path.join(p.dir, f)); // No ledger in the manifest, or no such file: nothing said. assert.deepEqual(await ledgerFileWarnings(p.dir, { ...p.manifest, ledger: undefined }), []); await rm(path.join(p.dir, "ledger.draft.json")); diff --git a/umtool/lib/report/lintCli.mjs b/umtool/lib/report/lintCli.mjs @@ -17,8 +17,9 @@ export const LINT_USAGE = [ " picked read, an attachment, a context post's media not in the project is an ERROR; another named file a warning.", " And the cast's guard (umtool cast): a picked read that says a cast character in another voice than now is a", " warning (umtool cast reread); a cast voice the project's voice map overrides on purpose is a note.", - " A ledger*.json beside a manifest that carries its own `ledger` is a warning: the manifest's is the live one (what", - " the build and umtool ledger read), the file stale -- or newer, its rows not in the cut; the file is never touched.", + " A ledger*.json beside a manifest that carries its own `ledger` -- one that parses as rows with ids -- is a warning:", + " the manifest's (with --take, the take's) is the live one, what the build and umtool ledger read; the file stale, or", + " NEWER when it holds row ids the live ledger lacks (named); local dates; the file is never touched.", " Exit 0 no error · 1 an error · 2 usage.", ].join("\n"); @@ -27,40 +28,55 @@ const exists = async (f) => !!(await stat(f).catch(() => null)); /** * THE LEDGER'S ONE SOURCE OF TRUTH (12 Nov): the build, the instruments and `umtool ledger` read the manifest's - * `ledger`; a `ledger*.json` beside it (quartering-diet's ledger.draft.json, 30 Aug, 186 rows against the manifest's - * 564) is read by none of them. One warning per such file, naming which is live, each one's rows and date, and - * which is newer. Only said when the manifest carries a ledger. The file is never touched (a project's own script - * may read it). + * `ledger`; a ledger file beside it (quartering-diet's ledger.draft.json, 30 Aug, 186 rows against the manifest's + * 564) is read by none of them. One warning per such file, naming which is live, each one's rows and (local) date. + * A file counts only when it parses as a ledger: `ledger*.json`, a list of rows each with an id, or `{rows|ledger: + * [...]}` -- never ledgerSchema.json, an empty list, rows without ids, or what does not parse. "NEWER" only when + * the file is newer AND holds row ids the live ledger lacks (review 1, S8). Only said when the manifest carries a + * ledger. The file is never touched (a project's own script may read it). Under --take, the live count is the take's. * @param {string} dir the project's dir - * @param {Record<string, any>} manifest + * @param {Record<string, any>} manifest the project's, or the take's resolved one (`take`) + * @param {{ take?: string | null }} [o] * @returns {Promise<string[]>} */ -export async function ledgerFileWarnings(dir, manifest) { +export async function ledgerFileWarnings(dir, manifest, { take = null } = {}) { if (!Array.isArray(manifest?.ledger)) return []; - const names = (await readdir(dir).catch(() => [])).filter((n) => /^ledger.*\.json$/i.test(n)).sort(); + const names = (await readdir(dir).catch(() => [])).filter((n) => /^ledger.*\.json$/i.test(n) && !/^ledger-?schema\b/i.test(n)).sort(); if (!names.length) return []; - const day = (ms) => new Date(ms).toISOString().slice(0, 10); + const pad = (n) => String(n).padStart(2, "0"); + const day = (ms) => { + const d = new Date(ms); + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; + }; const rows = (n) => `${n} row${n === 1 ? "" : "s"}`; const man = await stat(path.join(dir, "video.manifest.json")).catch(() => null); - const live = `video.manifest.json's \`ledger\` (${rows(manifest.ledger.length)}${man ? `, ${day(man.mtimeMs)}` : ""})`; + const liveIds = new Set(manifest.ledger.map((r) => (isObj(r) ? String(r.id ?? "") : "")).filter(Boolean)); + const when = man ? `, ${day(man.mtimeMs)}` : ""; + const live = take + ? `take ${take}'s (video.manifest.json's with its patch; ${rows(manifest.ledger.length)}${when})` + : `video.manifest.json's \`ledger\` (${rows(manifest.ledger.length)}${when})`; const out = []; for (const name of names) { const st = await stat(path.join(dir, name)).catch(() => null); - if (!st?.isFile()) continue; - let doc = null; + // A ledger file, not a dump: past 64 MB it is not read. + if (!st?.isFile() || st.size > 64 * 1024 * 1024) continue; + let doc; try { doc = JSON.parse(await readFile(path.join(dir, name), "utf8")); } catch { - /* not JSON: counted as unknown */ + continue; } const list = Array.isArray(doc) ? doc : Array.isArray(doc?.ledger) ? doc.ledger : Array.isArray(doc?.rows) ? doc.rows : null; - const it = `${name} (${list ? rows(list.length) : "rows unknown"}, ${day(st.mtimeMs)})`; - const newer = man && st.mtimeMs > man.mtimeMs; + if (!list?.length || !list.every((r) => isObj(r) && (typeof r.id === "string" || typeof r.id === "number") && String(r.id) !== "")) continue; + const extra = [...new Set(list.map((r) => String(r.id)))].filter((id) => !liveIds.has(id)); + const it = `${name} (${rows(list.length)}, ${day(st.mtimeMs)})`; + const newer = !!man && st.mtimeMs > man.mtimeMs; + const few = extra.slice(0, 5).join(", ") + (extra.length > 5 ? `, +${extra.length - 5} more` : ""); out.push( `${name} is not the ledger the build reads: the live ledger is ${live}; ` + - (newer - ? `${it} is NEWER than the manifest -- rows added there are not in the cut (umtool ledger <p> add …)` - : `${it} is stale -- the manifest is newer`) + + (newer && extra.length + ? `${it} is NEWER than the manifest and holds ${rows(extra.length)} the live ledger lacks (${few}) -- not in the cut (umtool ledger <p> add …)` + : `${it} is stale${extra.length ? ` -- ${rows(extra.length)} of it not in the live ledger (${few})` : ""}${newer ? " (written after the manifest, nothing in it the live ledger lacks)" : " -- the manifest is newer"}`) + "; the file is left as it is", ); } @@ -190,7 +206,7 @@ export async function lintCommand(args, { reportsRoot = REPORTS_ROOT, log = cons const lint = await lintManifestFile(file, { variant, final: flags.has("--final") }); const files = await namedFileProblems(selectVariant(manifest, variant), project.dir); const voices = await castProblems(selectVariant(manifest, variant), project, reportsRoot); - const ledgers = await ledgerFileWarnings(project.dir, manifest); + const ledgers = await ledgerFileWarnings(project.dir, manifest, { take }); const errors = [...lint.errors, ...files.errors]; const warnings = [...lint.warnings, ...files.warnings, ...voices.warnings, ...ledgers]; if (flags.has("--json")) log(JSON.stringify({ ok: errors.length === 0, project: project.id, take, variant, entries: manifest.timeline?.length ?? 0, errors, warnings, notes: voices.notes }, null, 2));