Archilyzer · Source

archilyzer

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

commit 1bcec842155f1e17f9556af25b1d9b9d9ae2f7a0
parent bd5dc71e822c9f2b56998ae0b961910b1ca8942b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 20 Nov 2026 19:23:57 -0500

Merge main into lane/gap-cue-module

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

Diffstat:
Meditor/CHANGELOG.md | 6++++++
Mumtool/docs/knobs.md | 4+++-
Mumtool/lib/report/sourceStatusCli.mjs | 35+++++++++++++++++++++++++++++------
Mumtool/lib/report/sourceStatusCli.test.mjs | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Aumtool/lib/report/sourceStatusTake.test.mjs | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/deck-source-status.test.mjs | 16++++++++++++++++
Mumtool/report-to-video/source-status.mjs | 23++++++++++++++++++-----
7 files changed, 229 insertions(+), 16 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog ## [Unreleased] +- **umtool: a take renders when the source-status stamp holds a source with no record.** + - A take of a project with a look preset failed with `sourceStatus.sources["…"].now must be one of …`, whether the + deck drew the status or not. Laying the project over its preset dropped the stamp's empty fields, and the build + read a missing field as wrong. It now reads a missing field as empty. + - `umtool source-status <p> refresh` no longer writes empty fields, so the project's stamp and the take's agree. A + stamp written with them still works, and a refresh does not rewrite it only to remove them. - **umtool: under a deck, the gap mark is a HyperFrames module, so changing it re-renders chrome only.** - Wherever a deck is drawn, the mark is the `gap-cue` module: one short page per mark, at its own seconds, like the stamps and popup posts. Its page is its live preview in Play the cut. diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -233,7 +233,9 @@ archive's build. It writes the stamp, one undo point, only when it changed. With is unchanged and the build says once that `refresh` has not been run; a status older than 14 days is a build note and is listed by `umtool check`, never a refusal, and so is a source whose records were written after the reading its entry holds (each entry keeps `recordsAt`, so a refresh that finds nothing new still clears it). A source with no -availability record at all is not listed. +availability record at all is not listed. An entry's empty fields (`now`, `since`, `asOf`, `first`, `firstAt`, +`firstWhen`) are left out, not written `null`, and a missing one reads as empty: a take lays the project over its look +preset, which drops every `null`, so the two agree. The status is the recording the clip is CUT from, not the one its `citeUrl` opens. Retrofit an old project: the switch (or a look preset that sets it), `refresh`, a retake. With the deck on only the diff --git a/umtool/lib/report/sourceStatusCli.mjs b/umtool/lib/report/sourceStatusCli.mjs @@ -96,7 +96,8 @@ export async function collectSourceStatus({ manifest, layers, archive = null }) const s = await readSourceStatus(dir); const newest = await newestSourceRecordMs(dir); sources[w.key] = { - ...(s ?? { now: null, since: null, asOf: null, first: null, firstAt: null, firstWhen: null, evidence: [] }), + // No record: no state and no reading, its nullable fields absent (compactSourceEntry) -- but an entry, so it was read. + ...(s ?? { evidence: [] }), from: "corpus", // The records' newest write this reading saw: `umtool check` compares the disk against it. ...(newest !== null ? { recordsAt: new Date(newest).toISOString() } : {}), @@ -163,7 +164,8 @@ export function mergeSourceEntry(prior, fresh) { const archived = p.from === "corpus" ? fresh : p; const ca = msOf(corpus.asOf); const aa = msOf(archived.asOf); - if (corpus.now === archived.now) { + // An absent `now` is null (compactSourceEntry): a no-record corpus entry agrees with an archive's null. + if ((corpus.now ?? null) === (archived.now ?? null)) { return { ...corpus, asOf: aa !== null && (ca === null || aa > ca) ? archived.asOf : corpus.asOf }; } if (ca !== null && (aa === null || ca > aa)) return corpus; @@ -178,19 +180,40 @@ export function mergeSourceEntry(prior, fresh) { }; } -/** The stamp's sources after a refresh: every cited source, in manifest order, merged (mergeSourceEntry); uncited ones dropped. */ +/** An entry's fields that may be null; absent reads as null (source-status.mjs validateSourceStatusStamp). */ +export const SOURCE_ENTRY_NULLABLE = Object.freeze(["now", "since", "asOf", "first", "firstAt", "firstWhen"]); + +/** + * One entry as the stamp keeps it: its null-valued nullable fields left out. A take + * lays the manifest over its look preset AS A MERGE PATCH (presets.mjs + * resolvePresetLayers), which drops every null, so this is the shape the take's + * manifest holds too; the entry still exists (a no-record source was read: it is + * `{ evidence: [], from, recordsAt }`). Every other field as it is, in its order. + */ +export function compactSourceEntry(e) { + if (!isObj(e)) return e; + const out = {}; + for (const [k, v] of Object.entries(e)) if (!(v === null && SOURCE_ENTRY_NULLABLE.includes(k))) out[k] = v; + return out; +} + +/** The stamp's sources after a refresh: every cited source, in manifest order, merged (mergeSourceEntry), compacted; uncited ones dropped. */ export function mergeSourceStatus(prior, fresh, keys) { const before = isObj(prior) ? prior : {}; const out = {}; for (const k of keys) { const merged = mergeSourceEntry(before[k], fresh[k]); - if (merged) out[k] = merged; + if (merged) out[k] = compactSourceEntry(merged); } return out; } -/** Two stamps' sources the same (refreshedAt aside)? */ -const sameSources = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null); +/** + * Two stamps' sources the same (refreshedAt aside)? Compared compacted: a stamp + * written with explicit nulls (before compactSourceEntry) is not rewritten for them alone. + */ +const compactSources = (s) => (isObj(s) ? Object.fromEntries(Object.entries(s).map(([k, e]) => [k, compactSourceEntry(e)])) : s ?? null); +export const sameSources = (a, b) => JSON.stringify(compactSources(a)) === JSON.stringify(compactSources(b)); /** How long one archive document may take, redirects and body included. */ export const ARCHIVE_TIMEOUT_MS = 20_000; diff --git a/umtool/lib/report/sourceStatusCli.test.mjs b/umtool/lib/report/sourceStatusCli.test.mjs @@ -83,9 +83,10 @@ test("refresh stamps the corpus's reading and the archive's; a second refresh wr const s1 = m.sourceStatus.sources["synth-channel/synthvid001"]; assert.deepEqual([s1.now, s1.first, s1.firstWhen, s1.from], ["members_only", "public", "live", "corpus"]); const s2 = m.sourceStatus.sources["synth-channel/synthvid002"]; - assert.deepEqual([s2.now, s2.asOf, s2.from], [null, null, "corpus"], "no availability record: no state, never 'gone'"); + assert.deepEqual(s2, { evidence: [], from: "corpus", recordsAt: s2.recordsAt }, "no availability record: no state, never 'gone' -- and no null keys (a take's manifest has none)"); const s3 = m.sourceStatus.sources["synth-channel/synthvid003"]; - assert.deepEqual([s3.now, s3.since, s3.asOf, s3.first, s3.from], ["private", "2031-03-05T00:00:00.000Z", "2031-03-06T00:00:00Z", null, "archive"]); + assert.deepEqual([s3.now, s3.since, s3.asOf, s3.from], ["private", "2031-03-05T00:00:00.000Z", "2031-03-06T00:00:00Z", "archive"]); + assert.ok(!("first" in s3) && !("firstAt" in s3) && !("firstWhen" in s3), "a null first state is left out, not written null"); const undo = (await readdir(path.join(dir, "revisions")).catch(() => [])).filter((f) => f.includes("auto-before-source-status")); assert.equal(undo.length, 1, "one undo point"); @@ -222,7 +223,7 @@ test("refresh without the corpus keeps what the corpus machine stamped (end to e assert.deepEqual([s.now, s.first, s.firstWhen, s.from, s.asOf], ["members_only", "public", "live", "corpus", "2031-03-01T20:00:00Z"], "an older archive build adds nothing"); await run(["ss5", "refresh"], { archive: async () => ({ archiveGeneratedAt: "2031-03-10T00:00:00Z" }) }); s = (await read(dir)).sourceStatus.sources["synth-channel/synthvid040"]; - assert.deepEqual([s.now, s.first], [null, null], "a newer build says public: the order is not known, nothing is drawn"); + assert.deepEqual([s.now ?? null, s.first ?? null, "now" in s], [null, null, false], "a newer build says public: the order is not known, nothing is drawn"); } finally { await rename(`${vdir}.away`, vdir); } @@ -244,7 +245,7 @@ test("archiveReading: no state is public only without the legacy flags; a delete const dir = await project("ss6", [{ type: "clip", id: "c01", video: "synthvid050", start: 1, end: 3, cite: 1 }]); await run(["ss6", "refresh"], { archive: async () => ({ isDeleted: true, archiveGeneratedAt: "2031-03-06T00:00:00Z" }) }); const s = (await read(dir)).sourceStatus.sources["synth-channel/synthvid050"]; - assert.equal(s.now, null); + assert.equal(s.now, undefined, "no state: the key left out (reads as null)"); assert.ok(s.evidence.some((e) => e.kind === "archive" && e.availability === "deleted")); }); @@ -303,3 +304,52 @@ test("a manifest written while refresh reads is refused, not overwritten", async assert.equal(m.title, "Edited meanwhile"); assert.equal(m.sourceStatus, undefined); }); + +// LANE source-status-nulls: a take lays the manifest over its look preset AS A MERGE PATCH +// (presets.mjs resolvePresetLayers), which drops every null, so refresh writes none -- and a +// stamp written before that, with explicit nulls, keeps working and is not rewritten for them. +test("a no-record entry is written without null keys; one written with them reads the same and is not rewritten", async () => { + const { sourceStatusRows, sourceStatusStaleness } = await import("./sourceStatusCli.mjs"); + const dir = await project("ssn1", [{ type: "clip", id: "c01", video: "synthvid002", start: 1, end: 3, cite: 1 }]); + const m0 = await read(dir); + m0.render.chrome = { deck: { subtitle: { status: "end" } } }; + await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(m0, null, 2) + "\n"); + assert.equal(JSON.parse((await run(["ssn1", "refresh", "--json"], { archive: null })).out).written, true); + const key = "synth-channel/synthvid002"; + const compact = (await read(dir)).sourceStatus.sources[key]; + assert.deepEqual(Object.keys(compact), ["evidence", "from", "recordsAt"], "an entry (it was read), its nulls left out"); + // The same entry as the stamp held it before this lane: every nullable field an explicit null. + const m = await read(dir); + m.sourceStatus.sources[key] = { now: null, since: null, asOf: null, first: null, firstAt: null, firstWhen: null, evidence: [], from: "corpus", recordsAt: compact.recordsAt }; + await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(m, null, 2) + "\n"); + const before = (await stat(path.join(dir, "video.manifest.json"))).mtimeMs; + const again = JSON.parse((await run(["ssn1", "refresh", "--json"], { archive: null })).out); + assert.deepEqual([again.changed, again.written], [false, false], "explicit nulls are not a change"); + assert.equal((await stat(path.join(dir, "video.manifest.json"))).mtimeMs, before); + // Both shapes read the same: ls, the rows, check's staleness. + const now = Date.now(); + for (const entry of [compact, m.sourceStatus.sources[key]]) { + const mm = { ...m, sourceStatus: { ...m.sourceStatus, sources: { [key]: entry } } }; + const [row] = sourceStatusRows(mm, { now }); + assert.deepEqual([row.stamped, row.now, row.asOf, row.first, row.firstWhen, row.words, row.stale], [true, null, null, null, null, "", false]); + assert.equal(await sourceStatusStaleness(dir, mm, { now }), null); + } + assert.match((await run(["ssn1", "ls"])).out, /synth-channel\/synthvid002\s+no record\s+—/); +}); + +test("mergeSourceEntry: an absent now is null -- a no-record corpus entry and an archive's null agree; the stamp is compacted", async () => { + const { compactSourceEntry, mergeSourceEntry, mergeSourceStatus, sameSources } = await import("./sourceStatusCli.mjs"); + const noRecord = { evidence: [], from: "corpus", recordsAt: "2031-03-01T00:00:00.000Z" }; + const archiveNull = { now: null, since: null, asOf: "2031-03-06T00:00:00Z", first: null, firstAt: null, firstWhen: null, from: "archive", evidence: [{ kind: "archive", availability: "deleted", counts: false }] }; + for (const [p, f] of [[noRecord, archiveNull], [archiveNull, noRecord]]) { + const merged = mergeSourceEntry(p, f); + assert.equal(merged.from, "corpus", "agreeing: the corpus's entry"); + assert.ok(!merged.evidence.some((e) => e.kind === "disagree"), "not a disagreement"); + assert.equal(merged.asOf, "2031-03-06T00:00:00Z"); + } + const out = mergeSourceStatus({}, { "a/b": { ...archiveNull } }, ["a/b"]); + assert.deepEqual(Object.keys(out["a/b"]), ["asOf", "from", "evidence"]); + assert.deepEqual(compactSourceEntry({ now: "private", since: null, recordsAt: null, x: null }), { now: "private", recordsAt: null, x: null }, "only the nullable fields"); + assert.ok(sameSources({ "a/b": archiveNull }, out)); + assert.ok(!sameSources({ "a/b": archiveNull }, { "a/b": { ...out["a/b"], now: "private" } })); +}); diff --git a/umtool/lib/report/sourceStatusTake.test.mjs b/umtool/lib/report/sourceStatusTake.test.mjs @@ -0,0 +1,103 @@ +// A TAKE OF A PROJECT WHOSE STAMP HOLDS A NO-RECORD SOURCE (lane source-status-nulls). +// +// A take's manifest is the project's with its look preset laid under it: composeTake -> +// presets.mjs resolvePresetLayers, which lays the MANIFEST over `{ render: preset.render }` +// as a merge patch, so every explicit null in it is dropped. A stamp's no-record entry +// (`now: null, …`) arrived at the build as `{ evidence, from, recordsAt }`, and the +// validator refused the whole take, the status switch on or off. Here the take-shaped +// manifest is made by composeTake itself, never imitated. Synthetic names only. +// +// Run with: node --test umtool/lib/report/sourceStatusTake.test.mjs + +import assert from "node:assert/strict"; +import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import test from "node:test"; + +const ROOT = await mkdtemp(path.join(tmpdir(), "umtool-source-status-take-")); +process.env.REPORTS_DIR = path.join(ROOT, "reports"); +process.env.CHANNELS_DIR = path.join(ROOT, "channels"); +process.env.UMTOOL_PRESETS_DIR = path.join(ROOT, "presets"); +test.after(() => rm(ROOT, { recursive: true, force: true })); + +const { checkSpec, composeTake } = await import("./takeMaker.mjs"); +const { estimateSchedule } = await import("../../report-to-video/deck.mjs"); +const { clipSourceStatus, sourceStatusNotes, validateSourceStatus } = await import("../../report-to-video/source-status.mjs"); + +const PALETTE = { bg: "#12101a", fg: "#f4f1ea", muted: "#9a93ad", accent: "#a97bff", amber: "#ffc860" }; +await mkdir(process.env.UMTOOL_PRESETS_DIR, { recursive: true }); +await writeFile(path.join(process.env.UMTOOL_PRESETS_DIR, "synth-look.json"), JSON.stringify({ + name: "synth-look", + description: "A synthetic deck look.", + render: { + width: 1920, height: 1080, fps: 30, transition: 0.5, palette: PALETTE, + chrome: { engine: "hyperframes", layout: "deck", deck: { subtitle: { parts: ["channel", "date", "clock"], status: "end" } } }, + }, +})); + +const clip = (id, video, start) => ({ id, type: "clip", video, start, end: start + 10, cite: start + 2, quote: "a synthetic line", onscreen: { title: `Moment ${id}` } }); +const META = (n) => ({ title: `Synthetic stream ${n}`, uploadDate: "20310301", channel: "Synth Channel", webpageUrl: `https://video.example.test/${n}` }); + +const STAMP = { + refreshedAt: "2031-03-02T00:00:00.000Z", + sources: { + // No record, as refresh wrote it before this lane: every nullable field an explicit null. + "synth-channel/synthvid001": { now: null, since: null, asOf: null, first: null, firstAt: null, firstWhen: null, evidence: [], from: "corpus", recordsAt: "2031-03-01T00:00:00.000Z" }, + "synth-channel/synthvid002": { now: "private", since: "2031-03-01T20:00:00Z", asOf: "2031-03-01T20:00:00Z", first: "public", firstAt: "2031-03-01T10:05:00Z", firstWhen: "live", from: "corpus", evidence: [] }, + // No record, as refresh writes it now. + "synth-channel/synthvid003": { evidence: [], from: "corpus", recordsAt: "2031-03-01T00:00:00.000Z" }, + // An archive reading with no state the line names (its deleted is the loose class). + "synth-channel/synthvid004": { now: null, since: null, asOf: "2031-03-01T20:00:00Z", first: null, firstAt: null, firstWhen: null, from: "archive", evidence: [{ kind: "archive", at: null, availability: "deleted", counts: false, why: "synthetic" }] }, + }, +}; + +let n = 0; +/** A project naming the preset, its manifest's own render under the switch given, and a take of it composed. */ +async function takeOf(status) { + const dir = path.join(process.env.REPORTS_DIR, `snt${++n}`); + await mkdir(dir, { recursive: true }); + const manifest = { + schemaVersion: 1, slug: `snt${n}`, title: "Synthetic cut", preset: "synth-look", + provenance: { channelSlug: "synth-channel", channel: "Synth Channel", siteOrigin: "https://archive.example.test" }, + render: status ? { chrome: { deck: { subtitle: { status } } } } : {}, + timeline: [clip("c01", "synthvid001", 600), clip("c02", "synthvid002", 1200), clip("c03", "synthvid003", 1800), clip("c04", "synthvid004", 2400)], + sourceStatus: STAMP, + }; + await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(manifest, null, 2) + "\n"); + // A take's patch, as a real draft carries one ("No intro"). + const c = await composeTake(dir, checkSpec({ id: "draft-1", label: "draft 1", window: "full", patch: { render: { intro: null } } })); + return { manifest, take: c.renderDoc }; +} + +test("the take's manifest has lost the stamp's nulls (the cause), and the build's validator passes it, the switch on or off", async () => { + for (const status of [null, "end", "off"]) { + const { manifest, take } = await takeOf(status); + assert.equal(take.presetApplied, "synth-look"); + assert.deepEqual(Object.keys(take.sourceStatus.sources["synth-channel/synthvid001"]), ["evidence", "from", "recordsAt"], "the preset's layering dropped the nulls"); + assert.ok(!("now" in take.sourceStatus.sources["synth-channel/synthvid004"])); + assert.deepEqual(validateSourceStatus(take), [], `switch ${status ?? "(the preset's)"}: the take validates`); + assert.deepEqual(validateSourceStatus(manifest), [], "and the project's own manifest, nulls and all"); + } +}); + +test("the take's deck: nothing for a no-record source, the words for a private one", async () => { + const { take } = await takeOf(null); + const s = estimateSchedule(take, { metas: [META(1), META(2), META(3), META(4)] }); + const seg = (id) => s.segments.find((x) => x.id === id); + assert.equal(seg("c02").subtitle, "Synth Channel · Mar 1, 2031 · 20:02 · now private (public when streamed)"); + for (const id of ["c01", "c03", "c04"]) { + assert.ok(seg(id).subtitleParts.every(([k]) => k !== "status"), `${id}: no status part`); + assert.doesNotMatch(seg(id).subtitle, /now /); + } + assert.equal(clipSourceStatus(take.timeline[0], take.sourceStatus, take.provenance), ""); + // The build's notes: a no-record source is not listed as stale, null or absent. + const notes = sourceStatusNotes(take, { now: Date.parse("2031-04-30T00:00:00Z") }); + assert.equal(notes.length, 1); + assert.doesNotMatch(notes[0], /synthvid001|synthvid003/); + + // The switch off in the take: the line is what it always was. + const off = (await takeOf("off")).take; + const so = estimateSchedule(off, { metas: [META(1), META(2), META(3), META(4)] }); + assert.equal(so.segments.find((x) => x.id === "c02").subtitle, "Synth Channel · Mar 1, 2031 · 20:02"); +}); diff --git a/umtool/report-to-video/deck-source-status.test.mjs b/umtool/report-to-video/deck-source-status.test.mjs @@ -286,3 +286,19 @@ test("validation: the switch's values, the status token, the stamp's shape, a cl assert.match(validateSourceStatus(manifest({ stamp: { refreshedAt: STAMP.refreshedAt, sources: { "a/b": { now: "private", first: "public" } } } }))[0], /firstWhen/); assert.match(validateSourceStatus(manifest({ timeline: [clip("c01", "synthvid001", 0, { sourceStatus: true })] }))[0], /may only be false/); }); + +// Lane source-status-nulls: a manifest with its look preset laid under it (every take's) has lost +// every null (presets.mjs lays the manifest over the preset as a merge patch). Absent reads as null. +test("validation: an absent field reads exactly as null -- an entry's, the stamp's, a clip's", () => { + const ok = (sources) => validateSourceStatus(manifest({ stamp: { refreshedAt: STAMP.refreshedAt, sources } })); + assert.deepEqual(ok({ "a/b": { evidence: [], from: "corpus", recordsAt: "2031-03-01T00:00:00.000Z" } }), [], "a no-record entry with its nulls dropped"); + assert.deepEqual(ok({ "a/b": { now: null, since: null, asOf: null, first: null, firstAt: null, firstWhen: null, evidence: [], from: "corpus" } }), [], "and with them"); + assert.deepEqual(ok({ "a/b": { now: "private", from: "corpus", evidence: [] } }), [], "a state, every other field absent"); + assert.match(ok({ "a/b": { now: "gone", from: "corpus" } })[0], /\.now must be one of/, "a bad state still fails"); + assert.deepEqual(validateSourceStatus(manifest({ stamp: null })), [], "a null stamp is no stamp"); + assert.deepEqual(validateSourceStatus(manifest({ timeline: [clip("c01", "synthvid001", 0, { sourceStatus: null })] })), [], "a clip's null is no hide"); + // The words: absent is null there too. + assert.equal(sourceStatusText({ evidence: [], from: "corpus" }), ""); + assert.equal(sourceStatusText({ now: "private" }), "now private"); + assert.equal(clipSourceStatus(clip("c01", "synthvid001", 0, { sourceStatus: null }), STAMP, { channelSlug: "synth-channel" }), "now members-only (public when streamed)"); +}); diff --git a/umtool/report-to-video/source-status.mjs b/umtool/report-to-video/source-status.mjs @@ -11,6 +11,10 @@ // now, since, asOf, first: "public"|null, firstAt, firstWhen: "live"|"other"|null, // from: "corpus"|"archive", evidence: [...], recordsAt?: ISO } } } // +// Every nullable field may also be ABSENT, and reads exactly as null: refresh writes +// no null keys (sourceStatusCli.mjs compactSourceEntry), and a manifest with its look +// preset laid under it -- every take's -- has lost them anyway (validateSourceStatusStamp). +// // `now` is null when the records hold no state the line may say (no record, records // that disagree, a removal no check read): the reason is in `evidence`. `recordsAt` // (corpus entries) is the newest write of the records that reading saw. @@ -102,9 +106,17 @@ export function statusSourceKeys(manifest) { .filter(Boolean))]; } -/** The manifest's `sourceStatus` checked: a list of what is wrong with it (empty: fine, or absent). */ +/** + * The manifest's `sourceStatus` checked: a list of what is wrong with it (empty: fine, or absent). + * + * An ABSENT key reads exactly as null, the stamp's own and each entry's (now, since, + * asOf, first, firstAt, firstWhen): a manifest whose look preset is laid under it + * (presets.mjs resolvePresetLayers lays the manifest over the preset AS A MERGE + * PATCH, so every null in it is dropped) -- every take's, and the build's own -- + * holds a no-record entry as `{ evidence, from, recordsAt }`. + */ export function validateSourceStatusStamp(v, where = "sourceStatus") { - if (v === undefined) return []; + if (v === undefined || v === null) return []; const errors = []; if (!isObj(v)) return [`${where} must be an object ({ refreshedAt, sources }) -- written by \`umtool source-status <p> refresh\``]; if (typeof v.refreshedAt !== "string" || !Number.isFinite(Date.parse(v.refreshedAt))) errors.push(`${where}.refreshedAt must be an ISO time`); @@ -116,8 +128,8 @@ export function validateSourceStatusStamp(v, where = "sourceStatus") { errors.push(`${where}.sources["${k}"] must be an object`); continue; } - if (s.now !== null && !SOURCE_STATUS_NOW.includes(s.now)) errors.push(`${where}.sources["${k}"].now must be one of ${SOURCE_STATUS_NOW.join("/")} or null`); - if (s.first !== null && s.first !== undefined && s.first !== "public") errors.push(`${where}.sources["${k}"].first must be "public" or null`); + if (s.now != null && !SOURCE_STATUS_NOW.includes(s.now)) errors.push(`${where}.sources["${k}"].now must be one of ${SOURCE_STATUS_NOW.join("/")} or null`); + if (s.first != null && s.first !== "public") errors.push(`${where}.sources["${k}"].first must be "public" or null`); if (s.first === "public" && !["live", "other"].includes(s.firstWhen)) errors.push(`${where}.sources["${k}"].firstWhen must be "live" or "other" beside first "public"`); if (s.asOf != null && (typeof s.asOf !== "string" || !Number.isFinite(Date.parse(s.asOf)))) errors.push(`${where}.sources["${k}"].asOf must be an ISO time or null`); if (s.recordsAt != null && (typeof s.recordsAt !== "string" || !Number.isFinite(Date.parse(s.recordsAt)))) errors.push(`${where}.sources["${k}"].recordsAt must be an ISO time or absent`); @@ -130,7 +142,8 @@ export function validateSourceStatusStamp(v, where = "sourceStatus") { export function validateSourceStatus(manifest) { const errors = validateSourceStatusStamp(manifest?.sourceStatus); for (const e of manifest?.timeline ?? []) { - if (e?.sourceStatus !== undefined && e.sourceStatus !== false) { + // null reads as absent (the preset's layering drops it): the line as usual. + if (e?.sourceStatus != null && e.sourceStatus !== false) { errors.push(`clip ${e?.id ?? "?"}: sourceStatus may only be false (hide the source status on its line)`); } }