Archilyzer · Source

archilyzer

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

commit 6b357d43070f2e44acb1b7c7d4f59d9ea2e5d18c
parent 8d6ca18c87f91132916ce00f31b9d1c3077f9c9c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri,  6 Nov 2026 17:13:14 -0500

umtool: a counter series nobody counted shows 0, and a teaser can carry marks that count over the card

The Leaflit side-tally video has no title or totals cards (operator, 6 Nov:
"Don't add the text title cards ... just the archilyzer intro"), so the deck's
counter is the only place the counts show, and two gaps made it wrong.

A series with 0 was never drawn: the tally laid out only the series some
stamp used (tallyVerdicts), and "Left 0" is the point of the video.
- factcheck.mjs tallyCells / tallyCellsFrom / tallyAlways: the cells are the
  series the stamps use plus every deck.counter series that SAYS
  showAt "always" (its own, else the counter's), in the counter's order. Said,
  not defaulted: a counter `umtool migrate` wrote from the verdicts never
  writes "always", so it draws the pages it drew (migrate.test's byte-for-byte
  check); the fact-check verdicts without a deck.counter keep their used-only
  tally; a cut that counts nothing still draws no counter.
- tallyOf, the finale's totals (chrome-finale, deck.mjs finaleRail) read it,
  so a totals cell still sits over its foot cell.
- Play's and the live preview's tally readout take the counter's order and
  its always-series from the preview route (tallyOrder, tallyAlways); before,
  they filtered by the verdicts and read nothing on a named-series cut.

A text card could not carry a mark: her two X posts are teasers (x-d28,
x-d29), so they did not step the count.
- marksOf and validateClaims take a teaser's marks as a clip's; `at` is
  seconds from the CARD's start (after a dip's black), 0 to its `seconds`
  (else TEASER_MARK_MAX, 20). The schedule reads it on the card's clock
  (deck.mjs teaserMarkClock as the segment's sourceFrom; onscreen.mjs's
  preview likewise).
- deck.mjs teaserCounts: a teaser carrying a mark, and not dipping, keeps the
  deck up over it (hidesDeck), with no title of its own unless its onscreen
  gives one -- the card's words are on the card -- so the count is seen to
  step. A teaser that dips still hides the deck at the black.
- updateMarks no longer refuses a teaser: `umtool set <p> x-d28
  mark.add=CENTER@2.15` writes it, refused in the renderer's words past the
  card. The On-screen table's claim cell is on teaser rows too.

Tests: modules/counter.test (the zero cell, said vs unsaid, first, verdicts),
teaser-marks.test (placement, deck kept up, dip, overlap), marks.test (the
writer and the CLI on a teaser), the old "a teaser is not evidence" asserts
turned round. Docs: knobs.md Marks and the Counter module rows, report-video.md,
the pipeline README, set's help, the changelog.

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

