commit c8da33f9f109d6000ed6ffb11fb5581685c979fb
parent 38cb66834f9f3a12f1b8d0915cc415c890ce45ac
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 1 Nov 2026 22:43:36 -0500
umtool: pieced.spec.ts and its fixture; knobs.md and clip-bench.md say a clip fetched per piece reads as cached and plays as one window
pieced-fixture (make-fixture.mjs, read-only): pc01 with both of its pieces on
disk, pc02 with one. The spec: the Cut tab's pill (cached / not fetched yet),
the walk's ready count, the bench opening pc01 on one pieces window (0-199) and
playing 14 s of sound across a 183 s gap, and pc02 offering to fetch.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 131 insertions(+), 1 deletion(-)
diff --git a/umtool/docs/clip-bench.md b/umtool/docs/clip-bench.md
@@ -63,6 +63,20 @@ gets an empty list — "nothing fetched for this clip yet", which is true — ra
than somebody else's window. A caller with no window at all (a ledger claim asks
for its video's files and picks by cite) still gets every file, widest first.
+**A clip fetched in pieces is one window.** A clip with gaps is fetched per kept
+piece (`umtool fetch`; pieces under 60 s apart as one), so no file holds its
+extent. When every piece it plays is on disk, `windowsFor()` puts first a window
+**on the source's clock** that spans the pieces: each where it was said, and where
+nothing was fetched (inside a gap) black picture and silence. It is named
+`<from>-<to>.<hash>.pieces.mp4`, cut once, lazily, like a long recording's
+excerpt (`out/bench-excerpts/<video>/`, a sidecar of every piece's identity, so
+a refetched piece re-cuts it), and everything on the bench — cues, waveform,
+marks, the edge drag, the gap bands — is true on it unchanged. Playback skips the
+gap as the cut will, so the filler is never the point. Fetched means the same on
+the Cut tab and the walk: the extent in one window, **or every kept piece in some
+window**. Pieces more than 15 minutes apart are not laid on one clock (the
+filler would be the file).
+
## A drag never downloads
Dragging past the cached window **clamps** and offers a button. A handle that
@@ -265,7 +279,7 @@ timeline order — so `p`, `n`, both header links, the start button and the jump
Walking back onto a clip somebody already answered is the round trip the walk
exists to remove.
- **Fetched** means some file in `out/clips-raw` holds this clip's own window
- end to end. Not the *padded* window a build would download, and not an
+ end to end (a clip with gaps fetched per piece: every kept piece is in some file). Not the *padded* window a build would download, and not an
overlap: a half-covered clip cannot be watched through, so there is nothing
to judge. Landing on one is a dead end whose only move is `n` again.
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -117,6 +117,19 @@ seconds (`report-to-video/gaps.mjs` is the rule and both clocks).
fades, the picture past the gap at the join, the clock and the scrub bar in cut seconds, a dashed tick on the reel
strip at each jump.
- **`umtool timeline <p> ls`** shows a clip's gaps and what it then plays.
+- **Fetched in pieces**: `umtool fetch` asks the editor for one window per kept piece (pieces under 60 s apart as
+ one), so a clip with a long gap has no file holding its extent. Every reader asks for the pieces, as the build does:
+ the clip is **cached** (the Cut tab's pill, `data-fetched`, the walk and its `ready N of M`, `umtool walk`, the
+ stand-ins) when its extent is in one window **or every kept piece is in some window**; one piece missing is "not
+ fetched yet". `umtool check`'s availability preflight counts it held when every piece is. `umtool scenes` scans each
+ held piece (`window.kind` `pieces`, one row per piece). The cut points Play draws and **Export one clip** measure
+ the pieces joined as the build joins them (a file in the cut-points cache, never in the project), on that file's
+ clock and mapped back: the row is the build's cut record (the cut's `gaps` include the seconds between pieces),
+ with no `silences` to snap a dragged edge with. **The bench** opens a pieced clip on ONE window on the source's clock:
+ the pieces where they were said and, where nothing was fetched (inside a gap), black, silent filler, cut once (lazily,
+ like a long recording's excerpt, `out/bench-excerpts/<video>/*.pieces.mp4`). Playback skips the gap as the cut will,
+ so the filler is only heard if you choose to hear a gap through ("Hear it") past the fetched edge. Pieces more than
+ 15 minutes apart are not laid on one clock; the bench then shows the windows as before.
### The bench waveform's zoom
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -1889,6 +1889,25 @@ makeCutEditingFixture({ reports, manifest, deckManifest, cachedWindow: path.join
mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true });
copyFileSync(path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), path.join(dir, "out", "clips-raw", "gapvid_0.00-9.00.mp4"));
}
+// A clip fetched PER KEPT PIECE (pieced.spec.ts, fetch-per-piece): no window holds its extent, the
+// pieces do. READ-ONLY (the spec writes nothing), so one project serves it.
+// pc01 pcvid 1-198, gap 8-191 (183 s out): both pieces on disk -- raw windows 0-9 and 190-199
+// pc02 pcvid2 1-198, the same gap: only the first piece on disk (0-9), the second never fetched
+// The windows are the fixture's vid1 tone window (silences 2.9-3.1, 5.9-6.1), 15 fps.
+{
+ const gap = [{ from: 8, to: 191 }];
+ const g = manifest("pieced-fixture", "The Pieced Fixture", { siteOrigin: "https://archive.example" }, [
+ { type: "clip", id: "pc01", video: "pcvid", start: 1, end: 198, cite: 1, section: 0, lock: true, quote: "a clip fetched in two pieces", gaps: gap },
+ { type: "clip", id: "pc02", video: "pcvid2", start: 1, end: 198, cite: 1, section: 0, lock: true, quote: "a clip with one piece fetched", gaps: gap },
+ ]);
+ g.render.fetchPad = 0;
+ const dir = writeProject("pieced-fixture", g);
+ mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true });
+ const win = path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4");
+ copyFileSync(win, path.join(dir, "out", "clips-raw", "pcvid_0.00-9.00.mp4"));
+ copyFileSync(win, path.join(dir, "out", "clips-raw", "pcvid_190.00-199.00.mp4"));
+ copyFileSync(win, path.join(dir, "out", "clips-raw", "pcvid2_0.00-9.00.mp4"));
+}
// The same cut for Play → Edit this clip → Back (phone-walk.spec.ts), which WRITES
// an edge: its own copy, so play-cut.spec's clock is never moved.
makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), name: "play-edit-fixture", title: "The Play Edit Fixture", video: "vid1" });
diff --git a/umtool/e2e/pieced.spec.ts b/umtool/e2e/pieced.spec.ts
@@ -0,0 +1,84 @@
+import { test, expect } from "@playwright/test";
+import { mkdirSync } from "node:fs";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// A clip fetched PER KEPT PIECE (fetch-per-piece; pieced-consumers.test.mjs is
+// the unit half): no window holds its extent, the pieces do, and every surface
+// that asked for "the window holding the clip" reads them.
+//
+// Fixture: pieced-fixture (make-fixture.mjs), READ-ONLY.
+// pc01 pcvid 1-198 less the gap 8-191: both pieces on disk (raw windows 0-9, 190-199)
+// pc02 pcvid2 1-198, the same gap: only the first piece on disk
+//
+// - the Cut tab's pill: pc01 "cached" (data-fetched 1), pc02 "not fetched yet"
+// - the bench opens pc01 on ONE window on the source's clock (the pieces where
+// they were said, black filler between), plays it across the gap -- the
+// gap skipped as the cut will skip it, seven seconds of sound twice, not 197
+// - pc02 is not offered as playable: it offers to fetch
+// - the walk (`ready N of M`) counts pc01 and not pc02
+// ---------------------------------------------------------------------------
+
+const PROJECT = "reports/pieced-fixture";
+const SHOTS = process.env.PIECED_SHOTS ?? "";
+const shot = async (page: import("@playwright/test").Page, name: string) => {
+ if (!SHOTS) return;
+ mkdirSync(SHOTS, { recursive: true });
+ await page.screenshot({ path: `${SHOTS}/${name}.png`, fullPage: false });
+};
+
+test.beforeEach(() => {
+ test.setTimeout(120_000);
+});
+
+test("the Cut tab: a clip with every piece on disk is cached; one with a piece missing is not fetched yet", async ({ page }) => {
+ await page.goto(urls.section(PROJECT, "timeline"));
+ await expect(page.locator("[data-entry=pc01][data-kind]")).toHaveAttribute("data-fetched", "1");
+ await expect(page.locator("[data-entry=pc01][data-kind]")).toHaveAttribute("data-cached", "1");
+ await expect(page.locator("[data-entry=pc01][data-kind]")).not.toContainText("not fetched yet");
+ await expect(page.locator("[data-entry=pc02][data-kind]")).toHaveAttribute("data-fetched", "0");
+ await expect(page.locator("[data-entry=pc02][data-kind]")).toContainText("not fetched yet");
+ // The walk counts what can be watched end to end: pc01.
+ await expect(page.locator("[data-ready-count]")).toHaveText("ready 1 of 2 needing judgement");
+ await shot(page, "cut-tab-pills");
+});
+
+test("the bench plays a clip fetched in pieces as one timeline: the gap is skipped, not played", async ({ page, request }) => {
+ // The bench's window: one file on the source's clock, named for the pieces it is laid from.
+ const clip = (await (await request.get(`/api/report/clip?project=${encodeURIComponent(PROJECT)}&clip=pc01`)).json()) as {
+ windows?: { name: string; from: number; to: number }[];
+ };
+ const wins = clip.windows ?? [];
+ expect(wins[0]?.name, JSON.stringify(wins)).toMatch(/\.pieces\.mp4$/);
+ expect([wins[0].from, wins[0].to]).toEqual([0, 199]);
+
+ await page.goto(urls.clipBenchHref(PROJECT, "pc01"));
+ const playback = page.locator("[data-playback]");
+ await expect(playback).toHaveAttribute("data-audio-state", "ready", { timeout: 60_000 });
+ await expect(page.locator("[data-gap-band]")).toHaveCount(1);
+ await expect(page.locator("[data-clip-unfetched]")).toHaveCount(0);
+ await shot(page, "bench-pieced");
+ // Keyboard attached (hydration), then play.
+ await expect(async () => {
+ await page.locator("body").press("x");
+ await expect(page.locator("[data-reject-menu]")).toBeVisible({ timeout: 500 });
+ }).toPass({ timeout: 10_000 });
+ await page.locator("body").press("Escape");
+ await page.locator("body").press(" ");
+ await expect(playback).toHaveAttribute("data-play-state", "playing", { timeout: 10_000 });
+ expect(await playback.getAttribute("data-play-engine")).toBe("webaudio");
+ const a = Number(await playback.getAttribute("data-play-ctx-start"));
+ const b = Number(await playback.getAttribute("data-play-ctx-stop"));
+ // 1-198 less the 183 s gap: 14 s of sound (7 + 7), not 197.
+ expect(b - a).toBeCloseTo(14, 1);
+ expect(Number(await playback.getAttribute("data-play-to"))).toBeCloseTo(198, 1);
+ await shot(page, "bench-pieced-playing");
+ await page.locator("body").press(" ");
+});
+
+test("a clip with a piece missing is not playable: the bench offers to fetch it", async ({ page }) => {
+ await page.goto(urls.clipBenchHref(PROJECT, "pc02"));
+ await expect(page.locator("[data-bench=pc02]")).toBeVisible();
+ await expect(page.locator("[data-clip-unfetched]")).toHaveCount(1);
+ await shot(page, "bench-part-fetched");
+});