Archilyzer · Source

archilyzer

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

commit 7854518024cf4375380a181ee151105dd8bb7e41
parent 2b1986e69fb26cee9339bebb69b3f05415b7af47
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 22 Oct 2026 11:09:45 -0400

knobs on the merged renderer: its validators are the rules, no shims or stripping; preview layout asked with the schedule; a new at previews approximately until the next build; Claim typedef; the ladder editor carries preset

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mplans/video-knobs-ui.md | 24++++++++----------------
Mumtool/app/api/report/chrome/preview/route.ts | 6+++---
Mumtool/app/api/report/chrome/route.ts | 4++--
Mumtool/app/api/report/still/route.ts | 3+--
Mumtool/components/projects/report/VariantsPanel.tsx | 16+++++++++-------
Mumtool/components/projects/review/ClipKnobs.tsx | 5+++++
Mumtool/docs/knobs.md | 6+++---
Mumtool/lib/report/knobs.mjs | 298+++++++++++--------------------------------------------------------------------
Mumtool/lib/report/knobs.test.mjs | 8+++-----
Mumtool/lib/report/knobsCli.test.mjs | 2+-
Mumtool/lib/report/manifest.mjs | 66++++++++++++++++++++++++------------------------------------------
11 files changed, 100 insertions(+), 338 deletions(-)