Diffstat:
Meditor/CHANGELOG.md | 1+
Mumtool/app/api/report/chrome/preview/route.ts | 7++++++-
Mumtool/components/projects/OnscreenSection.tsx | 77++++++++++++++++++++++++++++++++++++-----------------------------------------
Mumtool/components/projects/review/LiveDeckPreview.tsx | 9+++++++--
Mumtool/components/projects/review/PlayCut.tsx | 9+++++++--
Mumtool/docs/knobs.md | 10++++++++--
Mumtool/docs/report-video.md | 4++--
Mumtool/lib/report/knobsCli.mjs | 2++
Mumtool/lib/report/manifest.mjs | 13++++++++-----
Mumtool/lib/report/marks.test.mjs | 29+++++++++++++++++++++++++++++
Mumtool/lib/report/onscreen.mjs | 5++++-
Mumtool/report-to-video/README.md | 15+++++++++++----
Mumtool/report-to-video/chrome-finale.mjs | 4++--
Mumtool/report-to-video/clip-marks.test.mjs | 8++++++--
Mumtool/report-to-video/deck.mjs | 45++++++++++++++++++++++++++++++++++++---------
Mumtool/report-to-video/factcheck.mjs | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
Mumtool/report-to-video/factcheck.test.mjs | 11+++++------
Mumtool/report-to-video/modules/counter.mjs | 4++--
Mumtool/report-to-video/modules/counter.test.mjs | 55++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Aumtool/report-to-video/teaser-marks.test.mjs | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 files changed, 374 insertions(+), 96 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **umtool: a counter series nobody counted shows 0, and a text card can count.** The Leaflit side-tally video has no title or totals cards, so the deck's counter is the only place the counts show, and it left out "Left" (the point of the video: she never once says she is on the left) because the tally drew only the series some mark used. A series of `deck.counter` that says `showAt: "always"` (its own, or the counter's) is now a cell from the first frame, dim at 0, whether or not anything counts it; a series that says nothing (so a counter `umtool migrate` wrote draws what it drew), a `first` series, and the fact-check verdicts' tally of a cut without a `deck.counter` are as before, and a cut that counts nothing still draws no counter. Her two X posts are text cards (`teaser`s), which could not carry a mark, so they did not step the count. A teaser now takes marks as a clip does (`umtool set <p> x-d28 mark.add=CENTER@2.15`, the second counted from the card's start; validated, stamped over the card, counted, in Play and the On-screen table), and a teaser that carries one keeps the deck up over it, with no title of its own, so the count is seen to step. A teaser that dips still hides the deck at the black. - **Free disk, weekly, with one command: `archilyzer housekeeping`.** On 6 Nov /home was at 37 GB free, and a session freed 83 GB by hand. The operator: "We should build a regularly run command for this after we're done." It runs three passes of the apps' own commands. **Superseded takes:** `umtool prune --versions` deletes whole takes through `umtool takes delete`. Per version line it keeps the highest built number; the line is the take id with its digits folded (`draft-3` and `draft-4`), and a letter is never folded (`v6c` is not `v6d`, `release-6u` is not `release-6`). An older take goes only once the newer one is 7 days old (`--grace`). It also keeps any take picked, pinned, given any verdict, rendering, a build's base, the manifest's, with operator notes on it, or refused by `takes delete`, and skips a project whose verdicts file cannot be read. **Work files:** every project's takes' work files by its prune policy; in a project idle 3 days, the newest and picked takes' work goes too (`--idle-work`). **Worktrees:** `pnpm wt prune` removes merged, clean, idle worktrees with no process in them and no ignored files of anyone's (a corpus, an env file, a changed settings file, a nested repository), keeping their branches. A project or worktree touched in the last 3 days is left alone, and a run is skipped while a render, an e2e suite or a heavy job runs, or when that cannot be checked. Each run is recorded in `~/.local/state/archilyzer/housekeeping.json`. **Worktree ports no longer move:** a worktree's port block is recorded when it is added, so removing another worktree cannot shift a running suite's ports. **Upgrading:** `archilyzer service install` (host mode) now also installs `archilyzer-housekeeping.timer`, weekly; `--dry-run` shows it first, and `--no-housekeeping` leaves it out. OPERATING.md, "Free disk". - **Sync new and Resume backfill are separate actions for an X or Bluesky channel.** A fetch meant to get new posts could walk old history instead. If an account's full-history walk had stopped part-way, the next plain fetch, from Sync or the schedule too, resumed that walk and skipped the newest posts. On 6 Nov one such fetch read 100 posts the archive already held, stopped as "caught up" with 0 new, and missed 85 newer posts. It then cleared the walk's saved place, so the place was lost as well. The operator: "We should have distinct 'sync new' and 'resume backfill' actions, they are different actions for different purposes". **Sync new** (the channel page's first button; a plain `fetch-posts`, Sync and the scheduler) now always reads from the newest post down to the newest one archived, and never moves or clears the backfill's place. A sync that stops part-way keeps its own place and finishes on the next sync. **Resume backfill** (the button, shown only when a full-history walk is unfinished; `pnpm ops resume-backfill`, or `fetch-posts "backfill": true`; `--backfill` on `archilyzer posts fetch`; `backfill` on the MCP enqueue tool) continues that walk and does nothing else. When one is unfinished, the channel page says so: "backfill unfinished — N archived; Resume backfill continues it". The job log's first line names the mode. Resume backfill is refused when no walk is unfinished, and on a forum thread, which already reads its newest pages before its history. An X search channel has one walk and refuses it too. Re-fetch full history and Fetch older posts are unchanged. **Upgrading:** a `posts-state.json` from before this keeps one `cursor`. It is read as the unfinished backfill's place, so nothing is lost, and the next fetch rewrites it. Needs a restart of the editor. - **Archived posts can be packaged as timestamped evidence.** The operator wanted public evidence that Mr. Obvious's X posts existed, and Save Page Now refuses x.com as a site (HTTP 523); he chose "the timestamped evidence package". `archilyzer evidence pack <channel>[,<channel>…] [--handle <h>] [--since/--until YYYY-MM-DD] [--out <dir>] [--no-media] [--no-stamp] [--dry-run] [--json]` writes, read only over the corpus, a self-contained folder (default `~/reports/evidence/<handle>-<date>/`): `posts.jsonl` (one record a post, deduped across the channels, every archived field kept under `raw`, the capture record and availability check, and the archived record of a post it answers or quotes as `context`), `posts.csv`, the post media copied byte for byte from `posts-media/` (each hash checked against its `capture.json`), `pack.json`, a README saying how to verify, `SHA256SUMS` over every file, and an OpenTimestamps proof of it (`SHA256SUMS.ots`, the official `ots` client, one request to each calendar). `evidence upgrade <dir>` fetches the Bitcoin attestation a few hours later, `evidence verify <dir>` checks every file and the stamp, `evidence stamp <dir>` stamps an unstamped one. Refused inside the corpus or a channel's media, over a non-empty dir, and for a channel whose text is unreadable. OPERATING.md, "Package posts as timestamped evidence". diff --git a/umtool/app/api/report/chrome/preview/route.ts b/umtool/app/api/report/chrome/preview/route.ts @@ -18,7 +18,8 @@ import { import { deckGeometry, deckLayout, deckOn, feedGeometry, postsGeometry, stampGeometry, validateChrome, } from "umtool-report-to-video/deck"; -import { resolveFactcheck, stampsDrawn, tallyOf } from "umtool-report-to-video/factcheck"; +import { resolveFactcheck, stampsDrawn, tallyAlways, tallyOf } from "umtool-report-to-video/factcheck"; +import { counterOrder } from "umtool-report-to-video/counter"; import { cachedTakeManifest, takePlayDir, writePlayManifest } from "@/lib/report/takeManifest.mjs"; import { isTakeId } from "@/lib/report/takes.mjs"; @@ -293,6 +294,10 @@ export async function POST(request: Request) { verdictLabels: Object.fromEntries( Object.entries(resolveFactcheck(render).verdicts as Record<string, { label: string }>).map(([k, v]) => [k, v.label]), ), + // The tally's cells as the deck lays them (factcheck.mjs tallyCellsFrom): the counter's order, and the series + // it draws at 0 before (or without) a mark -- so the readout beside the picture lists the deck's cells. + tallyOrder: counterOrder(render), + tallyAlways: tallyAlways(render), }, { headers: { "cache-control": "no-store" } }, ); diff --git a/umtool/components/projects/OnscreenSection.tsx b/umtool/components/projects/OnscreenSection.tsx @@ -1508,8 +1508,6 @@ export default function OnscreenSection({ const isCurrent = current?.id === row.id; const set = (k: keyof Draft, v: string) => setDrafts((prev) => ({ ...prev, [row.id]: { ...(prev[row.id] ?? rowDraft(row)), [k]: v } })); - // A teaser is a finale, never evidence: the writer refuses a claim on one. - const claimable = row.type !== "teaser"; const stamped = schedule?.factcheck?.stamps.find((s) => s.segment === row.id) ?? null; return ( <tr @@ -1574,46 +1572,43 @@ export default function OnscreenSection({ /> </td> <td className="px-1.5 py-1"> - {claimable ? ( - <div className="flex items-center gap-1"> - <input - type="text" - data-testid="onscreen-claim-id" - name={`claim-${row.id}`} - value={d.claimId} - maxLength={64} - placeholder="claim id" - onFocus={() => jump(row.id)} - onChange={(e) => set("claimId", e.target.value)} - className={`${input} w-20 font-mono`} - /> - <select - data-testid="onscreen-claim-verdict" - name={`verdict-${row.id}`} - value={d.verdict} - onChange={(e) => set("verdict", e.target.value)} - className={`${input} min-w-0 flex-1`} + {/* Every row may carry a claim: a teaser too (a post shown as a text card that counts; it keeps the deck up). */} + <div className="flex items-center gap-1"> + <input + type="text" + data-testid="onscreen-claim-id" + name={`claim-${row.id}`} + value={d.claimId} + maxLength={64} + placeholder="claim id" + onFocus={() => jump(row.id)} + onChange={(e) => set("claimId", e.target.value)} + className={`${input} w-20 font-mono`} + /> + <select + data-testid="onscreen-claim-verdict" + name={`verdict-${row.id}`} + value={d.verdict} + onChange={(e) => set("verdict", e.target.value)} + className={`${input} min-w-0 flex-1`} + > + <option value="">—</option> + {VERDICTS.map((v) => ( + <option key={v} value={v}> + {v} + </option> + ))} + </select> + {stamped && ( + <span + data-testid="onscreen-claim-stamped" + className="micro shrink-0 text-[var(--color-dim)]" + title={`${stamped.claim}'s verdict is stamped at the end of this entry (${stamped.at.toFixed(1)}s in the cut)`} > - <option value="">—</option> - {VERDICTS.map((v) => ( - <option key={v} value={v}> - {v} - </option> - ))} - </select> - {stamped && ( - <span - data-testid="onscreen-claim-stamped" - className="micro shrink-0 text-[var(--color-dim)]" - title={`${stamped.claim}'s verdict is stamped at the end of this entry (${stamped.at.toFixed(1)}s in the cut)`} - > - stamp - </span> - )} - </div> - ) : ( - <span className="micro text-[var(--color-dim)]">—</span> - )} + stamp + </span> + )} + </div> </td> </tr> ); diff --git a/umtool/components/projects/review/LiveDeckPreview.tsx b/umtool/components/projects/review/LiveDeckPreview.tsx @@ -7,7 +7,7 @@ import { edgeClock } from "@/lib/report/clipEditorModel.mjs"; import type { EditorClip } from "@/lib/report/clipEditorTypes"; import { footageAt } from "@/lib/report/footage-move.mjs"; import { clipStamps, clockText, cutTimeAt, finaleUp, liveClock, stampAt, tallyAt } from "@/lib/report/liveClock.mjs"; -import { tallyVerdicts } from "umtool-report-to-video/factcheck"; +import { tallyCellsFrom, VERDICTS } from "umtool-report-to-video/factcheck"; import { BLUR_CAPTION_DEFAULT, BLUR_STRENGTH } from "umtool-report-to-video/clip-blur"; import { drawFootage } from "./footageCanvas"; import { DeckFrame, FeedOverlay, ModuleLayers, PostsOverlay, postsWindowAt, type DeckPreviewDoc, type DeckTexts, type Rect } from "../OnscreenSection"; @@ -58,6 +58,8 @@ type Write = (body: Record<string, unknown>, done?: string) => Promise<unknown>; type LiveDoc = DeckPreviewDoc & { leadIn?: number; verdictLabels?: Record<string, string>; + tallyOrder?: string[]; + tallyAlways?: string[]; schedule: DeckPreviewDoc["schedule"] & { finale?: { from: number; to: number } }; }; type JobLite = { id: string; state: string; error: string | null; log?: string[]; events?: Record<string, unknown>[] }; @@ -212,7 +214,10 @@ export default function LiveDeckPreview({ const box: Rect | null = g ? (doc?.feed?.footage ?? g.footage) : null; const move = schedule ? footageAt(schedule, t) : null; const rect: Rect | null = move?.rect ?? box; - const order = useMemo(() => (schedule?.factcheck ? tallyVerdicts(schedule.factcheck.stamps) : []), [schedule]); + const order = useMemo( + () => (schedule?.factcheck ? tallyCellsFrom(schedule.factcheck.stamps, doc?.tallyOrder ?? VERDICTS, doc?.tallyAlways ?? []) : []), + [schedule, doc?.tallyOrder, doc?.tallyAlways], + ); const tally = schedule?.factcheck ? tallyAt(schedule, t, order) : []; const stamp = schedule ? stampAt(schedule, t) : null; const mine = schedule && clock ? clipStamps(schedule, clock) : []; diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx @@ -13,7 +13,7 @@ import { finaleUp, stampAt, tallyAt } from "@/lib/report/liveClock.mjs"; import { chromeTime, counterSteps, cutAtSource, cutNotesRequest, playPlan, playTimeOfChrome, runningTime, seamsOf, skipEntries, sourceAt, startOf, } from "@/lib/report/playCut.mjs"; -import { tallyVerdicts } from "umtool-report-to-video/factcheck"; +import { tallyCellsFrom, VERDICTS } from "umtool-report-to-video/factcheck"; import { AssistReplyApply, ProposalList, routeLine, jobLine, useAssist } from "../report/AssistBox"; import { DeckFrame, FeedOverlay, ModuleLayers, PostsOverlay, postsWindowAt, type DeckPreviewDoc, type Rect } from "../OnscreenSection"; import { usePlayEngine } from "./playEngine/usePlayEngine"; @@ -171,6 +171,8 @@ export type PlayViewData = { type LiveDoc = DeckPreviewDoc & { leadIn?: number; verdictLabels?: Record<string, string>; + tallyOrder?: string[]; + tallyAlways?: string[]; schedule: DeckPreviewDoc["schedule"] & { finale?: { from: number; to: number } }; }; type Ui = { t: number; cur: number; playing: boolean; ended: boolean; waiting: boolean }; @@ -876,7 +878,10 @@ export default function PlayCut({ const box: Rect | null = g ? (doc?.feed?.footage ?? g.footage) : null; const move = schedule ? footageAt(schedule, tc) : null; const rect: Rect | null = move?.rect ?? box; - const order = useMemo(() => (schedule?.factcheck ? tallyVerdicts(schedule.factcheck.stamps) : []), [schedule]); + const order = useMemo( + () => (schedule?.factcheck ? tallyCellsFrom(schedule.factcheck.stamps, doc?.tallyOrder ?? VERDICTS, doc?.tallyAlways ?? []) : []), + [schedule, doc?.tallyOrder, doc?.tallyAlways], + ); const tally = schedule?.factcheck ? tallyAt(schedule, tc, order) : []; const stamp = schedule ? stampAt(schedule, tc) : null; const finaleNow = !!schedule && finaleUp(schedule, tc); diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -277,6 +277,12 @@ that mentions the seizure in question and one before it. The Marks box is on eve `mark.remove=<id>`, `mark.verdict=<verdict> [--mark <id>]`, `marks='[…]'` (all; `marks=` none); the `claim.*` keys set the first mark's knobs, or `--mark <id>`'s. `umtool show` prints a clip's marks (`--json`: `marks`, each with `stampsOn`). +- **On a teaser** (a post shown as a text card; lane counter-zero): a teaser carries marks as a clip does — stamped + over the card, counted, validated — with `at` in seconds from the CARD's start (after a dip's black), 0 to its + `seconds` (`umtool set <p> x-d28 mark.add=CENTER@2.15`: a line lands at `0.55 + 0.7 × its index + 0.2` s on the + default beat). A teaser that carries a mark keeps the deck up over it, so the count is seen to step; the deck + shows no title over it unless its `onscreen` gives one (the card's words are on the card). A teaser that dips + still hides the deck at the black, and its marks count unseen until the deck comes back. - **The route:** `POST /api/report/clip-editor` `{op: "marks", clip, add: {verdict, at?, …}}`, `{…, remove: id}`, `{…, mark: id, verdict}`, `{…, set: [..] | null}`; `{op: "claim", clip, mark, knobs}` for a mark's knobs. Token- and agent-token-guarded like every write. The writer: `lib/report/manifest.mjs` `updateMarks`. @@ -1605,8 +1611,8 @@ The deck's tally as named series (`render.chrome.deck.counter`). A clip's mark n | `deck.counter.series[]` | 1–8 `{id, label, color?, stampLabel?, tallyLabel?, showAt?, shape?, unit?}` -- an `id` a letter then letters, digits, `_` `-`; a verdict's id (`CORROBORATED` …) takes its default label, colour and shape; `label` ≤ 24 and fitting the cell, as the verdicts' are | `umtool look <p> deck.counter='{"series":[{"id":"seizures","label":"Seizures","color":"#e5534b","stampLabel":"Seizure"}]}'` | | `deck.counter.series[].shape` | `circle` `diamond` `square` `triangle` `ring` · default by place (a verdict's own) | same | | `deck.counter.series[].unit` | ≤ 24 · the noun a count claim's number reads (default its label, lower-cased) | same | -| `deck.counter.show`, `.position`, `.showAt` | bool · `right` `left` · `always` `first` (a series' own `showAt` wins) · defaults `true`, `right`, `always` | same | -| a mark's series | `claim.verdict` (or `claim.counter`): one of the series' ids | `umtool set <p> <clip> mark.add=seizures@190.2` | +| `deck.counter.show`, `.position`, `.showAt` | bool · `right` `left` · `always` `first` (a series' own `showAt` wins) · defaults `true`, `right`, `always`. A series that SAYS `always` (its own `showAt`, else the counter's) is a cell from the first frame, dim at 0, whether or not a mark ever counts it ("Left 0"); one with no `showAt` said, or `first`, is a cell once it is counted, so one never counted is not drawn. The cells show once the cut counts anything | same | +| a mark's series | `claim.verdict` (or `claim.counter`): one of the series' ids. A clip's mark, or a teaser's (a post shown as a text card: `at` seconds from the card's start; the deck stays up over it) | `umtool set <p> <clip> mark.add=seizures@190.2` · `umtool set <p> <teaser> mark.add=CENTER@2.15` | ### Claim checks diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -1518,7 +1518,7 @@ A row may also carry the entry's fact-check claim beside its text, `claim` is set on the entry (never inside `onscreen`), `null` removes it, and a row without the key leaves it as it is. After applying the batch the writer runs `validateClaims()` over the whole timeline — one verdict per claim id, -none on a teaser — and a refusal writes nothing. The On-screen table shows a +each `at` inside its entry — and a refusal writes nothing. The On-screen table shows a **claim** column (an id and a verdict) per row, `GET /api/report/onscreen` returns each row's `claim`, and PUT returns the `claims` it stored. The preview applies a draft's claims too: the build's stamps are placed again over @@ -1576,7 +1576,7 @@ and default. | where | key | range · default | what | |---|---|---|---| -| a claimed entry's `claim` | `at` | a source second in the clip's window · the stamp's usual timing | when the stamp lands and the tally steps | +| a claimed entry's `claim` | `at` | a source second in the clip's window (a teaser's: seconds from its card's start, 0 to its `seconds`) · the stamp's usual timing | when the stamp lands and the tally steps | | | `hold` | 0.5–10 s · `factcheck.stamp.seconds` | how long the stamp stays | | | `stamp` | true/false · true | false: counted, not drawn | | | `count` | 1–99 · 1 | the tally's step | diff --git a/umtool/lib/report/knobsCli.mjs b/umtool/lib/report/knobsCli.mjs @@ -76,6 +76,8 @@ export const SET_USAGE = [ " (the verdict by name or by this cut's label, e.g. Episodes@190.2; a JSON object for its knobs too);", " mark.remove=<id>; mark.verdict=<verdict> (the first mark's, or --mark <id>'s; every clip carrying", " the id); marks='[{\"id\":\"c1\",\"verdict\":\"CORROBORATED\",\"at\":190.2},…]' sets them all (`marks=` none).", + " A teaser takes marks too (a post shown as a text card that counts): its <sec> is seconds from the", + " card's start (mark.add=CENTER@2.15), and the deck stays up over it so the count is seen to step.", " verdict=confirmed|incorrect|rejected, or a reject reason as shorthand (the walk's; lib/report/rejectReasons.mjs):", " not-matching|wrong-speaker are FACT errors -- incorrect (+ reason=wrong-speaker, which needs no correction);", " irrelevant|repeats|weak|privacy|other are CUT reasons -- rejected + reason, rejectNote=<why> (other needs one),", diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -1454,8 +1454,8 @@ export function splitOnscreenRow(row, { series = null } = {}) { * A row may also carry the entry's fact-check `claim` (`{ id, verdict }`, or * null to remove it; splitOnscreenRow): set beside `onscreen`, never inside * it, and checked with validateClaims against the whole timeline once - * applied -- a claim on a teaser, or one claim id given two verdicts, refuses - * the batch. A row without `claim` leaves it as it is. + * applied -- one claim id given two verdicts, or an `at` outside its entry + * (a clip's window, a teaser's card), refuses the batch. A row without `claim` leaves it as it is. * * Ids are matched against the WHOLE timeline, every variant's entries * included: an entry only the `full` cut shows still has a title. @@ -1523,8 +1523,8 @@ export async function updateOnscreen(dir, onscreen, { token = null } = {}) { else delete e.claim; } } - // 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 + // The claims as the build will read them: one verdict per claim id, each + // knob in range. Refused before the write, so the file // is as it was. const bad = validateClaims(manifest); if (bad.length) throw new Error(`claim: ${bad.join("; ")} — nothing was written`); @@ -4278,6 +4278,10 @@ export async function updateClaimKnobs(dir, entryId, patch, { token = null, mark * the renderer's sentence, when the result would not build: a mark outside * the window, two stamps over each other, one id given two verdicts. * + * A TEASER takes marks too (a post shown as a text card that counts; lane + * counter-zero): its `at` is seconds from the card's start, and the deck + * stays up over it (deck.mjs teaserCounts). + * * @param {string} dir * @param {string} entryId * @param {Record<string, unknown>} change @@ -4294,7 +4298,6 @@ export async function updateMarks(dir, entryId, change, { token = null } = {}) { const manifest = JSON.parse(await readFile(manifestFile(dir), "utf8")); const entries = (manifest.timeline ?? []).filter((e) => isObj(e) && e.id === entryId); if (!entries.length) throw new Error(`no timeline entry with id ${entryId}`); - if (entries[0].type === "teaser") throw new Error(`${entryId} is a teaser: a teaser is not evidence for a claim`); const before = new Set(validateClaims(manifest)); let added = null; let marks = marksCopyOf(entries[0]); diff --git a/umtool/lib/report/marks.test.mjs b/umtool/lib/report/marks.test.mjs @@ -200,3 +200,32 @@ test("umtool set: mark.add=<verdict>@<sec>, mark.remove, mark.verdict, marks=<js assert.equal("claims" in entry(await read(dir), "fed"), false); assert.match(lines.at(-1), /fed: no marks/); }); + +test("a teaser takes marks (lane counter-zero): updateMarks and `umtool set` write them, `at` seconds from the card's start", async () => { + const sides = { series: [{ id: "LEFT", label: "Left" }, { id: "CENTER", label: "Center" }] }; + const m = base(); + m.render.chrome = { engine: "hyperframes", layout: "deck", deck: { counter: sides } }; + m.timeline = [ + { type: "clip", id: "d2", video: "v1", start: 10, end: 20, claim: { id: "d2", verdict: "CENTER", at: 15 } }, + { type: "teaser", id: "x-d28", seconds: 5, lines: [{ text: "@Leaflit on X · 1 Feb 2026", role: "overline" }, { text: "“… a moderate.”", role: "kicker" }] }, + ]; + const { dir, name } = await project(m); + const r = await updateMarks(dir, "x-d28", { add: { verdict: "CENTER", at: 1.45 } }, { token: await manifestToken(dir) }); + assert.equal(r.added, "x-d28"); + assert.deepEqual(entry(await read(dir), "x-d28").claim, { id: "x-d28", verdict: "CENTER", at: 1.45 }); + // A second past the card's end is refused, in the renderer's words, and nothing is written. + await assert.rejects( + updateMarks(dir, "x-d28", { add: { verdict: "LEFT", at: 6 } }, { token: await manifestToken(dir) }), + /claims\[1\]\.at 6 is outside the card's 0–5 \(seconds from the card's start\) — nothing was written/, + ); + assert.deepEqual(entry(await read(dir), "x-d28").claim, { id: "x-d28", verdict: "CENTER", at: 1.45 }); + // The CLI, as the operator runs it: remove, then add by the series' label. + const lines = []; + const run = (...args) => setCommand(args, { root: ROOT, out: (s) => lines.push(s), err: (s) => lines.push(`ERR ${s}`) }); + assert.equal(await run(name, "x-d28", "mark.remove=x-d28"), 0); + assert.equal("claim" in entry(await read(dir), "x-d28"), false); + assert.equal(await run(name, "x-d28", "mark.add=CENTER@2.15"), 0, lines.join("\n")); + assert.deepEqual(entry(await read(dir), "x-d28").claim, { id: "x-d28", verdict: "CENTER", at: 2.15 }); + assert.equal(await run(name, "x-d28", "claim.hold=2"), 0, lines.join("\n")); + assert.equal(entry(await read(dir), "x-d28").claim.hold, 2); +}); diff --git a/umtool/lib/report/onscreen.mjs b/umtool/lib/report/onscreen.mjs @@ -36,6 +36,7 @@ import { postWindows, resolveDeck, roundPosts, + teaserMarkClock, threadShotOf, transitionOf, } from "umtool-report-to-video/deck"; @@ -251,9 +252,11 @@ export function previewSchedule({ variantManifest, built, draft, metas, postsDra }); // A claim stamped at a source second (`claim.at`): the play window's start // stands in for the cut record's (the build's is exact; snapping moves it). + // A teaser's marks are on its card's clock (deck.mjs teaserMarkClock). + const clockOf = (e) => (e.type === "teaser" ? teaserMarkClock(e, built.transition, built.fps ?? render.fps ?? 30) : playWindow(e, render).from); const stamps = stampSchedule({ segments: claimed.map((s, i) => (marksOf(patchedEntries[i]).some((c) => c.at !== undefined) - ? { ...s, sourceFrom: s.sourceFrom ?? playWindow(patchedEntries[i], render).from } + ? { ...s, sourceFrom: s.sourceFrom ?? clockOf(patchedEntries[i]) } : s)), D: built.transition, total, render, }); diff --git a/umtool/report-to-video/README.md b/umtool/report-to-video/README.md @@ -746,9 +746,12 @@ entry may say which claim it is evidence for, and the claim's verdict. `claim` is its own key: an entry's `verdict` is the clip review's (`confirmed` / `incorrect`) and is untouched. The id is letters, digits and -`_ . : -` (≤ 64); a claim id carries ONE verdict across the timeline, a teaser -carries none, and `validateClaims()` (`factcheck.mjs`) refuses either before a -build fetches — umtool's writer refuses with the same function. +`_ . : -` (≤ 64); a claim id carries ONE verdict across the timeline, and +`validateClaims()` (`factcheck.mjs`) refuses two before a build fetches — +umtool's writer refuses with the same function. A TEASER may carry claims too +(a post shown as a text card that counts): its `at` is seconds from the card's +start, and the deck stays up over it so the tally is seen to step (deck.mjs +`teaserCounts`; a teaser that dips still hides the deck at the black). - **The stamp.** Each claim is stamped once, on the LAST segment that carries it (its evidence may run over several clips): the verdict's label, in its @@ -763,7 +766,11 @@ build fetches — umtool's writer refuses with the same function. label. A count steps up — the old number rolls out, the new one in, the cell flashes — at the moment its stamp lands; a cell is dim until its first. It is part of the deck's panel, so it slides away over a card with it, and the - title's column gives it its room only in a cut that stamps something. + title's column gives it its room only in a cut that stamps something. A + cut counting named series (`deck.counter`) also draws, from the first frame + at 0, every series that SAYS `showAt: "always"` (its own, else the + counter's; not the default) that no mark counts (factcheck.mjs + `tallyCells`): "Left 0" is a cell, not an absence. - **A cell on its first count (`tally.showAt`).** `"always"` (the default) is the tally above. `"first"`: a cell is HIDDEN, not dim, until the stamp that gives it its first count lands; then it pops in (`TALLY_POP`: scale 0.5 → 1 diff --git a/umtool/report-to-video/chrome-finale.mjs b/umtool/report-to-video/chrome-finale.mjs @@ -25,7 +25,7 @@ import { cueTime, cueTimeAfter, finaleRail, pageDuration, resolveDeck } from "./deck.mjs"; import { finaleClaimsMarkup } from "./chrome-claims.mjs"; import { mix, rgba, shapeCss, subtitleMarkup, subtitlePartsCss, subtitleTokens } from "./chrome-deck.mjs"; -import { resolveFactcheck, tallyFinals, tallyOf, tallyVerdicts } from "./factcheck.mjs"; +import { resolveFactcheck, tallyCells, tallyFinals, tallyOf } from "./factcheck.mjs"; import { resolveCounter } from "./counter.mjs"; import { aboveTop, FINALE_CLAIMS, FINALE_MOTION, finaleGeometry, resolveFinale } from "./finale.mjs"; @@ -63,7 +63,7 @@ export function finaleLayout(schedule, render) { const pal = render.palette; const stamps = schedule.factcheck?.stamps ?? []; const counter = resolveCounter(render); - const verdicts = f.totals && stamps.length ? tallyVerdicts(stamps, counter.order) : []; + const verdicts = f.totals && stamps.length ? tallyCells(stamps, render) : []; // The large rail (deck.mjs finaleRail): in the room the schedule gave it. const R = finaleRail(schedule, render, { railBottom: fin.railBottom ?? finaleGeometry(render).rail.bottom, textScale: fin.textScale ?? 1 }); const { geo, x0, labels, marks, claims, lay, fxs, footSize } = R; diff --git a/umtool/report-to-video/clip-marks.test.mjs b/umtool/report-to-video/clip-marks.test.mjs @@ -42,7 +42,8 @@ test("marksOf / claimOf / rawMarksOf: a lone claim is a list of one; claimOf is assert.deepEqual(marksOf(one), [{ id: "k", verdict: "PARTLY" }]); assert.deepEqual(marksOf(two).map((m) => m.id), ["k", "k.2"]); assert.deepEqual(claimOf(two), { id: "k", verdict: "PARTLY" }); - assert.deepEqual(marksOf({ ...two, type: "teaser" }), []); + // A teaser carries marks as a clip does (lane counter-zero: a post shown as a text card that counts). + assert.deepEqual(marksOf({ ...two, type: "teaser" }).map((m) => m.id), ["k", "k.2"]); assert.deepEqual(marksOf({ ...two, claim: { id: "x", verdict: "PARTLY" } }), [], "both set: none (validateClaims refuses it)"); assert.equal(claimOf({ type: "clip", id: "c" }), null); assert.equal(rawMarksOf(two).length, 2); @@ -66,7 +67,10 @@ test("validateClaims: claim and claims together refused; a mark's at in the wind }; assert.match(validateClaims(split)[0], /timeline\[1\] \(c2\)\.claim b is CONTRADICTED here and CORROBORATED at timeline\[0\] \(c1\)/); assert.match(validateClaims({ timeline: [clip("c1", 0, 30, { claims: [] })] })[0], /claims must name at least one mark/); - assert.match(validateClaims({ timeline: [{ type: "teaser", id: "t", claims: [{ id: "a", verdict: "PARTLY" }] }] })[0], /\.claims: a teaser is not evidence/); + // A teaser's marks: `at` is seconds from the card's start, 0 to its `seconds` (else to TEASER_MARK_MAX). + assert.deepEqual(validateClaims({ timeline: [{ type: "teaser", id: "t", seconds: 5, claims: [{ id: "a", verdict: "PARTLY", at: 1 }, { id: "b", verdict: "PARTLY", at: 4.5 }] }] }), []); + assert.match(validateClaims({ timeline: [{ type: "teaser", id: "t", seconds: 5, claim: { id: "a", verdict: "PARTLY", at: 5.5 } }] })[0], /timeline\[0\] \(t\)\.claim\.at 5\.5 is outside the card's 0–5 \(seconds from the card's start\)/); + assert.match(validateClaims({ timeline: [{ type: "teaser", id: "t", claim: { id: "a", verdict: "PARTLY", at: 21 } }] })[0], /outside the card's 0–20/); }); test("validateClaims: two stamps on one entry may not overlap -- the first's hold (else stamp.seconds) before the next lands", () => { diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -26,7 +26,7 @@ import { attributionParts, deckSubtitle, deckSubtitleLines, deckSubtitleLinesPar import { panelEntry, postDeckText, postItemSeconds, postLayout } from "./post-item.mjs"; import { videoDip, videoEnter, videoHidesChrome, videoSeconds } from "./video-entry.mjs"; import { - claimOf, marksOf, originalUrlAt, resolveFactcheck, roundStamps, stampSchedule, stampsWithFinale, tallyOf, tallyVerdicts, validateFactcheck, + claimOf, marksOf, originalUrlAt, resolveFactcheck, roundStamps, stampSchedule, stampsWithFinale, rawMarksOf, tallyCells, tallyOf, validateFactcheck, } from "./factcheck.mjs"; import { resolveCounter } from "./counter.mjs"; import { INSTRUMENT_COLUMN, instrumentsOn, instrumentsPlacement, instrumentsWanted, resolveDial } from "./instruments.mjs"; @@ -1157,10 +1157,22 @@ export function isMultiChannel(entries, provenance = {}) { return slugs.size > 1; } +/** + * Does this teaser COUNT: carry a mark (factcheck.mjs, `claim`/`claims` as + * a clip's) and not dip? Then the deck stays up over it, so the count it + * steps is seen as it steps (lane counter-zero). A teaser that dips goes to + * black first: the deck goes at the black as ever, and its marks still count. + */ +export function teaserCounts(entry) { + return entry?.type === "teaser" && rawMarksOf(entry).some(isObj) && !dipOf(entry); +} + /** Is the deck hidden over this segment? */ export function hidesDeck(entry, deck) { // A teaser and the brand intro are full frame: never framed into the footage box. - if (entry.type === "teaser" || entry.type === "intro") return true; + // A teaser that counts keeps the deck up over it (teaserCounts). + if (entry.type === "teaser") return !teaserCounts(entry); + if (entry.type === "intro") return true; // A video entry is the whole frame, nothing over it -- unless it says `deck: "shown"`. if (entry.type === "video") return videoHidesChrome(entry); return deck.overCards === "hide" && CARD_TYPES.includes(entry.type); @@ -1214,9 +1226,11 @@ export function deckText(entry, meta, provenance, deck, multiChannel) { // title's band, as for a clip with none). A different one stands. if (subtitleLines && title && sameTitle(title, parts.title) && titleKey(parts.title) && subtitleLines.some((l) => titleKey(l).includes(titleKey(parts.title)))) title = ""; } else if (entry.type === "teaser") { - // The deck is never up over a teaser; its words are what a table of - // the cut (umtool's On-screen rows, the schedule) names it by. - if (!title) title = teaserTitle(entry); + // The deck is not up over a teaser; its words are what a table of + // the cut (umtool's On-screen rows, the schedule) names it by. One that + // counts keeps the deck up (teaserCounts): its words are on the card, + // so the deck says only what its `onscreen` says. + if (!title && !teaserCounts(entry)) title = teaserTitle(entry); subtitle = ""; } else if (entry.type === "post") { // A post item: its day as the deck's date, its author and platform under it. @@ -1330,8 +1344,10 @@ export function deckSchedule({ const moves = placed.length && !feed ? footageMoves({ posts: placed, segments: segs, render }) : []; // A claim stamped at a source second (`claim.at`) needs the source second // its segment starts at: the cut record's (`clipClock`), else the play - // window's estimate. Only then: a cut without `at` places what it did. + // window's estimate; a teaser's is its card's own clock (markClock). Only + // then: a cut without `at` places what it did. // An entry's marks (`claims`, two or more) ride beside its first. + const markClock = (e) => (e.type === "teaser" ? teaserMarkClock(e, D, fps) : clipClock?.get(e.id) ?? fxClock?.get(e.id) ?? playWindow(e, render).from); const stamped = stampSchedule({ segments: segs.map((s, i) => { const marks = marksOf(entries[i], series); @@ -1339,7 +1355,7 @@ export function deckSchedule({ const many = marks.length > 1 ? { claims: marks } : {}; if (!marks.some((c) => c.at !== undefined)) return { ...s, claim, ...many }; const e = entries[i]; - return withGaps({ ...s, claim, ...many, sourceFrom: clipClock?.get(e.id) ?? fxClock?.get(e.id) ?? playWindow(e, render).from }, e); + return withGaps({ ...s, claim, ...many, sourceFrom: markClock(e) }, e); }), D, total, render, }); @@ -1438,7 +1454,7 @@ export function deckSchedule({ // at -- what placed the stamp, kept for a preview to place it again. // So does a clip a deck claim check is said in (`deck.claims`). ...(marksOf(e, series).some((c) => c.at !== undefined) || claimClips.has(e.id) - ? { sourceFrom: round(clipClock?.get(e.id) ?? fxClock?.get(e.id) ?? playWindow(e, render).from) } + ? { sourceFrom: round(markClock(e)) } : {}), // Only on a video entry (video-entry.mjs): the chrome off over it, and how it is entered. ...(e.type === "video" && videoHidesChrome(e) ? { noChrome: true } : {}), @@ -1959,7 +1975,7 @@ function finaleRailAt(schedule, render, railBottom, textScale) { const fc = resolveFactcheck(render); const pal = render.palette ?? {}; const stamps = schedule.factcheck?.stamps ?? []; - const verdicts = f.totals && stamps.length ? tallyVerdicts(stamps, resolveCounter(render).order) : []; + const verdicts = f.totals && stamps.length ? tallyCells(stamps, render) : []; const H = render?.height ?? 1080; const kh = H / 1080; const py = (v) => Math.round(v * kh); @@ -3345,6 +3361,17 @@ export function dipOf(entry, fps = 30) { } /** + * The clock a teaser's marks are read on, as a segment's `sourceFrom`: a + * mark's `at` is seconds from the CARD's start -- after a dip's lead -- so the + * segment "starts" at minus the lead (0 without a dip). stampSchedule places + * `seg.start + at - sourceFrom`. + */ +export function teaserMarkClock(entry, D = 0.5, fps = 30) { + const lead = teaserLead(entry, D, fps); + return lead ? -lead : 0; +} + +/** * The dark start of a teaser that dips, in its own clock: the dissolve into it * (`D`, the cut's transition) plus the dip's black (whole frames at `fps`). * Its page is black and its sound silent (but for the riser) until then; 0 diff --git a/umtool/report-to-video/factcheck.mjs b/umtool/report-to-video/factcheck.mjs @@ -451,11 +451,12 @@ export function normalizeMarks(v, { series = null } = {}) { /** * An entry's MARKS, normalised: each `{ id, verdict, …knobs }`, in the order - * written. None on a teaser, or on a shape that does not normalise. Never - * throws. + * written. None on a shape that does not normalise. Never throws. A teaser + * carries them as a clip does (lane counter-zero: a post shown as a text + * card that counts), its `at` in seconds from the card's start. */ export function marksOf(entry, series = null) { - if (!isObj(entry) || entry.type === "teaser") return []; + if (!isObj(entry)) return []; try { if (Array.isArray(entry.claims)) return entry.claim === undefined || entry.claim === null ? normalizeMarks(entry.claims, { series }) : []; const c = normalizeClaim(entry.claim, { series }); @@ -474,10 +475,19 @@ export function claimOf(entry, series = null) { } /** - * Every `claim` in the timeline, checked: its shape, that it is not on a - * teaser (a full-frame finale is no evidence), and that every entry naming a - * claim id names the same verdict. The build refuses with these before it - * fetches; umtool's writer refuses with them before it writes. + * The most seconds a teaser's mark may land from its card's start when the + * card does not set `seconds` (deck.mjs TEASER_LIMITS.seconds' ceiling; a + * card as long as its beats is shorter, and a mark past its end lands as the + * card leaves). + */ +export const TEASER_MARK_MAX = 20; + +/** + * Every `claim` in the timeline, checked: its shape, that a clip's `at` lies + * in its window and a teaser's in its card (seconds from the card's start: 0 + * to its `seconds`), and that every entry naming a claim id names the same + * verdict. The build refuses with these before it fetches; umtool's writer + * refuses with them before it writes. * * @returns {string[]} */ @@ -501,7 +511,6 @@ export function validateClaims(manifest) { const where = `timeline[${i}] (${e.id ?? "?"})`; const key = many ? "claims" : "claim"; if (many && one) { errors.push(`${where}: claim and claims are both set -- one mark is \`claim\`, two or more \`claims\``); return; } - if (e.type === "teaser") { errors.push(`${where}.${key}: a teaser is not evidence for a claim`); return; } // A ledger pin (`claim: "<row id>"`), where the manifest reads one: it // must name a row of the ledger, and is nothing more to check here. if (!many && typeof e.claim === "string" && pins) { @@ -517,8 +526,12 @@ export function validateClaims(manifest) { } marks.forEach((c, k) => { const name = many ? `claims[${k}]` : "claim"; - // `at` is the entry's own clock: a second of the source inside its window. - if (c.at !== undefined && Number.isFinite(e.start) && Number.isFinite(e.end) && (c.at < e.start || c.at > e.end)) { + // `at` is the entry's own clock: a second of the source inside its window, + // or on a teaser a second of the card, from its start. + if (c.at !== undefined && e.type === "teaser") { + const len = typeof e.seconds === "number" && Number.isFinite(e.seconds) ? e.seconds : TEASER_MARK_MAX; + if (c.at < 0 || c.at > len) errors.push(`${where}.${name}.at ${c.at} is outside the card's 0–${len} (seconds from the card's start)`); + } else if (c.at !== undefined && Number.isFinite(e.start) && Number.isFinite(e.end) && (c.at < e.start || c.at > e.end)) { errors.push(`${where}.${name}.at ${c.at} is outside the clip's window ${e.start}–${e.end} (source seconds)`); } const seen = verdictOf.get(c.id); @@ -714,13 +727,47 @@ export function roundStamps(stamps) { return stamps.map((s) => ({ ...s, at: round(s.at), landed: round(s.landed), out: s.out.map(round) })); } -/** The series a cut's stamps use, in the counter's order (`order`, the verdicts unless given): the tally's cells. */ +/** The series a cut's stamps use, in the counter's order (`order`, the verdicts unless given). */ export function tallyVerdicts(stamps = [], order = VERDICTS) { const used = new Set(stamps.map((s) => s.verdict)); return order.filter((v) => used.has(v)); } /** + * The tally's CELLS from their parts: the series the stamps use, and every + * series in `always` besides -- in `order`. `always` is what tallyAlways + * gives: empty for the fact-check verdicts, so their tally is the used ones + * as it always was. + */ +export function tallyCellsFrom(stamps = [], order = VERDICTS, always = []) { + const on = new Set([...stamps.map((s) => s.verdict), ...always]); + return order.filter((v) => on.has(v)); +} + +/** + * The series a counter draws whether or not a mark uses them: each of + * `deck.counter.series` that SAYS `showAt: "always"` -- its own, else the + * counter's -- drawn from the first frame, dim at 0, so a series nobody + * counted reads 0 (lane counter-zero: "Left 0" is the point). Said, not + * defaulted: a series with no `showAt` anywhere is a cell once the cut counts + * it, as ever, so a counter `umtool migrate` wrote from the verdicts (which + * never writes "always") draws the pages it drew. None without a + * `deck.counter`: the fact-check verdicts keep their tally of the verdicts + * the cut stamps. + */ +export function tallyAlways(render) { + const raw = render?.chrome?.deck?.counter; + if (!isObj(raw) || !Array.isArray(raw.series)) return []; + const said = new Map(raw.series.filter((s) => isObj(s) && typeof s.id === "string").map((s) => [s.id, s.showAt ?? raw.showAt])); + return resolveCounter(render).order.filter((id) => said.get(id) === "always"); +} + +/** The tally's cells for this render (tallyCellsFrom with the counter's order and tallyAlways). */ +export function tallyCells(stamps = [], render = null) { + return tallyCellsFrom(stamps, resolveCounter(render).order, tallyAlways(render)); +} + +/** * The tally's steps, in landing order: at each stamp's `landed`, its verdict's * count goes up by the stamp's `count` (1 unless its claim says). `count` is * the verdict's count after the step, `step` what it went up by, `counts` @@ -747,13 +794,13 @@ export function tallyFinals(stamps = [], order = VERDICTS) { } /** - * The verdicts a deck schedule's tally shows, or null for no tally: the - * setting is on and the cut stamps at least one claim. + * The cells a deck schedule's tally shows (tallyCells), or null for no tally: + * the setting is on and the cut stamps at least one claim. */ export function tallyOf(schedule, render) { const stamps = schedule?.factcheck?.stamps ?? []; if (!stamps.length || !resolveFactcheck(render).tally.show) return null; - return tallyVerdicts(stamps, resolveCounter(render).order); + return tallyCells(stamps, render); } /** diff --git a/umtool/report-to-video/factcheck.test.mjs b/umtool/report-to-video/factcheck.test.mjs @@ -65,14 +65,14 @@ test("normalizeClaim: trims the id, refuses a bad shape, an unknown field, a ver assert.deepEqual(VERDICTS, ["CORROBORATED", "PARTLY", "CONTRADICTED", "NOT_FOUND", "UNTESTABLE"]); }); -test("claimOf: a sound claim, never a teaser's, never a throw", () => { +test("claimOf: a sound claim (a teaser's too), never a throw", () => { assert.deepEqual(claimOf(ENTRIES[0]), { id: "k1", verdict: "PARTLY" }); assert.equal(claimOf(ENTRIES[3]), null); assert.equal(claimOf({ type: "clip", claim: { id: "k1" } }), null); - assert.equal(claimOf({ type: "teaser", claim: { id: "k1", verdict: "PARTLY" } }), null); + assert.deepEqual(claimOf({ type: "teaser", claim: { id: "k1", verdict: "PARTLY" } }), { id: "k1", verdict: "PARTLY" }); }); -test("validateClaims: shape, never on a teaser, one verdict per claim id; the review verdict is untouched", () => { +test("validateClaims: shape, one verdict per claim id (a teaser's claim counts as a clip's); the review verdict is untouched", () => { assert.deepEqual(validateClaims({ timeline: ENTRIES }), []); // `verdict` is the clip review's field, not the claim's: it is not read here. assert.deepEqual(validateClaims({ timeline: [{ ...ENTRIES[0], verdict: "incorrect" }] }), []); @@ -84,10 +84,9 @@ test("validateClaims: shape, never on a teaser, one verdict per claim id; the re { type: "clip", id: "c9", claim: { id: "k8", verdict: "MAYBE" } }, ], }); - assert.equal(errs.length, 3, errs.join("\n")); + assert.equal(errs.length, 2, errs.join("\n")); assert.match(errs[0], /timeline\[1\] \(c2\)\.claim k1 is CONTRADICTED here and PARTLY at timeline\[0\] \(c1\) -- one claim, one verdict/); - assert.match(errs[1], /timeline\[2\] \(fin\)\.claim: a teaser is not evidence/); - assert.match(errs[2], /timeline\[3\] \(c9\)\.claim\.verdict must be one of/); + assert.match(errs[1], /timeline\[3\] \(c9\)\.claim\.verdict must be one of/); }); test("a ledger pin (claim: \"<row id>\") is a measure ledger's, and a stamping manifest still refuses one", () => { diff --git a/umtool/report-to-video/modules/counter.mjs b/umtool/report-to-video/modules/counter.mjs @@ -43,8 +43,8 @@ export default defineModule({ ["`deck.counter.series[]`", "1–8 `{id, label, color?, stampLabel?, tallyLabel?, showAt?, shape?, unit?}` -- an `id` a letter then letters, digits, `_` `-`; a verdict's id (`CORROBORATED` …) takes its default label, colour and shape; `label` ≤ 24 and fitting the cell, as the verdicts' are", "`umtool look <p> deck.counter='{\"series\":[{\"id\":\"seizures\",\"label\":\"Seizures\",\"color\":\"#e5534b\",\"stampLabel\":\"Seizure\"}]}'`"], ["`deck.counter.series[].shape`", "`circle` `diamond` `square` `triangle` `ring` · default by place (a verdict's own)", "same"], ["`deck.counter.series[].unit`", "≤ 24 · the noun a count claim's number reads (default its label, lower-cased)", "same"], - ["`deck.counter.show`, `.position`, `.showAt`", "bool · `right` `left` · `always` `first` (a series' own `showAt` wins) · defaults `true`, `right`, `always`", "same"], - ["a mark's series", "`claim.verdict` (or `claim.counter`): one of the series' ids", "`umtool set <p> <clip> mark.add=seizures@190.2`"], + ["`deck.counter.show`, `.position`, `.showAt`", "bool · `right` `left` · `always` `first` (a series' own `showAt` wins) · defaults `true`, `right`, `always`. A series that SAYS `always` (its own `showAt`, else the counter's) is a cell from the first frame, dim at 0, whether or not a mark ever counts it (\"Left 0\"); one with no `showAt` said, or `first`, is a cell once it is counted, so one never counted is not drawn. The cells show once the cut counts anything", "same"], + ["a mark's series", "`claim.verdict` (or `claim.counter`): one of the series' ids. A clip's mark, or a teaser's (a post shown as a text card: `at` seconds from the card's start; the deck stays up over it)", "`umtool set <p> <clip> mark.add=seizures@190.2` · `umtool set <p> <teaser> mark.add=CENTER@2.15`"], ], }, }); diff --git a/umtool/report-to-video/modules/counter.test.mjs b/umtool/report-to-video/modules/counter.test.mjs @@ -4,7 +4,9 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { counterOrder, resolveCounter, validateCounter, VERDICT_SHAPES } from "../counter.mjs"; -import { claimOf, marksOf, normalizeClaim, resolveFactcheck, tallyFinals, tallyOf, tallyShowAt, validateClaims } from "../factcheck.mjs"; +import { + claimOf, marksOf, normalizeClaim, resolveFactcheck, tallyAlways, tallyCells, tallyCellsFrom, tallyCues, tallyFinals, tallyOf, tallyShowAt, validateClaims, +} from "../factcheck.mjs"; import { estimateSchedule, validateChrome } from "../deck.mjs"; import { deckHtml } from "../chrome-deck.mjs"; import counter from "./counter.mjs"; @@ -103,6 +105,57 @@ test("a cut counting named series: the schedule, the tally's cells, the deck's p assert.match(validateClaims(bad)[0], /claim\.verdict must be one of seizures, pitches/); }); +test("a series that says `showAt: always` is drawn at 0 though no mark uses it (lane counter-zero); unsaid, `first` and the verdicts are not", () => { + const SIDES = [ + { id: "LEFT", label: "Left", color: "#5b9bd5" }, + { id: "CENTER", label: "Center", color: "#e8d27a" }, + { id: "RIGHT", label: "Right", color: "#e5534b", showAt: "first" }, + ]; + const r = render({ counter: { series: SIDES, showAt: "always" } }); + const manifest = { + provenance: {}, posts: [], render: r, + timeline: [ + { type: "clip", id: "a", video: "v1", start: 0, end: 10, claim: { id: "d1", verdict: "CENTER" } }, + { type: "clip", id: "b", video: "v2", start: 0, end: 10 }, + ], + }; + const s = estimateSchedule(manifest); + // LEFT (always, the default) is a cell, in the counter's order; RIGHT (first, never counted) is not. + assert.deepEqual(tallyAlways(r), ["LEFT", "CENTER"]); + assert.deepEqual(tallyOf(s, r), ["LEFT", "CENTER"]); + assert.deepEqual(tallyCells(s.factcheck.stamps, r), ["LEFT", "CENTER"]); + // Its cell reads 0, dim as an always cell is before its first count, and never steps. + const cues = tallyCues(s.factcheck.stamps, tallyOf(s, r)); + assert.deepEqual(cues.init["ty.LEFT"], { opacity: 0.42 }); + assert.deepEqual(cues.init["ty.LEFT.n0"], { yPercent: 0, autoAlpha: 1 }); + assert.equal(cues.events.filter((e) => e.k.startsWith("ty.LEFT")).length, 0); + const html = deckHtml(s, r, {}); + assert.match(html, /data-verdict="LEFT"/); + assert.match(html, /<div class="tlabel">Left<\/div>/); + assert.doesNotMatch(html, /data-verdict="RIGHT"/); + // Said, not defaulted: a counter that never says "always" (as `umtool migrate` writes one) is a cell per series counted. + const unsaid = render({ counter: { series: SIDES } }); + assert.deepEqual(tallyAlways(unsaid), []); + assert.deepEqual(tallyOf(estimateSchedule({ ...manifest, render: unsaid }), unsaid), ["CENTER"]); + // A series' own "always" says it for that series alone. + const one = render({ counter: { series: [{ ...SIDES[0], showAt: "always" }, SIDES[1], SIDES[2]] } }); + assert.deepEqual(tallyAlways(one), ["LEFT"]); + // The counter's own showAt: first leaves an unused series out, as before. + const firstAll = render({ counter: { series: SIDES, showAt: "first" } }); + assert.deepEqual(tallyAlways(firstAll), []); + assert.deepEqual(tallyOf(estimateSchedule({ ...manifest, render: firstAll }), firstAll), ["CENTER"]); + // No mark at all: no tally, as ever (the counter steps on stamps). + assert.equal(tallyOf(estimateSchedule({ ...manifest, timeline: [manifest.timeline[1]] }), r), null); + // The fact-check verdicts keep their tally of the verdicts the cut stamps. + const fc = render(); + assert.deepEqual(tallyAlways(fc), []); + const verdicts = { ...manifest, render: fc, timeline: [{ ...manifest.timeline[0], claim: { id: "d1", verdict: "PARTLY" } }] }; + assert.deepEqual(tallyOf(estimateSchedule(verdicts), fc), ["PARTLY"]); + // The pure form the pages read: order, then the always ones besides the used. + assert.deepEqual(tallyCellsFrom([{ verdict: "c" }], ["a", "b", "c"], ["a"]), ["a", "c"]); + assert.deepEqual(tallyCellsFrom([{ verdict: "c" }], ["a", "b", "c"]), ["c"]); +}); + test("the counter module: its home, its validator, its docs", () => { assert.equal(counter.kind, "part"); assert.equal(counter.host, "shell"); diff --git a/umtool/report-to-video/teaser-marks.test.mjs b/umtool/report-to-video/teaser-marks.test.mjs @@ -0,0 +1,87 @@ +// A TEASER THAT COUNTS (lane counter-zero): a post shown as a text card may +// carry marks as a clip does -- `claim` / `claims`, `at` in seconds from the +// card's start -- stamped and counted over the card, with the deck kept up +// so the count is seen to step. A teaser without marks is the teaser it was. +// +// Run with: pnpm test:scripts +import assert from "node:assert/strict"; +import test from "node:test"; + +import { estimateSchedule, hidesDeck, resolveDeck, teaserCounts, teaserLead, teaserMarkClock, deckChoreography } from "./deck.mjs"; +import { tallyOf, tallySteps, validateClaims } from "./factcheck.mjs"; +import { deckHtml } from "./chrome-deck.mjs"; + +const PALETTE = { bg: "#101219", fg: "#f2f0ea", muted: "#979caa", accent: "#e5534b", amber: "#ffc860" }; +const SIDES = [ + { id: "LEFT", label: "Left", color: "#5b9bd5" }, + { id: "CENTER", label: "Center", color: "#e8d27a" }, +]; +const render = { width: 1920, height: 1080, fps: 30, transition: 0.5, palette: PALETTE, chrome: { engine: "hyperframes", layout: "deck", deck: { counter: { series: SIDES, showAt: "always" } } } }; +const card = (extra = {}) => ({ + type: "teaser", id: "x-d28", seconds: 5, + lines: [{ text: "@Leaflit on X · 1 Feb 2026", role: "overline" }, { text: "“… as a moderate.”", role: "kicker" }], + ...extra, +}); +const manifest = (teaser) => ({ + provenance: {}, posts: [], render, + timeline: [ + { type: "clip", id: "d2", video: "v1", start: 0, end: 10, claim: { id: "d2", verdict: "CENTER", at: 5 } }, + teaser, + { type: "clip", id: "d3", video: "v2", start: 0, end: 10 }, + ], +}); + +test("a teaser without a mark is as it was: the deck slides away over it, named by its lines", () => { + const s = estimateSchedule(manifest(card())); + const seg = s.segments[1]; + assert.equal(seg.hideDeck, true); + assert.equal(teaserCounts(card()), false); + assert.match(seg.title, /@Leaflit on X/); + assert.equal(seg.claim, undefined); + assert.deepEqual(s.factcheck.stamps.map((x) => x.claim), ["d2"]); +}); + +test("a teaser's mark lands at the card's second, counts, and keeps the deck up with no words of its own", () => { + const t = card({ claim: { id: "x-d28", verdict: "CENTER", at: 2.15 } }); + assert.deepEqual(validateClaims(manifest(t)), []); + assert.equal(teaserCounts(t), true); + assert.equal(hidesDeck(t, resolveDeck(render)), false); + const s = estimateSchedule(manifest(t)); + const seg = s.segments[1]; + assert.equal(seg.hideDeck, false); + assert.equal(seg.title, "", "its words are on the card"); + assert.equal(seg.subtitle, ""); + assert.equal(seg.sourceFrom, 0, "the card's own clock"); + const stamp = s.factcheck.stamps.find((x) => x.claim === "x-d28"); + assert.equal(stamp.segment, "x-d28"); + assert.equal(stamp.landed, Math.round((seg.start + 2.15) * 1000) / 1000); + // The count steps there: CENTER 1 on the clip, 2 on the card. + assert.deepEqual(tallySteps(s.factcheck.stamps).map((x) => [x.verdict, x.count, x.at]), [["CENTER", 1, s.factcheck.stamps[0].landed], ["CENTER", 2, stamp.landed]]); + // The deck stays up through the card: no slide away into it or back after it. + assert.deepEqual(deckChoreography(s, render).visibility, []); + assert.deepEqual(tallyOf(s, render), ["LEFT", "CENTER"]); + const html = deckHtml(s, render, {}); + assert.match(html, /data-seg="x-d28"/); +}); + +test("a teaser that dips still hides the deck at the black; its mark counts on the card's clock after the lead", () => { + const t = card({ dip: { fade: 1, black: 0.5 }, claim: { id: "x-d28", verdict: "CENTER", at: 1 } }); + assert.equal(teaserCounts(t), false); + const s = estimateSchedule(manifest(t)); + const seg = s.segments[1]; + assert.equal(seg.hideDeck, true); + const lead = teaserLead(t, 0.5, 30); + assert.equal(teaserMarkClock(t, 0.5, 30), -lead); + assert.equal(seg.sourceFrom, -lead); + const stamp = s.factcheck.stamps.find((x) => x.claim === "x-d28"); + assert.equal(stamp.landed, Math.round((seg.start + lead + 1) * 1000) / 1000); +}); + +test("a teaser's untimed mark lands as a clip's does, before the card leaves; two marks keep their hold apart", () => { + const s = estimateSchedule(manifest(card({ claim: { id: "x-d28", verdict: "CENTER" } }))); + const seg = s.segments[1]; + const stamp = s.factcheck.stamps.find((x) => x.claim === "x-d28"); + assert.ok(stamp.landed > seg.start && stamp.landed <= seg.end, JSON.stringify({ stamp, seg })); + const close = card({ claims: [{ id: "a", verdict: "CENTER", at: 1 }, { id: "b", verdict: "LEFT", at: 2 }] }); + assert.match(validateClaims(manifest(close))[0], /timeline\[1\] \(x-d28\)\.claims: the marks a \(at 1\) and b \(at 2\) overlap/); +});