Archilyzer · Source

archilyzer

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

commit bd8c81fb34533b3932b6bc21be2ee28bf492cae4
parent 3839fc53d25832484fd3b49cf781bd4e6a9fae26
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 12 Nov 2026 22:01:45 -0500

umtool analysis item after the merge: its date axis by days alone (trailLayout dayShare, the trail's default unchanged), the deck's faces required early, a --cut-window build over it

trailLayout takes `dayShare` (default DAY_SHARE: the by-date trail as merged); the analysis chart passes 1, so its
pages are byte-identical to before the merge. validateAnalysisEntries refuses a cut without render.fontRegular /
fontBold (its page draws in them). A test builds a --cut-window preview over an analysis item end to end.

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

Diffstat:
Mumtool/docs/report-video.md | 7+++++--
Mumtool/lib/report/analysisCli.test.mjs | 2+-
Mumtool/report-to-video/analysis-build.test.mjs | 35+++++++++++++++++++++++++++++++++--
Mumtool/report-to-video/analysis-plan.mjs | 10++++++++--
Mumtool/report-to-video/analysis-plan.test.mjs | 5+++++
Mumtool/report-to-video/trail-plan.mjs | 6++++--
6 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -533,8 +533,11 @@ row, a two-line reading, the QR -- has clear room. **Its segment** is composed and rendered once (`chrome/analysis-<id>/`, cached by its page key, as a teaser's is) and encoded with its sound; `segments/<id>.analysis.json` keys the frames, the sound (the source file, its offset, its gain) and the encode, so an unchanged item is not encoded again, and -`--chrome-only` rebuilds it from the cache. The deck is away over it (full frame). No vertical form: a -9:16 cut, or `--vertical` on a landscape one, refuses it before anything is spent. `umtool ledger rm` refuses +`--chrome-only` rebuilds it from the cache; a `--cut-window` preview lays it as any segment. The deck is away +over it (full frame). It draws in the deck's faces: a cut without `render.fontRegular` and `render.fontBold` +is refused early. No vertical form: a 9:16 cut, or `--vertical` on a landscape one, refuses it before +anything is spent. Its date axis is by days alone (`trailLayout`'s `dayShare: 1`), whatever share the +by-date trail gives its weights: a span's width says its days. `umtool ledger rm` refuses a row an analysis item draws, naming the item. A cut without an analysis item builds byte for byte as before. **Play the cut** draws its page as the build does (composed for preview by `POST /api/report/chrome/teasers`, as a teaser's), seeked on the cut clock -- silent: the sound under it is the diff --git a/umtool/lib/report/analysisCli.test.mjs b/umtool/lib/report/analysisCli.test.mjs @@ -19,7 +19,7 @@ const MANIFEST = { schemaVersion: 1, slug: "fixture", title: "Fixture", - render: { width: 640, height: 360, fps: 15, transition: 0 }, + render: { width: 640, height: 360, fps: 15, transition: 0, fontRegular: "/fonts/Regular.ttf", fontBold: "/fonts/Bold.ttf" }, ledgerSchema: { kind: "measure", unit: "lb", bandGapDays: 60, tracks: [{ key: "weight", role: "value", label: "Weight" }], fields: [{ key: "qualifier", label: "Bound", kind: "enum", options: [">", "<", "≈"], render: "cell" }], diff --git a/umtool/report-to-video/analysis-build.test.mjs b/umtool/report-to-video/analysis-build.test.mjs @@ -3,6 +3,7 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { existsSync } from "node:fs"; +import { spawnSync } from "node:child_process"; import { mkdtemp, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; @@ -11,7 +12,8 @@ import { analysisAudioGraph, analysisEncodeArgs, chapterTitle, teaserAudioGraph import { estimatedDuration, estimateSchedule, hidesDeck, resolveDeck } from "./deck.mjs"; import { validatorErrors, lintManifest, qrsOf } from "./lint.mjs"; -const render = { width: 1920, height: 1080, fps: 30, audioRate: 48000, audioChannels: 2, crf: 20, preset: "fast", audioBitrate: "192k" }; +const FONTS = { fontRegular: new URL("./fonts/IBMPlexMono-Regular.ttf", import.meta.url).pathname, fontBold: new URL("./fonts/IBMPlexMono-Bold.ttf", import.meta.url).pathname }; +const render = { width: 1920, height: 1080, fps: 30, audioRate: 48000, audioChannels: 2, crf: 20, preset: "fast", audioBitrate: "192k", ...FONTS }; test("the sound: the clip's span laid on its clock, levelled, faded, padded to the item; silent: the teaser's silence", () => { const g = analysisAudioGraph({ seconds: 14.5, render, audio: { clip: "c46" }, gain: -2.5 }); @@ -105,7 +107,7 @@ test("the first use's shape WITH audio passes the build's own validator block (b fields: [{ key: "qualifier", label: "Bound", kind: "enum", options: [">", "<", "≈"], render: "cell" }] }; const m = { schemaVersion: 1, slug: "fu", title: "First use", provenance: { siteOrigin: "https://example.pages.dev", channelSlug: "chan" }, - render: { width: 1920, height: 1080, fps: 30 }, ledgerSchema: schema, + render: { width: 1920, height: 1080, fps: 30, ...FONTS }, ledgerSchema: schema, ledger: [W("w83", "delta", "2026-07-23", -5), W("w91", "past", "2026-08-03", 349, { asOf: "2026-07-19" }), W("w104", "delta", "2026-09-04", -31.5), W("w110", "current", "2026-09-24", 310.5), W("w113", "delta", "2026-10-06", -47), W("w115", "current", "2026-10-15", 300, { qualifier: "<" }), W("w118", "current", "2026-10-26", 291.5, { asOf: "2026-10-23" }), W("w122", "delta", "2026-11-03", -58.2), W("w137", "current", "2026-11-07", 288.5), { id: "p01", scope: "weight", population: "promise", date: "2026-10-23" }], @@ -136,3 +138,32 @@ test("the first use's shape WITH audio passes the build's own validator block (b await rm(dir, { recursive: true, force: true }); } }); + +test("without the deck's faces an analysis item is refused before anything is spent", () => { + const m = manifest(); + m.render = { width: 1920, height: 1080, fps: 30 }; + assert.ok(validatorErrors(m).some((x) => /an analysis item draws in the deck's faces -- the cut needs render\.fontRegular and render\.fontBold/.test(x))); +}); + +test("--cut-window over an analysis item: the whole cut's segments, then the window laid -- it builds", { skip: (!existsSync(process.env.CHROME ?? "/usr/bin/chromium") || spawnSync("ffmpeg", ["-version"], { stdio: "ignore" }).status !== 0) && "no chromium or ffmpeg" }, async () => { + const { buildVideo } = await import("./build-video.mjs"); + const W = (id, population, date, value) => ({ id, scope: "weight", population, date, value }); + const m = { + schemaVersion: 1, slug: "win", title: "Window", provenance: { siteOrigin: "https://example.pages.dev", channelSlug: "chan" }, + render: { width: 640, height: 360, fps: 10, transition: 0, audioRate: 48000, audioChannels: 2, ...FONTS }, + ledgerSchema: { kind: "measure", unit: "lb", tracks: [{ key: "weight", role: "value" }] }, + ledger: [W("w1", "current", "2026-09-01", 310), W("w2", "current", "2026-10-01", 300)], + timeline: [{ type: "analysis", id: "an", title: "The run", series: { rows: ["w1", "w2"] }, pace: [{ from: "w1", to: "w2" }], reading: "It went down.", seconds: 4 }], + }; + const dir = await mkdtemp(path.join(tmpdir(), "analysis-window-")); + try { + const manifestPath = path.join(dir, "video.manifest.json"); + await writeFile(manifestPath, JSON.stringify(m)); + const r = await buildVideo({ manifestPath, opts: { noNetwork: true, skipFetch: true, cutWindow: { at: 1, dur: 2 } } }); + assert.match(r.out, /win\.window\.mp4$/); + const probe = spawnSync("ffprobe", ["-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", r.out], { encoding: "utf8" }); + assert.ok(Math.abs(Number(probe.stdout) - 2) < 0.25, probe.stdout); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); diff --git a/umtool/report-to-video/analysis-plan.mjs b/umtool/report-to-video/analysis-plan.mjs @@ -204,7 +204,12 @@ export const analysisContext = (manifest) => ({ /** Every analysis entry's errors, as the build refuses them. */ export function validateAnalysisEntries(manifest) { - return (manifest?.timeline ?? []).filter((e) => e?.type === "analysis").flatMap((e) => analysisProblems(e, analysisContext(manifest)).errors); + const items = (manifest?.timeline ?? []).filter((e) => e?.type === "analysis"); + const errors = items.flatMap((e) => analysisProblems(e, analysisContext(manifest)).errors); + // Its page draws in the deck's faces (instrumentFonts): a cut without them is refused before anything is spent. + const r = manifest?.render ?? {}; + if (items.length && (!r.fontRegular || !r.fontBold)) errors.push(`timeline ${items[0].id} (analysis): an analysis item draws in the deck's faces -- the cut needs render.fontRegular and render.fontBold`); + return errors; } /** Every analysis entry's warnings, as the lint says them. */ @@ -265,7 +270,8 @@ export function analysisPlan(entry, ctx, box = { x0: 70, x1: 800, y0: 150, y1: 5 const { points } = r; const line = trailLine(points); const mark = r.mark ? r.mark.value : null; - const L = trailLayout(points, box, { thr: Infinity, mark }); + // By days alone (dayShare 1): on this chart a span's width says its days, the band and the months included. + const L = trailLayout(points, box, { thr: Infinity, mark, dayShare: 1 }); const pos = new Map(points.map((p) => [p.n, { x: L.X(p.day), y: L.Y(p.value) }])); const step = L.hi - L.lo > 60 ? 20 : 10; const grid = []; diff --git a/umtool/report-to-video/analysis-plan.test.mjs b/umtool/report-to-video/analysis-plan.test.mjs @@ -232,4 +232,9 @@ test("axes: one cluster fitted to the points (trailLayout), a tick per month, th assert.equal(plan.layout.hi, 360); assert.deepEqual(plan.layout.months.map((m) => m.text), ["JUL", "AUG", "SEP", "OCT", "NOV"]); assert.ok(plan.band.x1 > plan.band.x0); + // The date axis is by days alone (trailLayout dayShare 1), whatever share the by-date trail gives to its weights: + // equal days, equal widths. + const per = (a, b) => (plan.layout.X(b) - plan.layout.X(a)) / (b - a); + const d = (iso) => Date.parse(`${iso}T00:00:00Z`) / 864e5; + assert.ok(Math.abs(per(d("2026-07-19"), d("2026-08-03")) - per(d("2026-10-23"), d("2026-11-07"))) < 0.02); }); diff --git a/umtool/report-to-video/trail-plan.mjs b/umtool/report-to-video/trail-plan.mjs @@ -95,8 +95,10 @@ const jan1 = (y) => Date.UTC(y, 0, 1) / 86400000; * between them (`gaps`: `{ key, x }`), the year labels (`years`: `{ key, text, x, tick }`), and `X(day)` / `Y(v)`. * * `box` = `{ x0, x1, y0, y1, gapPx, yearPx }` in page pixels. + * `dayShare` (default DAY_SHARE): the part of the width shared out by days -- 1 lays x by days alone (the analysis + * item's date axis, analysis-plan.mjs, where a span's width says its days). */ -export function trailLayout(points, box, { thr = Infinity, mark = null } = {}) { +export function trailLayout(points, box, { thr = Infinity, mark = null, dayShare = DAY_SHARE } = {}) { const { x0, x1, y0, y1 } = box; const gapPx = box.gapPx ?? 22; const yearPx = box.yearPx ?? 34; @@ -127,7 +129,7 @@ export function trailLayout(points, box, { thr = Infinity, mark = null } = {}) { c.knots = knots.map((d, i) => { if (i > 0) { const share = (i > 1 ? 0.5 : 0) + (i < knots.length - 1 ? 0.5 : 0); - x += avail * (DAY_SHARE * (d - knots[i - 1]) / widthDays + (1 - DAY_SHARE) * share / slots); + x += avail * (dayShare * (d - knots[i - 1]) / widthDays + (1 - dayShare) * share / slots); } return { d, x }; });