Archilyzer · Source

archilyzer

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

commit decdd5fd9641f90c372a350f21f7d57c30ec6822
parent 8fb03d65dcd8df0dc7b69889b78c19dd0dccfc17
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun,  1 Nov 2026 11:57:05 -0500

umtool docs + e2e: Play and the bench as one app, the reel strip's zoom and reorder, the latest take, the stamp fix (knobs.md, clip-bench.md, report-video.md, cli.md); play-walk.spec and its fixture; phone-walk.spec's take Back keeps the take

- knobs.md: the bench zoom's "the strip has no zoom" sentence goes; "The working
  cut is the latest take", "Play and the clip bench are one app", and a new
  "The reel strip: zoom and reorder" under Play the cut; the table's rows.
- clip-bench.md: "From Play, in place"; Saving: the refused stamp's fixes.
- report-video.md, Use this take: the pick follows the latest take (auto-pick,
  --pin), and the gate it removes.
- cli.md: timeline place, takes pick --pin/--unpin, takes ls's first line,
  window --move-stamp/--clear-stamp/--move-mute/--clear-mute.
- e2e/play-walk.spec.ts on play-walk-fixture (two sections, two working takes):
  the Latest label and a take switched while playing; strip zoom (Ctrl+wheel at
  the pointer, z/f/F, Zoom to section, overview); drag across a seam into §0
  with the section said, the toast, Undo, a refused drop, Esc, Alt+→; Play →
  bench in place → n → Back (clip, second, take, history); Back/Forward and Play
  from here; the stamp fix on the bench.
- phone-walk.spec: Back from a take's bench now returns to the take.

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

Diffstat:
Mumtool/docs/cli.md | 7++++---
Mumtool/docs/clip-bench.md | 19+++++++++++++++++++
Mumtool/docs/knobs.md | 63++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
Mumtool/docs/report-video.md | 13+++++++++++++
Mumtool/e2e/fixtures/make-fixture.mjs | 24++++++++++++++++++++++++
Mumtool/e2e/phone-walk.spec.ts | 7++++---
Aumtool/e2e/play-walk.spec.ts | 267+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 389 insertions(+), 11 deletions(-)

diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -23,6 +23,7 @@ Inbox cannot disagree about what is wrong with one. | `inbox [--all] [--json]` | the decisions grouped and ranked by piece (`a:<site>/<report>`, `p:<project>`): Your call, Review, Blocking, Notes, Open, Ready to finish, Quiet — one card per piece and kind, and how many sit hidden on parked or done pieces (`--all` lists them). Every decision, songs' and articles' included; runs `bin/inbox.ts` through tsx | | `folders [--json]` · `kinds [--json]` | the tree, the registry | | `window <project> <clip> [--start S] [--end E] [--lock] [--lock-end] [--no-lock-end] [--note …]` | edit a window | +| `window <project> <clip> --start S --end E --move-stamp first\|nearest\|<s>` · `--clear-stamp` · `--move-mute nearest` · `--clear-mute` | a window edit refused because a stamp's second (`claim.at`, a mark's `at`) or the mute mark would fall outside it, with the fix in the same write: the stamp to the first second that plays, the nearest, or `<s>`, or its `at` cleared; the mute mark to the nearest second, or cleared (never inside a gap). A refused `window` names these flags ([clip-bench.md](clip-bench.md#saving)) | | `window <project> <clip> --verdict confirmed\|incorrect [--correction T]` · `window <project> <clip> --reject <why> [--note T]` | what the walk said: `--reject` is the walk's **Reject ▾** kept in place (`not-matching`/`wrong-speaker`: incorrect, the note its correction; `irrelevant`/`repeats`/`weak`/`privacy`/`other`: rejected, the note its `rejectNote`); `umtool timeline <p> reject` takes it out ([report-video.md](report-video.md#verdict--what-the-walk-said)) | | `window <project> <clip> --walk-note T` · `--star` / `--no-star` · `--repeat-of <clip>` | what the walk said that is not a verdict: an editorial note (not a correction) and the ★ favourite, a trailer candidate (`trailer <project> --candidates [--json]` lists them as beats); a deliberate repeat ([knobs.md](knobs.md#a-clip)) | | `links <project> [--json] [--fix]` | do the clip QRs open on their sites? `corpus.json` → the channel's manifest → `slugToPage` → the shard's record, one request at a time, shards from the cue cache; recorded in `out/links.json`, which `check` reads (`link-dead` blocking, `links-unverified`, `links-unchecked`); `--fix` rewrites a Twitch id the site serves as `v<id>`; **exit 1** when a link is dead ([knobs.md](knobs.md#do-the-qr-links-open)) | @@ -54,8 +55,8 @@ Inbox cannot disagree about what is wrong with one. | `take <project> --id <id> --label L [--patch F \| …] --draft` (`--no-render`) · `take <project> --id <id> [--full \| --at S --dur S]` · `take <project> --id <id> --rebuild [--full \| --at S --dur S]` · `take <project> --id <id> --promote [--anyway] [--json]` | a **draft** take: recorded with nothing rendered, to be walked first; a draft named with no patch flags is rendered from its stored (walked) patch, and `--rebuild` takes a window flag; **make it the cut**: the take's patch applied to the manifest now, one undo point (`revisions/…-auto-before-promote-take`), refused (exit 1) when its timeline would replace a cut that changed since, until `--anyway` ([report-video.md](report-video.md#walking-a-take-drafts-edits-into-the-take-and-making-it-the-cut)) | | `take … --priority` · `takes make … --priority` · `render-mode on [--for 90m] [--note T] [--json \| --print-token]` · `render-mode on [--for 90m] [--note T] [--print-token] -- <cmd …>` · `render-mode off [--force] [--json]` · `render-mode status [--json]` | **render mode**: a render the operator waits for gets the machine. `--priority` turns it on for the take's (or the batch's) lifetime — on at the start, off at the end, on a failure and on a signal; the Takes page's **Give renders the machine** is the same flag. While it is on, every other heavy job (e2e suites, `next build`s, the publish stages, other renders) waits at the heavy slot's door (`queue-lock: held for a render (…) — waiting`), the render runs on the floor 4000 MB and the cap 10240 MB, and the editor's transcription and download lanes are held through its ops (`lane`; only the ones not already held, and only those are released at off). `render-mode on` is a window (default 2h) for a chain of renders: every `umtool take` started in it renders in it, another command joins with the `RENDER_PRIORITY_TOKEN` it prints (`--print-token`: the token alone on stdout, the rest on stderr). **`on … -- <cmd …>` is the form for a script**: the command is spawned with the token in its environment, the hold is the command's pid, and it is released when the command exits — done, failed, or umtool signalled (the signal is passed on); umtool exits with the command's code, and inside a manual window the command joins it. A bare `on` in a script leaves the window behind (the chain trap). `off` ends it (a running take's hold only with `--force`, else it ends with the take); `status` says what holds it and releases a stale hold's lanes. A hold whose process is gone or whose window is over is no hold. Needs WORKER_TOKEN and the editor at ARCHILYZER_EDITOR_URL for the lanes; without them it still holds the door. **Exit 1** when it is already on, or a lane could not be released ([report-video.md](report-video.md#render-mode-giving-a-render-the-machine); WORKTREES.md, "Render mode") | | `takes make <project> [--recipe FILE] [--only ID,ID] [--force]` · `takes make <project> --all-styles [--group G] [--at S --dur S \| --full]` | a recipe's takes, one at a time (default `takes/recipe.json`); every montage style, one take each (Make all styles); **exit 1** if any failed | -| `takes styles [--json]` · `takes effects <project> [--json]` · `takes pick <project> <take> [--anyway] [--json]` | the montage styles; the overlay effects the cut offers (`render.chrome.fx` presets: the Takes page's **Effect** list); **Use this take** — refused (exit 1) when the project changed since the take was made, until `--anyway` | -| `takes ls <project> [--json]` · `takes relabel <project> <take> <label…>` · `takes supersede <project> <take> [--by <take>]` · `takes supersede <project> <take> --clear` · `takes delete <project> <take> [--dry-run] [--force]` | **take housekeeping** (the Takes page's ✎, **Mark superseded**, **Delete take**): the takes with picked / superseded / RENDERING; a label fixed in `take.json` (an undo point of the take's own); a take folded away as superseded (verdicts.json, nothing deleted); a take deleted. Relabel and delete are refused (**exit 1**) while the take renders or a live render is made from it ([knobs.md](knobs.md#takes-relabel-supersede-delete)) | +| `takes styles [--json]` · `takes effects <project> [--json]` · `takes pick <project> <take> [--anyway] [--pin \| --unpin] [--json]` | the montage styles; the overlay effects the cut offers (`render.chrome.fx` presets: the Takes page's **Effect** list); **Use this take** — refused (exit 1) when the project changed since the take was made, until `--anyway`; `--pin` keeps the pick when newer takes are built (each whole-cut take of the manifest is otherwise its group's pick once built), `--unpin` lets go ([report-video.md](report-video.md#takes-alternative-renders-judged-side-by-side)) | +| `takes ls <project> [--json]` · `takes relabel <project> <take> <label…>` · `takes supersede <project> <take> [--by <take>]` · `takes supersede <project> <take> --clear` · `takes delete <project> <take> [--dry-run] [--force]` | **take housekeeping** (the Takes page's ✎, **Mark superseded**, **Delete take**): first the working cut's line (`Latest: draft-22 · 28:03 · +N edits since`, and the edits in words; `--json`: `working`), then the takes with latest / picked (pinned) / superseded / RENDERING; a label fixed in `take.json` (an undo point of the take's own); a take folded away as superseded (verdicts.json, nothing deleted); a take deleted. Relabel and delete are refused (**exit 1**) while the take renders or a live render is made from it ([knobs.md](knobs.md#takes-relabel-supersede-delete)) | | `trailer <project> --take <t> (--beats FILE \| --beats-json JSON) [--intro] [--finale S] [--xfade 0.3] [--out NAME] [--dry-run] [--json]` | a **trailer cut from the take's finished master**: spans of the master's own frames (the deck shows the whole timeline), clip beats in source seconds mapped by the take's build records, crossfaded, the take's encode, in the heavy slot; writes `takes/<t>/out/<slug>.trailer.mp4` and `.trailer.json`; **exit 1** on a refusal ([report-video.md](report-video.md#trailer-from-the-master)) | | `trailer-beats <project> [ls] [--json]` · `add <clip> [<from>-<to>] [--at N] [--label L]` · `add-raw <at> <dur>` · `set <n> <from>-<to>` · `remove <n>` · `move <n> --to <m>` · `order` · `limit <s\|m:ss\|x\|instagram\|shorts\|tiktok>` · `xfade <s>` · `intro on\|off` · `candidates [--add]` | **the trailer's beats** (`promo/trailer-beats.json`, the Trailer page's file, what `trailer --beats` reads): each beat's length, the running length against the platform limit (X 2:20 by default), beats outside their clip's window, the cut's order, the walk's ★ clips ([knobs.md](knobs.md#the-trailers-beats)) | | `rulings <project> [--json]` · `rulings <project> import [--dry-run] [--json]` · `rulings <project> set <clip\|key> keep\|cut\|not-him\|read-aloud [--reason R] [--match M]` · `rulings <project> clear <clip\|key>` | a montage's **clip rulings** (`montage-rulings.json`, the clip deck's): each clip and its ruling and the next render's kept clips; the earlier rulings in the seed's `edits.json`, once; one ruling set or cleared. A render leaves out every clip ruled cut, not-him or read-aloud ([report-video.md](report-video.md#ruling-the-clips)) | @@ -66,7 +67,7 @@ Inbox cannot disagree about what is wrong with one. | `phrases "<phrase>" ["<phrase>" …] --channels a,b [--prefer c] [--exclude RE] [--words \| --regex] [--samples N] [--no-cache] [--json \| --full]` | the phrase finder's search ([tools.md](tools.md#the-phrase-finder-toolsphrases)): every phrase in one pass, each with its count once folded, by year, the preferred channel's share or Rumble's, speaker changes, sample contexts. Plain words become a tolerant pattern unless the phrase holds a regular expression's characters. `--json` the numbers, `--full` every instance; `--spec FILE --out FILE --progress` is the page's job form. **Exit 1** on a bad phrase | | `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>` · `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. 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> [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> --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/clip-bench.md b/umtool/docs/clip-bench.md @@ -246,6 +246,15 @@ round trips to re-find your place. The Cut tab starts the walk: one because the per-row links are the right control for "go to that one" and the wrong one for "start". +### From Play, in place + +Opened from Play the cut (**Edit this clip**, E) the bench opens IN Play's page, Play kept as it was under +it: the address is the bench's (`?from=play&at&take&order=cut`), Back and Forward step between the two, +and **‹ Back to the cut** returns to the same clip, second and take without Play starting over +([knobs.md](knobs.md#play-the-cut-the-whole-cut-or-a-take-with-no-render)). There `p` / `n` and the +header's links walk the CUT's order — the reel strip's neighbours, judged or not ("40 of 127") — not the +walk's. Opened on its own, the bench's head has **▶ Play the cut from here**. + ### What the walk skips The walk visits the clips that still **need judgement** and are **fetched**, in @@ -495,6 +504,16 @@ header in the same sitting, and two writers would be two chances to lose the other's write. In the component this is why a window save no longer resets the attribution drafts and an attribution save no longer discards nudged edges. +**A save the writer refuses because a stamp's second would fall outside the new window** — `claim.at` (a +mark's `at` on a clip with several), or the mute mark — keeps your edit and offers the fix beside the +message: **Move the stamp to 5862.94 (first second)** — the first second that plays — or **(nearest)**, each +with the words it would land on, and **Clear the stamp's second (claim.at)** (the mute mark: move to the +nearest, or clear). Each is the same save again with the fix (`markFix` first | nearest | a second | clear, +`muteFix` nearest | clear), in one write; a second never lands inside a gap. The terminal's: `umtool window +<p> <clip> --start … --end … --move-stamp first|nearest|<s>` / `--clear-stamp` / `--move-mute nearest` / +`--clear-mute`, and a refused `umtool window` names those flags. The cite and its QR already follow a moved +edge ([knobs.md](knobs.md#the-cite-follows-the-edge)). + See [report-video.md](report-video.md) for the four rules the writer keeps (2 dp, the CLI's formatting, tmp+rename under a lock, an mtime token). A stale token is a **409 with both values**, never a silent overwrite: the other writer is usually diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -127,8 +127,8 @@ selection); keys `z` in, `Z` out, `f` fit, `F` to the selection. Zoomed, the whe drag it to pan, click elsewhere to centre, pinch it with two fingers. A ruler of round ticks sits over a zoomed waveform; at 20 s across or closer it also draws the measured silences (the cut-points route's, the build's own) and the pauses between words (when the project's words file is this recording's), so a gap's edge goes between two words. -At fit — the default, on every clip — the waveform is what it always was. (Play the cut's reel strip is a scrubber; -nothing is trimmed there, so it has no zoom.) +At fit — the default, on every clip — the waveform is what it always was. The same zoom is on Play the cut's reel strip, +over cut seconds ([below](#the-reel-strip-zoom-and-reorder)). ## A clip's picture, blurred @@ -348,7 +348,8 @@ browser. **Render this clip** is the pixel-true check of all of that but the joi `/projects/<p>/play` — the Cut tab's **Play the cut**, or a take's **Play** on the takes page (`/projects/<p>/play?take=<id>`) — plays the WHOLE cut in this browser in its final look, for iterating without a -render: every entry in timeline order, each clip from its cached source window (the bench's media route, an +render. **With no `take` it plays the LATEST take** (below), the look of the next draft; `?cut=1` plays the +manifest alone. It plays every entry in timeline order, each clip from its cached source window (the bench's media route, an excerpt of a long recording), the live preview's chrome over it on ONE cut clock — the rail's pip, the tally, the stamps, the markers and the finale advance as in the render, and every module that declares **`play`** in the module contract — the chapter cards over the first seconds of the clip each opens, the then-and-now pair strip, the @@ -358,6 +359,19 @@ own patch (a take's own `timeline` included), from `takes/<id>/take.json` or — names it; its pages are composed under `takes/<id>/out/`, never over the project's. `render.blur: "off"` on the take plays its blurred clips as recorded. +**The working cut is the latest take** (operator, 1 Nov 2026: "most of the time I'll only really be working on the +latest cut/draft rather than the picked one"). The head names it as prominently as a take — **Latest: draft-22 · +28:03 · +3 edits since** (hover lists them: `aw3 removed`, `mc1 moved`, `ss1 gaps`) — the newest WHOLE-CUT take made +from the project (`take.json` window `full`, rendered, not quick, no montage style, no `timeline` of its own: a +*working* take, `lib/report/takes.mjs` isWorkingTake), and the edits are the project's manifest against the manifest +that take rendered (`0` when the manifest's hash is the take's `baseHash`; `lib/report/workingCut.mjs`). The other +takes are a switch beside it (pills, the rest behind **N more**), **manifest only** the bare manifest; the pick (Use +this take, below) is named small only when it is not the latest. Every edit made in Play — a reorder, Reject, the +bench — writes the PROJECT's manifest, which a working take plays as it is now, so the latest take shows it at once; +a take with its own timeline says so and offers no structural edit (its walk edits it). `umtool takes ls <p>` prints +the same line first and marks `latest`; the Takes page shows it and a **latest** badge. **Re-render the take** (the +clip editor and the clip deck) remakes the latest take — it used to need a pick when there were two whole-cut takes. + **A rejected clip is skipped.** A clip the walk rejected — a fact error (`incorrect`: doesn't match, wrong speaker; or a legacy `correction` and no verdict) or a cut reason (`rejected`: irrelevant, repeats, weak, privacy, other) — is left out of what Play plays — its neighbours meet at the seam — and the reel strip shows it struck through where it @@ -374,6 +388,17 @@ in `removed.json` — or **Reject, keep in place** writes the verdict only, for it is the same flow with its reason preset ([report-video.md](report-video.md#verdict--what-the-walk-said)). Not on a take. +**Play and the clip bench are one app.** **Edit this clip** (E) opens the bench IN PLACE: Play is hidden and paused +but never unmounted, so its composed deck, decoded sound, measured edges, the strip's zoom and the take stay as they +were (`components/projects/cutApp/CutApp.tsx`; the bench's data is `GET /api/report/bench`, the same function its own +page renders from, `lib/report/benchData.ts`). The address moves by `history.pushState` to the bench's +(`/clip/<id>?from=play&at&take&order=cut`): the browser's Back and Forward step between the two, a reload or a link is +the bench's own page, and **‹ Back to the cut** goes back the entries it pushed (no second Play in the history). Inside +Play the bench walks the CUT's order (`order=cut`: p / n are the reel strip's neighbours, judged or not, `40 of 127`; +the neighbours are read ahead). Back on Play the view is read again in place (`GET /api/report/play-view`), the deck +is composed again only when the manifest's token moved, and Play stands on the clip it left by its id and source +second. A bench opened on its own (the Cut tab's Walk, a link) has **▶ Play the cut from here** in its head. + **Play keeps its place in its URL** (`?clip=&at=&t=` and `rejected=1` — an old `incorrect=1` still works — replaced at most once a second, never a history entry of its own), so **Edit this clip** (E) and then the browser's **Back** — or the bench's **‹ Back to the cut** — lands paused on the same second of the same clip. When an edit moved that clip in the cut, Play resumes by @@ -389,12 +414,40 @@ puts the walked take over the project's manifest with one undo | | In umtool | Keys | |---|---|---| | play / pause, back (tap again: further), pause, play (tap again: 1.5×, 2×, …; the voice keeps its pitch), ±5 s, previous / next clip | the transport under the picture, the speed menu | Space, J K L, ← →, P N | -| the whole cut at a glance: a cell per entry as wide as it plays, tinted by its recording's date (older is darker), hatched when its media is not fetched; the sections' seams with their first date; the counter (the deck's tally) as a staircase with its total at the end and at the playhead; the notes as pins | the **reel strip** under the picture: click or drag to scrub, a cell's Enter jumps to its start, hover names it | — | +| the whole cut at a glance: a cell per entry as wide as it plays, tinted by its recording's date (older is darker), hatched when its media is not fetched; the sections' seams with their first date and their name, in the section's colour; the counter (the deck's tally) as a staircase with its total at the end and at the playhead; the notes as pins | the **reel strip** under the picture: click or drag a cell's body to scrub, a cell's Enter jumps to its start, hover names it | — | +| closer: zoom at the pointer, in, out, fit, the clip on screen, its section; pan; the whole cut under it | the strip's **zoom** row (− + Fit, **Zoom to clip**, **Zoom to section**), Ctrl/⌘ + wheel, the wheel while zoomed, the overview | z Z f F | +| move a clip: drag it to another place, into another section | drag a cell by its top band (⠿, or with Alt held); **Move <clip> to…** (a section's start or end); an **Undo** after | Alt+← → on a focused cell | | what the clip on screen says, its spoken line lit as it plays, and what comes next | **Now**, under the strip | — | | a note at the playhead: the cut second, the clip on screen and its source second, the take, and what it asks for (Trim, Cut, Move, Fact, Look, Other: the anchor's `ask`); playback pauses while you write (**Pause while I write**, on by default) and goes on when it is saved | **Note at 09:44**, the kind chips, **Save note**; the list in reel order (Open / All / Resolved); a note's timecode seeks there | M, Alt+T C M F L O, Enter, Esc, [ ] | | the assistant on a note (its reply lands on the note, its edits wait for **Apply all**), or on every open note at once | a note's **Send to the assistant**; **Send N open notes to the assistant** | — | | every key | **?** | ? | +### The reel strip: zoom and reorder + +**Zoom** is the bench waveform's ([above](#the-bench-waveforms-zoom): `useWaveZoom`, `ZoomControls`, `ZoomOverview`, +`benchZoom.mjs`), over cut seconds: Ctrl/⌘ + wheel zooms at the pointer (the second under it stays), − / + / **Fit** +/ **Zoom to clip** / **Zoom to section**, keys `z` in at the playhead, `Z` out, `f` fit, `F` the clip on screen. +Zoomed, the wheel pans, an overview under the strip shows the whole cut in its sections' colours with what is shown +(drag it, click to centre), a ruler counts round ticks, each cell shows its id (and date when it has room), each seam +its section (`27 Feb 2025 §3 Leaves it open`, only the labels that fit, so twenty sections read at zoom), and while +playing the view pages on with the playhead. + +**Reorder**: grab a cell by its top band — the grip, ⠿, in the section's colour — or anywhere on it with Alt held, +and drag; a press on a cell's body still scrubs. An insertion bar in the drop's section's colour and the drop's words +follow the pointer (`c04 → §0 (the opening), after c01`): the left half of a cell lands before it, the right half +after it, so a seam's two sides are the end of one section and the start of the next — the same slot, the section +said. A zoomed strip pans at its edges while you drag, Ctrl/⌘ + wheel zooms mid-drag, Esc cancels. A drop that would +leave a section with no clip is refused in words before anything is written. The drop is ONE write — the **place** +op (`POST /api/report/timeline {op: "place", ids, before, section}`, `lib/report/sectionEdit.mjs` placeIn): the clip +lands before an entry and joins the section, every other clip keeps its own, the markers are re-anchored so that +holds (a plain `move` took the boundary with the clip a marker followed), take patches in step are synced, and each +drop is its own undo point. **Undo** (the toast) takes back exactly that drop (the structural undo with the drop's +token: an edit made since is never undone by mistake). The playhead stays on the clip it was on; until the deck is +composed again the estimate's segments play the new order. On the keyboard: Alt+← / Alt+→ on a focused cell moves it +one place (at a seam it first changes section, then moves); **Move <clip> to…** puts the clip on screen at a +section's start or end (`section-move`). The terminal's: `umtool timeline <p> place <id…> --before <id|-> [--section +N]` and `section-move`. A take with its own timeline is not reordered here (`umtool timeline <p> --take <t> move`). + **It plays the render's cut, edges first.** The build snaps every clip edge to the nearest silence within `render.snapWindow` (on the Huck cut, starts up to 1.0 s earlier and ends up to 1.0 s later than the manifest's), so Play asks where it will cut — `GET /api/report/cut-points?project=<p>[&take=<t>]`, the build's own source resolution, @@ -423,7 +476,7 @@ cards, teasers and images are **placeholders** with their heading for their seco drawn as a dissolve; the limiter after the loudness gain is not applied; a montage's phrase cuts are snapped as plain cuts. A clip whose source window is not on disk is a named placeholder that plays on (silent) — fetch it from the Cut tab. **Reload the cut** reads an edit made elsewhere, and the edges are measured again for what moved. **Edit this clip** (E) and the bench's **Back to the cut** come back -to the same clip by its id and then by the SOURCE second you left (`?clip=&at=`, the offset turned into a source +to the same clip — and the same take — by its id and then by the SOURCE second you left (`?clip=&at=`, the offset turned into a source second once the render's edges are in), so an edit that moves the clip's start does not move you off the word. The bench draws the render's cut over its waveform and, on a phone, on the edge strip (a faint line, and its offset under each edge). diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -1125,6 +1125,19 @@ the one the take was made from (its `baseHash`), the card says **The project cha take was made** and the pick waits for **Use anyway**. A take that does not record its base asks the same. +**The pick follows the latest take, and nothing needs one** (operator, 1 Nov 2026). The working cut is the +project's manifest and its name the newest whole-cut take made from it (`lib/report/workingCut.mjs`: +**Latest: draft-22 · +N edits since** in Play, on the Takes page and first in `umtool takes ls`); Play, +the bench and **Re-render the take** default to it. Use this take is for going BACK to an older take. +When a take is built, a *working* take (window `full`, rendered, not quick, no montage style, no +`timeline` of its own — `takes.mjs` isWorkingTake) becomes its group's pick automatically, a mark in +verdicts.json and nothing copied (the project's manifest is what it was made from), so whatever still +reads `picked` — the pruner's keep list, the Takes page's badge — follows the latest draft, an agent's +take as much as the operator's. A window preview, a draft, a quick render or a style take never does. +`umtool takes pick <p> <take> --pin` (the route's `pin: true`) pins a pick: newer takes are then not +auto-picked over it (`--unpin`, or picking another, lets go). The gate this removes: with two whole-cut +takes and none picked, Re-render the take had no target and the only way on was to pick one. + ### Render mode: giving a render the machine diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs @@ -19,6 +19,7 @@ import { symlinkSync, } from "node:fs"; import { spawnSync } from "node:child_process"; +import { createHash } from "node:crypto"; import path from "node:path"; import { SONG_DATA } from "../../song/paths.mjs"; import { songCapabilities } from "./song-capabilities.mjs"; @@ -1919,6 +1920,29 @@ makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out // Reject ▾ in Play the cut (play-modules.spec.ts), which WRITES (removes c02 as irrelevant, undoes; rejects // it in place as weak, undoes): its own copy too. makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), name: "play-reject-fixture", title: "The Play Reject Fixture" }); +// Play and the bench as one app (play-walk.spec.ts), which WRITES (drops on the reel strip, +// undone; a stamp moved on the bench): play-cut-fixture's cut on vid1 with two sections -- +// §0 c01 c02 | §1 "Two" k01 c03 c04 -- and two whole-cut takes made from it: draft-1 (the +// latest: a retitle, made from the manifest as written, so "no edits since") and draft-0 (older). +{ + const { dir: pwDir } = makePlayCutFixture({ + reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), + name: "play-walk-fixture", title: "The Play Walk Fixture", video: "vid1", + chrome: { deck: { markers: [{ after: "c02", label: "Two", color: "#ff8fb1" }] } }, + }); + rmSync(path.join(pwDir, "takes"), { recursive: true, force: true }); + const text = readFileSync(path.join(pwDir, "video.manifest.json"), "utf8"); + const baseHash = createHash("sha256").update(text).digest("hex"); + const made = (id, order, builtAt, label) => { + mkdirSync(path.join(pwDir, "takes", id), { recursive: true }); + const patch = { title: `The Play Walk Fixture, ${label}` }; + writeFileSync(path.join(pwDir, "takes", id, "take.json"), JSON.stringify({ id, group: "takes", order, label, kind: "different", preview: "preview.mp4", window: "full", style: null, patch, seconds: 9.97, builtAt, baseHash }, null, 2) + "\n"); + writeFileSync(path.join(pwDir, "takes", id, "video.manifest.json"), JSON.stringify({ ...JSON.parse(text), ...patch }, null, 2) + "\n"); + }; + made("draft-0", 1, "2026-10-30T10:00:00.000Z", "draft 0"); + made("draft-1", 2, "2026-11-01T10:00:00.000Z", "draft 1"); + writeFileSync(path.join(pwDir, "takes", "verdicts.json"), JSON.stringify({ "draft-0": { verdict: null, note: "", at: "2026-10-30T11:00:00.000Z", picked: true } }, null, 2) + "\n"); +} // TWO MORE cached windows for vid1, and they are the regression rather than // decoration. diff --git a/umtool/e2e/phone-walk.spec.ts b/umtool/e2e/phone-walk.spec.ts @@ -295,7 +295,8 @@ test("Play → Edit this clip → move an edge → Back: the new bounds are what await page.keyboard.press("k"); // A take: the edit goes to the project's cut, and the bench says so; Back - // plays the PROJECT's cut (the take's render does not change). + // returns to Play as it was -- the take still playing (Play and the bench + // are one app: Play was never unmounted). await page.goto(urls.playHref(PLAY, { take: "short" })); await expect(root).toHaveAttribute("data-play-item", "c04"); // E (the key is live once hydrated, which the first render cannot show). @@ -305,8 +306,8 @@ test("Play → Edit this clip → move an edge → Back: the new bounds are what }).toPass({ timeout: 15_000 }); await expect(page.locator('[data-back-take="short"]')).toContainText("not take short"); await page.locator("[data-back-to-play]").click(); - await expect(page).toHaveURL(/\/play\?clip=c04$/, { timeout: 20_000 }); - await expect(root).toHaveAttribute("data-play-cut", ""); + await expect(page).toHaveURL(/\/play\?take=short&clip=c04/, { timeout: 20_000 }); + await expect(root).toHaveAttribute("data-play-cut", "short"); await expect(root).toHaveAttribute("data-play-item", "c04"); }); diff --git a/umtool/e2e/play-walk.spec.ts b/umtool/e2e/play-walk.spec.ts @@ -0,0 +1,267 @@ +import { test, expect, type Page } from "@playwright/test"; +import { readFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// Play and the clip bench as ONE app, the reel strip's zoom and drag, the +// working cut's name (operator, 1 Nov 2026; umtool/docs/knobs.md, "Play the +// cut"; clip-bench.md, "Walking the cut"). +// +// play-walk-fixture (WRITABLE, make-fixture.mjs): play-cut-fixture's cut on +// vid1 with two sections -- §0 c01 c02 | §1 "Two" k01 c03 c04 -- and two +// whole-cut takes made from the manifest as written: draft-1 (the latest) +// and draft-0 (older, picked). Every write here is undone before the test +// ends, except the stamp moved last. +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const FIXTURE = path.join(HERE, "..", ".e2e-song"); +const P = "reports/play-walk-fixture"; +const DIR = path.join(FIXTURE, "reports", "play-walk-fixture"); + +type Entry = { id: string; type: string; start?: number; end?: number; claim?: { at?: number } }; +const manifest = () => JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")) as { timeline: Entry[]; render: { chrome: { deck: { markers: { after: string }[] } } } }; +const order = () => manifest().timeline.map((e) => e.id).join(" "); +const afters = () => manifest().render.chrome.deck.markers.map((m) => m.after).join(" "); + +const root = (page: Page) => page.locator("[data-play-cut]"); +const tNow = async (page: Page) => Number(await root(page).getAttribute("data-play-t")); +const ready = async (page: Page) => { + await expect(root(page)).toHaveAttribute("data-play-state", "paused"); + await expect(root(page)).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 }); +}; +/** The cell's grip band, and a point `frac` of the way across a cell. */ +const cellAt = async (page: Page, id: string, frac = 0.5) => { + const b = (await page.locator(`[data-play-row="${id}"]`).boundingBox())!; + return { x: b.x + b.width * frac, grip: b.y + 6, body: b.y + b.height - 8 }; +}; + +test.beforeEach(() => { + test.setTimeout(120_000); +}); + +test("the working cut is the latest take: named, played by default, switched without the URL write cancelling it", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.playHref(P)); + await ready(page); + await expect(page.locator("[data-play-working]")).toHaveAttribute("data-play-working", "draft-1"); + await expect(page.locator("[data-play-working]")).toContainText("Latest"); + await expect(page.locator("[data-play-working]")).toContainText("no edits since"); + await expect(root(page)).toHaveAttribute("data-play-cut", "draft-1"); + await expect(page.locator("[data-play-take-defaulted]")).toHaveCount(1); + // The pick (draft-0, from before) is said small, beside: secondary. + await expect(page.locator('[data-play-picked="draft-0"]')).toContainText("picked: draft-0"); + await page.screenshot({ path: test.info().outputPath("play-latest-label.png") }); + + // A take link clicked WHILE PLAYING: Play's once-a-second URL write used to cancel it. + await page.locator("[data-play-toggle]").click(); + await expect.poll(() => tNow(page), { timeout: 20_000 }).toBeGreaterThan(0.3); + await page.locator('[data-play-take-link="draft-0"]').click(); + await expect(root(page)).toHaveAttribute("data-play-cut", "draft-0", { timeout: 20_000 }); + await expect(page).toHaveURL(/take=draft-0/); + await expect(page.locator("[data-play-working]")).toContainText("Latest is"); + // The manifest alone, and back to the latest. + await page.locator('[data-play-take-link=""]').click(); + await expect(root(page)).toHaveAttribute("data-play-cut", "", { timeout: 20_000 }); + await expect(page).toHaveURL(/cut=1/); + await page.locator("[data-play-latest-link]").click(); + await expect(root(page)).toHaveAttribute("data-play-cut", "draft-1", { timeout: 20_000 }); +}); + +test("the reel strip zooms like the bench waveform: at the pointer, keys, to the clip and the section, an overview", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.playHref(P)); + await ready(page); + const strip = page.locator("[data-play-strip]"); + await expect(strip).toHaveAttribute("data-strip-zoom", "fit"); + await expect(page.locator("[data-strip-overview]")).toHaveCount(0); + // Ctrl + wheel at c03: zoomed, and c03 is still under the pointer. + const c = await cellAt(page, "c03"); + await page.mouse.move(c.x, c.body); + await page.keyboard.down("Control"); + await page.mouse.wheel(0, -400); + await page.keyboard.up("Control"); + await expect(strip).not.toHaveAttribute("data-strip-zoom", "fit"); + const c2 = await cellAt(page, "c03"); + const b3 = (await page.locator('[data-play-row="c03"]').boundingBox())!; + expect(c.x).toBeGreaterThanOrEqual(b3.x - 2); + expect(c.x).toBeLessThanOrEqual(b3.x + b3.width + 2); + expect(b3.width).toBeGreaterThan(0); + expect(c2.x).toBeGreaterThan(0); + // The overview shows the whole cut under a zoomed strip; f fits again. + await expect(page.locator("[data-strip-overview] [data-zoom-overview]")).toBeVisible(); + await page.locator("body").press("f"); + await expect(strip).toHaveAttribute("data-strip-zoom", "fit"); + // z zooms in at the playhead; Zoom to section shows §1 (k01 c03 c04) and not c01. + await page.locator('[data-play-row="c03"]').press("Enter"); + await page.locator("body").press("z"); + await expect(strip).not.toHaveAttribute("data-strip-zoom", "fit"); + await page.locator("body").press("f"); + await page.locator("[data-zoom-section]").click(); + await expect(page.locator('[data-play-row="c01"]')).toHaveCount(0); + await expect(page.locator('[data-play-row="c04"]')).toHaveCount(1); + // Zoomed, a cell names its section; the seam names it above. + await expect(page.locator('[data-play-row="c03"]')).toHaveAttribute("aria-label", /§1 Two/); + await page.screenshot({ path: test.info().outputPath("strip-zoomed.png") }); + // F: the clip on screen fills the strip. + await page.locator("body").press("F"); + const z = (await strip.getAttribute("data-strip-zoom"))!.split("-").map(Number); + expect(z[1] - z[0]).toBeLessThan(4); + await page.locator("body").press("f"); +}); + +test("drag to reorder: across a seam into §0, the drop's section said, one write, Undo; a drop that empties a section is refused; Alt+→", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + const before = order(); + expect(before).toBe("c01 c02 k01 c03 c04"); + expect(afters()).toBe("c02"); + await page.goto(urls.playHref(P)); + await ready(page); + // The playhead on c02: it stays on c02 through the move. + await page.locator('[data-play-row="c02"]').press("Enter"); + await expect(root(page)).toHaveAttribute("data-play-item", "c02"); + + // Grab c04 by its grip and drag it onto the right half of c01: after c01, in §0. + const from = await cellAt(page, "c04"); + const to = await cellAt(page, "c01", 0.75); + await page.mouse.move(from.x, from.grip); + await page.mouse.down(); + await page.mouse.move(from.x - 10, from.grip, { steps: 2 }); + await page.mouse.move(to.x, to.body, { steps: 8 }); + await expect(page.locator("[data-strip-ghost]")).toHaveAttribute("data-strip-ghost", "c04"); + await expect(page.locator("[data-strip-drop]")).toHaveAttribute("data-strip-drop-section", "0"); + await expect(page.locator("[data-strip-drop]")).toContainText("c04 → §0 (the opening), after c01"); + await expect(page.locator("[data-strip-insert]")).toHaveAttribute("data-strip-insert", "c02"); + await page.screenshot({ path: test.info().outputPath("strip-mid-drag.png") }); + await page.mouse.up(); + await expect(page.locator('[data-strip-toast="done"]')).toContainText("Moved: c04 → §0 (the opening), after c01"); + await expect.poll(order).toBe("c01 c04 c02 k01 c03"); + expect(afters()).toBe("c02"); + await expect(page.locator('[data-play-row="c04"]')).toHaveAttribute("data-play-row-section", "0", { timeout: 20_000 }); + await expect(root(page)).toHaveAttribute("data-play-item", "c02"); + // The working cut's name counts the edit. + await expect(page.locator("[data-play-working]")).toContainText("+1 edit since", { timeout: 20_000 }); + await page.screenshot({ path: test.info().outputPath("strip-undo-toast.png") }); + + // §1 is down to c03: dragging it into §0 would leave §1 with no clip -- refused before any write. + const c3 = await cellAt(page, "c03"); + const c1 = await cellAt(page, "c01", 0.25); + await page.mouse.move(c3.x, c3.grip); + await page.mouse.down(); + await page.mouse.move(c3.x - 10, c3.grip, { steps: 2 }); + await page.mouse.move(c1.x, c1.body, { steps: 8 }); + await expect(page.locator("[data-strip-drop]")).toHaveAttribute("data-strip-drop-refused", ""); + await page.mouse.up(); + await expect(page.locator("[data-strip-refusal]")).toContainText("§1 Two would have no clip left"); + expect(order()).toBe("c01 c04 c02 k01 c03"); + + // Undo: exactly the drop. + await page.locator("[data-strip-undo]").click(); + await expect(page.locator('[data-strip-toast="undone"]')).toBeVisible(); + await expect.poll(order).toBe(before); + await expect(page.locator('[data-play-row="c04"]')).toHaveAttribute("data-play-row-section", "1", { timeout: 20_000 }); + + // Esc cancels a drag: nothing written. + const f4 = await cellAt(page, "c04"); + await page.mouse.move(f4.x, f4.grip); + await page.mouse.down(); + await page.mouse.move(f4.x - 120, f4.body, { steps: 6 }); + await page.keyboard.press("Escape"); + await page.mouse.up(); + expect(order()).toBe(before); + + // The keyboard: Alt+→ on c01 moves it one place (after c02, still §0); Undo. + await page.locator('[data-play-row="c01"]').focus(); + await page.keyboard.press("Alt+ArrowRight"); + await expect.poll(order).toBe("c02 c01 k01 c03 c04"); + expect(afters()).toBe("c01"); + await expect(page.locator('[data-strip-toast="done"]')).toBeVisible(); + await page.locator("[data-strip-undo]").click(); + await expect.poll(order).toBe(before); + expect(afters()).toBe("c02"); +}); + +test("Play → Edit → the bench in place → Back: the same clip, second and take, no second Play in the history", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.playHref(P)); + await ready(page); + // Into c02, a little way in (a click on a cell's body scrubs there). + const mid = await cellAt(page, "c02", 0.6); + await page.mouse.click(mid.x, mid.body); + await expect(root(page)).toHaveAttribute("data-play-item", "c02"); + const t0 = await tNow(page); + const item = "c02"; + const hist = await page.evaluate(() => history.length); + await page.locator("[data-play-edit]").click(); + // In place: Play hidden (kept), the bench on the clip, its address the bench's. + await expect(page.locator(`[data-cut-app-bench="${item}"] [data-bench-shell="clip"]`)).toBeVisible({ timeout: 20_000 }); + await expect(page.locator("[data-cut-app-play]")).toHaveAttribute("data-cut-app-play", "hidden"); + await expect(page).toHaveURL(new RegExp(`/clip/${item}\\?from=play.*order=cut`)); + await page.screenshot({ path: test.info().outputPath("app-bench-in-place.png") }); + // n: the cut's next clip (the reel strip's order), in place. + const next = "c03"; + await page.locator("body").press("n"); + await expect(page.locator(`[data-cut-app-bench="${next}"]`)).toBeVisible({ timeout: 20_000 }); + await expect(page).toHaveURL(new RegExp(`/clip/${next}\\?`)); + // Back to the cut: Play as it was -- the clip, the second, the take -- and history as it was. + await page.locator("[data-back-to-play]").click(); + await expect(page.locator("[data-cut-app-play]")).toHaveAttribute("data-cut-app-play", "shown"); + await expect(root(page)).toHaveAttribute("data-play-item", item); + expect(Math.abs((await tNow(page)) - t0)).toBeLessThan(0.15); + await expect(root(page)).toHaveAttribute("data-play-cut", "draft-1"); + await expect(page).toHaveURL(/\/play\?/); + expect(await page.evaluate(() => history.length)).toBe(hist + 2); + // ...and Play did not start over: its deck stays composed. + await expect(root(page)).toHaveAttribute("data-play-compose", /ready|no-deck/); +}); + +test("Back and Forward step between Play and the bench; the bench on its own goes to Play from here", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.playHref(P)); + await ready(page); + await page.locator('[data-play-row="c04"]').press("Enter"); + await expect(root(page)).toHaveAttribute("data-play-item", "c04"); + await page.locator("body").press("e"); + await expect(page.locator('[data-cut-app-bench="c04"] [data-bench-shell="clip"]')).toBeVisible({ timeout: 20_000 }); + await page.goBack(); + await expect(page.locator("[data-cut-app-play]")).toHaveAttribute("data-cut-app-play", "shown"); + await expect(root(page)).toHaveAttribute("data-play-item", "c04"); + await page.goForward(); + await expect(page.locator('[data-cut-app-bench="c04"] [data-bench-shell="clip"]')).toBeVisible({ timeout: 20_000 }); + await page.goBack(); + await expect(page.locator("[data-cut-app-play]")).toHaveAttribute("data-cut-app-play", "shown"); + // A reload of the bench's address is the bench's own page; Walk → Play from there. + await page.goto(urls.clipBenchHref(P, "c03")); + const here = page.locator("[data-play-from-here]"); + await expect(here).toHaveAttribute("href", urls.playHref(P, { clip: "c03" })); + await page.screenshot({ path: test.info().outputPath("app-walk-play-from-here.png") }); + await here.click(); + await expect(page).toHaveURL(/\/play\?clip=c03/); + await expect(root(page)).toHaveAttribute("data-play-item", "c03", { timeout: 20_000 }); +}); + +test("a window save refused for the stamp's second offers the fix: Move the stamp, in one write, the trim kept", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + // c02 is 3.5–5.5 with its stamp (k1) at 4.5. + expect(manifest().timeline.find((e) => e.id === "c02")!.claim!.at).toBe(4.5); + await page.goto(urls.clipBenchHref(P, "c02")); + await expect(page.locator('[data-bench="c02"]')).toHaveCount(1); + // The start to 4.6 (past the stamp), by the keys: } is +0.5 s, ] +0.05 s. + await page.locator("body").press("Shift+BracketRight"); + await page.locator("body").press("Shift+BracketRight"); + await page.locator("body").press("BracketRight"); + await page.locator("body").press("BracketRight"); + await page.locator("[data-save-window]").click(); + const fix = page.locator('[data-bench-fix="mark"]'); + await expect(fix).toContainText("The stamp at 4.50 would be outside 4.60–5.50"); + await expect(page.locator("[data-bench-note]")).toContainText("claim.at 4.5"); + await expect(page.locator('[data-bench-fix-move="first"]')).toContainText("Move the stamp to 4.60 (first second)"); + await expect(page.locator("[data-bench-fix-clear]")).toContainText("Clear the stamp's second"); + await page.screenshot({ path: test.info().outputPath("bench-stamp-fix.png") }); + await page.locator('[data-bench-fix-move="first"]').click(); + await expect(fix).toHaveCount(0); + await expect.poll(() => manifest().timeline.find((e) => e.id === "c02")!.start).toBe(4.6); + expect(manifest().timeline.find((e) => e.id === "c02")!.claim!.at).toBe(4.6); +});