commit 0b9e8c4e5257a0ee882328452462b11f27f38802
parent f286e52076b3179ff70ea74b88e38309072f6bbc
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 2 Nov 2026 03:41:12 -0500
umtool: candidates inbox -- each Insert its own undo point; no panel (and no height) before a sweep proposes
insertInto writes with snapshotEvery 0, as Play's place does: every press is an undo point,
never coalesced into the last two minutes' (an undone group insert takes back that insert only).
The Cut tab draws the Candidates panel once <project>/candidates.json exists; until then one
line in the timeline's heading says how proposals come in -- an empty panel under the list
lengthened the page, and the cut-groups and cut-sections drags (the second drag of a test, after
the page had scrolled) landed on the wrong row. The candidates spec reads the fixture from
umtool/.e2e-song and waits out the second an undo point is named by.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/umtool/components/projects/report/CutTab.tsx b/umtool/components/projects/report/CutTab.tsx
@@ -23,6 +23,7 @@ import VoiceMatchPanel from "./VoiceMatchPanel";
import FetchWindowsPanel from "./FetchWindowsPanel";
import GroupProposalsPanel from "./GroupProposalsPanel";
import CandidatesPanel from "./CandidatesPanel";
+import { readCandidates } from "@/lib/report/candidates.mjs";
import BenchPrepPanel from "./BenchPrepPanel";
import { lastStartedRun, projectFetchBody, readFetchRuns } from "@/lib/report/fetchWindows.mjs";
import { readVoiceMatch, voiceMatchSummary } from "yt-dlp-transcript-common/lib/montage/voiceMatch.mjs";
@@ -69,6 +70,9 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor
).filter(Boolean).length;
const walkStart = (readiness.readyIds[0] as string | undefined) ?? clips[0]?.id;
const showAll = search.all === "1";
+ // The candidates inbox (UI notes item 14): its panel once a sweep has proposed something; until
+ // then one line in the timeline's heading says how proposals come in (no panel, no height).
+ const hasCandidates = (await readCandidates(project.dir)).exists === true;
const takes = await listTakes(project.dir);
// The trailer's beats (promo/trailer-beats.json): how many, for the Trailer link.
const trailerBeats = await readTrailerBeats(project.dir).then((d) => d.beats.length, () => null);
@@ -423,6 +427,11 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor
<section>
<h2 className="micro mb-1.5">
the cut — {entries.length} entries, in array order
+ {!hasCandidates && (
+ <span data-candidates-empty="" className="ml-2 normal-case tracking-normal text-[var(--color-dim)]" title="a sweep's proposed clips land in the Candidates panel, inserted only by your press">
+ · no candidates: <code className="font-mono">umtool candidates {project.id} import <sweep.md></code>
+ </span>
+ )}
</h2>
{/* The gap between "ready" and "needing", closed in one press. Every
row below it that reads "not fetched yet" is one of these, and
@@ -460,7 +469,7 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor
</section>
{/* The candidates inbox: a sweep's proposed clips, each inserted only by a press (UI notes item 14). */}
- <CandidatesPanel project={project.id} />
+ {hasCandidates && <CandidatesPanel project={project.id} />}
{clips.length > 0 && <GroupProposalsPanel project={project.id} />}
{/* --- the walk's ★ clips: the trailer's candidates ------------------- */}
{candidates.length > 0 && (
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -314,11 +314,11 @@ sweep's heading as its name; else the operator picks. A row whose second a clip
| | In umtool | From a terminal | Route |
|---|---|---|---|
-| the rows | the Cut tab's **Candidates** panel: verdict, `#N overall` (a sweep's Top N), its rank in its section, title, recording @ time, date, quote, why, the proposed place; **show inserted and set aside** | `umtool candidates <p> [ls] [--all] [--json]` | `GET /api/report/candidates` |
+| the rows | the Cut tab's **Candidates** panel, once a sweep has proposed (until then one line in the timeline's heading, "no candidates: umtool candidates … import"): verdict, `#N overall` (a sweep's Top N), its rank in its section, title, recording @ time, date, quote, why, the proposed place; **show inserted and set aside** | `umtool candidates <p> [ls] [--all] [--json]` | `GET /api/report/candidates` |
| import a sweep | — | `umtool candidates <p> import <sweep.md> [--dry-run]` -- every bullet `- [verdict] [title @ time](link) (date) "quote" — why` (numbered too), under its heading (a numbered heading's number dropped); a **Top N** section marks the moments it restates; a bullet with no verdict or link, or under a set-aside heading, is skipped and said | — |
| an agent's proposal | — | `umtool candidates <p> add <json\|@file>` -- `{channel?, video, t, quote?, why?, verdict?, score?, section?, title?, date?}` or `{link, …}`, one or a list | — |
| Play | **Play**: the cited second in the page when a cached window holds it, else **Play ↗** opens the archive at it | — | `GET /api/report/raw?candidate=<id>` |
-| Insert into section | the row's section (the proposed one preselected) and **Insert into section**: at the END of that section, the marker after its last clip re-anchored after the new one -- one write, an undo point | `umtool timeline <p> insert --to-section N <channel>/<video>@<start>-<end> [--title …]` | `POST /api/report/candidates {op: "insert", id, section, token}` |
+| Insert into section | the row's section (the proposed one preselected) and **Insert into section**: at the END of that section, the marker after its last clip re-anchored after the new one -- one write, its own undo point (never coalesced with the last edit) | `umtool timeline <p> insert --to-section N <channel>/<video>@<start>-<end> [--title …]` | `POST /api/report/candidates {op: "insert", id, section, token}` |
| Insert into group | the row's group (the proposed one preselected) and **Insert into group**: after the group's last clip and one of its clips, so the run stays together -- one write | `umtool timeline <p> insert --group G <spec> […]` | `{op: "insert", id, group, token}` |
| Not this | **Not this**: the row set aside, recorded with when, hidden, never deleted; the same moment proposed again stays set aside | — | `{op: "dismiss", id, note?}` |
| an Insert undone | the cut's **Undo last edit** (or the clip removed): the row waits again, "was <clip>, no longer in the cut" | `umtool timeline <p> undo` | — |
diff --git a/umtool/e2e/candidates.spec.ts b/umtool/e2e/candidates.spec.ts
@@ -21,7 +21,7 @@ import * as urls from "./urls";
// ---------------------------------------------------------------------------
const HERE = path.dirname(fileURLToPath(import.meta.url));
-const FIXTURE = path.join(HERE, ".e2e-song");
+const FIXTURE = path.join(HERE, "..", ".e2e-song");
const DIR = path.join(FIXTURE, "reports", "candidates-fixture");
const MANIFEST = path.join(DIR, "video.manifest.json");
const STORE = path.join(DIR, "candidates.json");
@@ -55,11 +55,17 @@ async function open(page: Page) {
await page.goto(urls.section(PROJECT, "timeline"));
await expect(page.getByTestId("candidates")).toBeVisible({ timeout: 20_000 });
}
+/** The Cut tab, with no candidates file yet: no panel, one line in the timeline's heading. */
+async function openEmpty(page: Page) {
+ await page.goto(urls.section(PROJECT, "timeline"));
+ await expect(page.locator("[data-candidates-empty]")).toBeVisible({ timeout: 20_000 });
+ await expect(page.getByTestId("candidates")).toHaveCount(0);
+}
const row = (page: Page, video: string) => page.locator(`[data-candidate-video='${video}']`);
const idOf = (video: string) => store().candidates.find((c) => c.video === video)!.id;
test("empty, the panel says how proposals come in; an import lands them proposed, the cut untouched", async ({ page }) => {
- await open(page);
+ await openEmpty(page);
await expect(page.locator("[data-candidates-empty]")).toContainText(`umtool candidates ${PROJECT} import`);
const before = order();
const out = importSweep();
@@ -67,7 +73,7 @@ test("empty, the panel says how proposals come in; an import lands them proposed
// A re-import changes nothing it holds.
expect(importSweep()).toMatch(/0 added, 4 already there/);
expect(order()).toBe(before);
- await page.reload();
+ await open(page);
await expect(page.getByTestId("candidates")).toHaveAttribute("data-candidates-proposed", "4");
// The Top 5's first leads the list.
await expect(page.locator("[data-candidate]").first()).toHaveAttribute("data-candidate-video", "v1234567");
@@ -76,7 +82,8 @@ test("empty, the panel says how proposals come in; an import lands them proposed
await expect(row(page, "vid2").locator("[data-candidate-place]")).toContainText("§1 (As a streamer) · group g1 (c04's group (g1))");
await expect(row(page, "W4pgGUq5ygQ").locator("[data-candidate-place]")).toContainText("§2 (Looks)");
await expect(row(page, "W4pgGUq5ygQ")).toContainText("“I respect that looks sell.”");
- await expect(row(page, "v1234567").locator("[data-candidate-place]")).toContainText("pick a section");
+ // A new claim names no clip: its place is the deck section of the heading it stands under.
+ await expect(row(page, "v1234567").locator("[data-candidate-place]")).toContainText("§1 (As a streamer) (the sweep's heading)");
// The proposed place is preselected.
await expect(page.locator(`[data-candidate-section='${idOf("W4pgGUq5ygQ")}']`)).toHaveValue("2");
await expect(page.locator(`[data-candidate-group='${idOf("vid2")}']`)).toHaveValue("g1");
@@ -121,6 +128,9 @@ test("Insert into section: at its end, the next marker after the new clip; Inser
expect(read().render.chrome.deck.markers![0].after).toBe("v1234567-3766");
const grp = idOf("vid2");
+ // An undo point is named by its second (lib/report/snapshots.mjs): two writes inside one second
+ // share one. A person's presses are seconds apart; the spec's are not, so it waits one out.
+ await page.waitForTimeout(1100);
await page.locator(`[data-candidate-insert-group='${grp}']`).click();
await expect.poll(() => store().candidates.find((c) => c.id === grp)!.status).toBe("inserted");
// Its id is the recording and its start: the window starts where the sentence does (vid2's cues).
diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs
@@ -2379,7 +2379,7 @@ export function insertIntoIn(m, spec, { section = null, group = null } = {}) {
/**
* Insert a clip into a section or a group (insertIntoIn): ONE structural
- * write -- one undo point -- the markers checked by the deck's own validator
+ * write -- its own undo point, never coalesced -- the markers checked by the deck's own validator
* and the take patches' markers brought along (sectionWrite).
*
* @param {string} dir
@@ -2388,7 +2388,8 @@ export function insertIntoIn(m, spec, { section = null, group = null } = {}) {
* @param {{ token?: string | null }} [opts]
*/
export async function insertInto(dir, spec, where, { token = null } = {}) {
- return prepAfter(dir, clipIdOf, sectionWrite(dir, "insert", token, (m) => insertIntoIn(m, spec, where)));
+ // EVERY insert its own undo point (no 2-minute coalescing, as Play's place): each is a press.
+ return prepAfter(dir, clipIdOf, sectionWrite(dir, "insert", token, (m) => insertIntoIn(m, spec, where), { snapshotEvery: 0 }));
}
// ---- sections, edited as sections (UI notes 2026-10-30, item 1) -----------