commit 859d222eae73fa5b64d0cab4cb2fd1b7e7743ab7
parent 75f0264fbd5206dfb66062c248b6201005e39c9e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 23 Oct 2026 02:08:30 -0400
live preview over marks: every mark a clip stamps is listed (stamps/counts <id> at <source s>), each its own stamp and tally step; the spec walks a clip with two marks
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 75 insertions(+), 37 deletions(-)
diff --git a/umtool/components/projects/review/LiveDeckPreview.tsx b/umtool/components/projects/review/LiveDeckPreview.tsx
@@ -6,7 +6,7 @@ import { cn } from "@/lib/utils";
import { edgeClock } from "@/lib/report/clipEditorModel.mjs";
import type { EditorClip } from "@/lib/report/clipEditorTypes";
import { footageAt } from "@/lib/report/footage-move.mjs";
-import { clipStamp, clockText, cutTimeAt, finaleUp, liveClock, stampAt, tallyAt } from "@/lib/report/liveClock.mjs";
+import { clipStamps, clockText, cutTimeAt, finaleUp, liveClock, stampAt, tallyAt } from "@/lib/report/liveClock.mjs";
import { tallyVerdicts } from "umtool-report-to-video/factcheck";
import { DeckFrame, FeedOverlay, PostsOverlay, postsWindowAt, type DeckPreviewDoc, type DeckTexts, type Rect } from "../OnscreenSection";
@@ -206,7 +206,7 @@ export default function LiveDeckPreview({
const order = useMemo(() => (schedule?.factcheck ? tallyVerdicts(schedule.factcheck.stamps) : []), [schedule]);
const tally = schedule?.factcheck ? tallyAt(schedule, t, order) : [];
const stamp = schedule ? stampAt(schedule, t) : null;
- const mine = schedule && clock ? clipStamp(schedule, clock) : null;
+ const mine = schedule && clock ? clipStamps(schedule, clock) : [];
const finaleNow = !!schedule && finaleUp(schedule, t);
const seg = schedule?.segments.find((s) => s.id === clip.id) ?? null;
const postsWin = doc?.posts ? postsWindowAt(doc.posts.windows, t) : null;
@@ -351,17 +351,19 @@ export default function LiveDeckPreview({
<span data-live-stamp={stamp ? `${stamp.claim}:${stamp.phase}` : ""}>
{stamp ? `stamp ${stamp.claim} (${stamp.phase})` : "no stamp on screen"}
</span>
- {mine && (
+ {mine.map((m) => (
<button
+ key={m.claim}
type="button"
- data-live-goto-stamp={mine.sourceLanded}
+ data-live-goto-stamp={m.sourceLanded}
+ data-live-goto-mark={m.claim}
className="ink-link"
- title="put the playhead a second before this clip's stamp lands"
- onClick={() => player.current?.seek(Math.max(clock.sourceFrom, mine.sourceLanded - 1))}
+ title="put the playhead a second before this mark's stamp lands"
+ onClick={() => player.current?.seek(Math.max(clock.sourceFrom, m.sourceLanded - 1))}
>
- {mine.drawn ? "this clip stamps" : "this clip counts"} {mine.claim} at {edgeClock(mine.sourceLanded)}
+ {m.drawn ? "stamps" : "counts"} {m.claim} at {edgeClock(m.sourceLanded)}
</button>
- )}
+ ))}
{finaleNow && <span data-live-finale-up="">finale</span>}
{schedule?.estimated && (
<details className="w-full text-[11px] text-muted" data-live-approximate="">
diff --git a/umtool/e2e/fixtures/live-preview-fixture.mjs b/umtool/e2e/fixtures/live-preview-fixture.mjs
@@ -6,7 +6,7 @@
// built: the live preview draws the manifest's estimate.
//
// c01 1.0-3.5 "24 Oct 2020"
-// c02 4.0-6.5 claim k1 Grift at 5.0 "2 Dec 2024"
+// c02 4.0-6.5 marks k1 Grift at 5.0, k1b Episodes at 6.0 "2 Dec 2024"
// c03 6.5-8.8 claim k2 Episodes, finale "27 Feb 2025"
//
// Synthetic, like every fixture.
@@ -23,7 +23,8 @@ export function makeLivePreviewFixture({ reports, deckManifest, cachedWindow })
{ type: "clip", id: "c01", video: "vid1", start: 1.0, end: 3.5, cite: 1, lock: true, quote: "This is a complete sentence.", onscreen: { title: "24 Oct 2020" } },
{
type: "clip", id: "c02", video: "vid1", start: 4.0, end: 6.5, cite: 4, lock: true, quote: "And this one runs on",
- onscreen: { title: "2 Dec 2024" }, claim: { id: "k1", verdict: "CONTRADICTED", at: 5.0 },
+ onscreen: { title: "2 Dec 2024" },
+ claims: [{ id: "k1", verdict: "CONTRADICTED", at: 5.0, hold: 0.8 }, { id: "k1b", verdict: "CORROBORATED", at: 6.0 }],
},
{
type: "clip", id: "c03", video: "vid1", start: 6.5, end: 8.8, cite: 6, lock: true, quote: "of that it finishes here.",
diff --git a/umtool/e2e/live-preview.spec.ts b/umtool/e2e/live-preview.spec.ts
@@ -76,9 +76,12 @@ test("the live preview: the deck over the clip, the tally and the stamp at the p
await expect(deck.locator('[data-seg="c02"] .deck-title')).toHaveText("2 Dec 2024");
await expect(page.locator("[data-live-readout]")).toContainText("clip 2 of 3");
- // The clip's stamp: the button puts the playhead a second before it lands (source 4.0, the clip's first second).
+ // The clip's two marks, each its own stamp and tally step. The first's button puts the playhead a second
+ // before it lands (source 4.0, the clip's first second).
await playerOn(page, "c02");
- const go = page.locator("[data-live-goto-stamp]");
+ await expect(page.locator("[data-live-goto-mark]")).toHaveCount(2);
+ await expect(page.locator('[data-live-goto-mark="k1b"]')).toHaveAttribute("data-live-goto-stamp", "6");
+ const go = page.locator('[data-live-goto-mark="k1"]');
await expect(go).toHaveAttribute("data-live-goto-stamp", "5");
await go.click();
await expect(live).toHaveAttribute("data-live-where", "inside");
@@ -86,9 +89,9 @@ test("the live preview: the deck over the clip, the tally and the stamp at the p
await expect(page.locator("[data-live-tally]")).toHaveAttribute("data-live-tally", "CORROBORATED:0,CONTRADICTED:0");
await expect(page.locator("[data-live-stamp]")).toHaveAttribute("data-live-stamp", "");
- // 1.6 s on (source 5.6): the stamp has landed on its source second, the tally has stepped.
- await nudgePlayer(page, 1.6);
- await expect.poll(async () => Number(await live.getAttribute("data-live-t"))).toBeCloseTo(t0 + 1.6, 1);
+ // 1.4 s on (source 5.4): the stamp has landed on its source second, the tally has stepped.
+ await nudgePlayer(page, 1.4);
+ await expect.poll(async () => Number(await live.getAttribute("data-live-t"))).toBeCloseTo(t0 + 1.4, 1);
await expect(page.locator("[data-live-stamp]")).toHaveAttribute("data-live-stamp", "k1:on");
await expect(page.locator("[data-live-tally]")).toHaveAttribute("data-live-tally", "CORROBORATED:0,CONTRADICTED:1");
// And the pages say the same: the stamp's page shows k1, the deck's tally shows Grift 1.
@@ -97,8 +100,15 @@ test("the live preview: the deck over the clip, the tally and the stamp at the p
await expect.poll(() => opacityIn(frameOf(page, /\/sourced\/index\.html/), '[data-k="ty.CONTRADICTED.n1"]')).toBeGreaterThan(0.9);
expect(await opacityIn(frameOf(page, /\/sourced\/index\.html/), '[data-k="ty.CONTRADICTED.n0"]')).toBeLessThan(0.1);
- // Back before it (source 4.6): no stamp, nothing counted -- the pages are seeked back too.
- await nudgePlayer(page, -1.0);
+ // 0.8 s more (source 6.2): the clip's second mark, its own stamp and step.
+ await nudgePlayer(page, 0.8);
+ await expect(page.locator("[data-live-stamp]")).toHaveAttribute("data-live-stamp", "k1b:on");
+ await expect(page.locator("[data-live-tally]")).toHaveAttribute("data-live-tally", "CORROBORATED:1,CONTRADICTED:1");
+ await expect.poll(() => opacityIn(frameOf(page, /stamp-preview/), '.stamp[data-claim="k1b"]')).toBeGreaterThan(0.9);
+ await expect.poll(() => opacityIn(frameOf(page, /\/sourced\/index\.html/), '[data-k="ty.CORROBORATED.n1"]')).toBeGreaterThan(0.9);
+
+ // Back before both (source 4.6): no stamp, nothing counted -- the pages are seeked back too.
+ await nudgePlayer(page, -1.6);
await expect(page.locator("[data-live-stamp]")).toHaveAttribute("data-live-stamp", "");
await expect(page.locator("[data-live-tally]")).toHaveAttribute("data-live-tally", "CORROBORATED:0,CONTRADICTED:0");
await expect.poll(() => opacityIn(frameOf(page, /stamp-preview/), '.stamp[data-claim="k1"]')).toBeLessThan(0.1);
@@ -119,13 +129,13 @@ test("the live preview: the deck over the clip, the tally and the stamp at the p
await playerOn(page, "c03");
const fin = page.locator('[data-live-preview="c03"]');
await expect(fin).toHaveAttribute("data-live-state", "ready");
- await expect(page.locator("[data-live-goto-stamp]")).toContainText("this clip counts k2");
- await page.locator("[data-live-goto-stamp]").click();
+ await expect(page.locator('[data-live-goto-mark="k2"]')).toContainText("counts k2");
+ await page.locator('[data-live-goto-mark="k2"]').click();
await expect(fin).toHaveAttribute("data-live-where", "inside");
await nudgePlayer(page, 1.0);
await expect(page.locator("[data-live-finale-up]")).toBeVisible();
await expect(page.getByTestId("live-finale")).toHaveAttribute("data-feed-ready", "1", { timeout: 30_000 });
- await expect(page.locator("[data-live-tally]")).toHaveAttribute("data-live-tally", "CORROBORATED:1,CONTRADICTED:1");
+ await expect(page.locator("[data-live-tally]")).toHaveAttribute("data-live-tally", "CORROBORATED:2,CONTRADICTED:1");
await expect(page.locator("[data-live-stamp]")).toHaveAttribute("data-live-stamp", "");
// Render this clip: a job (stubbed), the file shown inline when done.
diff --git a/umtool/lib/report/liveClock.mjs b/umtool/lib/report/liveClock.mjs
@@ -145,24 +145,27 @@ export function stampAt(schedule, t) {
}
/**
- * The stamp a clip carries, if any: its landing second in the SOURCE's clock
- * (where the editor's playhead would have to be), for the readout and a "go
- * to the stamp" seek. null when the clip stamps nothing in this schedule.
+ * The stamps a clip carries -- one per mark it stamps (a clip may carry
+ * several, `claims`) -- in landing order, each with its landing second in the
+ * SOURCE's clock (where the editor's playhead would have to be), for the
+ * readout and a "go to the stamp" seek. Empty when the clip stamps nothing in
+ * this schedule.
*
* @param {Schedule} schedule
* @param {ReturnType<typeof liveClock>} clock
*/
-export function clipStamp(schedule, clock) {
- if (!clock) return null;
- const s = (schedule?.factcheck?.stamps ?? []).find((x) => x.segment === clock.id);
- if (!s) return null;
- return {
- claim: s.claim,
- verdict: s.verdict,
- drawn: s.stamp !== false && !s.finale,
- landed: s.landed,
- sourceLanded: round(clock.sourceFrom + (s.landed - clock.start)),
- };
+export function clipStamps(schedule, clock) {
+ if (!clock) return [];
+ return (schedule?.factcheck?.stamps ?? [])
+ .filter((x) => x.segment === clock.id)
+ .sort((a, b) => a.landed - b.landed)
+ .map((s) => ({
+ claim: s.claim,
+ verdict: s.verdict,
+ drawn: s.stamp !== false && !s.finale,
+ landed: s.landed,
+ sourceLanded: round(clock.sourceFrom + (s.landed - clock.start)),
+ }));
}
/** Is the finale's page up at cut second `t` (its window, `from`–`to`)? */
diff --git a/umtool/lib/report/liveClock.test.mjs b/umtool/lib/report/liveClock.test.mjs
@@ -8,7 +8,7 @@ import test from "node:test";
import { estimateSchedule } from "umtool-report-to-video/deck";
import { tallyVerdicts } from "umtool-report-to-video/factcheck";
import {
- clipStamp, clockText, cutTimeAt, finaleUp, liveClock, livePlayWindow, sourceTimeAt, stampAt, tallyAt,
+ clipStamps, clockText, cutTimeAt, finaleUp, liveClock, livePlayWindow, sourceTimeAt, stampAt, tallyAt,
} from "./liveClock.mjs";
/** A deck cut of four clips: two claims (one stamped at a source second), a finale last. */
@@ -76,7 +76,7 @@ test("the stamp lands on its source second, and the tally steps there", () => {
const landing = cutTimeAt(clock, 110).t;
const st = s.factcheck.stamps.find((x) => x.claim === "k1");
assert.ok(Math.abs(st.landed - landing) < 0.002, `landed ${st.landed} vs the source's 110 at ${landing}`);
- const cs = clipStamp(s, clock);
+ const [cs] = clipStamps(s, clock);
assert.equal(cs.claim, "k1");
assert.ok(Math.abs(cs.sourceLanded - 110) < 0.002);
assert.equal(cs.drawn, true);
@@ -109,11 +109,33 @@ test("the finale: up over its window; a stamp there is counted, not drawn", () =
// The clip before it may still be leaving its own stamp; the finale's is never drawn.
for (const t of [k3.at, k3.at + 0.5, s.total - 0.01]) assert.notEqual(stampAt(s, t)?.claim, "k3");
assert.equal(stampAt(s, s.total - 0.01), null);
- assert.equal(clipStamp(s, liveClock(s, m.timeline[3])).drawn, false);
+ assert.equal(clipStamps(s, liveClock(s, m.timeline[3]))[0].drawn, false);
assert.equal(tallyAt(s, s.total).find((r) => r.verdict === "CONTRADICTED").count, 3);
assert.equal(finaleUp(estimateSchedule(manifest()), 0), false);
});
+test("a clip with two marks: each its own stamp at its own source second, each its own step of the tally", () => {
+ const m = manifest();
+ m.timeline[1] = {
+ ...m.timeline[1],
+ claim: undefined,
+ claims: [{ id: "k1", verdict: "CORROBORATED", at: 106, hold: 2 }, { id: "k1b", verdict: "CONTRADICTED", at: 112 }],
+ };
+ delete m.timeline[1].claim;
+ const s = estimateSchedule(m);
+ const order = tallyVerdicts(s.factcheck.stamps);
+ const clock = liveClock(s, m.timeline[1]);
+ const marks = clipStamps(s, clock);
+ assert.deepEqual(marks.map((x) => x.claim), ["k1", "k1b"]);
+ assert.ok(Math.abs(marks[0].sourceLanded - 106) < 0.002);
+ assert.ok(Math.abs(marks[1].sourceLanded - 112) < 0.002);
+ const at = (src) => cutTimeAt(clock, src).t;
+ assert.equal(stampAt(s, at(106.5))?.claim, "k1");
+ assert.equal(stampAt(s, at(112.5))?.claim, "k1b");
+ const count = (src, v) => tallyAt(s, at(src), order).find((r) => r.verdict === v).count;
+ assert.deepEqual([count(105.9, "CORROBORATED"), count(106, "CORROBORATED"), count(111.9, "CONTRADICTED"), count(112, "CONTRADICTED")], [0, 1, 0, 1]);
+});
+
test("a held clip: its hold after its footage's last frame", () => {
const s = { segments: [{ id: "a", start: 0, duration: 12, hold: 2 }] };
const clock = liveClock(s, { id: "a", start: 0, end: 10 });