Archilyzer · Source

archilyzer

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

commit 0de24564f11fb54ef17c89c1d9bc07c71a6826d2
parent 18238e01c7616be3ebf8283f05316b3e4aa350be
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon,  2 Nov 2026 00:26:19 -0500

umtool claim groups: knobs.md "Claim groups" and the cli.md row (groups ls/import/set/move/label/promote/remove, order); cut-groups-fixture and group-proposals-fixture (e2e/fixtures/cut-editing-fixture.mjs) and cut-groups.spec.ts (the bars inside the sections, the claim edited in place, a group bar dragged onto a row, into another group's middle refused, a clip joining a run and leaving one, promote, ungroup, the strip's lighter seams); an import's summary numbers each file section's deck section as the cut is after a dropped section; the claim's inline edit saves once (Enter, or the blur when neither key decided); a group's seam on the strip is solid, the lower half, at 0.6 (a dashed line is a gap's join)

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

Diffstat:
Mumtool/components/projects/TimelineEditor.tsx | 14++++++++++++--
Mumtool/components/projects/review/ReelStrip.tsx | 6+++---
Mumtool/docs/cli.md | 1+
Mumtool/docs/knobs.md | 27+++++++++++++++++++++++++++
Aumtool/e2e/cut-groups.spec.ts | 168+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/e2e/fixtures/cut-editing-fixture.mjs | 32+++++++++++++++++++++++++++++---
Mumtool/lib/report/claimGroups.mjs | 3++-
7 files changed, 242 insertions(+), 9 deletions(-)

diff --git a/umtool/components/projects/TimelineEditor.tsx b/umtool/components/projects/TimelineEditor.tsx @@ -639,9 +639,12 @@ export function GroupBar({ group }: { group: GroupInfo }) { const [claim, setClaim] = useState(group.claim); const [promoting, setPromoting] = useState(false); const [title, setTitle] = useState(group.claim); + // Enter or Escape has decided: the blur that follows (the input leaving) does not save again. + const decided = useRef(false); if (!ctx) return null; const { busy, run, draggingGroup } = ctx; const save = () => { + decided.current = true; const c = claim.trim(); if (!c || c === group.claim) { setEditing(false); @@ -686,11 +689,14 @@ export function GroupBar({ group }: { group: GroupInfo }) { onKeyDown={(e) => { if (e.key === "Enter") save(); if (e.key === "Escape") { + decided.current = true; setEditing(false); setClaim(group.claim); } }} - onBlur={save} + onBlur={() => { + if (!decided.current) save(); + }} className="min-w-64 flex-1 rounded border border-[var(--color-sel)] bg-[var(--color-ink)] px-1.5 py-0.5 text-[11px] text-[var(--color-text)] outline-none" /> ) : ( @@ -698,7 +704,11 @@ export function GroupBar({ group }: { group: GroupInfo }) { type="button" data-group-claim={group.id} disabled={busy} - onClick={() => (setClaim(group.claim), setEditing(true))} + onClick={() => { + decided.current = false; + setClaim(group.claim); + setEditing(true); + }} title="the group's claim — click to edit it" className="min-w-0 truncate text-left text-[var(--color-text)] hover:underline" > diff --git a/umtool/components/projects/review/ReelStrip.tsx b/umtool/components/projects/review/ReelStrip.tsx @@ -462,7 +462,7 @@ export default function ReelStrip({ </span> ))} - {/* the sections' seams, in the new section's colour; a claim group's lighter: half the height, faint, dashed */} + {/* the sections' seams, in the new section's colour; a claim group's lighter: the lower half, fainter (solid: a dashed line is a gap's join) */} {seams.map((s) => { const it = items[s.index]; if (s.kind === "group") { @@ -473,8 +473,8 @@ export default function ReelStrip({ data-strip-group-seam={s.before} data-strip-group={s.group} title={s.label ? `claim group ${s.group}: ${s.label}` : `claim group ${s.group}`} - className="pointer-events-none absolute bottom-0 z-[2] h-1/2 w-0 border-l border-dashed opacity-45" - style={{ left: pct(it.from), borderColor: named ? colorOf(secs[s.index]) : "var(--text-2)" }} + className="pointer-events-none absolute bottom-0 z-[2] h-1/2 w-px opacity-60" + style={{ left: pct(it.from), background: named ? colorOf(secs[s.index]) : "var(--text-2)" }} /> ) : null; } diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -68,6 +68,7 @@ Inbox cannot disagree about what is wrong with one. | `voice-match <project> [--reference auto\|rulings\|recordings] [--reference-video <channel>/<id> …] [--reference-channel <slug> …] [--instances FILE] [--span phrase\|cut] [--pad S] [--likely X --unlikely Y] [--out FILE] [--dry] [--json] [--progress ndjson]` | who is speaking, per montage clip: a local speaker-similarity score (TitaNet-small) against the host's voice → `<project>/voice-match.json` (the Cut tab's **Score the voices**); `--instances` also scores a phrase scan's instances not in the manifest; `--dry` prints the plan ([report-video.md](report-video.md#who-is-speaking-the-voice-match)) | | `clips analyze <project> [--from <channel>/<id>] [--rescan] [--no-laughs] [--no-voices] [params] [--words FILE] [--progress ndjson] [--json]` · `clips propose <project> [--from <channel>/<id>] [--host N] [params] [--words FILE] [--dry] [--json]` · `clips show <project> [--json]` · `clips segments <project> [--json]` | the **clip finder** on a long recording ([report-video.md](report-video.md#highlights-the-clip-finder)): `analyze` runs the laugh scan (CED-mini) and a voice centroid per speaker on the recording's sound (cached in `<project>/scans/`), then proposes; `propose` proposes again from what is there (after a role flip, a param change, new words); `show` prints the speakers, laughs and the cut. Params `--target S` (600) `--laugh-min X` (0.25) `--merge-gap S` (6) `--setup-max S` (20) `--clip-max S` (75) and the scope `--scope FROM:TO` (either side may be empty; `all` clears it) or `--from S --to S` with numbers (a `--from` that is a `<channel>/<id>` names the recording), kept in `reactions.json`; `--host N` is your word on the host, kept. `--keep-cut` proposes without touching the cut (nothing moved, removed or added; the proposals are listed). **`--scope auto`** reads the narrated video auto-scope finds in the speaker turns (`--segment sN` names one, else the longest); `segments` lists them. A chat replay beside the recording (`live_chat.cues.json`) adds chat-burst moments and the log names the chat's lag. A channel on no site gets each clip linked to its platform page (`citeUrl`). A clip you edited, ruled, locked or added is never moved. **Exit 2** with no `diarization.json` (the message names the `archilyzer diarize backfill` to run) | | `timeline <project> [ls] [--json]` · `timeline <project> insert --after <id\|-> <channel>/<video>@<start>-<end> [--id ID] [--section N] [--lock] [--lock-end] [--title T] [--stream-title T] [--date YYYY-MM-DD] [--quote Q] [--cite S] [--cite-url U]` · `timeline <project> move <id> --to <index>` · `place <id>… --before <id\|-> [--section N]` · `remove <id>` · `reject <id> <why> [--note T]` · `wrong-speaker <id> [--correction T]` · `duplicate <id>` (`--at <index>` names one of an id's twins) · `post <json\|@file>` · `post-remove <id>` · `teaser <id> <patch-json\|@file>` · `undo` | the **structure** of the cut (the Cut tab's timeline, the On-screen section's teasers and posts) through the writers `POST /api/report/timeline` runs: `ls` prints index, id, type, video, start–end, date and title (`--json` adds the token and the posts); an insert's attribution is a second write through `window`'s writer, its date checked before anything is written; it is written in the manifest's own convention — under the deck `--title` is the deck's title (`onscreen.title`, `--stream-title` the stream's), a cut whose deck titles are dates gets `--date` as one in their format, and the clip takes the section of the clip it goes after (`--section N` names another) and, from the same recording, its deck title and its citation link. `place` is Play's drag on the reel strip: the entries land before that entry (`-`: the end), their clips joining section N (default: the section of the clip they land after), every other clip keeping its own and the markers following, an emptied section refused, each place its own undo point ([knobs.md](knobs.md#the-reel-strip-zoom-and-reorder)). A removal re-anchors what named the clip (a marker to the clip before, a chapter to the next in its section; a pair, a status reference or a deck claim dropped) and prints each `re-anchored:` line; `reject` rejects the clip for `<why>` — `not-matching` or `wrong-speaker` (fact errors: `incorrect`, the note its correction) or `irrelevant`, `repeats`, `weak`, `privacy`, `other` (`rejected`, never a correction) — and removes it, on record in `removed.json` with the reason and the note; `wrong-speaker <id>` is `reject <id> wrong-speaker`; `ls` marks a clip rejected but still in the cut (`[rejected — irrelevant]`) ([report-video.md](report-video.md#verdict--what-the-walk-said)). Every write snapshots the manifest first (`revisions/…-auto-before-<op>`), is refused only for what it breaks in the build's own words (**exit 1**), and on a generated manifest leaves an `edit` note ([report-video.md](report-video.md#structural-edits)) | +| `timeline <project> groups [ls] [--json]` · `groups import <file> [--skip-missing] [--drop-empty]` · `groups set <gid\|-> <id…> [--claim C]` · `groups move <gid> --to <index>` · `groups move <gid> --to after <gid>` · `groups label <gid> <claim…>` · `groups promote <gid> [--label L]` · `groups remove <gid>` · `order <file\|@file\|id…>` | **claim groups** (`groups` beside the timeline; the Cut tab's group bars): runs of clips inside one section making one claim — `ls` by section, each group's id, claim and clips (`--json` with the token); `import` a claim-groups file (`{sections: [{label, groups: [{claim, ids}]}]}`) in ONE write — the cut re-ordered to it, its groups the cut's, the markers following; a file section is the deck section of its name, else the one most of its clips are in; **exit 1** for an id the cut lacks (`--skip-missing`) or a section left with no clip (`--drop-empty` removes its marker); `set` (the clips already together), `label`, `remove` (ungroup), `move` the whole group (before the group at that index, or after one, in its section), `promote` (a level-2 marker at its first clip titled with its claim — the one group edit the render sees; `--label` when the claim is over 24); `order` the named entries in the places they hold (every clip keeping its section). A clip moved out of its group's run leaves it; moved alone into the middle of one, it joins. Every write an undo point (`undo`) ([knobs.md](knobs.md#claim-groups-runs-of-clips-that-make-one-claim)) | | `timeline <project> --take <take> [ls \| move <id> --to <index> \| remove <id> \| undo]` | a **take's** timeline (walk a take): the same structure checks, written into the take's patch, each write with an undo point of the take's own (`takes/<take>/revisions/`); `undo` takes the take's newest edit back, whichever writer made it | | `timeline <project> sections [--json]` · `section-move <id>… --to-section N [--start]` · `section-add --after <id> [--label L] [--color C]` · `section-boundary <marker> --after <id>` · `section-remove <marker>` · `section-set <marker> [--label L] [--color C]` · `split <id> <second>` · `flash-forward <id> <from>-<to> (--after <id\|-> \| --to-section N [--start]) [--move] [--quote Q] [--id ID]` | **sections as sections** (the deck's markers; the Cut tab's section bars and row menus): clips moved to a section with every marker following, a section opened, a boundary moved, relabelled, removed — no section emptied, no boundary crossed (**exit 1**) — and every take patch in step synced; **split** (each half's quote from the words, the second half's cite and QR at its second, a marker after the clip following its second half); **flash-forward** a tight copy of a span elsewhere with the clip's attribution and locks, as `repeatOf` the clip (`--move`: out of the clip) ([knobs.md](knobs.md#sections-split-and-flash-forward-editing-the-cut)) | | `scenes <project> <clip> [--black-min 0.05] [--threshold 8] [--pix-th 0.10] [--pad 30 \| --from S --to S] [--json]` | the picture's **scene cuts** (ffmpeg `scdet`, score ≥ threshold) and **black spans** (`blackdetect`) in the clip's fetched window, in SOURCE seconds — for `blur.from`/`blur.to` and trims ([knobs.md](knobs.md#a-clips-picture-blurred)). The window is the one the build would cut from (the project's `out/clips-raw`, the editor's `channels/<slug>/data/<id>/clips/`, a saved source); the extent ± `--pad` inside it is scanned. Nothing is fetched: **exit 1** with no window on disk (`fetch` first) | diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -261,6 +261,33 @@ named (`lib/report/sectionEdit.mjs`; `patchMarkers.mjs` syncSectionMarkers, besi out of the clip instead (it must sit at one of the clip's edges; the clip keeps the rest, its quote re-read); a span in the middle is refused — split there first. A claim, the marks and the assistant's record stay with the clip. +## Claim groups (runs of clips that make one claim) + +`groups: [{id, section, claim, ids}]` beside the timeline: a run of clips inside ONE section that makes one claim +("One of the ladies: 'I'm not a man'" is `ow1 a01 b01`). Its clips stand together (no other clip between them; a card +does not break the run), it never crosses a section boundary, a clip is in at most one group, and `section` is the +index of the deck section its clips are in (a subsection counts) — each refused in words by the structural writers' +own check (`lib/report/claimGroups.mjs` validateGroups). **The render never reads `groups`**: a cut with groups builds +exactly as the same cut without, until a group is **promoted**. A manifest without the key is never given one. + +Every structural edit keeps them: a clip **removed** leaves its group (an emptied group goes); a clip **moved out of +its run** is detached; a clip moved **alone into the middle** of a group's run (strictly between two of its clips) +**joins** that group, and one moved to a run's edge joins nothing; a **whole group** moved into another group's +middle is refused; a split's second half stays in the group; `section` follows the markers, and a boundary dragged +into a group is refused. Each write is an undo point (**Undo last edit**, `umtool timeline <p> undo`). + +| | In umtool | From a terminal | Route | +|---|---|---|---| +| the groups | the Cut tab: a group's bar inside its section (claim, clips), its clips indented under it; Play's reel strip: a group's seam, lighter than a section's (the lower half, fainter) | `umtool timeline <p> groups [ls] [--json]` | `GET /api/report/timeline` (`groups`) | +| import a claim-groups file | — | `umtool timeline <p> groups import <file> [--skip-missing] [--drop-empty]` — `{sections: [{label, groups: [{claim, ids}]}]}` in ONE write: the cut re-ordered to the file, its groups the cut's (the old ones replaced), the markers re-anchored; a file section is the deck section of its name (case and dashes aside), else the one most of its clips are in now; a clip it does not name stays in its section, after the file's; refused for an id the cut lacks (`--skip-missing` leaves it out) or a section left with no clip (`--drop-empty` removes its marker); `undo` puts the cut back exactly | — | +| make or replace a group | the propose-groups review's **Accept** | `umtool timeline <p> groups set <gid\|-> <id…> [--claim C]` (the clips already together, in one section; `-` a new `g<n>`) | `POST /api/report/timeline {op: "group-set", group, ids, claim?}` | +| the claim | a bar's claim: click it, type, Enter (Escape leaves it) | `umtool timeline <p> groups label <gid> <claim…>` (at most 160) | `{op: "group-label", group, claim}` | +| move a whole group | drag a bar's ⠿ onto a row: the group lands before it, in that row's section | `umtool timeline <p> groups move <gid> --to <index>` (its place among the groups after the move: before the group there) · `--to after <gid>` | `{op: "group-move", group, before}` · `{…, to}` · `{…, after}` | +| ungroup | a bar's **ungroup** (the clips stay) | `umtool timeline <p> groups remove <gid>` | `{op: "group-remove", group}` | +| promote: the group opens a subsection | a bar's **promote**: the title (the claim, at most 24), **Open subsection** | `umtool timeline <p> groups promote <gid> [--label L]` — a level-2 marker at its first clip (`render.chrome.deck.markers[]`, `level: 2`), the one group edit the render sees; refused for the cut's first clip, where a section already opens, and in §0 (the cut's first marker must be a section) | `{op: "group-promote", group, label?}` | +| the cut's order in one write | — | `umtool timeline <p> order <file\|@file\|id…>` — the named entries take the places the named entries hold, in that order (name them all for the whole order); every clip keeps its section (an order across a boundary is refused: `place`, `section-move`); a JSON list, `{order}`, a claim-groups file or ids by spaces, commas or lines; one undo point | `{op: "order", ids}` | +| propose groups | the Cut tab's **Propose groups**: the proposals, each **Accept** / **Reject** — never applied without a press | `pnpm ops report-draft --json '{"task":"propose-groups","project":"/abs/project/dir"}'` (routed by `settings.generation`, `propose-groups`) | `POST /api/report/group-proposals` | + ## The finale (the timeline in primary view) The cut's last clips with the footer's rail redrawn large across the top (every pip lit, the markers flagged, diff --git a/umtool/e2e/cut-groups.spec.ts b/umtool/e2e/cut-groups.spec.ts @@ -0,0 +1,168 @@ +import { test, expect, type Page } from "@playwright/test"; +import { copyFileSync, existsSync, readFileSync, rmSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// Claim groups on the Cut tab and on Play's reel strip (lane L4, +// lib/report/claimGroups.mjs): +// +// cut-groups-fixture the deck on; §0 c01 c02 c03 | §1 "Two" c04 … c08; +// g1 c01 c02, g2 c04 c05, g3 c06 c07 (c03, c08 in +// none). WRITES its manifest and revisions/; every test +// starts from the fixture's. +// +// The group bars inside the section bars, the claim edited in place, a group +// bar dragged onto a row (the whole group moves), a group dropped into +// another's middle refused in words, a clip dragged alone into a group's +// middle joining it, promote (a level-2 marker at its first clip), ungroup, +// Undo, and the strip's lighter group seams. +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const DIR = path.join(HERE, "..", ".e2e-song", "reports", "cut-groups-fixture"); +const MANIFEST = path.join(DIR, "video.manifest.json"); +const PROJECT = "reports/cut-groups-fixture"; + +type Group = { id: string; section: number; claim: string; ids: string[] }; +type Marker = { after: string; label?: string; level?: number }; +const read = () => JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: { id: string }[]; groups?: Group[]; render: { chrome: { deck: { markers?: Marker[] } } } }; +const order = () => read().timeline.map((e) => e.id).join(" "); +const groups = () => (read().groups ?? []).map((g) => `${g.id}@${g.section}:${g.ids.join(",")}`).join(" "); +const list = (page: Page) => + page.locator("[data-testid=timeline-list] > li").evaluateAll((els) => + els.map((e) => e.getAttribute("data-entry") ?? (e.hasAttribute("data-group-bar") ? `g:${e.getAttribute("data-group-bar")}` : `§${e.getAttribute("data-section-bar")}`)), + ); + +test.beforeAll(() => { + if (!existsSync(`${MANIFEST}.pristine`)) copyFileSync(MANIFEST, `${MANIFEST}.pristine`); +}); +test.beforeEach(() => { + test.setTimeout(90_000); + copyFileSync(`${MANIFEST}.pristine`, MANIFEST); + rmSync(path.join(DIR, "revisions"), { recursive: true, force: true }); +}); + +async function open(page: Page) { + await page.goto(urls.section(PROJECT, "timeline")); + await settled(page); +} +/** The list has its token and no write is in flight. */ +async function settled(page: Page) { + await expect(page.getByTestId("timeline-undo")).toBeEnabled({ timeout: 20_000 }); + await page.waitForLoadState("networkidle"); +} +const POLL = { timeout: 20_000 }; + +test("the Cut tab draws each group's bar inside its section, its clips under it", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await open(page); + await expect.poll(() => list(page)).toEqual(["§0", "g:g1", "c01", "c02", "c03", "§1", "g:g2", "c04", "c05", "g:g3", "c06", "c07", "c08"]); + const g2 = page.locator("li[data-group-bar='g2']"); + await expect(g2).toContainText("The second claim, said twice"); + await expect(g2).toContainText("2 clips"); + await expect(g2).toHaveAttribute("data-group-section", "1"); + await expect(page.locator("li[data-entry='c04'][data-kind]")).toHaveAttribute("data-group", "g2"); + await expect(page.locator("li[data-entry='c03'][data-kind]")).not.toHaveAttribute("data-group", /./); + // The bar is inside its section: indented past the section bar's edge, its clips past the bar's. + const x = async (sel: string) => (await page.locator(sel).boundingBox())!.x; + expect(await x("li[data-group-bar='g2']")).toBeGreaterThan(await x("li[data-section-bar='1']")); + expect(await x("li[data-entry='c04'][data-kind]")).toBeGreaterThan(await x("li[data-group-bar='g2']")); + await page.locator("li[data-section-bar='1']").scrollIntoViewIfNeeded(); + await page.screenshot({ path: test.info().outputPath("cut-groups-bars.png"), fullPage: true }); +}); + +test("a claim is edited in place: Enter saves it, Escape leaves it", async ({ page }) => { + await open(page); + await page.locator("[data-group-claim='g3']").click(); + const input = page.locator("[data-group-claim-input='g3']"); + await input.fill("A third, reworded"); + await input.press("Escape"); + await expect(page.locator("[data-group-claim='g3']")).toHaveText("A third"); + await page.locator("[data-group-claim='g3']").click(); + await input.fill("A third, reworded"); + await input.press("Enter"); + await expect.poll(() => read().groups?.find((g) => g.id === "g3")?.claim, POLL).toBe("A third, reworded"); + await expect(page.locator("[data-group-claim='g3']")).toHaveText("A third, reworded"); +}); + +test("a group bar dragged onto a row moves the whole group before it; into another group's middle is refused; Undo", async ({ page }) => { + await open(page); + await page.locator("[data-group-handle='g3']").dragTo(page.locator("li[data-entry='c04'][data-kind]")); + await expect.poll(order, POLL).toBe("c01 c02 c03 c06 c07 c04 c05 c08"); + expect(groups()).toBe("g1@0:c01,c02 g2@1:c04,c05 g3@1:c06,c07"); + // The boundary stays where it was: g3 is in §1, before g2. + expect(read().render.chrome.deck.markers?.map((m) => m.after)).toEqual(["c03"]); + await expect.poll(() => list(page), POLL).toEqual(["§0", "g:g1", "c01", "c02", "c03", "§1", "g:g3", "c06", "c07", "g:g2", "c04", "c05", "c08"]); + await settled(page); + + const before = readFileSync(MANIFEST, "utf8"); + await page.locator("[data-group-handle='g1']").dragTo(page.locator("li[data-entry='c05'][data-kind]")); + await expect(page.getByTestId("timeline-error")).toContainText("g2 (\"The second claim, said twice\")'s clips are not together"); + expect(readFileSync(MANIFEST, "utf8")).toBe(before); + + await page.getByTestId("timeline-undo").click(); + await expect.poll(order, POLL).toBe("c01 c02 c03 c04 c05 c06 c07 c08"); +}); + +test("a clip dragged alone into the middle of a group joins it; out of its run, it leaves", async ({ page }) => { + await open(page); + await page.locator("[data-drag-handle='c08']").dragTo(page.locator("li[data-entry='c05'][data-kind]")); + await expect.poll(order, POLL).toBe("c01 c02 c03 c04 c08 c05 c06 c07"); + await expect.poll(groups, POLL).toBe("g1@0:c01,c02 g2@1:c04,c08,c05 g3@1:c06,c07"); + await expect(page.locator("li[data-entry='c08'][data-kind]")).toHaveAttribute("data-group", "g2"); + await expect(page.locator("li[data-group-bar='g2']")).toContainText("3 clips"); + await settled(page); + // c06 onto c03's row: out of g3's run (detached), at g1's edge (it joins nothing). + await page.locator("[data-drag-handle='c06']").dragTo(page.locator("li[data-entry='c03'][data-kind]")); + await expect.poll(order, POLL).toBe("c01 c02 c06 c03 c04 c08 c05 c07"); + await expect.poll(groups, POLL).toBe("g1@0:c01,c02 g2@1:c04,c08,c05 g3@1:c07"); + await expect(page.locator("li[data-entry='c06'][data-kind]")).not.toHaveAttribute("data-group", /./); +}); + +test("promote: the group opens a subsection titled with its claim; ungroup leaves its clips where they are", async ({ page }) => { + await open(page); + await page.locator("[data-group-promote='g3']").click(); + await expect(page.locator("[data-group-promote-label='g3']")).toHaveValue("A third"); + await page.locator("[data-group-promote-go='g3']").click(); + await expect.poll(() => read().render.chrome.deck.markers, POLL).toEqual([ + { after: "c03", label: "Two", color: "#ff5a5a" }, + { after: "c05", label: "A third", level: 2 }, + ]); + await expect(page.locator("[data-group-subsection='g3']")).toBeVisible(); + await settled(page); + await expect(page.locator("li[data-section-bar='2']")).toHaveAttribute("data-section-level", "2"); + // A claim over a marker's 24 characters cannot be the title: the button waits for a shorter one. + await page.locator("[data-group-promote='g2']").click(); + await expect(page.locator("[data-group-promote-go='g2']")).toBeDisabled(); + await page.locator("[data-group-promote-label='g2']").fill("Said twice"); + await expect(page.locator("[data-group-promote-go='g2']")).toBeEnabled(); + await page.keyboard.press("Escape"); + + await page.locator("[data-group-ungroup='g1']").click(); + await expect.poll(groups, POLL).toBe("g2@1:c04,c05 g3@2:c06,c07"); + expect(order()).toBe("c01 c02 c03 c04 c05 c06 c07 c08"); + await expect(page.locator("li[data-group-bar='g1']")).toHaveCount(0); +}); + +test("Play's reel strip draws a group's seam lighter than a section's", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.playHref(PROJECT)); + await expect(page.locator("[data-play-cut]")).toHaveAttribute("data-play-state", "paused", { timeout: 30_000 }); + // §1 opens at c04 (a section's seam); g3 at c06 (a group's); g1 opens the cut and g2 a section: no seam of their own. + await expect(page.locator("[data-strip-seam='c04']")).toHaveCount(1); + await expect(page.locator("[data-strip-group-seam]")).toHaveCount(1); + const seam = page.locator("[data-strip-group-seam='c06']"); + await expect(seam).toHaveAttribute("data-strip-group", "g3"); + const look = (sel: string) => + page.locator(sel).evaluate((el) => { + const s = getComputedStyle(el); + return { opacity: Number(s.opacity), height: el.getBoundingClientRect().height }; + }); + const sec = await look("[data-strip-seam='c04']"); + const grp = await look("[data-strip-group-seam='c06']"); + expect(grp.opacity).toBeLessThan(sec.opacity); + expect(grp.height).toBeLessThan(sec.height); + await page.locator("[data-play-strip]").screenshot({ path: test.info().outputPath("play-group-seams.png") }); +}); diff --git a/umtool/e2e/fixtures/cut-editing-fixture.mjs b/umtool/e2e/fixtures/cut-editing-fixture.mjs @@ -18,6 +18,13 @@ // …", the Ember mistake), draft-11, and draft-12 whose // build lock names a live pid -- RENDERING // (take-housekeeping.spec.ts) +// cut-groups-fixture claim groups (lane L4): the deck on, eight clips on +// vid1 -- §0 c01 c02 c03 | §1 "Two" c04 … c08 -- and +// three groups: g1 c01 c02 (opens the cut), g2 c04 +// c05 (opens §1), g3 c06 c07; c03 and c08 in none +// (cut-groups.spec.ts) +// group-proposals-fixture cut-sections-fixture's cut, no groups: the +// propose-groups review (group-proposals.spec.ts) // // Synthetic, like every fixture. import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; @@ -36,8 +43,8 @@ const MARKERS = [ { after: "c04", label: "Three", color: "#4fbf6a" }, ]; -const sixClips = () => - ["c01", "c02", "c03", "c04", "c05", "c06"].map((id, i) => ({ +const sixClips = (ids = ["c01", "c02", "c03", "c04", "c05", "c06"]) => + ids.map((id, i) => ({ type: "clip", id, video: "vid1", @@ -109,5 +116,24 @@ export function makeCutEditingFixture({ reports, manifest, deckManifest, cachedW ]) write(path.join(takes, "takes", id), "take.json", json(take(id, order, label))); // pid 1 is always alive; this host, so the lock reads as a render running now. write(path.join(takes, "takes", "draft-12"), ".building.json", JSON.stringify({ pid: 1, host: os.hostname(), startedAt: "2026-10-31T23:00:00.000Z", take: "draft-12", from: "draft-11" }) + "\n"); - return { sections, flash, trailer, takes }; + // ---- claim groups (lane L4) ---------------------------------------------------- + const groups = path.join(reports, "cut-groups-fixture"); + const gm = deckManifest("cut-groups-fixture", "The Cut Groups Fixture", sixClips(["c01", "c02", "c03", "c04", "c05", "c06", "c07", "c08"]).map((e) => ({ ...e, start: e.start / 2, end: e.start / 2 + 0.9, cite: e.start / 2 }))); + gm.render.chrome.deck.markers = [{ after: "c03", label: "Two", color: "#ff5a5a" }]; + gm.groups = [ + { id: "g1", section: 0, claim: "The opening claim", ids: ["c01", "c02"] }, + { id: "g2", section: 1, claim: "The second claim, said twice", ids: ["c04", "c05"] }, + { id: "g3", section: 1, claim: "A third", ids: ["c06", "c07"] }, + ]; + write(groups, "video.manifest.json", json(gm)); + mkdirSync(path.join(groups, "out", "clips-raw"), { recursive: true }); + copyFileSync(cachedWindow, path.join(groups, "out", "clips-raw", "vid1_0.00-9.00.mp4")); + + const proposals = path.join(reports, "group-proposals-fixture"); + const pm = deckManifest("group-proposals-fixture", "The Group Proposals Fixture", sixClips()); + pm.render.chrome.deck.markers = MARKERS.map((m) => ({ ...m })); + write(proposals, "video.manifest.json", json(pm)); + mkdirSync(path.join(proposals, "out", "clips-raw"), { recursive: true }); + copyFileSync(cachedWindow, path.join(proposals, "out", "clips-raw", "vid1_0.00-9.00.mp4")); + return { sections, flash, trailer, takes, groups, proposals }; } diff --git a/umtool/lib/report/claimGroups.mjs b/umtool/lib/report/claimGroups.mjs @@ -697,7 +697,8 @@ export function importGroupsIn(m, doc, { skipMissing = false, dropEmpty = false return { groups: groups.length, replaced: old, - sections: live.map((s, k) => ({ label: s.label, section: mapped[k], groups: s.groups.length })), + // Each file section's deck section, numbered as the cut is now (after any section dropped). + sections: live.map((s, k) => ({ label: s.label, section: mapped[k] === null ? null : mapped[k] - empty.filter((d) => d.index < mapped[k]).length, groups: s.groups.length })), moved: before !== tl.map((e) => e?.id).join("\n"), missing, dropped: empty.map((d) => ({ index: d.index, label: d.label })),