diff --git a/plans/video-knobs-ui.md b/plans/video-knobs-ui.md @@ -5,7 +5,7 @@ the count increments / the stamp appears per clip?", "Make quality variants … ones elsewhere", and "Add any knobs you can think of, I want to allow for deep human involvement as well as AI control for these videos." The plan (both lanes): the job's `video-knobs-plan.md`. The renderer side is `lane/knobs-core` (K1, `plans/video-knobs-core.md`); this lane is the writers, routes, UI, CLI and agent control. -Merge order K1 then K2. +K1 merged first; this lane is rebased on it. ## What shipped @@ -37,23 +37,15 @@ Rulings: - The On-screen table's claim rows keep the knobs while the claim id is unchanged; a row naming knobs replaces them. - `audio`: merged per key, a 0 or null removes a key, nothing left removes `audio`; offset rounded to the ms, gain to 0.1 dB, fades to 0.01 s. -- `render.variants`: ≤ 8 rungs, unique names `[a-z0-9-]{1,24}`; `master` takes no setting; a `maxMiB` rung takes no - height or crf; any other rung needs a height (even, 240–2160) or a maxMiB. +- The rules are the renderer's (factcheck.mjs `normalizeClaim`/`validateClaims`/`validateFactcheck`, deck.mjs + `validateChrome`/`validateDeckMarkers`, clip-audio.mjs `validateClipAudio`, variants.mjs `validateVariants`); + `lib/report/knobs.mjs` only reads a typed patch ("12.4", "false", "") into its value, drops a knob at its + default, and names the entry that stamps. - Sync: a lag past one frame (1000 / fps ms) is flagged; the file is the build's `<out>/sourced/sync.json`. +- The On-screen preview's deck layout is asked with the schedule, so a staggered marker band matches the page; the + Count & stamp box says a new `at` previews approximately until the next build. -## Until K1 merges (resolve at merge) - -- **Shims** (K1's files win): `umtool/report-to-video/clip-audio.mjs` (`validateClipAudio`, `CLIP_AUDIO_LIMITS`), - `umtool/report-to-video/variants.mjs` (`encodeVariants(outDir, {slug, variants, onLog})` + the CLI - `node variants.mjs <out dir>`, reading `<out>/../video.manifest.json`, in the heavy slot), and their two lines in - `umtool/report-to-video/package.json` exports (`./clip-audio`, `./variants`). -- `lib/report/knobs.mjs` checks every knob itself and probes the renderer's validators (`normalizeClaim`, - `validateFactcheck`, `validateChrome` markers) once: a validator that refuses a knob is handed the value without - it (`claimsForRenderer`, `chromeForRenderer`); one that accepts it gets the whole value. After K1 merges the probes - are true and those helpers pass values through unchanged. -- The claim knobs' limits here (hold 0.5–10, count 1–99, label ≤ 20, `at` inside `start`–`end`) and the stamp's - (scale 0.5–2, motion slam|pop|fade|none, opacity 0.3–1, stampLabel ≤ 24) are the plan's; if K1's differ, K1's - validators also run after the merge and the stricter rule refuses. +Built on main after lane/knobs-core merged (44c31791): this lane ships no copy of the renderer's modules. ## Files diff --git a/umtool/app/api/report/chrome/preview/route.ts b/umtool/app/api/report/chrome/preview/route.ts @@ -13,7 +13,6 @@ import { deckPreviewSrc, feedPreviewSrc, postsPreviewSrc, resolveReport, stampPr import { deckGeometry, deckLayout, deckOn, feedGeometry, postsGeometry, stampGeometry, validateChrome, } from "umtool-report-to-video/deck"; -import { chromeForRenderer } from "@/lib/report/knobs.mjs"; import { stampsDrawn, tallyOf } from "umtool-report-to-video/factcheck"; export const dynamic = "force-dynamic"; @@ -93,7 +92,7 @@ export async function POST(request: Request) { ); } const { chrome, ...rest } = render; - const errors = validateChrome(chromeForRenderer(chrome), rest); + const errors = validateChrome(chrome, rest); if (errors.length) { return Response.json({ error: `render.chrome: ${errors.join("; ")}`, errors }, { status: 400 }); } @@ -150,7 +149,8 @@ export async function POST(request: Request) { geometry: deckGeometry(render), // The ground a footage moved aside for the posts (schedule.moves) leaves showing. background: typeof (render.palette as { bg?: unknown } | undefined)?.bg === "string" ? (render.palette as { bg: string }).bg : null, - layout: deckLayout(render, { tally: tallyOf(schedule, render) }), + // With the schedule: a staggered marker band (deck.markerLayout) is a second row deep. + layout: deckLayout(render, { tally: tallyOf(schedule, render), schedule }), schedule, posts: { geometry: postsGeometry(render), diff --git a/umtool/app/api/report/chrome/route.ts b/umtool/app/api/report/chrome/route.ts @@ -1,6 +1,6 @@ import { withEditNotes } from "@/lib/report/guard"; import { ChromeRefused, StaleToken, StructureRefused, manifestToken, updateChrome, updateDeckMarkers } from "@/lib/report/manifest.mjs"; -import { MARKER_ALIGNS, MARKER_LAYOUTS, chromeForRenderer, chromeKnobProblems } from "@/lib/report/knobs.mjs"; +import { MARKER_ALIGNS, MARKER_LAYOUTS } from "@/lib/report/knobs.mjs"; import { invalidateProjects } from "@/lib/projects"; import { resolveReport } from "@/lib/report/serve.mjs"; import { DECK_DEFAULTS, deckOn, resolveDeck, validateChrome } from "umtool-report-to-video/deck"; @@ -40,7 +40,7 @@ export async function GET(request: Request) { defaults: DECK_DEFAULTS, // A block somebody hand-edited into a state the build would refuse. The // form shows these rather than pretending the saved settings are fine. - errors: chrome ? [...validateChrome(chromeForRenderer(chrome), rest), ...chromeKnobProblems(chrome)] : [], + errors: chrome ? validateChrome(chrome, rest) : [], // The Markers editor's choices (video knobs). markerAligns: MARKER_ALIGNS, markerLayouts: MARKER_LAYOUTS, diff --git a/umtool/app/api/report/still/route.ts b/umtool/app/api/report/still/route.ts @@ -1,7 +1,6 @@ import { deckStill, scheduleForPreview, stillTimeOf } from "@/lib/report/onscreen.mjs"; import { resolveReport } from "@/lib/report/serve.mjs"; import { deckOn, validateChrome } from "umtool-report-to-video/deck"; -import { chromeForRenderer } from "@/lib/report/knobs.mjs"; export const dynamic = "force-dynamic"; @@ -28,7 +27,7 @@ export async function GET(request: Request) { const render = (variantManifest.render ?? {}) as Record<string, unknown>; if (!deckOn(render)) return new Response("the deck is off for this manifest", { status: 409 }); const { chrome, ...rest } = render; - const errors = validateChrome(chromeForRenderer(chrome), rest); + const errors = validateChrome(chrome, rest); if (errors.length) return new Response(`render.chrome: ${errors.join("; ")}`, { status: 400 }); const clip = url.searchParams.get("clip"); diff --git a/umtool/components/projects/report/VariantsPanel.tsx b/umtool/components/projects/report/VariantsPanel.tsx @@ -24,7 +24,7 @@ import { clipEditorHref } from "@/lib/hrefs"; // `umtool variants <project> [--take t]` and `umtool look <project> variants=…` // do the same from a terminal. -type Variant = { name: string; height?: number; crf?: number; maxMiB?: number }; +type Variant = { name: string; height?: number; crf?: number; maxMiB?: number; preset?: string }; type Made = { name: string; width: number | null; height: number | null; bytes: number | null; kbps: number | null; exists: boolean; mtimeMs: number | null }; type SyncItem = { id: string; start: number | null; lagMs: number | null; peak: number | null; flagged: boolean; clip: boolean }; type State = { @@ -40,11 +40,11 @@ type State = { takes: string[]; }; type Job = { id: string; state: string; error: string | null; kind?: string; log?: string[]; next?: number }; -type LadderRow = { name: string; height: string; crf: string; maxMiB: string }; +type LadderRow = { name: string; height: string; crf: string; maxMiB: string; preset: string }; const input = "num rounded border border-[var(--color-line)] bg-[var(--color-ink)] px-1.5 py-0.5 font-mono text-[11px] text-[var(--color-text)] outline-none focus:border-[var(--color-sel)]"; -const rowOf = (v: Variant): LadderRow => ({ name: v.name, height: v.height == null ? "" : String(v.height), crf: v.crf == null ? "" : String(v.crf), maxMiB: v.maxMiB == null ? "" : String(v.maxMiB) }); +const rowOf = (v: Variant): LadderRow => ({ name: v.name, height: v.height == null ? "" : String(v.height), crf: v.crf == null ? "" : String(v.crf), maxMiB: v.maxMiB == null ? "" : String(v.maxMiB), preset: v.preset ?? "" }); const variantOf = (r: LadderRow): Variant => { const n = (s: string) => (s.trim() === "" ? undefined : Number(s)); const out: Variant = { name: r.name.trim() }; @@ -52,9 +52,11 @@ const variantOf = (r: LadderRow): Variant => { const v = n(r[k]); if (v !== undefined) out[k] = v; } + if (r.preset.trim()) out.preset = r.preset.trim(); return out; }; -const what = (v: Variant) => (v.name === "master" ? "the build as it is" : v.maxMiB ? `at most ${v.maxMiB} MiB` : `${v.height ?? "?"}p, crf ${v.crf ?? 23}`); +const what = (v: Variant) => + (v.name === "master" ? "the build as it is" : v.maxMiB ? `at most ${v.maxMiB} MiB${v.height ? `, up to ${v.height}p` : ""}` : `${v.height ? `${v.height}p` : "the build's height"}, crf ${v.crf ?? 23}`) + (v.preset ? ` · ${v.preset}` : ""); export default function VariantsPanel({ project }: { project: string }) { const [take, setTake] = useState<string>(""); @@ -154,7 +156,7 @@ export default function VariantsPanel({ project }: { project: string }) { </button> ) : ( <> - <button type="button" data-variants-add="" disabled={ladder.length >= 8} onClick={() => setLadder([...ladder, { name: "", height: "", crf: "", maxMiB: "" }])} className={buttonVariants({ variant: "quiet", size: "sm" })}> + <button type="button" data-variants-add="" disabled={ladder.length >= 12} onClick={() => setLadder([...ladder, { name: "", height: "", crf: "", maxMiB: "", preset: "" }])} className={buttonVariants({ variant: "quiet", size: "sm" })}> Add </button> <button type="button" data-variants-save="" onClick={() => void saveLadder(ladder.map(variantOf))} className={buttonVariants({ variant: "outline", size: "sm" })}> @@ -183,10 +185,10 @@ export default function VariantsPanel({ project }: { project: string }) { <ol className="m-0 list-none space-y-1 p-0"> {ladder.map((r, i) => ( <li key={i} className="flex flex-wrap items-center gap-1.5"> - {(["name", "height", "crf", "maxMiB"] as const).map((k) => ( + {(["name", "height", "crf", "maxMiB", "preset"] as const).map((k) => ( <label key={k} className="flex items-center gap-1 text-[11px]"> {k} - <input data-variant-field={`${i}:${k}`} value={r[k]} onChange={(e) => setLadder(ladder.map((x, j) => (j === i ? { ...x, [k]: e.target.value } : x)))} className={`${input} ${k === "name" ? "w-20" : "w-14"}`} /> + <input data-variant-field={`${i}:${k}`} value={r[k]} onChange={(e) => setLadder(ladder.map((x, j) => (j === i ? { ...x, [k]: e.target.value } : x)))} className={`${input} ${k === "name" || k === "preset" ? "w-20" : "w-14"}`} /> </label> ))} <button type="button" onClick={() => setLadder(ladder.filter((_, j) => j !== i))} className={buttonVariants({ variant: "quiet", size: "sm" })}> diff --git a/umtool/components/projects/review/ClipKnobs.tsx b/umtool/components/projects/review/ClipKnobs.tsx @@ -173,6 +173,11 @@ export function CountStampBox({ <KnobField name="count" label="count" step={1} value={claim.count} placeholder={String(defaults?.count ?? 1)} busy={busy} onSave={(v) => set({ count: numOrNull(v) }, v ? `Counts ${v}` : "Counts 1")} /> <KnobField name="label" label="label" kind="text" maxLength={20} value={claim.label} placeholder={word} busy={busy} onSave={(v) => set({ label: v || null }, v ? `The stamp says “${v}”` : "The stamp says the verdict's word")} /> </div> + {typeof claim.at === "number" && ( + <p data-knob-at-hint="" className="m-0 text-muted"> + The On-screen preview places this second from the last build&rsquo;s cut of the clip: it is approximate until the next build. + </p> + )} {defaults && !defaults.stampShown && <p className="m-0 text-muted">The cut draws no stamps (the fact-check's stamp effect is off): the count still steps here.</p>} {outsideCut && ( <p data-knob-warning="" className="m-0 text-reject-text"> diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -1,8 +1,8 @@ # Knobs: every setting of a report video, by hand or by an agent Each knob below is a field or a button in umtool **and** a `umtool` command an agent runs, and both go through the -same writer (`lib/report/manifest.mjs`), checked by the same rules (`lib/report/knobs.mjs`, then the renderer's own -validators). An absent key is the default: the video renders as it did before the knob existed. A knob set to its +same writer (`lib/report/manifest.mjs`), checked by the renderer's own validators (the +build refuses exactly what the writer refuses). An absent key is the default: the video renders as it did before the knob existed. A knob set to its default is removed, never written. Every manifest-write route takes the app's page (no `Authorization` header) or an agent's @@ -38,7 +38,7 @@ claim's id and verdict and keeps its knobs while the id stays the same. | `render.chrome.factcheck.verdicts.<V>.stampLabel` — the stamp's word (singular, `SEIZURE`) beside `label` (the tally's, `SEIZURES`) | fact-check labels, the third column | `factcheck.verdicts.CONTRADICTED.stampLabel=SEIZURE` | same | | `render.chrome.deck.markers[]` — `{after, label ≤ 24, color?, align?}`, at most 12; `align` `auto` `left` `right` `center` | On-screen, **markers**: add, the clip picker, label, colour, align, ↑ ↓, remove | `umtool look <p> deck.markers='[{"after":"c03","label":"Rescue","align":"right"}]'` | `PUT /api/report/chrome {project, token, markers}` | | `render.chrome.deck.markerLayout` — `stagger` or `truncate` when labels crowd (default: stagger only when a label would truncate) | markers, **layout** | `deck.markerLayout=truncate` | `PUT /api/report/chrome {project, token, markerLayout}` | -| `render.variants` — the ladder **Make variants** encodes: `{name, height?, crf?, maxMiB?}`; `master` is the build itself | Deliver, **Variants and sync**: Edit, Save ladder, Use the default | `umtool look <p> variants='[{"name":"master"},{"name":"720p","height":720,"crf":23}]'` | `PUT /api/report/render {project, token, variants}` | +| `render.variants` — the ladder **Make variants** encodes: `{name, height?, crf?, maxMiB?, preset?}` (at most 12; a `maxMiB` rung takes no crf, a height there caps it); `master` is the build itself | Deliver, **Variants and sync**: Edit, Save ladder, Use the default | `umtool look <p> variants='[{"name":"master"},{"name":"720p","height":720,"crf":23}]'` | `PUT /api/report/render {project, token, variants}` | The default ladder: `master`, `1080p` (crf 22), `720p` (crf 23), `fit24` (at most 24 MiB). `umtool look` also sets the look's keys (`transition=0.3`, …: [report-video.md](report-video.md#the-look-captions-loudness-shorts-release-36)). diff --git a/umtool/lib/report/knobs.mjs b/umtool/lib/report/knobs.mjs @@ -1,26 +1,25 @@ -// THE VIDEO KNOBS' RULES, writer side (plans/video-knobs-ui.md): every knob a -// person sets in the clip editor, the fact-check editor, the markers editor or -// Deliver -- and an agent sets with `umtool set` / `umtool look` -- is checked -// HERE before manifest.mjs writes it, so the UI, the routes and the CLI refuse -// the same things in the same words. +// THE VIDEO KNOBS, writer side (plans/video-knobs-ui.md): what a person sets +// in the clip editor, the fact-check editor, the markers editor or Deliver -- +// and an agent sets with `umtool set` / `umtool look` -- before manifest.mjs +// writes it. // -// a claimed entry claim.at / hold / stamp / count / label -// a clip audio: { offset, gain, fadeIn, fadeOut } (clip-audio.mjs validateClipAudio) +// a claimed entry claim.at / hold / stamp / count / label (factcheck.mjs normalizeClaim, validateClaims) +// a clip audio: { offset, gain, fadeIn, fadeOut } (clip-audio.mjs validateClipAudio) // the fact-check render.chrome.factcheck.stamp.scale / motion / opacity, -// verdicts[V].stampLabel -// the deck render.chrome.deck.markers[].align, deck.markerLayout -// the encode ladder render.variants +// verdicts[V].stampLabel (factcheck.mjs validateFactcheck) +// the deck render.chrome.deck.markers[].align, deck.markerLayout (deck.mjs validateChrome) +// the encode ladder render.variants (variants.mjs validateVariants) // -// The renderer (report-to-video, plans/video-knobs-core.md) draws them and -// validates them again with its own functions. Until its validators know a -// knob, the writers hand them the value WITHOUT the knobs (`forRenderer*`), -// having checked the knobs here; once they know it (probed below), the whole -// value goes through both. +// The RULES are the renderer's (report-to-video, plans/video-knobs-core.md): +// a value the writer accepts is one the build accepts. What is here is the +// writer's side of them: a patch typed by a person or an agent ("12.4", +// "false", "") read into the value it means, a knob at its default removed, +// and which entry's knobs the build reads. // // PURE: no fs. Plain ESM so `umtool set` runs it under bare node. -import { VERDICT_LABEL_MAX, VERDICTS } from "yt-dlp-transcript-common/lib/report/verdicts.mjs"; -import { normalizeClaim, validateFactcheck } from "umtool-report-to-video/factcheck"; -import { validateChrome } from "umtool-report-to-video/deck"; +import { CLAIM_KEYS, CLAIM_LIMITS, FACTCHECK_DEFAULTS, FACTCHECK_LIMITS, STAMP_MOTIONS } from "umtool-report-to-video/factcheck"; +import { MARKER_ALIGNS, MARKER_LAYOUTS } from "umtool-report-to-video/deck"; +import { DEFAULT_VARIANTS, validateVariants, variantsOf } from "umtool-report-to-video/variants"; const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); const num = (v) => typeof v === "number" && Number.isFinite(v); @@ -28,25 +27,25 @@ const numIn = (v, lo, hi) => num(v) && v >= lo && v <= hi; const q = (v) => JSON.stringify(v); const round = (n, dp) => Number(Number(n).toFixed(dp)); +export { MARKER_ALIGNS, MARKER_LAYOUTS, STAMP_MOTIONS, variantsOf }; + // --------------------------------------------------------------------------- // A claim's knobs (per entry). // --------------------------------------------------------------------------- /** The knobs a claim may carry beside its id and verdict, in the editor's order. */ -export const CLAIM_KNOBS = Object.freeze(["at", "hold", "stamp", "count", "label"]); +export const CLAIM_KNOBS = Object.freeze(CLAIM_KEYS.filter((k) => k !== "id" && k !== "verdict")); -export const CLAIM_KNOB_LIMITS = Object.freeze({ - hold: Object.freeze([0.5, 10]), - count: Object.freeze([1, 99]), - label: 20, -}); +/** Their limits: the renderer's. */ +export const CLAIM_KNOB_LIMITS = CLAIM_LIMITS; /** The defaults a claim with no knob gets (hold's is the cut's `factcheck.stamp.seconds`). */ export const CLAIM_KNOB_DEFAULTS = Object.freeze({ stamp: true, count: 1 }); /** - * One knob's value, checked and normalised. `null` (or "") = clear the knob. - * Throws a sentence naming `claim.<key>`. + * One knob's value as typed, read and checked. `null` (or "") = clear the + * knob. Throws a sentence naming `claim.<key>`. That `at` lies in the entry's + * window is validateClaims' (it has the entry). * * @param {string} key * @param {unknown} v @@ -57,13 +56,13 @@ export function claimKnobValue(key, v) { switch (key) { case "at": { const x = typeof v === "string" ? Number(v) : v; - if (!num(x) || x < 0) throw new Error(`claim.at must be a source second ≥ 0 (got ${q(v)})`); + if (!num(x) || x < 0) throw new Error(`claim.at must be a source second, 0 or more (got ${q(v)})`); return round(x, 2); } case "hold": { const x = typeof v === "string" ? Number(v) : v; - const [lo, hi] = CLAIM_KNOB_LIMITS.hold; - if (!numIn(x, lo, hi)) throw new Error(`claim.hold must be seconds from ${lo} to ${hi} (got ${q(v)})`); + const [lo, hi] = CLAIM_LIMITS.hold; + if (!numIn(x, lo, hi)) throw new Error(`claim.hold must be from ${lo} to ${hi} seconds (got ${q(v)})`); return round(x, 2); } case "stamp": { @@ -73,15 +72,16 @@ export function claimKnobValue(key, v) { } case "count": { const x = typeof v === "string" ? Number(v) : v; - const [lo, hi] = CLAIM_KNOB_LIMITS.count; + const [lo, hi] = CLAIM_LIMITS.count; if (!(Number.isInteger(x) && x >= lo && x <= hi)) throw new Error(`claim.count must be a whole number from ${lo} to ${hi} (got ${q(v)})`); return x; } case "label": { - if (typeof v !== "string") throw new Error(`claim.label must be a text (got ${q(v)})`); + if (typeof v !== "string") throw new Error(`claim.label must be words (got ${q(v)})`); const s = v.trim(); if (!s) return null; - if ([...s].length > CLAIM_KNOB_LIMITS.label) throw new Error(`claim.label is ${[...s].length} characters (at most ${CLAIM_KNOB_LIMITS.label})`); + if (/[\r\n]/.test(s)) throw new Error("claim.label must be one line"); + if (s.length > CLAIM_LIMITS.label) throw new Error(`claim.label is ${s.length} characters (at most ${CLAIM_LIMITS.label})`); return s; } default: @@ -120,14 +120,6 @@ export function claimKnobsOf(claim) { return out; } -/** A claim without its knobs: `{ id, verdict }` (anything else it carries is kept). */ -export function claimWithoutKnobs(claim) { - if (!isObj(claim)) return claim; - const out = { ...claim }; - for (const k of CLAIM_KNOBS) delete out[k]; - return out; -} - /** * The entry that STAMPS a claim: the last in the timeline carrying its id * (per variant: an entry with `variant` set counts only in that cut, one with @@ -147,232 +139,24 @@ export function stampingEntryId(manifest, claimId, variant = null) { return last; } -/** - * Every problem with the claim knobs in a timeline, as sentences: each knob's - * value, and `at` inside its entry's window (`start`–`end`, the source clock). - * - * @param {{ timeline?: unknown[] }} manifest - * @returns {string[]} - */ -export function claimKnobProblems(manifest) { - const errors = []; - (Array.isArray(manifest?.timeline) ? manifest.timeline : []).forEach((e, i) => { - if (!isObj(e) || !isObj(e.claim)) return; - const where = `timeline[${i}] (${e.id ?? "?"})`; - for (const k of CLAIM_KNOBS) { - if (e.claim[k] === undefined) continue; - try { - if (claimKnobValue(k, e.claim[k]) === null) errors.push(`${where}.claim.${k} is empty: remove the key`); - } catch (err) { - errors.push(`${where}.${err instanceof Error ? err.message : String(err)}`); - } - } - if (num(e.claim.at) && num(e.start) && num(e.end) && (e.claim.at < e.start || e.claim.at > e.end)) { - errors.push(`${where}.claim.at ${e.claim.at} must lie inside the clip's window ${e.start}–${e.end}`); - } - }); - return errors; -} - // --------------------------------------------------------------------------- -// The fact-check's stamp knobs (render.chrome.factcheck). +// The fact-check's stamp knobs, for the editor's placeholders. // --------------------------------------------------------------------------- -export const STAMP_MOTIONS = Object.freeze(["slam", "pop", "fade", "none"]); -export const STAMP_KNOB_LIMITS = Object.freeze({ scale: Object.freeze([0.5, 2]), opacity: Object.freeze([0.3, 1]) }); -export const STAMP_KNOB_DEFAULTS = Object.freeze({ scale: 1, motion: "slam", opacity: 1 }); -/** The stamp knobs `render.chrome.factcheck.stamp` gains. */ +/** The stamp knobs `render.chrome.factcheck.stamp` carries beside show/seconds/position. */ export const STAMP_KNOBS = Object.freeze(["scale", "motion", "opacity"]); - -/** - * The fact-check knobs' problems: stamp scale / motion / opacity and each - * verdict's `stampLabel`. Everything else in the block is the renderer's - * validateFactcheck's. - * - * @param {unknown} f render.chrome.factcheck - * @returns {string[]} - */ -export function factcheckKnobProblems(f, where = "render.chrome.factcheck") { - if (!isObj(f)) return []; - const errors = []; - if (isObj(f.stamp)) { - const s = f.stamp; - const [slo, shi] = STAMP_KNOB_LIMITS.scale; - if (s.scale !== undefined && !numIn(s.scale, slo, shi)) errors.push(`${where}.stamp.scale must be from ${slo} to ${shi}`); - if (s.motion !== undefined && !STAMP_MOTIONS.includes(s.motion)) errors.push(`${where}.stamp.motion must be ${STAMP_MOTIONS.map((m) => `"${m}"`).join(", ")}`); - const [olo, ohi] = STAMP_KNOB_LIMITS.opacity; - if (s.opacity !== undefined && !numIn(s.opacity, olo, ohi)) errors.push(`${where}.stamp.opacity must be from ${olo} to ${ohi}`); - } - if (isObj(f.verdicts)) { - for (const [k, v] of Object.entries(f.verdicts)) { - if (!isObj(v) || v.stampLabel === undefined) continue; - const w = `${where}.verdicts.${k}.stampLabel`; - if (typeof v.stampLabel !== "string" || !v.stampLabel.trim()) errors.push(`${w} must be a text (remove the key for the verdict's label)`); - else if ([...v.stampLabel.trim()].length > VERDICT_LABEL_MAX) errors.push(`${w} is ${[...v.stampLabel.trim()].length} characters (at most ${VERDICT_LABEL_MAX})`); - } - } - return errors; -} - -/** The fact-check block without the knobs (the renderer's validator before it knows them). */ -function factcheckWithoutKnobs(f) { - if (!isObj(f)) return f; - const out = { ...f }; - if (isObj(f.stamp)) { - const s = { ...f.stamp }; - for (const k of STAMP_KNOBS) delete s[k]; - out.stamp = s; - } - if (isObj(f.verdicts)) { - out.verdicts = Object.fromEntries( - Object.entries(f.verdicts).map(([k, v]) => { - if (!isObj(v)) return [k, v]; - const { stampLabel: _s, ...rest } = v; - return [k, rest]; - }), - ); - } - return out; -} - -// --------------------------------------------------------------------------- -// The deck's markers (render.chrome.deck.markers, deck.markerLayout). -// --------------------------------------------------------------------------- - -export const MARKER_ALIGNS = Object.freeze(["auto", "left", "right", "center"]); -export const MARKER_LAYOUTS = Object.freeze(["stagger", "truncate"]); - -/** The marker knobs' problems: each marker's `align`, and the deck's `markerLayout`. */ -export function markerKnobProblems(deck, where = "render.chrome.deck") { - if (!isObj(deck)) return []; - const errors = []; - if (Array.isArray(deck.markers)) { - deck.markers.forEach((m, i) => { - if (isObj(m) && m.align !== undefined && !MARKER_ALIGNS.includes(m.align)) { - errors.push(`${where}.markers[${i}].align must be ${MARKER_ALIGNS.map((a) => `"${a}"`).join(", ")}`); - } - }); - } - if (deck.markerLayout !== undefined && !MARKER_LAYOUTS.includes(deck.markerLayout)) { - errors.push(`${where}.markerLayout must be ${MARKER_LAYOUTS.map((a) => `"${a}"`).join(" or ")}`); - } - return errors; -} - -function deckWithoutKnobs(deck) { - if (!isObj(deck)) return deck; - const { markerLayout: _l, ...out } = deck; - if (Array.isArray(deck.markers)) { - out.markers = deck.markers.map((m) => { - if (!isObj(m)) return m; - const { align: _a, ...rest } = m; - return rest; - }); - } - return out; -} - -/** Every knob problem in a `render.chrome` block (fact-check and markers). */ -export function chromeKnobProblems(chrome) { - if (!isObj(chrome)) return []; - return [...factcheckKnobProblems(chrome.factcheck), ...markerKnobProblems(chrome.deck)]; -} +export const STAMP_KNOB_DEFAULTS = Object.freeze(Object.fromEntries(STAMP_KNOBS.map((k) => [k, FACTCHECK_DEFAULTS.stamp[k]]))); +export const STAMP_KNOB_LIMITS = Object.freeze({ scale: FACTCHECK_LIMITS.scale, opacity: FACTCHECK_LIMITS.opacity }); // --------------------------------------------------------------------------- // The encode ladder (render.variants). // --------------------------------------------------------------------------- /** The ladder "Make variants" encodes when the manifest names none. */ -export const VARIANTS_DEFAULT = Object.freeze([ - Object.freeze({ name: "master" }), - Object.freeze({ name: "1080p", height: 1080, crf: 22 }), - Object.freeze({ name: "720p", height: 720, crf: 23 }), - Object.freeze({ name: "fit24", maxMiB: 24 }), -]); -export const VARIANT_NAME_RE = /^[a-z0-9][a-z0-9-]{0,23}$/; -export const VARIANTS_MAX = 8; -export const VARIANT_LIMITS = Object.freeze({ height: Object.freeze([240, 2160]), crf: Object.freeze([0, 51]), maxMiB: Object.freeze([1, 4096]) }); - -/** The ladder a cut encodes: its own, else the default. */ -export const variantsOf = (render) => (Array.isArray(render?.variants) ? render.variants : VARIANTS_DEFAULT); - -/** - * `render.variants`: a list of `{ name, height?, crf?, maxMiB? }`. `master` - * is the build's own file and takes no setting; a `maxMiB` variant picks its - * own height, so it names no height or crf. - * - * @returns {string[]} - */ -export function variantsProblems(v, where = "render.variants") { - if (v === undefined || v === null) return []; - if (!Array.isArray(v)) return [`${where} must be a list of { name, height?, crf?, maxMiB? }`]; - const errors = []; - if (!v.length) errors.push(`${where} is empty: remove it for the default ladder`); - if (v.length > VARIANTS_MAX) errors.push(`${where} has ${v.length} variants (at most ${VARIANTS_MAX})`); - const seen = new Set(); - v.forEach((x, i) => { - const w = `${where}[${i}]`; - if (!isObj(x)) { - errors.push(`${w} must be { name, height?, crf?, maxMiB? }`); - return; - } - for (const k of Object.keys(x)) if (!["name", "height", "crf", "maxMiB"].includes(k)) errors.push(`${w}.${k} is not a variant setting (name, height, crf, maxMiB)`); - if (typeof x.name !== "string" || !VARIANT_NAME_RE.test(x.name)) errors.push(`${w}.name must be lower-case letters, digits and dashes (at most 24)`); - else if (seen.has(x.name)) errors.push(`${w}.name ${x.name} is used twice`); - else seen.add(x.name); - const [hlo, hhi] = VARIANT_LIMITS.height; - if (x.height !== undefined && !(Number.isInteger(x.height) && x.height >= hlo && x.height <= hhi && x.height % 2 === 0)) { - errors.push(`${w}.height must be an even whole number of pixels from ${hlo} to ${hhi}`); - } - const [clo, chi] = VARIANT_LIMITS.crf; - if (x.crf !== undefined && !(Number.isInteger(x.crf) && x.crf >= clo && x.crf <= chi)) errors.push(`${w}.crf must be a whole number from ${clo} to ${chi}`); - const [mlo, mhi] = VARIANT_LIMITS.maxMiB; - if (x.maxMiB !== undefined && !numIn(x.maxMiB, mlo, mhi)) errors.push(`${w}.maxMiB must be from ${mlo} to ${mhi}`); - if (x.name === "master" && (x.height !== undefined || x.crf !== undefined || x.maxMiB !== undefined)) errors.push(`${w}: master is the build's own file and takes no setting`); - if (x.maxMiB !== undefined && (x.height !== undefined || x.crf !== undefined)) errors.push(`${w}: a maxMiB variant picks its own height and quality (no height or crf with it)`); - if (x.name !== "master" && x.height === undefined && x.maxMiB === undefined) errors.push(`${w} needs a height or a maxMiB`); - }); - return errors; -} - -// --------------------------------------------------------------------------- -// Until the renderer's validators know the knobs. -// -// Probed once: a renderer whose normalizeClaim / validateFactcheck / -// validateChrome refuses a knob is handed the value without it (the knob was -// checked above); one that accepts it is handed the whole value. -// --------------------------------------------------------------------------- +export const VARIANTS_DEFAULT = DEFAULT_VARIANTS; -const probe = (fn) => { - try { - return fn(); - } catch { - return false; - } -}; -const RENDERER_KNOWS = { - claim: probe(() => !!normalizeClaim({ id: "k", verdict: VERDICTS[0], count: 2, at: 1, hold: 2, stamp: false, label: "X" })), - factcheck: probe(() => validateFactcheck({ stamp: { scale: 1, motion: "pop", opacity: 1 }, verdicts: { [VERDICTS[0]]: { stampLabel: "X" } } }).length === 0), - markers: probe(() => !validateChrome({ engine: "hyperframes", layout: "deck", deck: { markers: [{ after: "a", label: "b", align: "left" }], markerLayout: "stagger" } }, {}).some((e) => /align|markerLayout/.test(e))), -}; - -/** Does the renderer's validator know this group of knobs? */ -export const rendererKnows = (group) => RENDERER_KNOWS[group] === true; - -/** A manifest as the renderer's claim validator can read it. */ -export function claimsForRenderer(manifest) { - if (rendererKnows("claim") || !Array.isArray(manifest?.timeline)) return manifest; - return { ...manifest, timeline: manifest.timeline.map((e) => (isObj(e) && isObj(e.claim) ? { ...e, claim: claimWithoutKnobs(e.claim) } : e)) }; -} - -/** A `render.chrome` block as the renderer's validateChrome can read it. */ -export function chromeForRenderer(chrome) { - if (!isObj(chrome)) return chrome; - let out = chrome; - if (!rendererKnows("factcheck") && isObj(chrome.factcheck)) out = { ...out, factcheck: factcheckWithoutKnobs(chrome.factcheck) }; - if (!rendererKnows("markers") && isObj(chrome.deck)) out = { ...out, deck: deckWithoutKnobs(chrome.deck) }; - return out; -} +/** A variant's name, as the encoder's rule: what a file may be served by. */ +export const VARIANT_NAME_RE = /^[a-z0-9][a-z0-9-]{0,23}$/; -/** A fact-check block as the renderer's validateFactcheck can read it. */ -export const factcheckForRenderer = (f) => (rendererKnows("factcheck") ? f : factcheckWithoutKnobs(f)); +/** `render.variants`' problems: the encoder's validateVariants; null (remove it) has none. */ +export const variantsProblems = (v) => (v === null ? [] : validateVariants(v)); diff --git a/umtool/lib/report/knobs.test.mjs b/umtool/lib/report/knobs.test.mjs @@ -71,8 +71,8 @@ test("updateClaimKnobs: sets each knob, says which entry stamps, clears with nul test("updateClaimKnobs: refuses a bad value, an at outside the window, an entry with no claim, a stale token", async () => { const dir = await project(); const before = await readRaw(dir); - await assert.rejects(updateClaimKnobs(dir, "c02", { at: 50 }), /claim\.at 50 must lie inside the clip's window 30–41/); - await assert.rejects(updateClaimKnobs(dir, "c02", { hold: 0.2 }), /claim\.hold must be seconds from 0\.5 to 10/); + await assert.rejects(updateClaimKnobs(dir, "c02", { at: 50 }), /claim\.at 50 is outside the clip's window 30–41/); + await assert.rejects(updateClaimKnobs(dir, "c02", { hold: 0.2 }), /claim\.hold must be from 0\.5 to 10 seconds/); await assert.rejects(updateClaimKnobs(dir, "c02", { count: 1.5 }), /whole number from 1 to 99/); await assert.rejects(updateClaimKnobs(dir, "c02", { label: "x".repeat(21) }), /at most 20/); await assert.rejects(updateClaimKnobs(dir, "c02", { colour: 1 }), /not a claim knob/); @@ -175,11 +175,10 @@ test("updateVariants: sets the ladder, null restores the default, a bad ladder i const dir = await project(); await updateVariants(dir, [{ name: "master" }, { name: "4k", height: 2160, crf: 18 }, { name: "fit8", maxMiB: 8 }]); assert.equal((await read(dir)).render.variants.length, 3); - await assert.rejects(updateVariants(dir, [{ name: "x", maxMiB: 8, height: 720 }]), /picks its own height/); + await assert.rejects(updateVariants(dir, [{ name: "x", maxMiB: 8, crf: 20 }]), /takes no crf/); await assert.rejects(updateVariants(dir, [{ name: "a", height: 720 }, { name: "a", height: 480 }]), /used twice/); await assert.rejects(updateVariants(dir, [{ name: "A b" }]), /name must be/); await assert.rejects(updateVariants(dir, [{ name: "master", crf: 20 }]), /master/); - await assert.rejects(updateVariants(dir, [{ name: "x" }]), /needs a height or a maxMiB/); await updateVariants(dir, null); assert.equal("variants" in (await read(dir)).render, false); }); @@ -188,7 +187,6 @@ test("knobs: normalizeClaimKnobPatch and the problems lists", () => { assert.deepEqual(knobs.normalizeClaimKnobPatch({ at: "12.345", stamp: "false", count: "2" }), { at: 12.35, stamp: false, count: 2 }); assert.deepEqual(knobs.normalizeClaimKnobPatch({ stamp: true, count: 1 }), { stamp: null, count: null }); assert.throws(() => knobs.normalizeClaimKnobPatch({}), /nothing to change/); - assert.deepEqual(knobs.claimKnobProblems({ timeline: [{ id: "a", start: 1, end: 2, claim: { id: "k", verdict: "PARTLY", at: 5 } }] }), ["timeline[0] (a).claim.at 5 must lie inside the clip's window 1–2"]); assert.deepEqual(knobs.variantsProblems(knobs.VARIANTS_DEFAULT), []); assert.equal(knobs.stampingEntryId({ timeline: [{ id: "a", claim: { id: "k" } }, { id: "b", claim: { id: "k" } }, { id: "c", variant: "full", claim: { id: "k" } }] }, "k", "sourced"), "b"); }); diff --git a/umtool/lib/report/knobsCli.test.mjs b/umtool/lib/report/knobsCli.test.mjs @@ -61,7 +61,7 @@ test("umtool set: claim and audio knobs through the writers; key= clears; a bad assert.equal(await run("set", "c01", "claim.colour=1"), 2); assert.match(lines.at(-1), /not a clip knob/); assert.equal(await run("set", "c01", "claim.at=99"), 1); - assert.match(lines.at(-1), /must lie inside the clip's window/); + assert.match(lines.at(-1), /is outside the clip's window/); assert.equal(await run("set", "c02", "claim.count=2"), 1); assert.match(lines.at(-1), /carries no claim/); assert.equal(await run("set"), 2); diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -39,20 +39,7 @@ import { validateRoom } from "umtool-report-to-video/room"; import { applySectionEnter } from "./sections.mjs"; import { normalizeClaim, validateClaims } from "umtool-report-to-video/factcheck"; import { validateClipAudio } from "umtool-report-to-video/clip-audio"; -import { - CLAIM_KNOBS, - chromeForRenderer, - chromeKnobProblems, - claimKnobProblems, - claimKnobsOf, - claimKnobValue, - claimsForRenderer, - factcheckKnobProblems, - markerKnobProblems, - normalizeClaimKnobPatch, - stampingEntryId, - variantsProblems, -} from "./knobs.mjs"; +import { CLAIM_KNOBS, claimKnobsOf, claimKnobValue, normalizeClaimKnobPatch, stampingEntryId, variantsProblems } from "./knobs.mjs"; import { validateNarration } from "umtool-report-to-video/narration"; import { parseMuteFrom } from "./playback.mjs"; import { DELIVERABLES_MODES } from "./storage.mjs"; @@ -820,6 +807,12 @@ function setOnscreen(entry, value) { } /** + * An entry's fact-check claim (factcheck.mjs normalizeClaim): its id and + * verdict, and the stamp's knobs on the entry that stamps it (video knobs). + * @typedef {{ id: string, verdict: string, at?: number, hold?: number, stamp?: false, count?: number, label?: string }} Claim + */ + +/** * A row of the On-screen table split into its two keys: the entry's * `onscreen` text, normalised (null: delete it), and -- only when the row * names one -- its fact-check `claim` (`{ id, verdict }`, or null to delete @@ -827,7 +820,7 @@ function setOnscreen(entry, value) { * alone. Throws on a value either normaliser refuses. * * @param {unknown} row - * @returns {{ onscreen: { title?: string, subtitle?: string } | null, claim?: { id: string, verdict: string } | null }} + * @returns {{ onscreen: { title?: string, subtitle?: string } | null, claim?: Claim | null }} */ export function splitOnscreenRow(row) { if (row === null || row === undefined || typeof row !== "object" || Array.isArray(row) || !("claim" in row)) { @@ -871,10 +864,10 @@ export function splitOnscreenRow(row) { * included: an entry only the `full` cut shows still has a title. * * @param {string} dir - * @param {Record<string, { title?: string, subtitle?: string, claim?: { id: string, verdict: string } | null } | null>} onscreen + * @param {Record<string, { title?: string, subtitle?: string, claim?: Claim | null } | null>} onscreen * @param {{ token?: string | null }} [opts] * @returns {Promise<{ onscreen: Record<string, { title?: string, subtitle?: string } | null>, - * claims: Record<string, { id: string, verdict: string } | null>, token: string | null }>} + * claims: Record<string, Claim | null>, token: string | null }>} */ export async function updateOnscreen(dir, onscreen, { token = null } = {}) { if (!onscreen || typeof onscreen !== "object" || Array.isArray(onscreen)) { @@ -886,7 +879,7 @@ export async function updateOnscreen(dir, onscreen, { token = null } = {}) { // file says, and refusing it needs no read. /** @type {Record<string, { title?: string, subtitle?: string } | null>} */ const next = {}; - /** @type {Record<string, { id: string, verdict: string } | null>} */ + /** @type {Record<string, Claim | null>} */ const claims = {}; /** The rows whose claim names its knobs: those REPLACE the entry's; any other keeps them. */ const withKnobs = new Set(); @@ -929,7 +922,7 @@ export async function updateOnscreen(dir, onscreen, { token = null } = {}) { // The claims as the build will read them: one verdict per claim id, none // on a teaser, each knob in range. Refused before the write, so the file // is as it was. - const bad = [...validateClaims(claimsForRenderer(manifest)), ...claimKnobProblems(manifest)]; + const bad = validateClaims(manifest); if (bad.length) throw new Error(`claim: ${bad.join("; ")} — nothing was written`); const nextToken = await writeManifestAtomic(dir, manifest); @@ -963,11 +956,11 @@ export async function updateChrome(dir, chrome, { token = null } = {}) { if (chrome === null) { if (manifest.render) delete manifest.render.chrome; } else { - const errors = [...validateChrome(chromeForRenderer(chrome), renderWithoutChrome), ...chromeKnobProblems(chrome)]; + const errors = validateChrome(chrome, renderWithoutChrome); if (errors.length) throw new ChromeRefused(errors); manifest.render = { ...(manifest.render ?? {}), chrome }; // The deck's markers against the timeline: each follows a clip in it. - const markers = validateDeckMarkers(rendererView(manifest)); + const markers = validateDeckMarkers(manifest); if (markers.length) throw new ChromeRefused(markers); } @@ -1305,10 +1298,9 @@ export function freshEntryId(timeline, base) { function structureErrors(manifest) { return [ ...validatePosts(manifest.posts, manifest.timeline ?? [], manifest.render), - ...validateClaims(claimsForRenderer(manifest)), - ...claimKnobProblems(manifest), + ...validateClaims(manifest), // The deck's markers follow clips: removing one a marker names is refused. - ...validateDeckMarkers(rendererView(manifest)), + ...validateDeckMarkers(manifest), ...validateTeasers(manifest), ...validateNarration(manifest), ...validateDrafted(manifest), @@ -1700,11 +1692,8 @@ export async function updateFactcheck(dir, factcheck, { token = null } = {}) { if (factcheck === null) delete chrome.factcheck; else chrome.factcheck = factcheck; const { chrome: _old, ...rest } = render; - const already = new Set(validateChrome(chromeForRenderer(render.chrome), rest)); - const errors = [ - ...validateChrome(chromeForRenderer(chrome), rest).filter((e) => !already.has(e)), - ...factcheckKnobProblems(chrome.factcheck), - ]; + const already = new Set(validateChrome(render.chrome, rest)); + const errors = validateChrome(chrome, rest).filter((e) => !already.has(e)); if (errors.length) throw new StructureRefused(errors); m.render = { ...render, chrome }; return { factcheck: chrome.factcheck ?? null }; @@ -1713,18 +1702,11 @@ export async function updateFactcheck(dir, factcheck, { token = null } = {}) { // --------------------------------------------------------------------------- // THE VIDEO KNOBS (plans/video-knobs-ui.md): a claim's stamp and count, the -// deck's markers, the encode ladder. Checked by ./knobs.mjs, and by the -// renderer's own validators once they know the knobs (knobs.mjs probes them). +// deck's markers, the encode ladder. Read by ./knobs.mjs, checked by the +// renderer's own validators (validateClaims, validateChrome, validateVariants). // A clip's `audio` is updateClip's. // --------------------------------------------------------------------------- -/** A manifest as the renderer's validators read it: knobs they do not know yet left out. */ -function rendererView(manifest) { - const m = claimsForRenderer(manifest); - const chrome = manifest?.render?.chrome; - return isObj(chrome) ? { ...m, render: { ...manifest.render, chrome: chromeForRenderer(chrome) } } : m; -} - /** * Patch the knobs of ONE claimed entry's `claim`: `{ at?, hold?, stamp?, * count?, label? }`, each a value or null (back to the default: the key is @@ -1756,8 +1738,8 @@ export async function updateClaimKnobs(dir, entryId, patch, { token = null } = { else e.claim[k] = v; } } - // Ours, then the renderer's own (which also reads the knobs once it knows them). - const bad = [...claimKnobProblems({ timeline: entries }), ...validateClaims(claimsForRenderer({ timeline: entries }))]; + // The renderer's own check -- each knob, and `at` inside the entry's window -- on this entry's rows. + const bad = validateClaims(manifest).filter((e) => e.includes(`(${entryId})`)); if (bad.length) throw new Error(`${bad.join("; ")} — nothing was written`); const nextToken = await writeManifestAtomic(dir, manifest); const stampsOn = stampingEntryId(manifest, entries[0].claim.id); @@ -1816,8 +1798,8 @@ export async function updateDeckMarkers(dir, patch, { token = null } = {}) { } const chrome = { ...render.chrome, deck }; const { chrome: _old, ...rest } = render; - const already = new Set(validateChrome(chromeForRenderer(render.chrome), rest)); - const errors = [...validateChrome(chromeForRenderer(chrome), rest).filter((e) => !already.has(e)), ...markerKnobProblems(deck)]; + const already = new Set(validateChrome(render.chrome, rest)); + const errors = validateChrome(chrome, rest).filter((e) => !already.has(e)); if (errors.length) throw new StructureRefused(errors); m.render = { ...render, chrome }; return { markers: deck.markers ?? [], markerLayout: deck.markerLayout ?? null };