commit 786e448915e81c1eade741a0928dd3c19762fc2f
parent da25981f947c369f3098f1634f18c1418e0c3d15
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 10 Nov 2026 17:11:09 -0500
Merge lane/review-present: the workspace has modes -- Review pass (Keep, Fix, Note per block, the verdict at the end) and Present, in the address; the old play, present, review, walk, post and claim pages redirect into workspace states; the readiness bar (redesign L7b)
A version opens read-only: the workspace is keyed on its mode and take and one read-only flag refuses every writer
(moves, Undo, Redo, E, the inspector, marks, the block menu, Look and Render). Fix is a "needs work" mark in
review-pass.json on any block and never a clip's verdict; Keep never overwrites a bench ruling of incorrect or wrong
speaker; a mark carries the block's signature and goes stale when the block changes. The end verdict judges the
parent version when the draft differs only in review fields, else saves the next version and judges that
(`umtool review-pass <p> verdict`). Rendered means a take's preview on disk; pills say -- when a check did not read.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
72 files changed, 2909 insertions(+), 255 deletions(-)
diff --git a/umtool/app/api/report/readiness/route.ts b/umtool/app/api/report/readiness/route.ts
@@ -0,0 +1,12 @@
+import { projectRef } from "@/lib/projects";
+import { readinessOf } from "@/lib/inbox/readiness";
+
+export const dynamic = "force-dynamic";
+
+// THE READINESS BAR as JSON (lib/inbox/readiness.ts; the workspace's row under its top bar): GET ?project=<id> ->
+// { project, pills: [{ id, label, state: bad|count|ok|none, count, title, href }] }. Read-only: it writes nothing.
+export async function GET(request: Request) {
+ const project = await projectRef(new URL(request.url).searchParams.get("project") ?? "");
+ if (!project) return Response.json({ error: "no such project" }, { status: 404 });
+ return Response.json(await readinessOf(project), { headers: { "cache-control": "no-store" } });
+}
diff --git a/umtool/app/api/report/review-pass/route.ts b/umtool/app/api/report/review-pass/route.ts
@@ -0,0 +1,43 @@
+import { projectRef } from "@/lib/projects";
+import { readManifest } from "@/lib/projects/report.mjs";
+import { marksAgainst, readReviewPass, setReviewMark } from "@/lib/report/reviewPass.mjs";
+import { refuseCaller } from "@/lib/report/caller";
+import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs";
+
+export const dynamic = "force-dynamic";
+
+// THE REVIEW PASS's post and card marks (lib/report/reviewPass.mjs; the workspace's `?mode=review`). A clip's
+// Keep / Fix is its walk verdict, written through the window writer (PUT /api/report/window); this is the store
+// for what has none.
+//
+// GET ?project=<id> <project>/review-pass.json, as read
+// POST { project, block, mark: "keep"|"fix"|null, note? } one block's mark (null clears it); a Fix says what
+// needs fixing. Terminal twin: `umtool review-pass <p> mark`.
+export async function GET(request: Request) {
+ const url = new URL(request.url);
+ const project = await projectRef(url.searchParams.get("project") ?? "");
+ if (!project) return Response.json({ error: "no such project" }, { status: 404 });
+ // The marks against the cut as it is now: a block changed since it was reviewed is `stale` (unanswered again).
+ const [doc, manifest] = await Promise.all([readReviewPass(project.dir), readManifest(project.dir).catch(() => null)]);
+ return Response.json({ ...doc, marks: marksAgainst(doc, manifest) }, { headers: { "cache-control": "no-store" } });
+}
+
+export async function POST(request: Request) {
+ const refused = refuseCaller(request, "/api/report/review-pass");
+ if (refused) return refused;
+ const cross = crossSiteRefusal(request.headers);
+ if (cross) return Response.json({ error: cross }, { status: 403 });
+ const body = (await request.json().catch(() => null)) as { project?: string; block?: string; mark?: string | null; note?: string } | null;
+ if (!body || typeof body !== "object" || typeof body.block !== "string") return Response.json({ error: "bad json: { project, block, mark }" }, { status: 400 });
+ const project = await projectRef(String(body.project ?? ""));
+ if (!project) return Response.json({ error: "no such project" }, { status: 404 });
+ const manifest = await readManifest(project.dir);
+ if (!manifest) return Response.json({ error: "no video.manifest.json" }, { status: 404 });
+ const mark = body.mark === null || body.mark === undefined || body.mark === "" ? null : body.mark;
+ try {
+ const r = await setReviewMark(project.dir, manifest, body.block, mark as "keep" | "fix" | null, { note: typeof body.note === "string" ? body.note : undefined });
+ return Response.json({ ok: true, mark: r.mark, doc: { ...r.doc, marks: marksAgainst(r.doc, manifest) } }, { headers: { "cache-control": "no-store" } });
+ } catch (e) {
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 400 });
+ }
+}
diff --git a/umtool/app/api/report/review-pass/verdict/route.ts b/umtool/app/api/report/review-pass/verdict/route.ts
@@ -0,0 +1,31 @@
+import { projectRef } from "@/lib/projects";
+import { judgeDraft } from "@/lib/report/versions.mjs";
+import { refuseCaller } from "@/lib/report/caller";
+import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs";
+
+export const dynamic = "force-dynamic";
+
+// THE REVIEW PASS'S VERDICT ON THE DRAFT (lib/report/versions.mjs judgeDraft): one locked call -- the draft that
+// differs from its parent only by the walk's and the review pass's fields judges the PARENT, nothing saved; else it
+// is saved as the next version and that is judged. A version reviewed as itself is judged through
+// /api/report/takes/verdict. Terminal twin: `umtool review-pass <p> verdict like|maybe|no|clear`.
+//
+// POST { project, verdict: "like"|"maybe"|"no"|null, note? } -> { ok, judged, saved, entry }
+export async function POST(request: Request) {
+ const refused = refuseCaller(request, "/api/report/review-pass/verdict");
+ if (refused) return refused;
+ const cross = crossSiteRefusal(request.headers);
+ if (cross) return Response.json({ error: cross }, { status: 403 });
+ const body = (await request.json().catch(() => null)) as { project?: string; verdict?: string | null; note?: string } | null;
+ if (!body || typeof body !== "object") return Response.json({ error: "bad json" }, { status: 400 });
+ const v = body.verdict === null || body.verdict === "" ? null : body.verdict;
+ if (v !== null && !["like", "maybe", "no"].includes(String(v))) return Response.json({ error: "verdict must be like, maybe, no or null" }, { status: 400 });
+ const project = await projectRef(String(body.project ?? ""));
+ if (!project) return Response.json({ error: "no such project" }, { status: 404 });
+ try {
+ const r = await judgeDraft(project, v as "like" | "maybe" | "no" | null, { note: typeof body.note === "string" ? body.note : undefined });
+ return Response.json({ ok: true, ...r }, { headers: { "cache-control": "no-store" } });
+ } catch (e) {
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 400 });
+ }
+}
diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs
@@ -885,6 +885,8 @@ const COMMANDS = {
window: cmdWindow,
// The clip bench's walk, of the cut or of a take (walk a take): lib/report/walkCli.mjs.
walk: async () => process.exit(await (await import("../lib/report/walkCli.mjs")).walkCommand(argv.slice(argv.indexOf("walk") + 1))),
+ // The workspace's review pass: each block's answer, a post's or a card's mark (lib/report/reviewPass.mjs).
+ "review-pass": async () => process.exit(await (await import("../lib/report/reviewPass.mjs")).reviewPassCommand(argv.slice(argv.indexOf("review-pass") + 1))),
// Present mode: the cut as slides (lib/report/presentCli.mjs).
intro: async () => process.exit(await (await import("../lib/report/introCli.mjs")).introCommand(argv.slice(argv.indexOf("intro") + 1))),
present: async () => process.exit(await (await import("../lib/report/presentCli.mjs")).presentCommand(argv.slice(argv.indexOf("present") + 1))),
diff --git a/umtool/components/articles/ArticlePage.tsx b/umtool/components/articles/ArticlePage.tsx
@@ -144,7 +144,7 @@ export default async function ArticlePage({
// A note: the article's own opens the reader; a note on the video project
// opens where its anchor is drawn.
const articleNote = !!sp.note && !!notes.doc?.notes.some((n) => n.id === sp.note);
- const noteTab = sp.note && !sp.tab && !articleNote && videoRef ? await projectNoteTab(videoRef.dir, sp.note) : null;
+ const noteTab = sp.note && !sp.tab && !articleNote && videoRef ? await projectNoteTab(videoRef.dir, sp.note, { piece: "article" }) : null;
const tab = articleTabOf(sp, { noteTab });
// `?project=` is carried from tab to tab only when it is not the article's Cut.
diff --git a/umtool/components/notes/AnchoredNotes.tsx b/umtool/components/notes/AnchoredNotes.tsx
@@ -9,7 +9,8 @@ import { NoteComposer, NoteThread } from "./NoteThread";
// The notes on one THING: a timeline row (`entry`), a take (`take`). A count
// of the open ones, folded; unfolded, every note on it and a box for another.
-type Pin = { kind: "entry"; entry: string } | { kind: "take"; take: string };
+// An entry pin's `take`: a note taken on a saved version (its review pass) records it.
+type Pin = { kind: "entry"; entry: string; take?: string } | { kind: "take"; take: string };
export const notesOn = (notes: Note[], pin: Pin) =>
notes.filter((n) => {
diff --git a/umtool/components/projects/ClipBench.tsx b/umtool/components/projects/ClipBench.tsx
@@ -7,6 +7,7 @@ import AnchoredNotes, { notesOn } from "@/components/notes/AnchoredNotes";
import GeneratedBanner from "@/components/notes/GeneratedBanner";
import { useSharedNotes, wroteNotes } from "@/components/notes/NotesProvider";
import { announceManifestChanged } from "./timelineApi";
+import { writeClipPatch } from "./bench/walkVerdict";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { LatestLine, type WorkingCut } from "./review/WhatPlays";
import { createPortal } from "react-dom";
@@ -1241,14 +1242,6 @@ export default function ClipBench({
async (u: UndoRec) => {
setUndo(null);
const b = u.before;
- const r = await fetch(`/api/report/clip?project=${encodeURIComponent(u.project)}&clip=${encodeURIComponent(u.clip)}`, {
- cache: "no-store",
- });
- if (!r.ok) {
- setNote(`could not undo: ${r.status}`);
- return;
- }
- const tok = ((await r.json()) as { token?: string }).token ?? null;
const patch: Record<string, unknown> = { verdict: b.verdict === "confirmed" || b.verdict === "incorrect" ? b.verdict : "" };
if (u.moved) {
patch.start = b.start;
@@ -1257,16 +1250,13 @@ export default function ClipBench({
patch.cutEnd = b.cutEnd ?? "";
patch.muteFrom = b.muteFrom ?? "";
}
- const w = await fetch("/api/report/window", {
- method: "PUT",
- headers: { "content-type": "application/json" },
- body: JSON.stringify({ project: u.project, clip: u.clip, token: tok, ...patch }),
- });
- const j = (await w.json()) as Record<string, unknown>;
+ // The walk's verdict writer (bench/walkVerdict.ts): the clip's own token, then the window writer.
+ const w = await writeClipPatch(u.project, u.clip, patch);
if (!w.ok) {
- setNote(j.stale ? "could not undo: the manifest changed since — reload" : `could not undo: ${String(j.error ?? w.status)}`);
+ setNote(w.stale ? "could not undo: the manifest changed since — reload" : `could not undo: ${w.error}`);
return;
}
+ const j = w.json;
if (wroteNotes(j)) void notes.reload();
if (u.clip === clip.id) {
const next = fromEntry(clip, j.entry as Record<string, unknown>);
diff --git a/umtool/components/projects/PlayCutPage.tsx b/umtool/components/projects/PlayCutPage.tsx
@@ -62,7 +62,8 @@ export default async function PlayCutPage({
}
// Play and the clip bench as ONE app (cutApp/CutApp.tsx): Play stays mounted, the bench opens in place.
return (
- <CutApp project={project.id} playTop={top}>
+ // Play's own address (always with a query since L7b: a bare /play is the workspace's), for "Back to the cut".
+ <CutApp project={project.id} playTop={top} home={playHref(project.id, { take: take || null })}>
<RememberCut project={project.id} title={project.name ?? project.id} />
<NotesProvider target={{ project: project.id }}>
<PlayCut
diff --git a/umtool/components/projects/ProjectView.tsx b/umtool/components/projects/ProjectView.tsx
@@ -1,4 +1,5 @@
-import { notFound } from "next/navigation";
+import { notFound, permanentRedirect } from "next/navigation";
+import { workspaceHref } from "@/lib/hrefs";
import type { ProjectRef } from "@/lib/project-types";
import SongProject from "./SongProject";
import CutPage from "./CutPage";
@@ -15,7 +16,6 @@ import VoicesPage from "./VoicesPage";
import ReviewPage from "./ReviewPage";
import ClipDeckPage from "./ClipDeckPage";
import PlayCutPage from "./PlayCutPage";
-import PresentPage from "./present/PresentPage";
import OpenInDraftPage from "./OpenInDraftPage";
import ReelPlayPage from "./reel/ReelPlayPage";
import ReelWalkPage from "./reel/ReelWalkPage";
@@ -79,7 +79,10 @@ export default async function ProjectView({
// `/projects/<project>/takes/<take>/open` -- open a saved version in the draft (it asks first, L3).
// The take walk's and a take's bench's old addresses (`…/takes/<take>/walk`, `…/takes/<take>/clip/<id>`)
// are that page too: every edit lands in the draft, so a version is opened in it before its clips are walked.
- if (rest.length === 3 && rest[0] === "takes" && (rest[2] === "open" || rest[2] === "walk")) return <OpenInDraftPage project={project} take={rest[1]} search={search} />;
+ // The take walk is the version's REVIEW PASS now (umtool redesign L7b): watched block by block, read-only,
+ // its verdict at the end, "Open in draft" to change it. A 308: the address means that for good.
+ if (rest.length === 3 && rest[0] === "takes" && rest[2] === "walk" && isTakeId(rest[1])) permanentRedirect(workspaceHref(project.id, { mode: "review", take: rest[1], all: search.all === "1", note: search.note ?? null }));
+ if (rest.length === 3 && rest[0] === "takes" && rest[2] === "open") return <OpenInDraftPage project={project} take={rest[1]} search={search} />;
if (rest.length === 4 && rest[0] === "takes" && rest[2] === "clip") {
if (!isTakeId(rest[1])) return notFound();
return <OpenInDraftPage project={project} take={rest[1]} clip={rest[3]} search={search} />;
@@ -111,7 +114,13 @@ export default async function ProjectView({
return <ReelWalkPage project={project} reel={search.reel} take={search.take} beat={search.beat} changed={search.changed === "1"} />;
}
// `/projects/<project>/present` (and `?take=<id>`) -- the cut as slides, navigated like a deck (present mode).
- if (rest.length === 1 && rest[0] === "present") return <PresentPage project={project} take={search.take} bare={search.cut === "1"} />;
+ // Present mode is the workspace's (umtool redesign L7b): `?mode=present`, the take kept, the slide's `#id` kept
+ // by the browser across the redirect. A 308.
+ if (rest.length === 1 && rest[0] === "present") permanentRedirect(workspaceHref(project.id, { mode: "present", take: search.take || null }));
+ // A BARE `/play` is the workspace (L7b, a 308): the draft playing is its viewer. Play's own page -- its notes
+ // column, the reel strip's edits, the assistant -- is asked for with a query (`?cut=1`, `?take=`, `?clip=`,
+ // `?note=`; lib/hrefs.ts playHref writes one always) until the workspace holds all of it.
+ if (rest.length === 1 && rest[0] === "play" && Object.keys(search).length === 0) permanentRedirect(workspaceHref(project.id));
if (rest.length === 1 && rest[0] === "play") return <PlayCutPage project={project} take={search.take} bare={search.cut === "1"} note={search.note} clip={search.clip} at={search.at} />;
return notFound();
}
diff --git a/umtool/components/projects/ReportProject.tsx b/umtool/components/projects/ReportProject.tsx
@@ -2,9 +2,10 @@ import AppShell from "@/components/shell/AppShell";
import PieceFrame from "@/components/piece/PieceFrame";
import { readPieceFrame } from "@/lib/pieces/frame";
import Link from "next/link";
+import { permanentRedirect, redirect } from "next/navigation";
import { projectHref, projectsHref, workspaceHref } from "@/lib/hrefs";
import { projectNoteTab } from "@/lib/pieces/article";
-import { PIECE_TABS, tabOf } from "@/lib/pieces/tabs.mjs";
+import { PIECE_FOLDED, PIECE_TABS, PIECE_VIEWS, PIECE_VIEW_IDS, tabOf } from "@/lib/pieces/tabs.mjs";
import type { ProjectRef } from "@/lib/project-types";
import DeleteProject from "./DeleteProject";
import ReportTabBody, { reportCounts, reportStatus } from "./report/ReportTabBody";
@@ -58,6 +59,15 @@ export default async function ReportProject({
}
const m = detail.manifest;
+ // The tabs that folded (L7b: Build and Media into Deliver): a 307, the rest of the query kept (`note` last) --
+ // temporary, since that content will move again (an article piece keeps its own Build and Media: never here).
+ // The workspace's own tab is its address for good: a 308.
+ const folded = search.tab ? (PIECE_FOLDED as Record<string, string>)[search.tab] : undefined;
+ if (folded) {
+ const { tab: _t, note, ...rest } = search;
+ redirect(projectHref(project.id, { ...(rest as Record<string, string>), tab: folded, note: note ?? null }));
+ }
+ if (search.tab === "workspace") permanentRedirect(workspaceHref(project.id));
const tab = tabOf(search, { noteTab: !search.tab ? await projectNoteTab(project.dir, search.note) : null });
const frame = await readPieceFrame(project);
// The head's one primary row (lane/ui-simplify): Play the newest take, on every tab, and the status line
@@ -73,9 +83,10 @@ export default async function ReportProject({
<PieceFrame
crumbs={[{ href: projectsHref(), label: "Projects" }, { label: project.id }, { label: typeof m.title === "string" && m.title ? m.title : project.id }]}
frame={frame}
- tab={tab}
- tabs={PIECE_TABS.map((t) => ({ ...t, href: projectHref(project.id, { tab: t.id }) }))}
- counts={await reportCounts(detail, project.dir)}
+ // The Overview and the cut's list are the workspace's views (out of the tab bar): its tab is lit on them.
+ tab={PIECE_VIEW_IDS.includes(tab) ? "workspace" : tab}
+ tabs={PIECE_TABS.map((t) => ({ ...t, href: t.id === "workspace" ? workspaceHref(project.id) : projectHref(project.id, { tab: t.id }) }))}
+ counts={await reportCounts(detail, project.dir).then((c) => ({ workspace: c.cut, deliver: c.media, sources: c.sources }))}
note={primaryStatus(working, openNotes, reportStatus(detail))}
primary={<ProjectPrimary project={project.id} detail={detail} latest={working?.latest?.id ?? null} words={latestWords(working)} />}
more={
@@ -86,12 +97,18 @@ export default async function ReportProject({
<Link href={workspaceHref(project.id)} prefetch={false} data-primary-workspace="" className="block rounded-[2px] px-2 py-1 text-[12.5px] text-text-2 hover:bg-panel-2 hover:text-text">
Open the workspace
</Link>
+ {/* The views out of the tab bar (lib/pieces/tabs.mjs PIECE_VIEWS): what the workspace does not hold yet. */}
+ {PIECE_VIEWS.map((v) => (
+ <Link key={v.id} href={projectHref(project.id, { tab: v.id })} prefetch={false} data-piece-view={v.id} className="block rounded-[2px] px-2 py-1 text-[12.5px] text-text-2 hover:bg-panel-2 hover:text-text">
+ {v.label}
+ </Link>
+ ))}
<DeleteProject project={project.id} />
</>
}
>
<RememberCut project={project.id} title={typeof m.title === "string" && m.title ? m.title : project.id} />
- <ReportTabBody project={project} detail={detail} search={search} tab={tab} frame={frame} />
+ <ReportTabBody project={project} detail={detail} search={search} tab={tab} frame={frame} fold />
</PieceFrame>
</div>
);
diff --git a/umtool/components/projects/bench/walkVerdict.ts b/umtool/components/projects/bench/walkVerdict.ts
@@ -0,0 +1,30 @@
+// THE WALK'S VERDICT WRITER, outside the bench (umtool redesign L7b): one clip's verdict -- `confirmed`, or
+// `incorrect` with its `correction` -- written exactly as the clip bench writes it: the clip's own token read
+// (GET /api/report/clip), then the window writer (PUT /api/report/window), one write and one undo point
+// (lib/report/manifest.mjs updateClip). The bench's Undo of a Confirm writes through this, and the workspace's
+// review pass's Keep does; ClipBench's own Confirm keeps its in-component save, which carries a moved
+// window in the same patch. Its terminal twin: `umtool window <p> <clip> --verdict confirmed|incorrect`.
+
+export type ClipWrite =
+ | { ok: true; entry: Record<string, unknown>; token: string; json: Record<string, unknown> }
+ | { ok: false; error: string; stale: boolean };
+
+/** One clip's patch through the window writer, on the clip's token as it is now. */
+export async function writeClipPatch(project: string, clip: string, patch: Record<string, unknown>): Promise<ClipWrite> {
+ const r = await fetch(`/api/report/clip?project=${encodeURIComponent(project)}&clip=${encodeURIComponent(clip)}`, { cache: "no-store" });
+ if (!r.ok) return { ok: false, error: `HTTP ${r.status}`, stale: false };
+ const tok = ((await r.json().catch(() => ({}))) as { token?: string }).token ?? null;
+ const w = await fetch("/api/report/window", {
+ method: "PUT",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, clip, token: tok, ...patch }),
+ });
+ const j = (await w.json().catch(() => ({}))) as Record<string, unknown>;
+ if (!w.ok) return { ok: false, error: String(j.error ?? `HTTP ${w.status}`), stale: !!j.stale };
+ return { ok: true, entry: (j.entry ?? {}) as Record<string, unknown>, token: String(j.token ?? ""), json: j };
+}
+
+/** The walk's verdict a review pass writes: Keep (`confirmed`) -- never `incorrect`, the bench's fact-error ruling. */
+export function writeWalkVerdict(project: string, clip: string, v: { verdict: "confirmed" } | { verdict: "" }): Promise<ClipWrite> {
+ return writeClipPatch(project, clip, v);
+}
diff --git a/umtool/components/projects/cutApp/CutApp.tsx b/umtool/components/projects/cutApp/CutApp.tsx
@@ -77,6 +77,8 @@ export default function CutApp({
const isPlay = useCallback((pathname: string) => pathname === home || pathname === playPath(project), [home, project]);
const router = useRouter();
const [view, setView] = useState<View>({ kind: "play" });
+ const viewKind = useRef<View["kind"]>("play");
+ viewKind.current = view.kind;
const [bench, setBench] = useState<{ key: string; state: "loading" | "ready" | "error"; bench?: Bench; error?: string } | null>(null);
// How many entries the app pushed past Play: "Back to the cut" goes back that many.
const depth = useRef(0);
@@ -187,6 +189,8 @@ export default function CutApp({
const st = (window.history.state ?? {}) as { cutApp?: number };
if (isPlay(p)) {
depth.current = 0;
+ // A history step that stays on the home view (the workspace's mode, present's slides) is not a return.
+ if (viewKind.current === "play") return;
setView({ kind: "play" });
setBench(null);
returned();
diff --git a/umtool/components/projects/present/PresentPage.tsx b/umtool/components/projects/present/PresentPage.tsx
@@ -1,36 +0,0 @@
-import Link from "next/link";
-import { playHref, presentHref } from "@/lib/hrefs";
-import { pieceHrefOfProject } from "@/lib/pieces/article";
-import type { ProjectRef } from "@/lib/project-types";
-import { presentPayload } from "@/lib/report/present.mjs";
-import PresentView, { type PresentPayload } from "./PresentView";
-
-// `/projects/<project>/present` (and `?take=<id>`, `?cut=1`) -- PRESENT MODE (umtool/docs/knobs.md, "Present
-// mode"): the cut as slides, one at a time, navigated like a deck. lib/report/present.mjs makes the payload (Play's
-// view cut into slides); PresentView.tsx shows it. umtool is the operator's, so the payload carries what the build
-// censors as data the viewer can toggle (`canUncensor`).
-
-export default async function PresentPage({ project, take, bare = false }: { project: ProjectRef; take?: string; bare?: boolean }) {
- const [payload, back] = await Promise.all([presentPayload(project, { take: take || null, bare, canUncensor: true }), pieceHrefOfProject(project.id, { tab: "cut" })]);
- if ("error" in payload) {
- return (
- <main data-present-error="" className="flex h-full flex-col items-start gap-2 p-6 text-[13px]">
- <p className="text-reject-text">{String(payload.error)}</p>
- <p className="flex gap-3">
- {take && (
- <Link href={presentHref(project.id)} className="ink-link">
- present the latest cut instead
- </Link>
- )}
- <Link href={playHref(project.id)} className="ink-link">
- Play the cut
- </Link>
- <Link href={back} className="ink-link">
- ‹ {project.id}
- </Link>
- </p>
- </main>
- );
- }
- return <PresentView payload={payload as unknown as PresentPayload} back={back} playHref={playHref(project.id, { take: take || null, bare })} />;
-}
diff --git a/umtool/components/projects/present/PresentView.tsx b/umtool/components/projects/present/PresentView.tsx
@@ -6,6 +6,7 @@ import PostItemPlayer, { postItemAssets, type CardView, type PostPlan, type Prog
import ComboBadge, { type ComboInfo } from "../review/ComboBadge";
import { postPreload } from "../review/playEngine/postPreload";
import IntroCardPlayer, { type IntroPage } from "../review/IntroCardPlayer";
+import { aModalIsOpen } from "@/components/ui/modalOpen";
// ---------------------------------------------------------------------------
// PRESENT MODE, THE VIEWER (umtool/docs/knobs.md, "Present mode"; operator, 8 Nov 2026): the cut as slides, one at
@@ -163,7 +164,18 @@ function useFitted(box: Box) {
return { ref, size };
}
-export default function PresentView({ payload, back, playHref }: { payload: PresentPayload; back: string; playHref: string }) {
+export default function PresentView({
+ payload,
+ back,
+ playHref,
+ onExit,
+}: {
+ payload: PresentPayload;
+ back: string;
+ playHref: string;
+ /** The workspace's present mode (umtool redesign L7b): Esc (the settings closed) and ‹ Edit go back to Edit. */
+ onExit?: () => void;
+}) {
const { slides, sections, box } = payload;
const project = payload.project;
const take = payload.take?.id ?? null;
@@ -172,6 +184,10 @@ export default function PresentView({ payload, back, playHref }: { payload: Pres
const [index, setIndex] = useState(0);
const [paused, setPaused] = useState(false);
const [drawer, setDrawer] = useState(false);
+ const drawerRef = useRef(drawer);
+ drawerRef.current = drawer;
+ const exitRef = useRef(onExit);
+ exitRef.current = onExit;
const [settings, setSettings] = useState<PresentSettings>(payload.settings);
const [loaded, setLoaded] = useState(false);
const canUncensor = payload.capabilities.canUncensor;
@@ -228,12 +244,16 @@ export default function PresentView({ payload, back, playHref }: { payload: Pres
// ---- the keys ----
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
+ // A modal is up (the ⌘K palette): its keys -- Esc closes IT, never present mode under it; no slide moves.
+ if (aModalIsOpen()) return;
const t = e.target as HTMLElement | null;
// Typing in a field (the linger) is not a move; a checkbox is not typing.
const typing = !!t && ((t.tagName === "INPUT" && !["checkbox", "radio", "button"].includes((t as HTMLInputElement).type)) || t.tagName === "TEXTAREA" || t.isContentEditable);
if (e.key === "Escape") {
if (t && t !== document.body) t.blur();
- setDrawer(false);
+ // The settings open: Esc closes them. Closed: back to the workspace's Edit, when presenting in it.
+ if (drawerRef.current || !exitRef.current) setDrawer(false);
+ else exitRef.current();
return;
}
if (typing) return;
@@ -377,6 +397,11 @@ export default function PresentView({ payload, back, playHref }: { payload: Pres
<button type="button" data-present-settings-open="" aria-expanded={drawer} className="ml-auto rounded px-1.5 py-0.5 text-white/60 hover:bg-white/10 hover:text-white" onClick={() => setDrawer((d) => !d)}>
Settings · s
</button>
+ {onExit && (
+ <button type="button" data-present-exit="" className="rounded px-1.5 py-0.5 text-white/60 hover:bg-white/10 hover:text-white" onClick={onExit} title="back to the workspace's Edit (Esc)">
+ Edit · Esc
+ </button>
+ )}
</div>
{drawer && (
<SettingsDrawer
diff --git a/umtool/components/projects/report/ReportTabBody.tsx b/umtool/components/projects/report/ReportTabBody.tsx
@@ -47,8 +47,17 @@ export function reportStatus(detail: ClipDetail): string {
export default function ReportTabBody({
tab,
frame,
+ fold = false,
...props
-}: ReportTabProps & { tab: string; frame: PieceFrame }) {
+}: ReportTabProps & {
+ tab: string;
+ frame: PieceFrame;
+ /**
+ * The project piece's four tabs (L7b, lib/pieces/tabs.mjs PIECE_FOLDED): Deliver draws what Build and Media
+ * held, above its own. An article piece keeps the seven (its Build and Media tabs are their own).
+ */
+ fold?: boolean;
+}) {
const m = props.detail.manifest;
return (
<NotesProvider target={{ project: props.project.id }}>
@@ -56,8 +65,16 @@ export default function ReportTabBody({
<GeneratedBanner generatedBy={typeof m.generatedBy === "string" ? m.generatedBy : null} />
{tab === "overview" && <OverviewTab {...props} frame={frame} />}
{tab === "cut" && <CutTab {...props} />}
- {tab === "media" && <MediaTab {...props} />}
- {tab === "build" && <BuildTab {...props} />}
+ {tab === "media" && !fold && <MediaTab {...props} />}
+ {tab === "build" && !fold && <BuildTab {...props} />}
+ {tab === "deliver" && fold && (
+ <>
+ {/* What was Build: the build chain and the final mp4. */}
+ <BuildTab {...props} />
+ {/* What was Media: the drafted fields, the upload's text, the on-screen panel. */}
+ <MediaTab {...props} />
+ </>
+ )}
{tab === "deliver" && <DeliverTab {...props} />}
{tab === "sources" && <SourcesTab {...props} />}
{tab === "history" && <HistoryTab {...props} />}
diff --git a/umtool/components/projects/workspace/BlockStrip.tsx b/umtool/components/projects/workspace/BlockStrip.tsx
@@ -61,6 +61,7 @@ export default function BlockStrip({
onSelect,
onMove,
plus,
+ marks = null,
menu,
}: {
blocks: Block[];
@@ -71,8 +72,10 @@ export default function BlockStrip({
onSelect: (id: string) => void;
/** Move block `id` to timeline index `to`. */
onMove: (id: string, at: number, to: number) => void;
- /** The + at the end: what it opens. */
+ /** The + at the end: what it opens (none outside Edit). */
plus: React.ReactNode;
+ /** The review pass's answers (L7b): a block kept or to fix is marked. */
+ marks?: Map<string, { mark: "keep" | "fix" | "ruled"; note: string | null }> | null;
/** What a block's menu does (none: no menus). */
menu?: BlockActions;
}) {
@@ -150,6 +153,7 @@ export default function BlockStrip({
data-ws-block-at={b.at ?? ""}
data-ws-block-now={b.id === playing ? "" : undefined}
data-ws-block-rejected={b.rejected ? "" : undefined}
+ data-ws-block-review={marks ? (marks.get(b.id)?.mark ?? "") : undefined}
draggable={movable}
onDragStart={(e) => {
if (!movable) return;
@@ -209,6 +213,11 @@ export default function BlockStrip({
{b.id === playing && <span aria-hidden className="absolute inset-x-0 top-0 h-0.5 bg-[var(--color-signal)]" />}
<span className="flex items-baseline gap-1">
<span className={cn("truncate font-mono text-[11.5px] font-medium text-text", b.rejected && "line-through")}>{b.id}</span>
+ {marks?.get(b.id) && (
+ <span aria-label={marks.get(b.id)!.mark === "keep" ? "kept" : marks.get(b.id)!.mark === "fix" ? "needs work" : "ruled in the bench"} className={cn("shrink-0 text-[11px] font-semibold", marks.get(b.id)!.mark === "keep" ? "text-kept-text" : "text-doubt-text")}>
+ {marks.get(b.id)!.mark === "keep" ? "✓" : marks.get(b.id)!.mark === "fix" ? "✎" : "✗"}
+ </span>
+ )}
<span className="ml-auto shrink-0 text-[10px] uppercase tracking-[0.06em] text-muted">{TYPE_WORD[b.type] ?? b.type}</span>
</span>
<span className="truncate text-[11px] leading-tight text-text-2">{b.heading || " "}</span>
diff --git a/umtool/components/projects/workspace/ReadinessBar.tsx b/umtool/components/projects/workspace/ReadinessBar.tsx
@@ -0,0 +1,111 @@
+"use client";
+
+import Link from "next/link";
+import { useCallback, useEffect, useMemo, useState } from "react";
+import { cn } from "@/lib/utils";
+import type { Readiness, ReadinessPill } from "@/lib/inbox/readiness";
+import { MANIFEST_CHANGED } from "../timelineApi";
+
+export type { Readiness };
+
+// ---------------------------------------------------------------------------
+// THE READINESS BAR (umtool redesign L7b): under the workspace's top bar, one pill each for the quote check, the
+// links, the captures, the render and X's jar -- ✓, a count, ! or — -- read from what the Inbox reads for this
+// piece (GET /api/report/readiness, lib/inbox/readiness.ts) and read again after a write here. Each pill is a
+// click to its fix or its page; a clip with no media fetched selects that block. Read-only.
+// ---------------------------------------------------------------------------
+
+const GLYPH = { ok: "✓", bad: "!", none: "—" } as const;
+const TONE = {
+ ok: "border-[color-mix(in_srgb,var(--color-good)_40%,transparent)] text-kept-text",
+ count: "border-[color-mix(in_srgb,var(--color-dirty)_45%,transparent)] text-doubt-text",
+ bad: "border-[color-mix(in_srgb,var(--color-bad)_55%,transparent)] bg-[color-mix(in_srgb,var(--color-bad)_10%,transparent)] text-reject-text",
+ none: "border-seam-2 text-muted",
+} as const;
+
+export default function ReadinessBar({
+ project,
+ initial,
+ missing,
+ onSelect,
+}: {
+ project: string;
+ initial: Readiness | null;
+ /** The clips with no media fetched (the strip's "no media"): the captures pill counts them. */
+ missing: string[];
+ onSelect: (block: string) => void;
+}) {
+ const [got, setGot] = useState<Readiness | null>(initial);
+ const read = useCallback(async () => {
+ try {
+ const r = await fetch(`/api/report/readiness?project=${encodeURIComponent(project)}`, { cache: "no-store" });
+ if (r.ok) setGot((await r.json()) as Readiness);
+ } catch {
+ // The bar stays as it was.
+ }
+ }, [project]);
+ useEffect(() => {
+ if (!initial) void read();
+ }, [initial, read]);
+ useEffect(() => {
+ let t: ReturnType<typeof setTimeout> | null = null;
+ const on = (e: Event) => {
+ if ((e as CustomEvent).detail?.project !== project) return;
+ if (t) clearTimeout(t);
+ t = setTimeout(() => void read(), 400);
+ };
+ window.addEventListener(MANIFEST_CHANGED, on);
+ return () => {
+ window.removeEventListener(MANIFEST_CHANGED, on);
+ if (t) clearTimeout(t);
+ };
+ }, [project, read]);
+
+ const pills = useMemo<ReadinessPill[]>(() => {
+ const list = got?.pills ?? [];
+ return list.map((p) => {
+ if (p.id !== "captures" || !missing.length || p.state === "bad") return p;
+ const why = `${missing.slice(0, 6).join(", ")}${missing.length > 6 ? ` and ${missing.length - 6} more` : ""}: no media fetched`;
+ return { ...p, state: "count", count: (p.state === "count" ? p.count : 0) + missing.length, title: p.state === "count" ? `${p.title} · ${why}` : why, select: missing[0] };
+ });
+ }, [got, missing]);
+ if (!pills.length) return null;
+ return (
+ <nav aria-label="Readiness" data-ws-readiness="" className="flex flex-wrap items-center gap-1.5 border-b border-seam bg-ground px-3 py-1 text-[11.5px]">
+ {pills.map((p) => {
+ const glyph = p.state === "count" ? String(p.count) : GLYPH[p.state];
+ const cls = cn("inline-flex items-center gap-1.5 rounded-full border px-2 py-[1px] leading-[18px] hover:brightness-125", TONE[p.state]);
+ const body = (
+ <>
+ <span className="font-mono font-semibold tabular-nums">{glyph}</span>
+ <span className="text-text-2">{p.label}</span>
+ </>
+ );
+ const attrs = { "data-ready-pill": p.id, "data-ready-state": p.state, "data-ready-count": String(p.count), title: p.title };
+ if (p.select) {
+ return (
+ <button key={p.id} type="button" className={cls} onClick={() => onSelect(p.select!)} {...attrs}>
+ {body}
+ </button>
+ );
+ }
+ if (!p.href) {
+ return (
+ <span key={p.id} className={cls} {...attrs}>
+ {body}
+ </span>
+ );
+ }
+ return /^https?:/.test(p.href) ? (
+ <a key={p.id} href={p.href} target="_blank" rel="noreferrer" className={cls} {...attrs}>
+ {body}
+ </a>
+ ) : (
+ <Link key={p.id} href={p.href} prefetch={false} className={cls} {...attrs}>
+ {body}
+ </Link>
+ );
+ })}
+ </nav>
+ );
+}
diff --git a/umtool/components/projects/workspace/ReviewPass.tsx b/umtool/components/projects/workspace/ReviewPass.tsx
@@ -0,0 +1,434 @@
+"use client";
+
+import Link from "next/link";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { buttonVariants } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+import { clipBenchHref, openInDraftHref } from "@/lib/hrefs";
+import { blockAnswer, clipKeepable, clipVerdict, reviewProgress } from "@/lib/report/reviewPassModel.mjs";
+import AnchoredNotes from "@/components/notes/AnchoredNotes";
+import { useSharedNotes } from "@/components/notes/NotesProvider";
+import { writeWalkVerdict } from "../bench/walkVerdict";
+import { MANIFEST_CHANGED, announceManifestChanged } from "../timelineApi";
+import VersionVerdict from "../review/VersionVerdict";
+import type { PlayEntry } from "../review/PlayCut";
+import { READ_ONLY_SAID } from "./readOnly";
+import { aModalIsOpen } from "@/components/ui/modalOpen";
+
+// ---------------------------------------------------------------------------
+// THE REVIEW PASS (umtool redesign L7b; the workspace's `?mode=review`): the inspector hidden, the viewer playing
+// the draft block by block, and each block answered here --
+//
+// Keep k a clip: its walk verdict `confirmed` (the bench's writer, bench/walkVerdict.ts) -- only while it has
+// none or is confirmed: a clip the bench ruled incorrect is shown, never overwritten (Full bench); a post
+// or a card: `keep` in review-pass.json (lib/report/reviewPass.mjs)
+// Fix f "needs work", saying what: a `fix` mark in review-pass.json on ANY block -- never a clip's verdict
+// Note n the notes composer, anchored to the block (notes.json, `umtool notes`)
+//
+// -- then on to the next block, playing. After the last, the VERDICT for the draft (saved as a version first when
+// it has edits: a verdict is a version's) or for the version being reviewed: Like · Maybe · No, L4's writer
+// (takes/verdicts.json, `umtool takes verdict`). "4 / 12 reviewed"; it resumes on the first block with no answer.
+// A version (`?take=`) is read-only: its blocks are watched and noted, never marked -- Open in draft to change it.
+// ---------------------------------------------------------------------------
+
+export type Answer = { mark: "keep" | "fix" | "ruled"; note: string | null; verdict?: string };
+/** A mark as the server reads it against the cut now: `stale` when its block changed since it was reviewed. */
+type Mark = { mark: "keep" | "fix"; note?: string; at: string; stale?: boolean };
+
+/** The pass's state: the marks (review-pass.json), each block's answer, the progress, and the writers. */
+export function useReviewPass(project: string, entries: PlayEntry[], on: boolean, readOnly = false) {
+ const [marks, setMarks] = useState<Record<string, Mark>>({});
+ const [loaded, setLoaded] = useState(false);
+ // A clip's answer as just written, until the draft is read again (MANIFEST_CHANGED) and its verdict is in it.
+ const [written, setWritten] = useState<Record<string, Answer>>({});
+ useEffect(() => setWritten({}), [entries]);
+ const marksSeq = useRef(0);
+ const readMarks = useCallback(async () => {
+ const mine = ++marksSeq.current;
+ try {
+ const j = (await (await fetch(`/api/report/review-pass?project=${encodeURIComponent(project)}`, { cache: "no-store" })).json()) as { marks?: Record<string, Mark> };
+ if (mine === marksSeq.current) setMarks(j.marks ?? {});
+ } finally {
+ if (mine === marksSeq.current) setLoaded(true);
+ }
+ }, [project]);
+ useEffect(() => {
+ if (on) void readMarks().catch(() => {});
+ }, [on, readMarks]);
+ // The draft changed (a write here or elsewhere): a mark's block may no longer be what was reviewed -- read again.
+ useEffect(() => {
+ if (!on) return;
+ const onChange = (ev: Event) => {
+ if ((ev as CustomEvent).detail?.project === project) void readMarks().catch(() => {});
+ };
+ window.addEventListener(MANIFEST_CHANGED, onChange);
+ return () => window.removeEventListener(MANIFEST_CHANGED, onChange);
+ }, [on, project, readMarks]);
+
+ const seen = useMemo(
+ () =>
+ entries.map((e) => {
+ const w = written[e.id];
+ if (!w || e.type !== "clip") return e;
+ return { ...e, review: { verdict: "confirmed", reason: null, correction: null, rejectNote: null } };
+ }),
+ [entries, written],
+ );
+ const progress = useMemo(() => reviewProgress(seen, marks) as { done: number; total: number; next: string | null; ids: string[] }, [seen, marks]);
+ const answers = useMemo(() => {
+ const m = new Map<string, Answer>();
+ for (const e of seen) {
+ const a = blockAnswer(e, marks) as Answer | null;
+ if (a) m.set(e.id, a);
+ }
+ return m;
+ }, [seen, marks]);
+
+ const postMark = useCallback(
+ async (block: string, mark: "keep" | "fix" | null, note: string | null): Promise<string | null> => {
+ const r = await fetch("/api/report/review-pass", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, block, mark, note: note ?? undefined }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { error?: string; doc?: { marks?: Record<string, Mark> } };
+ if (!r.ok) return j.error ?? `HTTP ${r.status}`;
+ setMarks(j.doc?.marks ?? {});
+ return null;
+ },
+ [project],
+ );
+ /**
+ * One block answered. Fix ("needs work"), on any block, is a mark in review-pass.json -- never a clip's verdict.
+ * Keep on a clip is its walk verdict `confirmed` (the bench's writer), only while it has none or is confirmed: a
+ * clip the bench ruled incorrect is the bench's to change. Keep on anything else is a mark.
+ */
+ const answer = useCallback(
+ async (e: PlayEntry, mark: "keep" | "fix", note: string | null): Promise<string | null> => {
+ // A version on screen (readOnly.ts): its marks would land on the draft's blocks.
+ if (readOnly) return READ_ONLY_SAID;
+ if (mark === "fix" || e.type !== "clip") return postMark(e.id, mark, note);
+ if (!clipKeepable(e)) return `marked ${clipVerdict(e)} in the bench: the Full bench changes it`;
+ // A Fix it carried is taken back: kept now.
+ if (marks[e.id]) {
+ const err = await postMark(e.id, null, null);
+ if (err) return err;
+ }
+ if (clipVerdict(e) !== "confirmed") {
+ const w = await writeWalkVerdict(project, e.id, { verdict: "confirmed" });
+ if (!w.ok) return w.stale ? "the draft changed since — try again" : w.error;
+ setWritten((x) => ({ ...x, [e.id]: { mark: "keep", note: null } }));
+ announceManifestChanged(project);
+ }
+ return null;
+ },
+ [project, readOnly, postMark, marks],
+ );
+ return { marks, loaded, progress, answers, answer };
+}
+
+export type ReviewPassState = ReturnType<typeof useReviewPass>;
+
+const VERDICTS = [
+ { id: "like", label: "Like" },
+ { id: "maybe", label: "Maybe" },
+ { id: "no", label: "No" },
+] as const;
+
+/** The draft's verdict: saved as a version first (a verdict is a version's), then judged with L4's writer. */
+function DraftVerdict({ project, draft }: { project: string; draft: { line: string; parent: string | null; edits: number | null } | null }) {
+ // Always the server's answer (never a shortcut fixed at mount: a Keep is an edit, and the draft read here may be
+ // older than the write it follows).
+ const [saved, setSaved] = useState<{ id: string; saved: boolean } | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+ if (saved) {
+ return (
+ <span className="inline-flex flex-wrap items-center gap-2" data-review-verdict-take={saved.id} data-review-verdict-saved={saved.saved ? "1" : "0"}>
+ <span className="text-[12px] text-text-2" data-review-judged="">
+ {saved.saved ? (
+ <>
+ Saved <span className="font-mono text-text">{saved.id}</span> and judged it:
+ </>
+ ) : (
+ <>
+ Judged <span className="font-mono text-text">{saved.id}</span>:
+ </>
+ )}
+ </span>
+ <VersionVerdict project={project} take={saved.id} />
+ </span>
+ );
+ }
+ const judge = async (v: (typeof VERDICTS)[number]["id"]) => {
+ setBusy(true);
+ setErr(null);
+ try {
+ // One locked call (versions.mjs judgeDraft): the parent when only review fields differ, else saved, then judged.
+ const r = await fetch("/api/report/review-pass/verdict", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ project, verdict: v }) });
+ const j = (await r.json().catch(() => ({}))) as { judged?: string; saved?: boolean; error?: string };
+ if (!r.ok || !j.judged) throw new Error(j.error ?? `HTTP ${r.status}`);
+ setSaved({ id: j.judged, saved: !!j.saved });
+ // A version saved for it: the draft's line ("from vN") is read again. Its token did not move (the manifest is
+ // as it was), so the workspace keeps its Redo and its Undo token (the MANIFEST_CHANGED rule, L8b).
+ if (j.saved) announceManifestChanged(project);
+ } catch (e) {
+ setErr(e instanceof Error ? e.message : String(e));
+ } finally {
+ setBusy(false);
+ }
+ };
+ return (
+ <span className="inline-flex flex-wrap items-center gap-1.5" role="group" aria-label="the draft's verdict">
+ <span className="text-[12px] text-text-2" title="a verdict is a version's: its parent's when the draft differs from it only by the review's marks, else the draft saved as the next version (umtool review-pass <p> verdict)">
+ {draft?.line ?? "The draft"}:
+ </span>
+ {VERDICTS.map((v) => (
+ <button key={v.id} type="button" disabled={busy} onClick={() => void judge(v.id)} data-review-verdict={v.id} className={buttonVariants({ variant: "outline", size: "sm" })}>
+ {v.label}
+ </button>
+ ))}
+ {err && (
+ <span role="alert" className="text-[11.5px] text-reject-text">
+ {err}
+ </span>
+ )}
+ </span>
+ );
+}
+
+const TYPE_WORD: Record<string, string> = { clip: "Clip", post: "Post", teaser: "Card", card: "Card", video: "Video" };
+
+export default function ReviewPass({
+ project,
+ rv,
+ entry,
+ atEnd,
+ take,
+ readOnly,
+ draft,
+ onPrev,
+ onNext,
+ onAnswered,
+ onExit,
+}: {
+ project: string;
+ rv: ReviewPassState;
+ /** The block under review (null at the end). */
+ entry: PlayEntry | null;
+ atEnd: boolean;
+ /** A version reviewed read-only, or null for the draft. */
+ take: { id: string; label: string } | null;
+ /** The workspace's read-only flag (readOnly.ts): Keep and Fix refuse. */
+ readOnly: boolean;
+ draft: { line: string; parent: string | null; edits: number | null } | null;
+ onPrev: () => void;
+ onNext: () => void;
+ /** A block was answered: the pass moves on (and plays the next). */
+ onAnswered: () => void;
+ onExit: () => void;
+}) {
+ const notes = useSharedNotes({ project });
+ const [fixing, setFixing] = useState(false);
+ const [fixText, setFixText] = useState("");
+ const [noting, setNoting] = useState(false);
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+ const id = entry?.id ?? null;
+ useEffect(() => {
+ setFixing(false);
+ setNoting(false);
+ setErr(null);
+ setFixText("");
+ }, [id]);
+ const answer = id ? (rv.answers.get(id) ?? null) : null;
+ // Marked once, but the block is not what was reviewed any more (an edge, a post's words, another version opened).
+ const changed = !!(id && rv.marks[id]?.stale);
+ // The bench's ruling on a clip (incorrect: a fact error, wrong speaker), shown and left as it is.
+ const bench =
+ entry?.type === "clip" && !clipKeepable(entry)
+ ? { verdict: String(clipVerdict(entry)), words: entry.review?.correction || entry.rejected?.label || entry.review?.reason || null }
+ : null;
+
+ const go = useCallback(
+ async (mark: "keep" | "fix", note: string | null) => {
+ if (!entry || readOnly || busy || (mark === "keep" && bench)) return;
+ setBusy(true);
+ setErr(null);
+ const e = await rv.answer(entry, mark, note);
+ setBusy(false);
+ if (e) return setErr(e);
+ setFixing(false);
+ onAnswered();
+ },
+ [entry, readOnly, busy, rv, onAnswered, bench],
+ );
+ const openFix = useCallback(() => {
+ if (!entry || readOnly) return;
+ setNoting(false);
+ setFixText(answer?.mark === "fix" ? (answer.note ?? "") : "");
+ setFixing(true);
+ }, [entry, readOnly, answer]);
+
+ // k / f / n: the block's answers (the workspace keeps Space and ← →).
+ const keys = useRef({ go, openFix, setNoting });
+ keys.current = { go, openFix, setNoting };
+ useEffect(() => {
+ const onKey = (ev: KeyboardEvent) => {
+ if (ev.metaKey || ev.ctrlKey || ev.altKey) return;
+ // A held key is one answer, never a run of them over blocks nobody watched.
+ if (ev.repeat) return;
+ // A modal is up (⌘K, the Keys): the keys are its.
+ if (aModalIsOpen()) return;
+ const t = ev.target as HTMLElement | null;
+ if (t?.closest("input, textarea, select, [contenteditable=true], [role=dialog]")) return;
+ if (ev.key === "k" || ev.key === "K") void keys.current.go("keep", null);
+ else if (ev.key === "f" || ev.key === "F") keys.current.openFix();
+ else if (ev.key === "n" || ev.key === "N") keys.current.setNoting(true);
+ else return;
+ ev.preventDefault();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, []);
+
+ const { done, total } = rv.progress;
+ const btn = (variant: "go" | "outline" | "quiet") => cn(buttonVariants({ variant, size: "md" }));
+ return (
+ <div className="flex min-h-0 flex-col" data-review-pass={take?.id ?? "draft"} data-review-progress={`${done}/${total}`} data-review-current={atEnd ? "end" : (id ?? "")}>
+ <div className="flex flex-wrap items-baseline gap-x-2 gap-y-1 border-b border-seam px-3 py-2">
+ <span className="micro">Review pass</span>
+ {take && (
+ <span className="font-mono text-[12px] text-text" title={take.label}>
+ {take.id} · read-only
+ </span>
+ )}
+ <span className="font-mono text-[12px] tabular-nums text-text-2" data-review-count="">
+ {done} / {total} reviewed
+ </span>
+ <span className="ml-auto inline-flex items-center gap-1">
+ <button type="button" className={cn(buttonVariants({ variant: "outline", size: "sm" }), "min-w-8 font-mono")} onClick={onPrev} aria-label="the block before" title="the block before (←)" data-review-prev="">
+ ‹
+ </button>
+ <button type="button" className={cn(buttonVariants({ variant: "outline", size: "sm" }), "min-w-8 font-mono")} onClick={onNext} aria-label="the block after" title="the block after (→)" data-review-next="">
+ ›
+ </button>
+ </span>
+ </div>
+ <div className="min-h-0 flex-1 space-y-3 overflow-y-auto px-3 py-3">
+ {atEnd || !entry ? (
+ <section data-review-end="" className="space-y-3">
+ <h2 className="m-0 text-[14px] font-semibold text-text">{done === total ? "Every block reviewed" : `${total - done} block${total - done === 1 ? "" : "s"} not reviewed`}</h2>
+ <div className="flex flex-wrap items-center gap-2">
+ {take ? (
+ <span className="inline-flex flex-wrap items-center gap-2" data-review-verdict-take={take.id}>
+ <span className="text-[12px] text-text-2">
+ <span className="font-mono text-text">{take.id}</span> “{take.label}”:
+ </span>
+ <VersionVerdict project={project} take={take.id} />
+ </span>
+ ) : (
+ <DraftVerdict project={project} draft={draft} />
+ )}
+ </div>
+ <div className="flex flex-wrap gap-2">
+ {rv.progress.next && (
+ <button type="button" className={btn("outline")} onClick={onNext} data-review-resume="">
+ Back to {rv.progress.next}
+ </button>
+ )}
+ <button type="button" className={btn("quiet")} onClick={onExit} data-review-done="">
+ Done — back to Edit
+ </button>
+ </div>
+ </section>
+ ) : (
+ <section data-review-block={entry.id} data-review-answer={answer?.mark ?? ""} className="space-y-2.5">
+ <div className="flex flex-wrap items-baseline gap-2">
+ <span className="micro">{TYPE_WORD[entry.type] ?? entry.type}</span>
+ <span className="font-mono text-[13px] font-medium text-text">{entry.id}</span>
+ {answer && answer.mark !== "ruled" && (
+ <span className={cn("text-[12px]", answer.mark === "keep" ? "text-kept-text" : "text-doubt-text")} data-review-said="">
+ {answer.mark === "keep" ? "kept" : `needs work: ${answer.note ?? ""}`}
+ </span>
+ )}
+ </div>
+ {changed && !answer && (
+ <p className="m-0 text-[12px] text-muted" data-review-changed="" title={`marked ${rv.marks[id!]?.mark} before the block changed`}>
+ changed since reviewed
+ </p>
+ )}
+ {/* A clip the bench ruled (a fact error, wrong speaker): the pass shows it and never overwrites it. */}
+ {bench && (
+ <p className="m-0 text-[12px] text-doubt-text" data-review-bench={bench.verdict}>
+ marked {bench.verdict} in the bench{bench.words ? `: ${bench.words}` : ""}{" "}
+ <Link href={clipBenchHref(project, entry.id)} prefetch={false} className="ink-link" data-review-full-bench="">
+ Full bench
+ </Link>
+ </p>
+ )}
+ {(entry.quote || entry.heading) && <p className="m-0 font-serif text-[13.5px] leading-snug text-text-2">{entry.type === "clip" && entry.quote ? `“${entry.quote}”` : entry.heading}</p>}
+ <div className="flex flex-wrap items-center gap-1.5">
+ <button type="button" className={btn("go")} disabled={readOnly || busy || !!bench} onClick={() => void go("keep", null)} data-review-keep="" title={readOnly ? "a version is read-only: Open in draft to mark its blocks" : bench ? `marked ${bench.verdict} in the bench: the Full bench changes it` : entry.type === "clip" ? "keep it: the walk's verdict, confirmed (k)" : "keep it (k): review-pass.json"}>
+ Keep <kbd>k</kbd>
+ </button>
+ <button type="button" className={btn("outline")} disabled={readOnly || busy} onClick={openFix} data-review-fix="" title={readOnly ? "a version is read-only: Open in draft to mark its blocks" : "it needs work: say what (f) -- a mark in review-pass.json, never the clip's verdict"}>
+ Fix <kbd>f</kbd>
+ </button>
+ <button type="button" className={btn("quiet")} onClick={() => setNoting((x) => !x)} aria-pressed={noting} data-review-note="" title="a note on this block (n): notes.json, for you or an agent (umtool notes)">
+ Note <kbd>n</kbd>
+ </button>
+ {readOnly && take && (
+ <Link href={openInDraftHref(project, take.id)} prefetch={false} className="ink-link text-[12px]" data-review-open-draft="">
+ Open in draft
+ </Link>
+ )}
+ </div>
+ {fixing && (
+ <form
+ className="space-y-1.5"
+ data-review-fix-form=""
+ onSubmit={(e) => {
+ e.preventDefault();
+ if (fixText.trim()) void go("fix", fixText.trim());
+ }}
+ >
+ <textarea
+ autoFocus
+ value={fixText}
+ onChange={(e) => setFixText(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Escape") setFixing(false);
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ if (fixText.trim()) void go("fix", fixText.trim());
+ }
+ }}
+ rows={2}
+ placeholder="what needs work"
+ data-review-fix-text=""
+ className="w-full rounded-[3px] border border-seam-2 bg-ground px-2 py-1 text-[12.5px] text-text outline-none focus:border-[var(--color-signal)]"
+ />
+ <span className="flex gap-1.5">
+ <button type="submit" className={cn(buttonVariants({ variant: "go", size: "sm" }))} disabled={busy || !fixText.trim()} data-review-fix-save="">
+ Save
+ </button>
+ <button type="button" className={cn(buttonVariants({ variant: "quiet", size: "sm" }))} onClick={() => setFixing(false)}>
+ Cancel
+ </button>
+ </span>
+ </form>
+ )}
+ {/* On a version, the note records which (its anchor's `take`): `umtool notes` says it was about vN. */}
+ {noting && <AnchoredNotes key={entry.id} notes={notes} pin={{ kind: "entry", entry: entry.id, ...(take ? { take: take.id } : {}) }} startOpen />}
+ {err && (
+ <p role="alert" className="m-0 text-[12px] text-reject-text" data-review-error="">
+ {err}
+ </p>
+ )}
+ </section>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/umtool/components/projects/workspace/Workspace.tsx b/umtool/components/projects/workspace/Workspace.tsx
@@ -4,7 +4,7 @@ import { useRouter } from "next/navigation";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
-import { clipBenchHref, postBenchHref } from "@/lib/hrefs";
+import { clipBenchHref, isWorkspaceMode, openInDraftHref, playHref, postBenchHref, workspaceHref, type WorkspaceMode } from "@/lib/hrefs";
import { runningTime, sourceAt, startOf } from "@/lib/report/playCut.mjs";
import { PlayStage, usePlayCore } from "../review/playCore";
import type { PlayViewData } from "../review/PlayCut";
@@ -18,6 +18,10 @@ import type { BlockActions, BlockInfo } from "./BlockMenu";
import WorkspaceInspector from "./WorkspaceInspector";
import WorkspaceTop, { type UndoState } from "./WorkspaceTop";
import GeneratedBanner from "@/components/notes/GeneratedBanner";
+import PresentView, { type PresentPayload } from "../present/PresentView";
+import ReviewPass, { useReviewPass } from "./ReviewPass";
+import ReadinessBar, { type Readiness } from "./ReadinessBar";
+import { READ_ONLY_SAID, WorkspaceReadOnly, workspaceReadOnly } from "./readOnly";
// ---------------------------------------------------------------------------
// THE WORKSPACE (umtool redesign L7a): a report video's ONE screen, at its own
@@ -42,6 +46,14 @@ import GeneratedBanner from "@/components/notes/GeneratedBanner";
// (cutApp/CutApp.tsx, `home` the workspace's address) -- the viewer stays
// mounted, paused, everything it composed kept -- and Back returns here.
//
+// THE MODES (L7b), in the address (`?mode=`; Edit is the bare one), each a history entry:
+// Edit the above
+// Review pass the inspector's column is the pass (ReviewPass.tsx): the viewer plays the block under review and
+// stops at its end; Keep · Fix · Note (k f n) answer it and move on. A version (`?take=`) is
+// reviewed read-only, its verdict at the end
+// Present the viewer full screen as slides (present/PresentView.tsx, Present's own deck: arrows, the
+// censor toggles), Esc back to Edit; a 9:16 cut presents tall
+//
// THE KEYS (the inspector's bench keeps its own while the focus is in it):
// Space play / pause · ← → the block before / after · Alt+← → move the
// selected block · E edit it in place · Esc nothing selected (the project's
@@ -64,6 +76,8 @@ const KEYS: { keys: string; what: string }[] = [
{ keys: "⌘K", what: "the command palette" },
{ keys: "Shift+F10", what: "the focused block's menu (or right-click it, or its ⋯): its verbs, each a form filled in from it" },
{ keys: "?", what: "these keys" },
+ { keys: "k f n", what: "review pass: keep, fix (say what), a note on the block" },
+ { keys: "Esc", what: "present: back to Edit" },
];
type Timeline = { token: string | null; ids: string[] };
@@ -71,12 +85,23 @@ type Timeline = { token: string | null; ids: string[] };
export default function Workspace({
view: served,
initialBlock = null,
+ initialAt = null,
+ initialMode = "edit",
+ presentInitial = null,
+ readiness = null,
introWritten = null,
hasLedger = false,
generatedBy = null,
}: {
view: PlayViewData;
initialBlock?: string | null;
+ /** `?at=`: seconds into the selected block (the bench's Back to the cut). */
+ initialAt?: number | null;
+ initialMode?: "edit" | WorkspaceMode;
+ /** Present mode's slides, when the page opened on it (else read when it is entered). */
+ presentInitial?: PresentPayload | null;
+ /** The readiness bar's pills as the page read them (ReadinessBar reads them again after a write). */
+ readiness?: Readiness | null;
introWritten?: unknown;
hasLedger?: boolean;
/** The manifest's `generatedBy`: a rebuild overwrites edits made here, said under the top bar. */
@@ -86,17 +111,54 @@ export default function Workspace({
const [view, setView] = useState(served);
useEffect(() => setView(served), [served]);
const project = view.project;
+ // A saved version reviewed or presented (`?take=`): read-only, its own view; Edit is the draft's page.
+ const take = view.take ? { id: view.take.id, label: view.take.label } : null;
+ const takeId = take?.id ?? null;
+ // THE read-only flag (readOnly.ts): derived here once, handed down; every draft writer below refuses on it.
+ const readOnly = workspaceReadOnly(view);
+ const readOnlyRef = useRef(readOnly);
+ readOnlyRef.current = readOnly;
const reloadSeq = useRef(0);
const reloadView = useCallback(async () => {
const mine = ++reloadSeq.current;
try {
- const r = await fetch(`/api/report/play-view?${new URLSearchParams({ project }).toString()}`, { cache: "no-store" });
+ const r = await fetch(`/api/report/play-view?${new URLSearchParams({ project, ...(takeId ? { take: takeId } : {}) }).toString()}`, { cache: "no-store" });
const j = (await r.json()) as PlayViewData & { error?: string };
if (mine === reloadSeq.current && r.ok && !j.error) setView(j);
} catch {
// The view stays as it was.
}
- }, [project]);
+ }, [project, takeId]);
+
+ // ---- the mode (L7b): Edit, Review pass, Present -- in the address, a history entry each ----------------------
+ const [mode, setModeState] = useState<"edit" | WorkspaceMode>(initialMode);
+ const modeRef = useRef(mode);
+ modeRef.current = mode;
+ const setMode = useCallback(
+ (next: "edit" | WorkspaceMode) => {
+ if (next === modeRef.current) return;
+ // Edit of a version is the draft's: its own page.
+ if (next === "edit" && takeId) {
+ router.push(workspaceHref(project));
+ return;
+ }
+ const u = new URL(window.location.href);
+ if (next === "edit") u.searchParams.delete("mode");
+ else u.searchParams.set("mode", next);
+ if (next !== "present") u.hash = "";
+ window.history.pushState(window.history.state, "", `${u.pathname}${u.search}${u.hash}`);
+ setModeState(next);
+ },
+ [router, project, takeId],
+ );
+ useEffect(() => {
+ const onPop = () => {
+ const m = new URL(window.location.href).searchParams.get("mode");
+ setModeState(isWorkspaceMode(m) ? m : "edit");
+ };
+ window.addEventListener("popstate", onPop);
+ return () => window.removeEventListener("popstate", onPop);
+ }, []);
// The one app (CutApp): the bench opened in place over the workspace; the keys are the workspace's only while it shows.
const app = useCutApp();
@@ -140,6 +202,11 @@ export default function Workspace({
const [epoch, setEpoch] = useState(0);
const write = useCallback(
async (op: string, args: Record<string, unknown> = {}) => {
+ // A version on screen: the draft is not what is shown, so nothing writes it (a move, an Undo, a Redo).
+ if (readOnlyRef.current) {
+ setUndo((u) => ({ ...u, busy: false, said: READ_ONLY_SAID, error: true }));
+ return null;
+ }
setUndo((u) => ({ ...u, busy: true, said: null, error: false }));
const token = tl.current.token ?? (await loadTimeline()).token;
let res = await timelineOp(project, token, op, args);
@@ -210,19 +277,20 @@ export default function Workspace({
// announce's two reads an old view's index checked against the new ids could land on the other twin.
const own = fresh && typeof e.timelineAt === "number" && tlIds[e.timelineAt] === e.id ? e.timelineAt : null;
const n = count.get(e.id) ?? 0;
- const at = e.type === "intro" ? null : (own ?? (n === 1 ? tlIds.indexOf(e.id) : null));
+ // A version's (a take's) blocks are never moved (readOnly.ts: its timeline is not the draft's).
+ const at = e.type === "intro" || readOnly ? null : (own ?? (n === 1 ? tlIds.indexOf(e.id) : null));
return {
id: e.id,
type: e.type,
heading: e.type === "clip" ? (e.quote ?? e.heading ?? "") : (e.heading ?? ""),
seconds: p ? Math.max(0, p.it.to - p.it.from) : 0,
at,
- twin: e.type !== "intro" && at === null && n > 1,
+ twin: e.type !== "intro" && !readOnly && at === null && n > 1,
rejected: e.rejected?.label ?? null,
missing: e.type === "clip" && !e.media,
};
});
- }, [view.entries, view.token, itemOf, tlIds, tlToken]);
+ }, [view.entries, view.token, itemOf, tlIds, tlToken, readOnly]);
const entryOf = core.entryOf;
// ---- the selection (the inspector's block), kept in the URL (`?block=`) ----------------
@@ -255,8 +323,9 @@ export default function Workspace({
const p = itemOf.get(selected);
if (!p) return;
placed.current = true;
- engine.seekTo(startOf(planRef.current, p.i));
- }, [itemOf, selected, engine, planRef]);
+ const into = initialAt != null && initialAt > 0 ? Math.min(initialAt, Math.max(0, p.it.to - p.it.from - 0.05)) : 0;
+ engine.seekTo(startOf(planRef.current, p.i) + into);
+ }, [itemOf, selected, engine, planRef, initialAt]);
const step = useCallback(
(d: 1 | -1) => {
if (!blocks.length) return;
@@ -267,6 +336,95 @@ export default function Workspace({
},
[blocks, selected, select],
);
+ // ---- the review pass (L7b): the selection is the block under review; past the last, the verdict ------------
+ const rv = useReviewPass(project, view.entries, mode === "review" && !takeId, readOnly);
+ const [atEnd, setAtEnd] = useState(false);
+ const reviewReady = mode === "review" && (takeId ? true : rv.loaded);
+ const reviewPlaced = useRef(false);
+ // A reload resumes on the block in its address; entering from Edit resumes on the first with no answer.
+ const reviewFromAddress = useRef(initialMode === "review");
+ useEffect(() => {
+ if (mode !== "review") {
+ reviewPlaced.current = false;
+ return;
+ }
+ if (!reviewReady || reviewPlaced.current) return;
+ reviewPlaced.current = true;
+ // Where it stopped: the block in the address (a reload), else the first with no answer, else the verdict.
+ const ids = rv.progress.ids;
+ const fromAddress = reviewFromAddress.current;
+ reviewFromAddress.current = false;
+ if (fromAddress && selected && ids.includes(selected)) return;
+ const at = takeId ? (ids[0] ?? null) : rv.progress.next;
+ if (at) {
+ setAtEnd(false);
+ select(at);
+ } else {
+ setAtEnd(true);
+ setSelected(null);
+ }
+ }, [mode, reviewReady, rv.progress, selected, select, takeId]);
+ const reviewStep = useCallback(
+ (d: 1 | -1, play = false) => {
+ const ids = rv.progress.ids;
+ if (!ids.length) {
+ setAtEnd(true);
+ return;
+ }
+ const i = atEnd ? ids.length : selected ? ids.indexOf(selected) : -1;
+ const to = i + d;
+ if (to >= ids.length) {
+ setAtEnd(true);
+ setSelected(null);
+ setPlaying(false);
+ return;
+ }
+ setAtEnd(false);
+ select(ids[Math.max(0, to)]);
+ if (play) setPlaying(true);
+ },
+ [rv.progress.ids, atEnd, selected, select, setPlaying],
+ );
+ // The viewer plays block by block: it stops where the block under review ends.
+ const lastItem = useRef<string | null>(null);
+ const playingId = core.item?.id ?? null;
+ useEffect(() => {
+ const prev = lastItem.current;
+ lastItem.current = playingId;
+ if (mode !== "review" || !ui.playing) return;
+ if (prev && prev === selected && playingId !== selected) setPlaying(false);
+ }, [playingId, mode, ui.playing, selected, setPlaying]);
+
+ // ---- present (L7b): Present's own deck over the workspace, its slides read on the way in ------------------------
+ const [present, setPresent] = useState<{ state: "ready"; payload: PresentPayload } | { state: "loading" } | { state: "error"; error: string } | null>(
+ presentInitial ? { state: "ready", payload: presentInitial } : null,
+ );
+ const presentRead = useRef(!!presentInitial);
+ const presentSeq = useRef(0);
+ useEffect(() => {
+ if (mode !== "present") {
+ presentRead.current = false;
+ presentSeq.current += 1;
+ return;
+ }
+ setPlaying(false);
+ // Read once per entry (the draft may have changed since the last); a reading overtaken by a newer one is dropped.
+ if (presentRead.current) return;
+ presentRead.current = true;
+ const mine = ++presentSeq.current;
+ setPresent({ state: "loading" });
+ void (async () => {
+ try {
+ const r = await fetch(`/api/report/present?${new URLSearchParams({ project, ...(takeId ? { take: takeId } : {}) }).toString()}`, { cache: "no-store" });
+ const j = (await r.json().catch(() => ({}))) as PresentPayload & { error?: string };
+ if (mine !== presentSeq.current) return;
+ setPresent(r.ok && !j.error ? { state: "ready", payload: j } : { state: "error", error: j.error ?? `HTTP ${r.status}` });
+ } catch (e) {
+ if (mine === presentSeq.current) setPresent({ state: "error", error: e instanceof Error ? e.message : String(e) });
+ }
+ })();
+ }, [mode, project, takeId, setPlaying]);
+
const move = useCallback(
async (id: string, at: number, to: number) => {
if (to < 0 || to >= tl.current.ids.length || to === at) return;
@@ -287,6 +445,7 @@ export default function Workspace({
// ---- edit in place (E): the clip bench over the workspace, Back returns here ----------
const editHere = useCallback((which?: string) => {
+ if (readOnlyRef.current) return;
const id = which ?? (selected && selected !== ADD ? selected : (core.item?.id ?? null));
const e = id ? entryOf.get(id) : null;
if (!e) return;
@@ -307,9 +466,13 @@ export default function Workspace({
// ---- the keys ---------------------------------------------------------------------
const [help, setHelp] = useState(false);
+ const reviewStepRef = useRef(reviewStep);
+ reviewStepRef.current = reviewStep;
useEffect(() => {
const onKey = (ev: KeyboardEvent) => {
if (!shownRef.current) return;
+ // Present's deck has the keys while it is up (present/PresentView.tsx; Esc is its way back to Edit).
+ if (modeRef.current === "present") return;
const tgt = ev.target as HTMLElement | null;
if (ev.key === "Escape" && help) {
setHelp(false);
@@ -321,6 +484,19 @@ export default function Workspace({
if (document.querySelector("dialog:modal")) return;
const k = ev.key;
const mod = ev.metaKey || ev.ctrlKey;
+ // The review pass: Space and ← → walk it (k f n are ReviewPass's); nothing here edits.
+ if (modeRef.current === "review") {
+ if (mod || ev.altKey) return;
+ if (k === " ") setPlaying(!now().playing);
+ else if (k === "ArrowLeft") reviewStepRef.current(-1);
+ else if (k === "ArrowRight") reviewStepRef.current(1);
+ else if (k === "?") setHelp((h) => !h);
+ else return;
+ ev.preventDefault();
+ return;
+ }
+ // A version on screen: no key here writes (undo, redo, a move, E).
+ if (readOnlyRef.current && (mod || ev.altKey || k === "e" || k === "E")) return;
if (mod && !ev.altKey && (k === "z" || k === "Z")) {
if (ev.shiftKey) {
if (undoRef.current.canRedo && !undoRef.current.busy) void doRedo();
@@ -439,15 +615,22 @@ export default function Workspace({
const item = core.item;
return (
+ <WorkspaceReadOnly.Provider value={readOnly}>
<div
data-workspace={project}
+ data-ws-read-only={readOnly ? "" : undefined}
// The draft's token as this page last read it (a spec waits on it before pressing Undo after a save).
data-ws-token={tlToken ?? ""}
data-ws-selected={selected ?? ""}
+ data-ws-mode-now={mode}
className="flex min-h-0 flex-1 flex-col overflow-hidden max-[899px]:pb-[44px]"
>
<WorkspaceTop
project={project}
+ mode={mode}
+ onMode={setMode}
+ version={take}
+ readOnly={readOnly}
title={view.title}
draftLine={view.draft?.line ?? "Draft"}
draftParent={view.draft?.parent ?? null}
@@ -462,6 +645,9 @@ export default function Workspace({
onChanged={() => void reloadView()}
help={() => setHelp(true)}
/>
+ {/* The readiness bar (L7b): quote-check, links, captures, render, X jar -- what the Inbox would say of this
+ piece, each a click to its fix. Read-only. */}
+ {!takeId && <ReadinessBar project={project} initial={readiness} missing={blocks.filter((b) => b.missing).map((b) => b.id)} onSelect={(id) => select(id)} />}
{generatedBy && (
<div className="border-b border-seam px-3 py-1">
<GeneratedBanner generatedBy={generatedBy} />
@@ -530,12 +716,15 @@ export default function Workspace({
selected={selected}
playing={item?.id ?? null}
busy={undo.busy}
- onSelect={(id) => select(id)}
+ onSelect={(id) => {
+ if (mode === "review") setAtEnd(false);
+ select(id);
+ }}
onMove={(id, at, to) => void move(id, at, to)}
- // No menu on a version or take (read-only: nothing writes it from here). lane/review-present's `mode`
- // joins this gate when it merges: `mode === "edit"` too.
- menu={view.take ? undefined : menu}
- plus={
+ marks={mode === "review" ? rv.answers : null}
+ // A block's menu only in Edit on the draft: the workspace's one read-only flag (readOnly.ts) and the mode.
+ menu={mode === "edit" && !readOnly ? menu : undefined}
+ plus={mode !== "edit" || readOnly ? null : (
<button
type="button"
onClick={() => setSelected(selected === ADD ? null : ADD)}
@@ -549,14 +738,14 @@ export default function Workspace({
>
+
</button>
- }
+ )}
/>
</section>
{/* ---- the inspector (a sheet at the bottom under ~900 px) ---- */}
<aside
- aria-label="Inspector"
- data-ws-inspector={selected === ADD ? "add" : (selEntry?.type ?? "project")}
+ aria-label={mode === "review" ? "Review pass" : "Inspector"}
+ data-ws-inspector={mode === "review" ? "review" : selected === ADD ? "add" : (selEntry?.type ?? "project")}
data-ws-sheet={sheetOpen ? "open" : "closed"}
className={cn(
"min-h-0 min-w-0 overflow-y-auto border-seam bg-panel min-[900px]:border-l",
@@ -565,20 +754,58 @@ export default function Workspace({
)}
>
<button type="button" className="flex w-full items-center gap-2 border-b border-seam px-3 py-2 text-left text-[12px] text-text-2 min-[900px]:hidden" onClick={() => setSheetOpen((o) => !o)} aria-expanded={sheetOpen} data-ws-sheet-toggle="">
- <span className="micro">Inspector</span>
- <span className="font-mono">{selected === ADD ? "add" : (selected ?? "the project")}</span>
+ <span className="micro">{mode === "review" ? "Review pass" : "Inspector"}</span>
+ <span className="font-mono">{mode === "review" ? `${rv.progress.done} / ${rv.progress.total}` : selected === ADD ? "add" : (selected ?? "the project")}</span>
<span className="ml-auto">{sheetOpen ? "▾" : "▴"}</span>
</button>
- <div key={`${selected ?? "-"}:${epoch}`}>
- {selected === ADD ? (
- <AddPanels project={project} after={blocks.length ? blocks[blocks.length - 1].id : null} channels={postChannels} />
- ) : (
- <WorkspaceInspector project={project} entry={selEntry} hasLedger={hasLedger} hasClips={!!firstClip} introWritten={introWritten} />
- )}
- </div>
+ {mode === "review" ? (
+ // The review pass hides the inspector: its column is the pass.
+ <ReviewPass
+ project={project}
+ rv={rv}
+ entry={atEnd ? null : selEntry}
+ atEnd={atEnd || !selEntry}
+ take={take}
+ readOnly={readOnly}
+ draft={view.draft ?? null}
+ onPrev={() => reviewStep(-1)}
+ onNext={() => reviewStep(1)}
+ onAnswered={() => reviewStep(1, true)}
+ onExit={() => setMode("edit")}
+ />
+ ) : (
+ <div key={`${selected ?? "-"}:${epoch}`}>
+ {selected === ADD ? (
+ <AddPanels project={project} after={blocks.length ? blocks[blocks.length - 1].id : null} channels={postChannels} />
+ ) : (
+ <WorkspaceInspector project={project} entry={selEntry} hasLedger={hasLedger} hasClips={!!firstClip} introWritten={introWritten} readOnly={readOnly} openInDraft={take ? openInDraftHref(project, take.id) : null} />
+ )}
+ </div>
+ )}
</aside>
</div>
+ {mode === "present" && (
+ <div className="fixed inset-0 z-[70]" data-ws-present={present?.state ?? "loading"}>
+ {present?.state === "ready" ? (
+ <PresentView payload={present.payload} back={workspaceHref(project)} playHref={playHref(project, { take: takeId })} onExit={() => setMode("edit")} />
+ ) : (
+ <div className="flex h-full flex-col items-start gap-2 bg-black p-6 text-[13px] text-white/80">
+ {present?.state === "error" ? (
+ <p role="alert" className="text-reject-text" data-present-error="">
+ {present.error}
+ </p>
+ ) : (
+ <p data-present-loading="">reading the slides…</p>
+ )}
+ <button type="button" className="ink-link text-amber-300" onClick={() => setMode("edit")} data-present-exit="">
+ ‹ Back to Edit
+ </button>
+ </div>
+ )}
+ </div>
+ )}
+
{help && (
<div role="dialog" aria-modal="true" aria-label="Keys" className="fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4" onClick={() => setHelp(false)} data-ws-keys="">
<div className="w-full max-w-[440px] rounded-[3px] border border-seam-2 bg-panel p-4 text-[12.5px] text-text-2" onClick={(e) => e.stopPropagation()}>
@@ -600,6 +827,7 @@ export default function Workspace({
</div>
)}
</div>
+ </WorkspaceReadOnly.Provider>
);
}
diff --git a/umtool/components/projects/workspace/WorkspaceInspector.tsx b/umtool/components/projects/workspace/WorkspaceInspector.tsx
@@ -143,7 +143,39 @@ function PostInspector({ project, entry }: { project: string; entry: PlayEntry }
);
}
-export default function WorkspaceInspector({ project, entry, hasLedger, hasClips, introWritten }: { project: string; entry: PlayEntry | null; hasLedger: boolean; hasClips: boolean; introWritten: unknown }) {
+export default function WorkspaceInspector({
+ project,
+ entry,
+ hasLedger,
+ hasClips,
+ introWritten,
+ readOnly = false,
+ openInDraft = null,
+}: {
+ project: string;
+ entry: PlayEntry | null;
+ hasLedger: boolean;
+ hasClips: boolean;
+ introWritten: unknown;
+ /** The workspace's read-only flag (readOnly.ts): a saved version on screen -- no panel that writes the draft. */
+ readOnly?: boolean;
+ openInDraft?: string | null;
+}) {
+ if (readOnly) {
+ return (
+ <>
+ <Head kind={entry?.type ?? "Version"} id={entry?.id ?? null} />
+ <p className="m-0 px-3 py-2 text-[12px] text-muted" data-ws-inspector-read-only="">
+ A saved version is read-only: its panels would write the draft.{" "}
+ {openInDraft && (
+ <Link href={openInDraft} prefetch={false} className="ink-link">
+ Open in draft
+ </Link>
+ )}
+ </p>
+ </>
+ );
+ }
if (entry?.type === "clip") return <ClipInspector project={project} entry={entry} />;
if (entry?.type === "post") return <PostInspector project={project} entry={entry} />;
if (entry?.type === "teaser") {
@@ -172,7 +204,7 @@ export default function WorkspaceInspector({ project, entry, hasLedger, hasClips
<>
<Head kind={entry.type} id={entry.id} />
<p className="m-0 px-3 py-2 text-[12px] text-muted" data-ws-inspector-none={entry.type}>
- {entry.heading ? `“${entry.heading}”. ` : ""}A {entry.type} is edited on the Cut tab.
+ {entry.heading ? `“${entry.heading}”. ` : ""}A {entry.type} is edited on the cut as a list (Piece ▾).
</p>
</>
);
diff --git a/umtool/components/projects/workspace/WorkspacePage.tsx b/umtool/components/projects/workspace/WorkspacePage.tsx
@@ -1,29 +1,59 @@
+import Link from "next/link";
import type { ProjectRef } from "@/lib/project-types";
import { readManifest } from "@/lib/projects/report.mjs";
import { playView } from "@/lib/report/playView.mjs";
-import { workspaceHref } from "@/lib/hrefs";
+import { presentPayload } from "@/lib/report/present.mjs";
+import { isWorkspaceMode, workspaceHref } from "@/lib/hrefs";
+import { readinessOf } from "@/lib/inbox/readiness";
import { NotesProvider } from "@/components/notes/NotesProvider";
import { RememberCut } from "@/components/shell/RecentCuts";
import CutApp from "../cutApp/CutApp";
import ReportProject from "../ReportProject";
import type { PlayViewData } from "../review/PlayCut";
+import type { PresentPayload } from "../present/PresentView";
import Workspace from "./Workspace";
// `/projects/<project>` for a report video -- THE WORKSPACE (umtool redesign L7a; components/projects/workspace/
// Workspace.tsx): the draft playing, its blocks, the inspector, one screen. `?block=<id>` opens with that block
-// selected. A project whose draft cannot be read is the piece page, which says why. The piece page's tabs stay
-// at `?tab=` (lib/projects/kinds.mjs opensWorkspace).
+// selected (`&at=` seconds into it). `?mode=review` the review pass, `?mode=present` present mode (L7b), either
+// with `?take=<version>` for a saved version, read-only. A project whose draft cannot be read is the piece page,
+// which says why. The piece page's tabs stay at `?tab=` (lib/projects/kinds.mjs opensWorkspace).
export default async function WorkspacePage({ project, search }: { project: ProjectRef; search: Record<string, string | undefined> }) {
- const [view, m] = await Promise.all([playView(project, {}), readManifest(project.dir).catch(() => null)]);
- if ("error" in view) return <ReportProject project={project} search={{ ...search, tab: "overview" }} />;
+ const mode = isWorkspaceMode(search.mode) ? search.mode : "edit";
+ const take = mode !== "edit" && search.take ? search.take : null;
+ const [view, m, present, readiness] = await Promise.all([
+ playView(project, { take }),
+ readManifest(project.dir).catch(() => null),
+ mode === "present" ? presentPayload(project, { take, canUncensor: true }) : Promise.resolve(null),
+ take ? Promise.resolve(null) : readinessOf(project),
+ ]);
+ if ("error" in view) {
+ if (!take) return <ReportProject project={project} search={{ ...search, tab: "overview" }} />;
+ return (
+ <main data-ws-error="" className="flex h-full flex-col items-start gap-2 p-6 text-[13px]">
+ <p className="text-reject-text">{String(view.error)}</p>
+ <Link href={workspaceHref(project.id)} className="ink-link">
+ ‹ the draft
+ </Link>
+ </main>
+ );
+ }
const manifest = (m ?? {}) as { render?: { intro?: unknown }; ledger?: unknown; ledgerSchema?: unknown; generatedBy?: unknown };
+ const at = Number(search.at);
return (
<CutApp project={project.id} home={workspaceHref(project.id)} kind="workspace" playTop={null}>
<RememberCut project={project.id} title={(view as PlayViewData).title || project.name || project.id} />
<NotesProvider target={{ project: project.id }}>
+ {/* Keyed on the address's mode and take: a navigation that changes either (Versions ▾ → Review, a pill, "Done —
+ back to Edit" from a version) is a fresh workspace, so its mode and the cut it shows never part (L7b). */}
<Workspace
+ key={`${mode}:${take ?? ""}`}
view={view as PlayViewData}
initialBlock={search.block ?? null}
+ initialAt={Number.isFinite(at) && at > 0 ? at : null}
+ initialMode={mode}
+ presentInitial={present && !("error" in present) ? (present as unknown as PresentPayload) : null}
+ readiness={readiness}
introWritten={manifest.render?.intro ?? null}
hasLedger={Array.isArray(manifest.ledger) || !!manifest.ledgerSchema}
generatedBy={typeof manifest.generatedBy === "string" ? manifest.generatedBy : null}
diff --git a/umtool/components/projects/workspace/WorkspaceTop.tsx b/umtool/components/projects/workspace/WorkspaceTop.tsx
@@ -5,8 +5,8 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { Mark } from "@/components/shell/Wordmark";
import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
-import { clipBenchHref, openInDraftHref, playHref, presentHref, projectHref, projectsHref, takesHref } from "@/lib/hrefs";
-import { PIECE_TABS } from "@/lib/pieces/tabs.mjs";
+import { openInDraftHref, playHref, projectHref, projectsHref, takesHref, versionReviewHref, workspaceHref, type WorkspaceMode } from "@/lib/hrefs";
+import { PIECE_TABS, PIECE_VIEWS } from "@/lib/pieces/tabs.mjs";
import CopyShareLine from "../CopyShareLine";
import { startTakeJob } from "../NewTakePanel";
import { announceManifestChanged } from "../timelineApi";
@@ -19,8 +19,8 @@ import { announceManifestChanged } from "../timelineApi";
//
// Versions ▾ lists every saved version (and legacy take): Play it read-only, Open it in the draft (it asks
// first, and saves the draft as a version when it has edits -- OpenInDraftPage), and Save version (the
-// draft frozen as the next vN: `umtool takes save`). The mode switch's Review pass and Present go to
-// today's walk and present pages until L7b brings them in here. Look writes render.mode (`umtool look
+// draft frozen as the next vN: `umtool takes save`). The mode switch (L7b) is the workspace's own: Edit, the
+// Review pass (`?mode=review`), Present (`?mode=present`) -- links, so a new tab opens each. Look writes render.mode (`umtool look
// <p> mode=basic|deck`); Render queues a take of the draft (`umtool take`); Share copies the share line
// of the selected clip (`umtool share`). Piece ▾ is the piece page's tabs (Sources, Deliver, History …).
// ---------------------------------------------------------------------------
@@ -101,6 +101,9 @@ function VersionsMenu({ project, versions, onSaved }: { project: string; version
<span className="min-w-0 flex-1 truncate text-muted" title={v.label}>
{v.label}
</span>
+ <Link href={versionReviewHref(project, v.id)} prefetch={false} className="ink-link" data-ws-version-review={v.id} title="its review pass: watched block by block, read-only, its verdict at the end">
+ Review
+ </Link>
<Link href={playHref(project, { take: v.id })} prefetch={false} className="ink-link" data-ws-version-play={v.id} title="play it read-only">
Play
</Link>
@@ -205,8 +208,18 @@ function RenderMenu({ project }: { project: string }) {
export type UndoState = { busy: boolean; said: string | null; error: boolean; canRedo: boolean };
+const MODES: { id: "edit" | WorkspaceMode; label: string; title: string }[] = [
+ { id: "edit", label: "Edit", title: "the draft: its blocks, the inspector" },
+ { id: "review", label: "Review pass", title: "the draft block by block: Keep · Fix · Note each (k f n), a verdict at the end" },
+ { id: "present", label: "Present ⛶", title: "the cut as slides, full screen, navigated like a deck (Esc back)" },
+];
+
export default function WorkspaceTop({
project,
+ mode = "edit",
+ onMode,
+ version = null,
+ readOnly = false,
title,
draftLine,
draftParent,
@@ -228,7 +241,7 @@ export default function WorkspaceTop({
draftEdits: number | null;
versions: Version[];
basic: boolean;
- /** The walk starts here (Review pass, until L7b). */
+ /** The cut's first clip (unused since L7b's review pass; kept for callers). */
firstClip: string | null;
/** The clip whose share line Share copies: the selected one, else the one on screen. */
shareClip: string | null;
@@ -238,6 +251,12 @@ export default function WorkspaceTop({
/** Something the bar wrote (a version, the look): the workspace reads the draft again. */
onChanged: () => void;
help: () => void;
+ mode?: "edit" | WorkspaceMode;
+ onMode?: (m: "edit" | WorkspaceMode) => void;
+ /** A saved version reviewed or presented read-only (`?take=`): nothing here writes the draft. */
+ version?: { id: string; label: string } | null;
+ /** The workspace's one read-only flag (readOnly.ts): nothing on the bar writes the draft. */
+ readOnly?: boolean;
}) {
return (
<header data-app-header="workspace" data-ws-top="" className="flex flex-wrap items-center gap-x-2.5 gap-y-1 border-b border-seam bg-panel px-3 py-1.5">
@@ -253,31 +272,51 @@ export default function WorkspaceTop({
{title}
</h1>
</nav>
- <span className="font-mono text-[11.5px] text-text-2" data-ws-draft={draftParent ?? ""} data-ws-draft-edits={draftEdits ?? ""} title="the working draft: every edit lands in it (video.manifest.json)">
- {draftLine}
- </span>
- <VersionsMenu project={project} versions={versions} onSaved={onChanged} />
- <nav aria-label="Mode" className="inline-flex items-center rounded-[3px] border border-seam-2 p-0.5 text-[12px]" data-ws-mode="edit">
- <span aria-current="page" className="rounded-[2px] bg-panel-2 px-2 py-0.5 font-medium text-text" data-ws-mode-edit="">
- Edit
- </span>
- {firstClip ? (
- <Link href={clipBenchHref(project, firstClip)} prefetch={false} className="rounded-[2px] px-2 py-0.5 text-muted-2 hover:text-text" data-ws-mode-review="" title="walk the draft's clips, a verdict each (the walk, until the review pass lands here)">
- Review pass
+ {version ? (
+ <span className="inline-flex items-baseline gap-2 font-mono text-[11.5px] text-text-2" data-ws-version-shown={version.id} title={version.label}>
+ {version.id} · read-only
+ <Link href={openInDraftHref(project, version.id)} prefetch={false} className="ink-link font-sans" data-ws-version-open-draft="">
+ Open in draft
</Link>
- ) : (
- <span className="px-2 py-0.5 text-seam-2" title="no clip to walk">
- Review pass
- </span>
- )}
- <Link href={presentHref(project)} prefetch={false} className="rounded-[2px] px-2 py-0.5 text-muted-2 hover:text-text" data-ws-mode-present="" title="the cut as slides, full screen, navigated like a deck">
- Present ⛶
- </Link>
+ <Link href={workspaceHref(project)} prefetch={false} className="ink-link font-sans" data-ws-version-back="">
+ the draft
+ </Link>
+ </span>
+ ) : (
+ <span className="font-mono text-[11.5px] text-text-2" data-ws-draft={draftParent ?? ""} data-ws-draft-edits={draftEdits ?? ""} title="the working draft: every edit lands in it (video.manifest.json)">
+ {draftLine}
+ </span>
+ )}
+ <VersionsMenu project={project} versions={versions} onSaved={onChanged} />
+ <nav aria-label="Mode" className="inline-flex items-center rounded-[3px] border border-seam-2 p-0.5 text-[12px]" data-ws-mode={mode}>
+ {MODES.map((m) => {
+ const on = m.id === mode;
+ const href = m.id === "edit" ? workspaceHref(project) : workspaceHref(project, { mode: m.id, take: version?.id ?? null });
+ return (
+ <a
+ key={m.id}
+ href={href}
+ aria-current={on ? "page" : undefined}
+ {...{ [`data-ws-mode-${m.id}`]: "" }}
+ title={m.title}
+ onClick={(e) => {
+ if (!onMode || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
+ e.preventDefault();
+ onMode(m.id);
+ }}
+ className={on ? "rounded-[2px] bg-panel-2 px-2 py-0.5 font-medium text-text" : "rounded-[2px] px-2 py-0.5 text-muted-2 hover:text-text"}
+ >
+ {m.label}
+ </a>
+ );
+ })}
</nav>
- <LookSwitch project={project} basic={basic} onChanged={onChanged} />
- <RenderMenu project={project} />
+ {!readOnly && <LookSwitch project={project} basic={basic} onChanged={onChanged} />}
+ {!readOnly && <RenderMenu project={project} />}
{shareClip && <CopyShareLine key={shareClip} project={project} clip={shareClip} testid="ws" />}
<span className="ml-auto inline-flex items-center gap-1">
+ {!readOnly && (
+ <>
<button type="button" className={btn("quiet")} disabled={undo.busy} onClick={onUndo} data-ws-undo="" title="take back the newest edit to the draft (⌘Z / Ctrl+Z; umtool timeline <p> undo)">
Undo
</button>
@@ -289,16 +328,27 @@ export default function WorkspaceTop({
{undo.said}
</span>
)}
- <Menu label="Piece ▾" testid="piece" align="right" title="the piece page's tabs">
+ </>
+ )}
+ <Menu label="Piece ▾" testid="piece" align="right" title="the piece page's tabs: Sources, Deliver, History (and the views the workspace does not hold yet)">
{(close) => (
<ul className="m-0 flex list-none flex-col p-0">
- {PIECE_TABS.map((t) => (
+ {/* lib/pieces/tabs.mjs PIECE_TABS: this screen is the first of them. */}
+ {PIECE_TABS.filter((t) => t.id !== "workspace").map((t) => (
<li key={t.id}>
<Link href={projectHref(project, { tab: t.id })} prefetch={false} onClick={close} className="block rounded-[2px] px-2 py-1 text-text-2 hover:bg-panel-2 hover:text-text" data-ws-piece-tab={t.id}>
{t.label}
</Link>
</li>
))}
+ <li aria-hidden className="my-1 border-t border-seam" />
+ {PIECE_VIEWS.map((t) => (
+ <li key={t.id}>
+ <Link href={projectHref(project, { tab: t.id })} prefetch={false} onClick={close} className="block rounded-[2px] px-2 py-1 text-muted-2 hover:bg-panel-2 hover:text-text" data-ws-piece-tab={t.id}>
+ {t.label}
+ </Link>
+ </li>
+ ))}
</ul>
)}
</Menu>
diff --git a/umtool/components/projects/workspace/readOnly.ts b/umtool/components/projects/workspace/readOnly.ts
@@ -0,0 +1,25 @@
+"use client";
+
+import { createContext, useContext } from "react";
+
+// ---------------------------------------------------------------------------
+// THE WORKSPACE'S ONE READ-ONLY RULE (umtool redesign L7b): a saved version shown in the workspace (`?take=`, its
+// review pass or present mode) is read-only -- nothing reachable from the screen writes the DRAFT while it shows
+// another cut. Derived ONCE (Workspace.tsx: `workspaceReadOnly(view)`), then handed down: as a prop to the
+// workspace's own parts, and through this context to anything mounted under it (the inspector's panels, the
+// strip's menus). Every draft writer refuses while it is true: the timeline writes (move, undo, redo), E, the
+// inspector, the review pass's marks.
+// ---------------------------------------------------------------------------
+
+/** The rule: a version (a take) on screen is read-only. */
+export function workspaceReadOnly(view: { take?: unknown }): boolean {
+ return !!view.take;
+}
+
+export const WorkspaceReadOnly = createContext(false);
+
+/** True while the workspace shows a saved version: a writer under it refuses. */
+export const useWorkspaceReadOnly = () => useContext(WorkspaceReadOnly);
+
+/** What a refused write says. */
+export const READ_ONLY_SAID = "a saved version is read-only: Open in draft to change it";
diff --git a/umtool/components/ui/modalOpen.ts b/umtool/components/ui/modalOpen.ts
@@ -0,0 +1,7 @@
+// Is a modal up anywhere on the page -- a native <dialog> opened modally (the ⌘K palette), or an element that says
+// `aria-modal="true"` (the workspace's Keys)? A page's own keys stand aside while one is, whatever has the focus:
+// the modal has the keyboard (umtool redesign L7b: the review pass's k f n, present mode's arrows and Esc).
+export function aModalIsOpen(): boolean {
+ if (typeof document === "undefined") return false;
+ return !!document.querySelector("dialog[open], [aria-modal='true']");
+}
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -42,6 +42,8 @@ Inbox cannot disagree about what is wrong with one.
| `window <project> <clip> --align` · `--quote-ruled` / `--no-quote-ruled` | the cut snapped to the quote as HEARD (0.15 s before its first word, 0.3 s after its last, the extent widened to hold it, `lockCut`); a person's ruling on the quote check (a take renders a ruled clip) |
| `window <project> <clip> --take <take> …` | a **take's** clip (walk a take): the same fields, written into the take's patch (`takes/<take>/take.json`) with an undo point first; the project's manifest is untouched ([clip-bench.md](clip-bench.md#walking-a-take)) |
| `walk <project> [--take <take>] [--all] [--json]` | the clip bench's **walk**: every clip in walk order with its window, verdict and whether a fetched file holds it, and (→) the ones the walk visits — fetched and needing a verdict; `--all` every fetched one; `--take` walks a take (a draft too); the bench's address to start at. The intro (`render.intro`) is listed first, watched, not judged (`intro`, `stops` in `--json`) |
+| `review-pass <project> [ls] [--json]` · `review-pass <project> mark <block> keep\|fix\|clear [--note T]` | the workspace's **review pass** (`?mode=review`): every block but the intro and a clip rejected for a cut reason, its answer and the block the pass resumes on; a Fix ("needs work", saying what) is a mark in `<project>/review-pass.json` on any block, a clip too — never a clip's verdict (`incorrect` is the bench's fact-error ruling, never written or overwritten here); a clip's Keep is its walk verdict (`window --verdict confirmed`), a post's or a card's a mark — `mark` writes one (a Fix needs `--note`; a clip takes `fix` and `clear`) ([knobs.md](knobs.md#the-review-pass)) |
+| `review-pass <project> verdict like\|maybe\|no\|clear [--note T] [--json]` | the pass's **verdict on the draft**, one locked call: a draft that differs from its parent version only by what the walk and the review pass write (verdict, correction, reason, reject note, walk note, ★) judges the PARENT and saves nothing; otherwise the draft is saved as the next version and that is judged (`takes/verdicts.json`) |
| `present <project> [--take <take> \| --cut] [--json] [--public] [--open] [--url <origin>]` | **present mode**: the cut as slides, navigated like a deck (`/projects/<p>/present`) — prints the address and every slide (its kind, id — a post's `<channel>/<id>`, a clip's id, `section-<n>`, `day-<YYYY-MM-DD>` — date, words and censor counts); `--json` the payload (each post's card as Play draws it and its censor data by kind, each clip's spans, the dividers); `--public` the payload a public page would carry (censored, no reveal data); `--open` opens it; `<address>#<slide id>` opens a slide ([knobs.md](knobs.md#present-mode-the-cut-as-slides-navigated-like-a-deck)) |
| `set <project> <clip> key=value …` | a clip's **knobs**: `claim.at` `claim.hold` `claim.stamp` `claim.count` `claim.label` (the first mark's, or `--mark <id>`'s), its **marks** `mark.add=<verdict>[@<sec>]` `mark.remove=<id>` `mark.verdict=<verdict>` `marks=<json>`, `audio.offset` `audio.gain` `audio.fadeIn` `audio.fadeOut`, its picture's **blur** `blur.on=true` `blur.caption=…` `blur.strength` `blur.from` `blur.to` (`blur.on=` clears it; [knobs.md](knobs.md#a-clips-picture-blurred)), its **effects** `fx.zoom=<json>` `fx.receipts=<json>` `fx.punch=…` `fx.quote` `fx.punchIn=<json>` `fx.speakers=<json>` (`fx=<json>` all of them, `fx=` clears them; a shot is a file in the project; [knobs.md](knobs.md#effects)); `key=` clears one ([knobs.md](knobs.md#marks)) |
| `intro <project> [key=value …] [--off] [--json]` · `intro <project> --take <take> --off\|--on` | **the intro** the cut opens on (`render.intro`): with no key, prints it as written, what the cut opens with (a `title-card`'s words resolved) and each version's on/off; `key=value` writes it through the look writer (`style` `seconds` 3.5–8 `mark` `ground` `sound` (`false` silent) `site` `title` `lines` (`a\|b`, ≤ 3) and the brand's keys; `key=` clears one; a new intro starts as `boot-dark`); `--off` takes it off the cut; `--take <t> --off` that version opens on no intro (its patch's `render.intro: null`), `--on` on the cut's again. **Exit 1** on a value the build refuses ([knobs.md](knobs.md#the-intro-played-and-edited)) |
@@ -190,6 +192,9 @@ draft (the project's manifest); *project*: a project's other files, or reads; *c
| `link <project> [<article>] [--clear]` | the manifest names the article it is the video of | form · *draft* |
| `window <project> <clip> [--start N] [--end N] [--lock] [--lock-end] [--no-lock-end] [--cut-start N] [--cut-end N] [--lock-cut] [--align] [--title TITLE] [--date DATE] [--cite N] [--cite-url CITE-URL] [--quote QUOTE] [--repeat-of REPEAT-OF] [--verdict confirmed\|incorrect] [--correction CORRECTION] [--reject not-matching\|wrong-speaker\|irrelevant\|repeats\|weak\|privacy\|other] [--note NOTE] [--walk-note WALK-NOTE] [--star] [--no-star] [--quote-ruled] [--no-quote-ruled] [--move-stamp MOVE-STAMP] [--clear-stamp] [--move-mute nearest] [--clear-mute] [--gap GAP…] [--gap-remove N] [--gaps GAPS] [--take TAKE]` | a clip's window, cut, attribution and verdict | form · *draft* |
| `walk <project> [--take TAKE] [--all]` | the clip bench's walk: clips in walk order, verdicts, fetched | form · *project* |
+| `review-pass <project> ls` | the review pass: each block's answer, and where it resumes | form · *project* |
+| `review-pass <project> mark <block> keep\|fix\|clear [--note NOTE]` | a block's review-pass mark: keep (a post, a card), fix (needs work, saying what; any block) or clear | form · *project* |
+| `review-pass <project> verdict like\|maybe\|no\|clear [--note NOTE]` | the draft's verdict at the pass's end: its parent's when only review fields differ, else saved as a version and judged | form · *project* |
| `present <project> [--take TAKE] [--cut] [--public]` | present mode's address and slides | form · *project* |
| `set <project> <clip> key=value… [--mark MARK] [--take TAKE]` | a clip's knobs: claim, marks, audio, blur, fx … | form · *draft* |
| `intro <project> [key=value…] [--off] [--take TAKE] [--on]` | the intro the cut opens on (render.intro) | form · *draft* |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -717,14 +717,42 @@ expected the cut). A take is a **saved version** — FROZEN:
## The workspace (one screen per report video)
`/projects/<p>` — a report video's own address — is **the workspace** (umtool redesign L7a): one screen at 1366×768,
-nothing scrolling but the strip and the inspector. The piece page's tabs are `?tab=` (`?tab=overview` written out;
-the piece head's ⋯ **More → Open the workspace** comes back), and a claimed project's own address is its workspace too (its tabs still go
-to the article's piece). `?block=<id>` opens with that block selected.
+nothing scrolling but the strip and the inspector. A claimed project's own address is its workspace too (its tabs
+still go to the article's piece). `?block=<id>` opens with that block selected (`&at=<s>` that far into it);
+`?mode=review` is [the review pass](#the-review-pass), `?mode=present` [present mode](#present-mode-the-cut-as-slides-navigated-like-a-deck),
+either with `&take=<version>` for a saved version, read-only (L7b). Each mode is a history entry: Back returns.
+
+**The piece's tabs are four since L7b** (`lib/pieces/tabs.mjs` PIECE_TABS): **Workspace** (this screen), **Sources**,
+**Deliver**, **History**. What the seven held and where it is now:
+
+| Was | Now |
+|---|---|
+| Build (the build chain, the final mp4) | on **Deliver**, above its own panels — `?tab=build` 307s there (temporary: this content moves again) |
+| Media (the drafted fields, the upload's text, the on-screen panel, the review and narration links) | on **Deliver** — `?tab=media` 307s there |
+| Overview (the Next card, the piece's decisions and their settles, the stats, the article and its iterations, the README) | still `?tab=overview`, a view out of the tab bar (**Piece ▾ → Overview**, the piece head's ⋯): the workspace does not hold it yet |
+| Cut (the timeline as a list and its every tool: fetch windows, candidates, groups, prep, voices, removed clips …) | still `?tab=cut`, **Piece ▾ → The cut as a list**: its tools have no home in the workspace yet |
+
+An article piece keeps all nine of its tabs (its video's Build and Media are tabs of their own there).
+
+**The old addresses (L7b, each a 308):** `/present` → `?mode=present` (its `take` kept), a take's walk
+`/takes/<t>/walk` → `?mode=review&take=<t>`, a BARE `/play` → the workspace. What the workspace does not hold yet
+stays at its own address: the **clip bench** `/clip/<id>` (the walk steps bare `/clip/<id>` addresses, and the
+inspector's **Full bench** is one: the verdict bar, the reader, the answer), the **post bench** `/post/<id>`, the
+**claim bench** `/claim/<id>` (a ledger entry, ±90 s of its context: no block of the strip holds it), the **drafts
+review** `/review` (the drafted fields' approvals a final build checks — not the walk), **Play's own page** (any
+query: `?cut=1`, `?take=`, `?clip=`, `?note=`), the montage deck (`/clips`), `/takes/compare` and `/trailer`.
+
+**The readiness bar**, under the top bar (beside the generated-manifest banner): one pill each — **Quote check**,
+**Links**, **Captures**, **Render**, **X jar** — showing **✓** (fine), a **count**, **!** (blocking) or **—** (does not
+apply), read from what the Inbox reads for this piece (the reducer's decisions, the piece's calls, X's jar:
+`GET /api/report/readiness`, `lib/inbox/readiness.mjs`). A click goes to the fix: the piece's decisions (their
+one-press settles), home's Run quote-check, the version to judge, the editor's settings; a clip with no media
+fetched selects its block. Read-only; its terminal twins are `umtool check <p>` and `umtool decisions`.
| Knob | UI | CLI twin |
|---|---|---|
-| the draft's line, versions | the top bar: **Draft · from v2 · 3 edits**; **Versions ▾** — each version's **Play** (read-only) and **Open in draft**, and **Save version** | `umtool takes ls <p>` · `takes open <p> <t>` · `takes save <p>` |
-| mode | **Edit** · **Review pass** (the walk, until L7b brings it in) · **Present ⛶** | `umtool walk <p>` · `umtool present <p>` |
+| the draft's line, versions | the top bar: **Draft · from v2 · 3 edits**; **Versions ▾** — each version's **Review** (its review pass, read-only), **Play** (read-only) and **Open in draft**, and **Save version** | `umtool takes ls <p>` · `takes open <p> <t>` · `takes save <p>` |
+| mode | **Edit** · **Review pass** (`?mode=review`) · **Present ⛶** (`?mode=present`) | `umtool review-pass <p>` · `umtool present <p>` |
| look | **Look Basic \| Deck** (`render.mode`) | `umtool look <p> mode=basic\|deck` |
| render the draft | **Render ▾** — **Render 60 s**, **Render full** (a take of the draft, queued) | `umtool take <p> --at 0 --dur 60` · `umtool take <p> --full` |
| share | **Copy share line** for the selected clip (else the one on screen) | `umtool share <p> <clip>` |
@@ -771,11 +799,50 @@ to the article's piece). `?block=<id>` opens with that block selected.
undo point. A redo renames the point back to `auto-before-<op>`, so the next Undo takes the redone edit back again
(`lib/report/manifest.mjs` redoStructural). `undo-saved` and `redone-*` keep their newest 200, as the undo points do.
+### The review pass
+
+`?mode=review` — the top bar's **Review pass** — walks the draft BLOCK BY BLOCK (it replaces the walk as the way
+through a cut; the clip bench stays the deep tool for one clip). The inspector's column is the pass; the viewer
+plays the block under review and stops where it ends. Every block but the intro (watched, never judged) and a clip
+rejected for a cut reason is in it, **"4 / 12 reviewed"**, and it resumes on the first block with no answer.
+
+| Answer | Key | A clip | A post, a card, a video entry |
+|---|---|---|---|
+| **Keep** | k | its walk verdict, `confirmed` (the bench's writer) — only while it has none or is confirmed | `keep` in `<p>/review-pass.json` |
+| **Fix** — "needs work", saying what | f | a `fix` mark with that text in `review-pass.json` — **never** its verdict | the same |
+| **Note** | n | the notes composer, anchored to the block (`notes.json`) | the same |
+
+A clip the BENCH ruled `incorrect` (a fact error, wrong speaker) is answered already: the pass shows that verdict
+and its words, **Keep** is off ("marked incorrect in the bench"), and **Full bench** is where it changes — the pass
+never writes `incorrect` (that is the fact-error verdict: a blocking `clip-incorrect` and `umtool corrections`) and
+never overwrites it. A mark wins over a verdict in what the pass shows; Keep on a clip carrying a Fix takes the
+mark back.
+
+Keep and Fix move on to the next block and play it; **← →** step without answering; Space plays and pauses. The
+strip marks each answered block (✓ kept, ✎ to fix). Past the last block: the **verdict** — **Like · Maybe · No**,
+L4's writer (`takes/verdicts.json`), one locked call on the server: a draft that differs from its parent version
+only by what the walk and the review pass write (a verdict, its correction and reason, a walk note, the ★) judges the
+PARENT and saves nothing (**Judged v5**); otherwise the draft is saved as the next version and that is judged
+(**Saved v6 and judged it**). A version reviewed (`&take=`) is judged as itself. **Done** is back to
+Edit. A version's pass is read-only: watched and noted, never marked (Keep and Fix are off; **Open in draft**
+changes it). The take walk's old address (`/takes/<t>/walk`) is that version's pass (a 308).
+
+| | CLI twin |
+|---|---|
+| each block's answer, where the pass resumes | `umtool review-pass <p> [ls] [--json]` |
+| a post's or a card's answer; any block's Fix | `umtool review-pass <p> mark <block> keep\|fix\|clear [--note T]` (a clip: `fix`, `clear`) |
+| a clip's Keep | `umtool window <p> <clip> --verdict confirmed` |
+| a note on a block | `umtool notes <p>` (reading); the app writes it |
+| the verdict | `umtool review-pass <p> verdict like\|maybe\|no\|clear` (a version: `umtool takes verdict <p> <v> …`) |
+
## Play the cut (the whole cut, or a take, with no render)
-`/projects/<p>/play` — the head's **▶ Play the draft**, or a version's **Play** on the takes page
+`/projects/<p>/play?cut=1` — the head's **▶ Play the draft**, or a version'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. **With no `take` it plays THE DRAFT** (above), where every edit lands; `?cut=1` is the same. It plays 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 DRAFT** (above), where every edit lands. Since L7b a BARE `/play` (no query at
+all) is the workspace's — a 308 to `/projects/<p>`, whose viewer plays the draft — so Play's own page is always asked
+for with a query (`?cut=1`, `?take=`, `?clip=`, `?note=`; `playHref` writes `?cut=1`), until the workspace holds its
+notes column, the reel strip's edits and the assistant. 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
@@ -931,10 +998,12 @@ Then the cut: the Build tab's **final** preset (a full build, about an hour for
## Present mode (the cut as slides, navigated like a deck)
-`/projects/<p>/present` — **Present** beside Play in the project's head and on a take's card
-(`/projects/<p>/present?take=<id>`; `?cut=1` the manifest alone) — shows the cut one SLIDE at a time, full stage, and
+`/projects/<p>?mode=present` — the workspace's **Present ⛶**, **Present** in the project's head and on a take's card
+(`&take=<id>`) — shows the cut one SLIDE at a time, full screen over the workspace, and
moves like a slide deck (operator, 8 Nov 2026: "present X posts … navigated like a PowerPoint presentation including
-settings like toggled censors"). With no `take` it presents the latest take, as Play does. The slides are Play's own
+settings like toggled censors"). With no `take` it presents the draft. **Esc** (the settings closed) or **Edit · Esc**
+is back to the workspace's Edit. The old `/projects/<p>/present` 308s here, its `take` kept (the slide's `#id` rides
+the browser's redirect). A 9:16 cut (`render.format: "vertical"`) presents tall. The slides are Play's own
view cut up (`lib/report/present.mjs`, no AI, nothing fetched or rendered):
- a **post** slide per post item, drawn by Play's player (the card page the build screenshots, its attachments in their
diff --git a/umtool/e2e/add-clip.spec.ts b/umtool/e2e/add-clip.spec.ts
@@ -27,6 +27,21 @@ test.afterEach(() => {
if (had) for (const f of clipFiles()) if (!had.has(f)) rmSync(path.join(CLIPS, f), { force: true });
had = null;
});
+// And whatever this file's fetches left that landed after a test ended (the stub editor writes the window when its
+// job runs, which can be after the page saw the job end): every spec after this one reads vid1's windows, and a
+// wider one changes their numbers (clip-bench.spec: peaks, `ready N of M`).
+let before: Set<string> | null = null;
+test.beforeAll(() => {
+ before = new Set(clipFiles());
+});
+test.afterAll(async () => {
+ for (let i = 0; i < 20; i += 1) {
+ const extra = clipFiles().filter((f) => before && !before.has(f));
+ for (const f of extra) rmSync(path.join(CLIPS, f), { force: true });
+ if (!extra.length && i >= 4) break;
+ await new Promise((r) => setTimeout(r, 250));
+ }
+});
test("Add a clip: find the words, in and out on the cues, after a row, added and fetched", async ({ page }) => {
test.setTimeout(120_000);
diff --git a/umtool/e2e/bench-shell.spec.ts b/umtool/e2e/bench-shell.spec.ts
@@ -136,7 +136,8 @@ test("the claim bench: its context on the reader, the cited cue lit, j/k from an
test("the drafts review is a bench: j/k light a field, the bar asks about it, a approves, r goes to the note", async ({ page }) => {
await page.goto(urls.reviewHref(REVIEW, { view: "list" }));
await expect(page.locator("[data-bench-top] [data-bench-kind]")).toHaveText("Drafts review");
- await expect(page.locator("[data-bench-back]")).toHaveAttribute("href", urls.projectHref(REVIEW, { tab: "media" }));
+ // Media folded into Deliver (L7b): the drafts' own tab.
+ await expect(page.locator("[data-bench-back]")).toHaveAttribute("href", urls.projectHref(REVIEW, { tab: "deliver" }));
const rows = page.locator("[data-draft-row]");
await expect(rows).toHaveCount(3);
const bar = page.locator("[data-verdict-bar]");
diff --git a/umtool/e2e/draft-versions.spec.ts b/umtool/e2e/draft-versions.spec.ts
@@ -102,7 +102,8 @@ test("Play is the draft, named by its parent; a version plays read-only; Open in
await expect(ask).toHaveAttribute("data-open-draft-saves", "");
await page.screenshot({ path: test.info().outputPath("open-in-draft.png") });
await ask.locator("[data-open-draft-confirm]").click();
- await expect(page).toHaveURL(/\/projects\/reports\/draft-versions-fixture\/play$/);
+ // Play of the draft (Play's own page always carries a query since L7b: a bare /play is the workspace's).
+ await expect(page).toHaveURL(/\/projects\/reports\/draft-versions-fixture\/play\?cut=1(&|$)/);
await expect(page.locator("[data-play-draft]")).toContainText("Draft · from v1 · no edits", { timeout: 20_000 });
expect(manifestText()).toBe(base("v1"));
expect(draftFrom()).toBe("v1");
diff --git a/umtool/e2e/fixtures/editor-stub-services.mjs b/umtool/e2e/fixtures/editor-stub-services.mjs
@@ -2,7 +2,9 @@
// what a spec put there (`POST /__stub/services {alerts, x}`, the stub's own door, no token; `{}` resets to no
// alerts) -- the payload editor/app/lib/cookieAlerts.ts serves, so the Inbox's X jar row (lib/inbox/xJar.ts)
// reads the same shape it reads from the real editor. Nothing here asks X anything.
-const state = { alerts: [], pending: [], x: null };
+// `down: true`: the services route answers 503, as an editor that is not up does (readiness.spec.ts: the X jar pill
+// is "—" then, never ✓).
+const state = { alerts: [], pending: [], x: null, down: false };
/** The spec's door. True when it answered. */
export function servicesControl(req, res, url, { json, readBody }) {
@@ -11,6 +13,7 @@ export function servicesControl(req, res, url, { json, readBody }) {
state.alerts = Array.isArray(body?.alerts) ? body.alerts : [];
state.pending = Array.isArray(body?.pending) ? body.pending : [];
state.x = body?.x && typeof body.x === "object" ? body.x : null;
+ state.down = body?.down === true;
json(res, 200, { ok: true, alerts: state.alerts.length });
});
return true;
@@ -20,6 +23,7 @@ export function servicesControl(req, res, url, { json, readBody }) {
export function servicesRoute(req, res, url, { json }) {
if (req.method !== "GET" || url.pathname !== "/api/ops/services") return false;
req.resume();
+ if (state.down) return json(res, 503, { error: "the editor is down (stub)" }), true;
json(res, 200, { ok: true, alerts: state.alerts, pending: state.pending, ...(state.x ? { x: state.x } : {}) });
return true;
}
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -2181,6 +2181,28 @@ makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out
writeFileSync(wsFile, JSON.stringify(wsM, null, 2) + "\n");
}
+// THE REVIEW PASS (review-pass.spec.ts, umtool redesign L7b, WRITES: walk verdicts, review-pass.json, a note, a
+// version and its verdict): workspace-fixture's cut -- c01 c02 p-5 k01 c03 c04 -- under its own name.
+{
+ const { dir: rpDir } = makePlayCutFixture({
+ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"),
+ name: "review-pass-fixture", title: "The Review Pass Fixture", video: "vid1",
+ });
+ const rpFile = path.join(rpDir, "video.manifest.json");
+ const rpM = JSON.parse(readFileSync(rpFile, "utf8"));
+ rpM.render.chrome.factcheck.verdicts.CORROBORATED.tallyLabel = "Seized";
+ // c03 on vid1 (its cues in the corpus) far past any window a spec fetches: a clip never fetched whose source
+ // answers -- the readiness bar's captures count (readiness.spec.ts), never a build-dies row.
+ rpM.timeline = rpM.timeline.map((e) => (e.id === "c03" ? { ...e, video: "vid1", start: 300, end: 302, cite: 300 } : e));
+ // c04 ruled in the bench -- wrong speaker, a fact error: the pass shows it and never overwrites it (L7b review 6).
+ rpM.timeline = rpM.timeline.map((e) => (e.id === "c04" ? { ...e, verdict: "incorrect", reason: "wrong-speaker", correction: "it is the co-host speaking" } : e));
+ rpM.timeline.splice(2, 0, {
+ type: "post", id: "p-5", post: "postchan-x/5", platform: "x", author: "Post Subject", handle: "postsubject",
+ date: "2026-10-30T12:00:00.000Z", text: "The scale said 291 this morning. I said the scale was broken.", url: "https://x.com/postsubject/status/5", subjects: ["postsubject"],
+ });
+ writeFileSync(rpFile, JSON.stringify(rpM, null, 2) + "\n");
+}
+
// A BLOCK'S MENU (block-menus.spec.ts, umtool redesign L8b, WRITES): the workspace fixture's cut, its own copy --
// c01 c02 p-5 k01 c03 c04 (k01 a chapter card) -- the spec inserts a card from c01's menu, moves and removes
// blocks, and undoes each.
@@ -2590,6 +2612,12 @@ makeRunTraceFixture({ articles: ARTICLES, source: `local:${RESEARCH_PUBLIC}` });
// WHAT NEEDS YOU (needs-you.spec.ts, redesign L4): a cut with a rendered version to judge, clips to walk and quote
// checks out of date; a Rumble QR naming its folder (Use embed ids); a live case with a transcript since its scan.
makeNeedsYouFixture({ reports, reportsRoot: dest, channels: CHANNELS, deckManifest, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
+// THE READINESS BAR (readiness.spec.ts, umtool redesign L7b, READ-ONLY): the same calls under its own names -- needs-you.spec
+// settles its own -- for one pill each: quote checks out of date, versions to judge, a dead Rumble QR, a clip not fetched.
+makeNeedsYouFixture({
+ reports, reportsRoot: dest, channels: CHANNELS, deckManifest, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture,
+ names: { project: "readiness-fixture", title: "The Readiness Fixture", links: "readiness-links", linksTitle: "The Readiness Links", withCase: false },
+});
console.log(`fixture at ${dest}`);
console.log(` SITES_DIR=${SITES}`);
diff --git a/umtool/e2e/fixtures/needs-you-fixture.mjs b/umtool/e2e/fixtures/needs-you-fixture.mjs
@@ -39,11 +39,14 @@ const write = (dir, name, doc) => {
};
/**
- * @param {{ reports: string, reportsRoot: string, channels: string, deckManifest: Function, manifest: Function, cachedWindow: string, makePlayCutFixture: Function }} o
+ * @param {{ reports: string, reportsRoot: string, channels: string, deckManifest: Function, manifest: Function, cachedWindow: string, makePlayCutFixture: Function,
+ * names?: { project: string, title: string, links: string, linksTitle: string, withCase: boolean } }} o
+ * `names`: a second copy under its own names (readiness.spec.ts, umtool redesign L7b: the workspace's readiness bar
+ * reads the same calls, and needs-you.spec writes its own), with no case.
*/
-export function makeNeedsYouFixture({ reports, reportsRoot, channels, deckManifest, manifest, cachedWindow, makePlayCutFixture }) {
+export function makeNeedsYouFixture({ reports, reportsRoot, channels, deckManifest, manifest, cachedWindow, makePlayCutFixture, names = { project: NY_PROJECT, title: NY_TITLE, links: NY_LINKS, linksTitle: NY_LINKS_TITLE, withCase: true } }) {
// ---- the cut: versions to judge, clips not walked, quote checks out of date ----
- const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name: NY_PROJECT, title: NY_TITLE });
+ const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name: names.project, title: names.title });
const file = path.join(dir, "video.manifest.json");
const m = JSON.parse(readFileSync(file, "utf8"));
m.timeline = m.timeline.map((e) => (e.id === "c01" ? { ...e, verdict: "confirmed" } : e));
@@ -66,8 +69,8 @@ export function makeNeedsYouFixture({ reports, reportsRoot, channels, deckManife
const rv = path.join(rch, "data", NY_FOLDER);
write(rv, "metadata.info.json", { id: NY_EMBED, title: "The NY Rumble Recording", webpage_url: `https://rumble.com/${NY_FOLDER}-the-ny-rumble-recording.html` });
write(rv, "transcript.cues.json", { title: "The NY Rumble Recording", duration: 60, cues: [{ start: 0, end: 60, text: "a rumble." }] });
- const lm = manifest(NY_LINKS, NY_LINKS_TITLE, { siteOrigin: NY_SITE, channelSlug: NY_RUMBLE }, [{ type: "clip", id: "n01", video: NY_FOLDER, start: 10, end: 14, cite: 10, section: 0, quote: "a rumble." }]);
- const ldir = path.join(reports, NY_LINKS);
+ const lm = manifest(names.links, names.linksTitle, { siteOrigin: NY_SITE, channelSlug: NY_RUMBLE }, [{ type: "clip", id: "n01", video: NY_FOLDER, start: 10, end: 14, cite: 10, section: 0, quote: "a rumble." }]);
+ const ldir = path.join(reports, names.links);
write(ldir, "video.manifest.json", lm);
const [qr] = linksOf(lm);
if (!qr) throw new Error("needs-you-fixture: the Rumble clip draws no QR");
@@ -85,6 +88,7 @@ export function makeNeedsYouFixture({ reports, reportsRoot, channels, deckManife
],
});
+ if (!names.withCase) return { dir, ldir, cdir: null };
// ---- a live case, scanned on 1 Nov, its channel transcribed since ----
const now = "2026-11-01T00:00:00.000Z";
const cdir = path.join(reportsRoot, ".umtool", "research", NY_CASE);
diff --git a/umtool/e2e/intro-play.spec.ts b/umtool/e2e/intro-play.spec.ts
@@ -75,10 +75,11 @@ test("Present opens the deck on the intro slide, playing the build's page", asyn
await expect(root).not.toHaveAttribute("data-present-slide", "brand-intro");
});
-test("the walk lists the intro first: the walk's stops (a version's old walk address is Open in draft, L3)", async ({ page, request }) => {
- // v1 is the cut as written (its rendered manifest is the draft's bytes): nothing to copy, straight on to Play.
+test("the walk lists the intro first: the walk's stops (a version's old walk address is its review pass, L7b)", async ({ page, request }) => {
+ // A version's take walk is its review pass now (a 308): watched block by block, read-only.
await page.goto(urls.takeWalkHref(PROJECT, "v1"));
- await expect(page).toHaveURL(new RegExp(`/projects/${PROJECT}/play$`));
+ await expect(page).toHaveURL(new RegExp(`${urls.versionReviewHref(PROJECT, "v1").replace(/[?]/g, "\\?")}$`));
+ await expect(page.locator("[data-review-pass]")).toHaveAttribute("data-review-pass", "v1", { timeout: 30_000 });
const w = (await (await request.get(`/api/report/walk?project=${encodeURIComponent(PROJECT)}`)).json()) as { stops: string[]; intro: { style: string } | null; first: string | null };
expect(w.stops[0]).toBe("brand-intro");
expect(w.intro?.style).toBe("title-card");
diff --git a/umtool/e2e/phone-walk.spec.ts b/umtool/e2e/phone-walk.spec.ts
@@ -285,7 +285,7 @@ test("Play → Edit this clip → move an edge → Back: the new bounds are what
await page.locator("body").press("Shift+BracketLeft");
await expect(back).toHaveText("Save and back to the cut");
await back.click();
- await expect(page).toHaveURL(/\/play\?clip=c02/, { timeout: 20_000 });
+ await expect(page).toHaveURL(/\/play\?(cut=1&)?clip=c02/, { timeout: 20_000 });
await expect(root).toHaveAttribute("data-play-item", "c02");
expect(entryOf(PLAY, "c02").start).toBe(3);
await expect(root).toHaveAttribute("data-play-source", "3-5.5");
@@ -329,7 +329,7 @@ test("Play → Edit this clip → move an edge → Back: the new bounds are what
const back = page.locator("[data-walk-back-play]");
await expect(back).toHaveText("Save, back to the cut");
await back.click();
- await expect(page).toHaveURL(/\/play\?clip=c01/, { timeout: 20_000 });
+ await expect(page).toHaveURL(/\/play\?(cut=1&)?clip=c01/, { timeout: 20_000 });
await expect(root).toHaveAttribute("data-play-item", "c01");
expect(entryOf(PLAY, "c01").end).toBe(9);
await expect(root).toHaveAttribute("data-play-source", `${before.start}-9`);
diff --git a/umtool/e2e/piece.spec.ts b/umtool/e2e/piece.spec.ts
@@ -21,7 +21,7 @@ const PIECE = `p:${PROJECT}`;
const tab = (page: Page, id: string) => page.getByTestId(`piece-tab-${id}`);
const keysReady = (page: Page) => expect(page.locator("[data-piece-keys=ready]")).toBeAttached();
-test("the frame: title, trail, stepper at Video, the Next card, seven tabs with the Overview lit", async ({ page }) => {
+test("the frame: title, trail, stepper at Video, the Next card, four tabs (L7b) with the workspace's lit on its Overview", async ({ page }) => {
const res = await page.goto(urls.projectHref(PROJECT, { tab: "overview" }));
expect(res?.status()).toBe(200);
const crumbs = page.getByRole("navigation", { name: "Breadcrumb" });
@@ -43,10 +43,12 @@ test("the frame: title, trail, stepper at Video, the Next card, seven tabs with
await expect(steps.nth(1)).toHaveAttribute("title", "no article");
await expect(steps.nth(3)).toHaveAttribute("data-step", "todo");
+ // Four tabs since the workspace (L7b): the Overview is one of its views, out of the tab bar.
const tabs = page.getByRole("navigation", { name: "Piece" }).getByRole("link");
- await expect(tabs).toHaveText([/^Overview/, /^Cut/, /^Media/, /^Build/, /^Deliver/, /^Sources/, /^History/]);
- await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page");
- await expect(tab(page, "cut")).toHaveText("Cut4");
+ await expect(tabs).toHaveText([/^Workspace/, /^Sources/, /^Deliver/, /^History/]);
+ await expect(tab(page, "workspace")).toHaveAttribute("aria-current", "page");
+ await expect(tab(page, "workspace")).toHaveAttribute("href", urls.workspaceHref(PROJECT));
+ await expect(tab(page, "workspace")).toHaveText("Workspace4");
await expect(tab(page, "sources")).toHaveText("Sources2");
// The Overview: the Next card, the project's decisions, its stats -- and none
@@ -82,12 +84,14 @@ test("the tab is the URL: ?tab=, ?all=1 on the Cut, a bad tab the Overview, and
await expect(page.locator("[data-sources]")).toBeVisible();
await expect(page.locator("[data-next]")).toHaveCount(0);
+ // The cut's list and the Overview are the workspace's views (L7b): its tab is lit on them.
await page.goto(urls.projectHref(PROJECT, { all: true }));
- await expect(tab(page, "cut")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator("[data-piece-tab]")).toHaveAttribute("data-piece-tab", "cut");
+ await expect(tab(page, "workspace")).toHaveAttribute("aria-current", "page");
await expect(page.locator("[data-entry=c01][data-kind]")).toBeVisible();
await page.goto(`${urls.projectHref(PROJECT)}?tab=nonsense`);
- await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator("[data-piece-tab]")).toHaveAttribute("data-piece-tab", "overview");
// /browse/<project> (before P3) rides the redirect to the project's own address: its workspace (L7a);
// the Overview is written out.
@@ -95,7 +99,7 @@ test("the tab is the URL: ?tab=, ?all=1 on the Cut, a bad tab the Overview, and
await expect(page).toHaveURL(new RegExp(`/projects/${PROJECT}$`));
await expect(page.locator(`[data-workspace="${PROJECT}"]`)).toBeVisible();
await page.goto(urls.projectHref(PROJECT, { tab: "overview" }));
- await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator("[data-piece-tab]")).toHaveAttribute("data-piece-tab", "overview");
// Clicking a tab is a link: the address changes, the section is there.
await tab(page, "history").click();
@@ -111,7 +115,7 @@ test("a note's link opens the tab its anchor is drawn on", async ({ page, reques
const id = ((await add.json()) as { note: { id: string } }).note.id;
try {
await page.goto(urls.projectHref(PROJECT, { note: id }));
- await expect(tab(page, "cut")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator("[data-piece-tab]")).toHaveAttribute("data-piece-tab", "cut");
await expect(page.locator("[data-anchored-notes='c02']")).toHaveAttribute("data-open-notes", "1");
} finally {
await request.post(`/api/notes?project=${PROJECT}`, { data: { op: { op: "delete", id } } });
@@ -167,14 +171,14 @@ test("the lifecycle chip: Mark done says it hid the piece from Active, and Undo
}
});
-test("keys: 1–7 open the tabs, n runs the Next card's action; typing in a field is left alone", async ({ page }) => {
+test("keys: 1–4 open the tabs (1 the workspace), n runs the Next card's action; typing in a field is left alone", async ({ page }) => {
await page.goto(urls.projectHref(PROJECT, { tab: "overview" }));
await keysReady(page);
await page.keyboard.press("2");
- await expect(page).toHaveURL(/\?tab=cut$/);
- await expect(tab(page, "cut")).toHaveAttribute("aria-current", "page");
+ await expect(page).toHaveURL(/\?tab=sources$/);
+ await expect(tab(page, "sources")).toHaveAttribute("aria-current", "page");
await keysReady(page);
- await page.keyboard.press("7");
+ await page.keyboard.press("4");
await expect(page).toHaveURL(/\?tab=history$/);
await keysReady(page);
// The snapshot label is a field: a digit typed there is a digit.
@@ -185,8 +189,9 @@ test("keys: 1–7 open the tabs, n runs the Next card's action; typing in a fiel
await expect(page).toHaveURL(/\?tab=history$/);
await label.evaluate((el: HTMLElement) => el.blur());
await page.keyboard.press("1");
- await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator(`[data-workspace="${PROJECT}"]`)).toBeVisible({ timeout: 30_000 });
+ await page.goto(urls.projectHref(PROJECT, { tab: "overview" }));
await keysReady(page);
const href = await page.locator("[data-next-action] > a:visible").getAttribute("href");
await page.keyboard.press("n");
@@ -398,14 +403,15 @@ test("an article drafted from a research board: at Research (its sweep running,
// field and all at once -- with the on-screen panel moved in from Build.
// fixtures/bench-shell-fixture.mjs: media-tab-fixture, written here alone.
// ---------------------------------------------------------------------------
-test("the Media tab: every drafted field with where it came from, approve per field and all, on-screen moved from Build", async ({ page }) => {
+test("the Media tab, folded into Deliver (L7b): every drafted field with where it came from, approve per field and all, on-screen and the build beside it", async ({ page }) => {
await page.setViewportSize({ width: 1366, height: 768 });
const P = "reports/media-tab-fixture";
await page.goto(urls.projectHref(P, { tab: "media" }));
- await expect(tab(page, "media")).toHaveAttribute("aria-current", "page");
+ await expect(page).toHaveURL(new RegExp(`${urls.projectHref(P, { tab: "deliver" }).replace(/[?]/g, "\\?")}$`));
+ await expect(tab(page, "deliver")).toHaveAttribute("aria-current", "page");
// One number: the fields awaiting review -- the two drafted titles and the release-25 narration its
// draft file records -- on the tab, in the header and on the Inbox's drafts card.
- await expect(tab(page, "media")).toHaveText("Media3");
+ await expect(tab(page, "deliver")).toHaveText("Deliver3");
const media = page.getByRole("region", { name: "Media drafts" });
await expect(media.locator("[data-media-counts]")).toHaveText("3 fields · 0 approved · 3 to review");
await expect(media.locator("[data-draft-row]")).toHaveCount(3);
@@ -448,15 +454,16 @@ test("the Media tab: every drafted field with where it came from, approve per fi
await expect(media.locator("[data-approve-all]")).toHaveCount(0);
// Nothing awaits review: the tab says no number, and the Inbox has no drafts card for it.
await page.reload();
- await expect(tab(page, "media")).toHaveText("Media");
+ await expect(tab(page, "deliver")).toHaveText("Deliver");
const inbox = (await (await page.request.get("/api/browse/decisions")).json()) as { items: { kind: string; project?: string }[] };
expect(inbox.items.filter((d) => d.kind === "drafts-unreviewed" && d.project === P)).toEqual([]);
- // The on-screen panel is Media's now; the Build tab is the build.
+ // The on-screen panel and the build, on Deliver both (Build folded in too).
await expect(page.getByTestId("onscreen-section")).toBeVisible();
const w = await page.evaluate(() => document.documentElement.scrollWidth);
expect(w).toBeLessThanOrEqual(1366);
await page.goto(urls.projectHref(P, { tab: "build" }));
- await expect(page.getByTestId("onscreen-section")).toHaveCount(0);
+ await expect(page).toHaveURL(new RegExp(`${urls.projectHref(P, { tab: "deliver" }).replace(/[?]/g, "\\?")}$`));
+ await expect(page.getByTestId("onscreen-section")).toBeVisible();
await expect(page.locator("[data-build-options]")).toBeVisible();
});
diff --git a/umtool/e2e/play-engine.spec.ts b/umtool/e2e/play-engine.spec.ts
@@ -105,8 +105,9 @@ test("the clock is the sound's: one AudioContext, nodes started ahead of their t
});
test("the picture: WebCodecs in this browser, a dissolve is two layers; the <video> path does the same", async ({ page }) => {
- for (const [q, want] of [["", "webcodecs"], ["?picture=element", "element"]] as const) {
- await page.goto(urls.playHref(PROJECT) + q);
+ for (const [q, want] of [["", "webcodecs"], ["picture=element", "element"]] as const) {
+ // Play's own address always carries a query (L7b: a bare /play is the workspace's).
+ await page.goto(urls.playHref(PROJECT) + (q ? `&${q}` : ""));
await expect(root(page)).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 });
await page.locator('[data-play-row="c02"]').press("Enter");
await expect(root(page)).toHaveAttribute("data-play-picture", want, { timeout: 15_000 });
diff --git a/umtool/e2e/play-take-edit.spec.ts b/umtool/e2e/play-take-edit.spec.ts
@@ -75,7 +75,7 @@ test("Play on a version → Edit asks to open it in the draft (the draft saved f
// Back to the cut: Play of the draft, the same clip; the draft is from tight, one edit.
await page.locator("[data-back-to-play]").click();
- await expect(page).toHaveURL(/\/play\?clip=t01b/);
+ await expect(page).toHaveURL(/\/play\?(cut=1&)?clip=t01b/);
await expect(root).toHaveAttribute("data-play-item", "t01b", { timeout: 20_000 });
await expect(root).toHaveAttribute("data-play-cut", "");
await expect(page.locator("[data-play-draft]")).toContainText(`Draft · from ${TAKE} · 1 edit`);
diff --git a/umtool/e2e/play-walk.spec.ts b/umtool/e2e/play-walk.spec.ts
@@ -244,7 +244,7 @@ test("Back and Forward step between Play and the bench; the bench on its own goe
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(page).toHaveURL(/\/play\?(cut=1&)?clip=c03/);
await expect(root(page)).toHaveAttribute("data-play-item", "c03", { timeout: 20_000 });
});
diff --git a/umtool/e2e/post-happy-path.spec.ts b/umtool/e2e/post-happy-path.spec.ts
@@ -56,7 +56,7 @@ test("a post video from Add posts to a queued render, all by clicking", async ({
// 3. Play, from the head: no /play typed.
await page.locator('[data-play-link="header"]').click();
- await expect(page).toHaveURL(/\/play$/);
+ await expect(page).toHaveURL(/\/play\?cut=1(&|$)/);
await expect(page.locator("[data-play-cut]")).toBeVisible();
// 5. A take, rendered: the take maker's job starts from a press.
diff --git a/umtool/e2e/present.spec.ts b/umtool/e2e/present.spec.ts
@@ -183,3 +183,69 @@ test("the project head links to present mode", async ({ page }) => {
await page.goto(urls.projectHref(PROJECT, { tab: "cut" }));
await expect(page.locator('[data-present-link="header"]')).toHaveAttribute("href", urls.presentHref(PROJECT));
});
+
+// THE WORKSPACE'S PRESENT MODE (umtool redesign L7b): the same deck, over the workspace, at `?mode=present`.
+test("in the workspace: Present ⛶ is the deck full screen, the arrows move it, Esc is back to Edit; the old /present 308s here", async ({ page }) => {
+ await page.goto(urls.workspaceHref(PROJECT));
+ await expect(page.locator("[data-ws-mode-present]")).toHaveAttribute("href", urls.presentHref(PROJECT));
+ await page.locator("[data-ws-mode-present]").click();
+ await expect(page).toHaveURL(/[?&]mode=present/);
+ await expect(root(page)).toHaveAttribute("data-present-slide", "section-0", { timeout: 30_000 });
+ // Full screen: the deck covers the window, nothing of the workspace shows around it.
+ const box = await root(page).boundingBox();
+ expect(box).toMatchObject({ x: 0, y: 0, width: 1366, height: 768 });
+ await page.keyboard.press("ArrowRight");
+ await expect(root(page)).toHaveAttribute("data-present-slide", "c01");
+ await expect(page).toHaveURL(/mode=present#c01$/);
+ await shot(page, "ws-present.png");
+ // ⌘K over the deck: its Esc closes the palette, never present mode under it; the arrows are the palette's.
+ await page.keyboard.press("Control+k");
+ const jump = page.locator("dialog[open]");
+ await expect(jump).toBeVisible();
+ await page.keyboard.press("ArrowRight");
+ await expect(root(page)).toHaveAttribute("data-present-slide", "c01");
+ await page.keyboard.press("Escape");
+ await expect(jump).toHaveCount(0);
+ await expect(root(page)).toHaveCount(1);
+ // Esc: the settings first, when open; then back to Edit.
+ await page.keyboard.press("s");
+ await expect(page.locator("[data-present-settings]")).toBeVisible();
+ await page.keyboard.press("Escape");
+ await expect(page.locator("[data-present-settings]")).toHaveCount(0);
+ await expect(root(page)).toHaveCount(1);
+ await page.keyboard.press("Escape");
+ await expect(root(page)).toHaveCount(0);
+ await expect(page).not.toHaveURL(/mode=/);
+ await expect(page.locator("[data-ws-mode-edit]")).toHaveAttribute("aria-current", "page");
+ // The browser's Back: presenting again, on the slide it left.
+ await page.goBack();
+ await expect(root(page)).toHaveAttribute("data-present-slide", "c01", { timeout: 30_000 });
+ // The old address: a 308 to the mode, its take kept.
+ for (const [old, now] of [
+ [urls.legacyPresentHref(PROJECT), urls.presentHref(PROJECT)],
+ [urls.legacyPresentHref(PROJECT, { take: "v1" }), urls.presentHref(PROJECT, { take: "v1" })],
+ ]) {
+ const res = await page.request.get(old, { maxRedirects: 0 });
+ expect(res.status(), old).toBe(308);
+ expect(res.headers()["location"], old).toBe(now);
+ }
+});
+
+test("a 9:16 cut presents tall (the stacked vertical deck); on a phone the deck fits the width", async ({ page }) => {
+ const V = "reports/vertical-deck-fixture";
+ await page.goto(urls.presentHref(V));
+ await expect(root(page)).toHaveAttribute("data-present-slide", /.+/, { timeout: 30_000 });
+ const stage = await page.locator("[data-present-stage]").boundingBox();
+ expect(stage).not.toBeNull();
+ expect(stage!.height).toBeGreaterThan(stage!.width * 1.6);
+ await shot(page, "ws-present-tall.png");
+ await page.setViewportSize({ width: 390, height: 844 });
+ await page.goto(urls.presentHref(PROJECT));
+ await expect(root(page)).toHaveAttribute("data-present-slide", "section-0", { timeout: 30_000 });
+ expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
+ await expect(page.locator("[data-present-exit]")).toBeInViewport();
+ await page.locator('[data-present-zone="next"]').click();
+ await expect(root(page)).toHaveAttribute("data-present-slide", "c01");
+ await page.locator("[data-present-exit]").click();
+ await expect(root(page)).toHaveCount(0);
+});
diff --git a/umtool/e2e/readiness.spec.ts b/umtool/e2e/readiness.spec.ts
@@ -0,0 +1,124 @@
+import { test, expect, type APIRequestContext, type Page } from "@playwright/test";
+import { mkdirSync } from "node:fs";
+import path from "node:path";
+import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE READINESS BAR (umtool redesign L7b; workspace/ReadinessBar.tsx, lib/inbox/readiness.mjs): under the
+// workspace's top bar, one pill each -- quote check, links, captures, render, X jar -- read from the calls the
+// Inbox reads (L4), each a click to its fix or its page. Read-only.
+//
+// readiness-fixture / readiness-links (READ-ONLY; needs-you-fixture.mjs under their own names): quote checks out
+// of date (c02 stale, c01 c03 c04 never checked), v1 and `short` rendered with no verdict, c03 never fetched; a
+// Rumble QR naming its folder (dead). X's jar: the stub editor's services, put up here and taken down after.
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/readiness-fixture";
+const L = "reports/readiness-links";
+const STUB = `http://127.0.0.1:${portFor("EDITOR_STUB_PORT")}`;
+const X_ALERT = { service: "x", label: "X", family: "x", state: "stale", kind: "jar-age", since: "2026-11-09T09:00:00.000Z", raisedAt: "2026-11-09T09:00:00.000Z", headline: "X cookies are 3 h old (limit 60 min)", fix: "Refresh cookies on /settings.", detail: "2 X jobs are queued." };
+const services = (request: APIRequestContext, alerts: unknown[]) => request.post(`${STUB}/__stub/services`, { data: { alerts } });
+const pill = (page: Page, id: string) => page.locator(`[data-ws-readiness] [data-ready-pill="${id}"]`);
+const SHOTS = process.env.L7B_SHOTS ?? "";
+
+test.beforeEach(async ({ page, request }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await services(request, []);
+});
+test.afterAll(async ({ request }) => {
+ await services(request, []);
+});
+
+test("five pills under the top bar, the generated banner's row kept; the page still never scrolls", async ({ page }) => {
+ await page.goto(urls.workspaceHref(P));
+ const bar = page.locator("[data-ws-readiness]");
+ await expect(bar).toBeVisible({ timeout: 30_000 });
+ expect(await bar.locator("[data-ready-pill]").evaluateAll((els) => els.map((e) => e.getAttribute("data-ready-pill")))).toEqual(["quote-check", "links", "captures", "render", "x-jar"]);
+ // Right under the top bar.
+ const top = await page.locator("[data-ws-top]").boundingBox();
+ const row = await bar.boundingBox();
+ expect(Math.abs(row!.y - (top!.y + top!.height))).toBeLessThan(2);
+ expect(await page.evaluate(() => document.documentElement.scrollHeight <= window.innerHeight)).toBe(true);
+ if (SHOTS) {
+ mkdirSync(SHOTS, { recursive: true });
+ await page.screenshot({ path: path.join(SHOTS, "ws-readiness.png") });
+ }
+});
+
+test("quote check: 4 out of date (the Inbox's quote-check-stale rows), its click home's Run quote-check", async ({ page }) => {
+ await page.goto(urls.workspaceHref(P));
+ await expect(pill(page, "quote-check")).toHaveAttribute("data-ready-state", "count", { timeout: 30_000 });
+ await expect(pill(page, "quote-check")).toHaveAttribute("data-ready-count", "4");
+ await expect(pill(page, "quote-check")).toHaveAttribute("title", /c02: .*cut or quote changed/);
+ await expect(pill(page, "quote-check")).toHaveAttribute("href", urls.homeHref());
+});
+
+test("links: the dead Rumble QR is ! (blocking), its click the piece's decisions where Use embed ids is", async ({ page }) => {
+ await page.goto(urls.workspaceHref(L));
+ await expect(pill(page, "links")).toHaveAttribute("data-ready-state", "bad", { timeout: 30_000 });
+ await expect(pill(page, "links")).toHaveAttribute("title", /v6nyslug/);
+ await expect(pill(page, "links")).toHaveAttribute("href", urls.projectHref(L, { tab: "overview" }));
+ await pill(page, "links").click();
+ await expect(page.locator("[data-settle-button='links']").first()).toHaveText("Use embed ids (1)", { timeout: 30_000 });
+});
+
+test("captures: a source the build would die at is ! (the reducer's clip-no-cues), its click the piece's decisions", async ({ page }) => {
+ // The fixture's recordings have no cues in the corpus (testchan/playvid, nofetch): blocking, as the Inbox says.
+ await page.goto(urls.workspaceHref(P));
+ await expect(pill(page, "captures")).toHaveAttribute("data-ready-state", "bad", { timeout: 30_000 });
+ await expect(pill(page, "captures")).toHaveAttribute("title", /no transcript\.cues\.json/);
+ await expect(pill(page, "captures")).toHaveAttribute("href", urls.projectHref(P, { tab: "overview" }));
+});
+
+test("captures: on a cut whose sources answer, the clip never fetched is counted, and its click selects that block", async ({ page }) => {
+ // review-pass-fixture: vid1's cues are in the corpus; c03 (vid1 300-302) was never fetched.
+ const W = "reports/review-pass-fixture";
+ await page.goto(urls.workspaceHref(W));
+ await expect(pill(page, "captures")).toHaveAttribute("data-ready-count", /\d/, { timeout: 30_000 });
+ await expect(pill(page, "captures")).toHaveAttribute("data-ready-state", "count");
+ await expect(pill(page, "captures")).toHaveAttribute("data-ready-count", "1");
+ await expect(pill(page, "captures")).toHaveAttribute("title", /c03: no media fetched/);
+ await pill(page, "captures").click();
+ await expect(page.locator('[data-ws-block="c03"]')).toHaveAttribute("aria-selected", "true");
+ await expect(page).toHaveURL(/[?&]block=c03/);
+});
+
+test("render: two versions to judge (v1, short), its click the first one's review pass", async ({ page }) => {
+ await page.goto(urls.workspaceHref(P));
+ await expect(pill(page, "render")).toHaveAttribute("data-ready-state", "count", { timeout: 30_000 });
+ await expect(pill(page, "render")).toHaveAttribute("data-ready-count", "2");
+ const href = await pill(page, "render").getAttribute("href");
+ expect([urls.versionReviewHref(P, "v1"), urls.versionReviewHref(P, "short")]).toContain(href);
+});
+
+test("X jar: — with no X post and no X work waiting; ! while the editor says X work waits on a stale jar", async ({ page, request }) => {
+ await page.goto(urls.workspaceHref(P));
+ await expect(pill(page, "x-jar")).toHaveAttribute("data-ready-state", "none", { timeout: 30_000 });
+ await services(request, [X_ALERT]);
+ await page.reload();
+ await expect(pill(page, "x-jar")).toHaveAttribute("data-ready-state", "bad", { timeout: 30_000 });
+ await expect(pill(page, "x-jar")).toHaveAttribute("title", /X cookies are 3 h old/);
+ await expect(pill(page, "x-jar")).toHaveAttribute("href", `${STUB}/settings`);
+ // The API says the same, read-only.
+ const r = (await (await request.get(`/api/report/readiness?project=${encodeURIComponent(P)}`)).json()) as { pills: { id: string; state: string }[] };
+ const state = Object.fromEntries(r.pills.map((p) => [p.id, p.state]));
+ expect(state).toMatchObject({ "quote-check": "count", render: "count", "x-jar": "bad" });
+});
+
+test("X jar: ✓ on a cut with an X post while the editor says nothing waits; — (never ✓) while the editor does not answer, and the page does not wait for it", async ({ page, request }) => {
+ const W = "reports/review-pass-fixture"; // p-5 is an X post
+ await page.goto(urls.workspaceHref(W));
+ await expect(pill(page, "x-jar")).toHaveAttribute("data-ready-state", "ok", { timeout: 30_000 });
+ await request.post(`${STUB}/__stub/services`, { data: { alerts: [], down: true } });
+ const t0 = Date.now();
+ const r = await request.get(`/api/report/readiness?project=${encodeURIComponent(W)}`);
+ expect(Date.now() - t0).toBeLessThan(5_000);
+ const x = ((await r.json()) as { pills: { id: string; state: string; title: string }[] }).pills.find((p) => p.id === "x-jar");
+ expect(x).toMatchObject({ state: "none", title: "the editor did not answer: X's jar is not known" });
+ await page.reload();
+ await expect(pill(page, "x-jar")).toHaveAttribute("data-ready-state", "none", { timeout: 30_000 });
+});
diff --git a/umtool/e2e/redirects.spec.ts b/umtool/e2e/redirects.spec.ts
@@ -1,4 +1,5 @@
import { test, expect } from "@playwright/test";
+import * as urls from "./urls";
import { REDIRECTS } from "./urls";
// ---------------------------------------------------------------------------
@@ -95,3 +96,74 @@ test("a page that did not move is not redirected", async ({ request }) => {
expect(res.status(), p).toBe(200);
}
});
+
+// ---------------------------------------------------------------------------
+// THE WORKSPACE'S STATES (umtool redesign L7b): the views a report video's workspace now holds answer with a 308 to
+// it (ProjectView, after the project resolves -- a project id is a path, so these cannot be rows of the table).
+// What the workspace does not hold yet stays where it is: the clip bench (the walk's every step is a bare
+// /clip/<id>), the post and claim benches, the drafts review, Play's own page (`?cut=1` and every query), the
+// montage deck, the takes' compare and the trailer.
+// ---------------------------------------------------------------------------
+
+const W = "reports/play-cut-fixture";
+for (const [old, now] of [
+ [urls.legacyPresentHref(W), urls.workspaceHref(W, { mode: "present" })],
+ [urls.legacyPresentHref(W, { take: "short" }), urls.workspaceHref(W, { mode: "present", take: "short" })],
+ [urls.takeWalkHref(W, "v1"), urls.workspaceHref(W, { mode: "review", take: "v1" })],
+ [urls.takeWalkHref(W, "short", { all: true }), urls.workspaceHref(W, { mode: "review", take: "short", all: true })],
+ [urls.takeWalkHref(W, "v1", { all: true, note: "n1" }), urls.workspaceHref(W, { mode: "review", take: "v1", all: true, note: "n1" })],
+ [urls.barePlayHref(W), urls.workspaceHref(W)],
+ // The workspace's own tab.
+ [urls.projectHref(W, { tab: "workspace" }), urls.workspaceHref(W)],
+] as const) {
+ test(`L7b: ${old} → ${now} (308)`, async ({ request }) => {
+ const res = await request.get(old, { maxRedirects: 0 });
+ expect(res.status(), old).toBe(308);
+ expect(parts(res.headers()["location"]), old).toEqual(parts(now));
+ expect((await request.get(old)).status(), `${old} lands`).toBe(200);
+ });
+}
+
+test("L7b: what the workspace does not hold yet is not redirected", async ({ request }) => {
+ for (const href of [
+ urls.playHref(W),
+ urls.playHref(W, { take: "short" }),
+ urls.playHref(W, { clip: "c02", at: 0.5 }),
+ urls.clipBenchHref(W, "c01"),
+ urls.clipBenchHref(W, "c01", { play: { at: 1 } }),
+ urls.postBenchHref("reports/post-items-fixture", "p-txt"),
+ urls.claimBenchHref("reports/bench-fixture", "k03"),
+ urls.reviewHref("reports/draft-review-fixture"),
+ urls.projectHref(W, { tab: "overview" }),
+ urls.projectHref(W, { tab: "cut" }),
+ urls.takesHref(W),
+ urls.trailerHref(W),
+ urls.clipDeckHref(W),
+ ]) {
+ const res = await request.get(href, { maxRedirects: 0 });
+ expect(res.status(), href).not.toBe(308);
+ expect(res.status(), href).toBeLessThan(400);
+ }
+});
+
+// The tabs that folded into Deliver: a 307 (that content moves again), the rest of the query kept, note last. An
+// article piece keeps its own Build and Media tabs: its `?tab=build` is not redirected at all.
+for (const [old, now] of [
+ [urls.projectHref(W, { tab: "build" }), urls.projectHref(W, { tab: "deliver" })],
+ [urls.projectHref(W, { tab: "media", note: "n1" }), urls.projectHref(W, { tab: "deliver", note: "n1" })],
+] as const) {
+ test(`L7b: ${old} → ${now} (307)`, async ({ request }) => {
+ const res = await request.get(old, { maxRedirects: 0 });
+ expect(res.status(), old).toBe(307);
+ expect(parts(res.headers()["location"]), old).toEqual(parts(now));
+ expect((await request.get(old)).status(), `${old} lands`).toBe(200);
+ });
+}
+
+test("L7b: an article piece's ?tab=build and ?tab=media are its own tabs, never redirected", async ({ request }) => {
+ for (const tab of ["build", "media"]) {
+ const href = urls.articleHref({ site: "articles", id: "zeta" }, { tab });
+ const res = await request.get(href, { maxRedirects: 0 });
+ expect(res.status(), href).toBe(200);
+ }
+});
diff --git a/umtool/e2e/review-pass.spec.ts b/umtool/e2e/review-pass.spec.ts
@@ -0,0 +1,270 @@
+import { test, expect, type Page } from "@playwright/test";
+import { existsSync, mkdirSync, readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE REVIEW PASS (umtool redesign L7b; workspace/ReviewPass.tsx, lib/report/reviewPass.mjs): the workspace's
+// `?mode=review` -- the inspector hidden, the viewer playing block by block, each block answered Keep · Fix · Note
+// (k f n), the verdict at the end, and the pass resuming where it stopped.
+//
+// review-pass-fixture (WRITES; make-fixture.mjs): workspace-fixture's cut -- c01 c02 p-5 k01 c03 c04, c04 ruled
+// wrong speaker in the bench -- and play-cut-fixture's version v1. The tests run in order, each leaving what the next reads.
+//
+// L7B_SHOTS (a directory): the pass's screenshots at 1366×768 go there too.
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/review-pass-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", ".e2e-song", "reports", "review-pass-fixture");
+const json = (name: string) => JSON.parse(readFileSync(path.join(DIR, name), "utf8"));
+const verdictOf = (id: string) => (json("video.manifest.json").timeline as { id: string; verdict?: string; correction?: string }[]).find((e) => e.id === id);
+const pass = (page: Page) => page.locator("[data-review-pass]");
+const SHOTS = process.env.L7B_SHOTS ?? "";
+const shot = async (page: Page, name: string) => {
+ if (!SHOTS) return;
+ mkdirSync(SHOTS, { recursive: true });
+ await page.screenshot({ path: path.join(SHOTS, name) });
+};
+
+test.beforeEach(async ({ page }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+});
+
+test("Review pass: the inspector hidden, k keeps a clip (its walk verdict), f on a clip and on the post is \"needs work\" (a mark, never a verdict), n opens the composer on the card", async ({ page }) => {
+ await page.goto(urls.workspaceHref(P));
+ await expect(page.locator("[data-ws-mode-edit]")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator("[data-ws-mode-review]")).toHaveAttribute("href", urls.workspaceHref(P, { mode: "review" }));
+ await page.locator("[data-ws-mode-review]").click();
+ await expect(page).toHaveURL(/[?&]mode=review/);
+ await expect(page.locator("[data-ws-mode]")).toHaveAttribute("data-ws-mode", "review");
+ // The inspector is the pass: no bench, no project panels.
+ await expect(page.locator("[data-ws-inspector]")).toHaveAttribute("data-ws-inspector", "review");
+ await expect(page.locator("[data-ws-project-panels]")).toHaveCount(0);
+ await expect(pass(page)).toHaveAttribute("data-review-current", "c01", { timeout: 20_000 });
+ // c04 is answered already: the bench ruled it.
+ await expect(pass(page)).toHaveAttribute("data-review-progress", "1/6");
+ await expect(page.locator("[data-review-count]")).toHaveText("1 / 6 reviewed");
+ // The viewer is on the block under review.
+ await expect(page.locator('[data-ws-block="c01"]')).toHaveAttribute("aria-selected", "true");
+ await shot(page, "ws-review.png");
+
+ // k: c01 kept -- its walk verdict, the bench's writer -- and on to c02, playing.
+ await page.keyboard.press("k");
+ await expect(pass(page)).toHaveAttribute("data-review-current", "c02");
+ await expect.poll(() => verdictOf("c01")?.verdict).toBe("confirmed");
+ await expect(page.locator('[data-ws-block="c01"]')).toHaveAttribute("data-ws-block-review", "keep");
+ await expect(page.locator("[data-ws-viewer]")).toHaveAttribute("data-play-item", "c02", { timeout: 20_000 });
+ // f on a clip: "needs work", a mark in review-pass.json -- its verdict untouched (never `incorrect`).
+ await page.keyboard.press("f");
+ await expect(page.locator("[data-review-fix-text]")).toBeFocused();
+ await page.locator("[data-review-fix-text]").fill("trim the tail");
+ await page.locator("[data-review-fix-text]").press("Enter");
+ await expect(pass(page)).toHaveAttribute("data-review-current", "p-5");
+ await expect.poll(() => json("review-pass.json").marks.c02).toMatchObject({ mark: "fix", note: "trim the tail" });
+ expect(verdictOf("c02")?.verdict).toBeUndefined();
+ expect(verdictOf("c02")?.correction).toBeUndefined();
+ await expect(page.locator('[data-ws-block="c02"]')).toHaveAttribute("data-ws-block-review", "fix");
+ await expect(pass(page)).toHaveAttribute("data-review-progress", "3/6");
+
+ // f on the post: what needs fixing, then on. A post has no walk verdict: review-pass.json holds it.
+ await page.keyboard.press("f");
+ const fix = page.locator("[data-review-fix-text]");
+ await expect(fix).toBeFocused();
+ await fix.fill("the crop cuts his face");
+ await fix.press("Enter");
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01");
+ await expect.poll(() => (existsSync(path.join(DIR, "review-pass.json")) ? json("review-pass.json").marks["p-5"] : null)).toMatchObject({ mark: "fix", note: "the crop cuts his face" });
+ await expect(page.locator('[data-ws-block="p-5"]')).toHaveAttribute("data-ws-block-review", "fix");
+ await expect(pass(page)).toHaveAttribute("data-review-progress", "4/6");
+
+ // n on the card: the notes composer, anchored to the block (notes.json).
+ await page.keyboard.press("n");
+ const input = page.getByTestId("note-input-k01");
+ await expect(input).toBeFocused();
+ await input.fill("is this card needed at all?");
+ await input.press("Enter");
+ await expect
+ .poll(() => (existsSync(path.join(DIR, "notes.json")) ? (json("notes.json").notes as { text: string; anchor: { kind: string; entry?: string } }[]).find((n) => n.text === "is this card needed at all?")?.anchor : null))
+ .toEqual({ kind: "entry", entry: "k01" });
+ // A note is not an answer: the card is still the block under review.
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01");
+ await expect(pass(page)).toHaveAttribute("data-review-progress", "4/6");
+});
+
+test("a reload resumes at block 4; so does the pass entered afresh (the first block with no answer)", async ({ page }) => {
+ await page.goto(urls.workspaceHref(P, { mode: "review", block: "k01" }));
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01", { timeout: 20_000 });
+ await page.reload();
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01", { timeout: 20_000 });
+ await expect(page.locator("[data-review-count]")).toHaveText("4 / 6 reviewed");
+ await page.goto(urls.workspaceHref(P, { mode: "review" }));
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01", { timeout: 20_000 });
+ // The answers so far, said on the strip.
+ expect(await page.locator("[data-ws-block-review]").evaluateAll((els) => els.map((e) => `${e.getAttribute("data-ws-block")}:${e.getAttribute("data-ws-block-review")}`))).toEqual([
+ "c01:keep",
+ "c02:fix",
+ "p-5:fix",
+ "k01:",
+ "c03:",
+ "c04:ruled",
+ ]);
+ // Under a modal (the Keys), k answers nothing -- even with the focus nowhere in it; a held k is one press.
+ const manifestNow = readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+ const marksNow = readFileSync(path.join(DIR, "review-pass.json"), "utf8");
+ await page.keyboard.press("?");
+ await expect(page.locator("[data-ws-keys]")).toBeVisible();
+ await page.evaluate(() => (document.activeElement as HTMLElement | null)?.blur());
+ await page.keyboard.press("k");
+ await page.waitForTimeout(400);
+ expect(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")).toBe(manifestNow);
+ expect(readFileSync(path.join(DIR, "review-pass.json"), "utf8")).toBe(marksNow);
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01");
+ await page.keyboard.press("Escape");
+ await expect(page.locator("[data-ws-keys]")).toHaveCount(0);
+
+ // The CLI twin reads the same answers.
+ const { reviewPassCommand } = await import("../lib/report/reviewPass.mjs");
+ const out: string[] = [];
+ await reviewPassCommand([P, "--json"], { resolve: async () => ({ id: P, dir: DIR }), log: (s: string) => out.push(s), err: (s: string) => out.push(s) });
+ expect(JSON.parse(out.join("\n"))).toMatchObject({ done: 4, total: 6, next: "k01" });
+});
+
+test("past the last block, the verdict: Like saves the draft as a version and writes verdicts.json (L4's writer); Done is back to Edit", async ({ page }) => {
+ await page.goto(urls.workspaceHref(P, { mode: "review" }));
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01", { timeout: 20_000 });
+ // → walks on without answering: k01, c03, c04, the end.
+ for (const id of ["c03", "c04"]) {
+ await page.keyboard.press("ArrowRight");
+ await expect(pass(page)).toHaveAttribute("data-review-current", id);
+ }
+ // c04, ruled wrong speaker in the bench: shown with its words, Keep off, k writes nothing; the Full bench changes it.
+ await expect(page.locator('[data-review-bench="incorrect"]')).toContainText("it is the co-host speaking");
+ await expect(page.locator("[data-review-keep]")).toBeDisabled();
+ await expect(page.locator("[data-review-full-bench]")).toHaveAttribute("href", urls.clipBenchHref(P, "c04"));
+ await page.keyboard.press("k");
+ await page.waitForTimeout(400);
+ expect(verdictOf("c04")).toMatchObject({ verdict: "incorrect", correction: "it is the co-host speaking" });
+ await expect(pass(page)).toHaveAttribute("data-review-current", "c04");
+ await page.keyboard.press("ArrowRight");
+ await expect(pass(page)).toHaveAttribute("data-review-current", "end");
+ const end = page.locator("[data-review-end]");
+ await expect(end).toContainText("2 blocks not reviewed");
+ await shot(page, "ws-review-end.png");
+ await end.locator('[data-review-verdict="like"]').click();
+ const judged = end.locator("[data-review-verdict-take]");
+ await expect(judged).toBeVisible({ timeout: 20_000 });
+ const take = (await judged.getAttribute("data-review-verdict-take"))!;
+ expect(take).toMatch(/^v\d+$/);
+ await expect.poll(() => json(path.join("takes", "verdicts.json"))[take]?.verdict).toBe("like");
+ // The server said which: the parent when only review fields differ, else a version saved for it.
+ await expect(end.locator("[data-review-judged]")).toHaveText(new RegExp(`^(Judged ${take}|Saved ${take} and judged it):$`));
+ await expect(end.locator('[data-play-verdict-button="like"]')).toHaveAttribute("aria-pressed", "true");
+ await end.locator("[data-review-done]").click();
+ await expect(page).not.toHaveURL(/mode=/);
+ await expect(page.locator("[data-ws-mode-edit]")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator("[data-ws-inspector]")).not.toHaveAttribute("data-ws-inspector", "review");
+ // The browser's Back: the pass again.
+ await page.goBack();
+ await expect(page.locator("[data-ws-mode]")).toHaveAttribute("data-ws-mode", "review");
+});
+
+test("by clicking, both ways: Versions ▾ → Review on v1 is v1's pass, where E, Ctrl+Z and k write nothing; Done is the draft in Edit, where k writes nothing", async ({ page }) => {
+ const disk = () => [
+ readFileSync(path.join(DIR, "video.manifest.json"), "utf8"),
+ readFileSync(path.join(DIR, "takes", "v1", "take.json"), "utf8"),
+ existsSync(path.join(DIR, "review-pass.json")) ? readFileSync(path.join(DIR, "review-pass.json"), "utf8") : null,
+ ];
+ await page.goto(urls.workspaceHref(P));
+ await expect(page.locator("[data-ws-mode]")).toHaveAttribute("data-ws-mode", "edit");
+ // A block selected in Edit first: the state a soft navigation must not carry over.
+ await page.locator('[data-ws-block="c02"]').click();
+ await expect(page.locator("[data-ws-inspector]")).toHaveAttribute("data-ws-inspector", "clip");
+ const before = disk();
+ await page.locator("[data-ws-versions] > summary").click();
+ await page.locator('[data-ws-version-review="v1"]').click();
+ await expect(page).toHaveURL(new RegExp(`${urls.versionReviewHref(P, "v1").replace(/[?]/g, "\\?")}`));
+ await expect(pass(page)).toHaveAttribute("data-review-pass", "v1", { timeout: 20_000 });
+ await expect(page.locator("[data-ws-mode]")).toHaveAttribute("data-ws-mode", "review");
+ await expect(page.locator("[data-workspace]")).toHaveAttribute("data-ws-read-only", "");
+ await page.locator("body").press("e");
+ await page.locator("body").press("Control+z");
+ await page.locator("body").press("k");
+ // The strip's writers too (L8b's, gated on the same flag): Alt+→ on a block, a drag onto another, its menu.
+ await page.locator('[data-ws-block="c01"]').click();
+ await page.locator("body").press("Alt+ArrowRight");
+ await page.locator('[data-ws-block="c01"]').dragTo(page.locator('[data-ws-block="c02"]'));
+ await page.locator('[data-ws-block="c02"]').click({ button: "right" });
+ await expect(page.locator('[role="menu"]')).toHaveCount(0);
+ await page.waitForTimeout(600);
+ await expect(page.locator("[data-cut-app-bench]")).toHaveCount(0);
+ expect(disk()).toEqual(before);
+
+ // "Done — back to Edit": the DRAFT, in Edit, writable again -- and k there is nothing.
+ await page.locator("[data-review-next]").click();
+ for (let i = 0; i < 8 && !(await page.locator("[data-review-done]").isVisible()); i += 1) await page.locator("[data-review-next]").click();
+ await page.locator("[data-review-done]").click();
+ await expect(page).not.toHaveURL(/take=|mode=/);
+ await expect(page.locator("[data-ws-mode]")).toHaveAttribute("data-ws-mode", "edit", { timeout: 20_000 });
+ await expect(page.locator("[data-ws-version-shown]")).toHaveCount(0);
+ await expect(page.locator("[data-workspace]")).not.toHaveAttribute("data-ws-read-only", "");
+ await expect(page.locator("[data-ws-undo]")).toBeVisible();
+ await page.locator("body").press("k");
+ await page.waitForTimeout(600);
+ expect(disk()).toEqual(before);
+});
+
+test("a version's review pass is read-only: watched and noted, never marked -- Open in draft to change it; its verdict at the end", async ({ page }) => {
+ await page.goto(urls.versionReviewHref(P, "v1"));
+ await expect(pass(page)).toHaveAttribute("data-review-pass", "v1", { timeout: 20_000 });
+ await expect(page.locator("[data-ws-version-shown]")).toContainText("v1 · read-only");
+ await expect(page.locator("[data-review-keep]")).toBeDisabled();
+ await expect(page.locator("[data-review-fix]")).toBeDisabled();
+ await expect(page.locator("[data-review-open-draft]")).toHaveAttribute("href", urls.openInDraftHref(P, "v1"));
+ // Nothing on the bar writes the draft: no Look, Render, Undo.
+ await expect(page.locator("[data-ws-undo]")).toHaveCount(0);
+ await expect(page.locator("[data-ws-look]")).toHaveCount(0);
+ const before = readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+ await page.keyboard.press("k");
+ await page.waitForTimeout(400);
+ expect(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")).toBe(before);
+ // A note on a version's block records the version (`umtool notes` says which it was about).
+ const block = await pass(page).getAttribute("data-review-current");
+ await page.keyboard.press("n");
+ const input = page.getByTestId(`note-input-${block}`);
+ await expect(input).toBeFocused();
+ await input.fill("on v1 this ran long");
+ await input.press("Enter");
+ await expect
+ .poll(() => (json("notes.json").notes as { text: string; anchor: Record<string, string> }[]).find((n) => n.text === "on v1 this ran long")?.anchor)
+ .toEqual({ kind: "entry", entry: block, take: "v1" });
+ // The take walk's old address is this pass (a 308).
+ const res = await page.request.get(urls.takeWalkHref(P, "v1"), { maxRedirects: 0 });
+ expect(res.status()).toBe(308);
+ expect(res.headers()["location"]).toBe(urls.versionReviewHref(P, "v1"));
+});
+
+test("on a phone (390 px) the pass is a sheet under the viewer, its answers in reach", async ({ page }) => {
+ await page.setViewportSize({ width: 390, height: 844 });
+ await page.goto(urls.workspaceHref(P, { mode: "review" }));
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01", { timeout: 20_000 });
+ await expect(page.locator("[data-review-keep]")).toBeInViewport();
+ await expect(page.locator("[data-review-note]")).toBeInViewport();
+ expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
+ await shot(page, "ws-review-phone.png");
+});
+
+test("a mark is of what was reviewed: c02's edge moved since its Fix -- \"changed since reviewed\", unanswered, the pass resumes there", async ({ page, request }) => {
+ const tok = ((await (await request.get(`/api/report/clip?project=${encodeURIComponent(P)}&clip=c02`)).json()) as { token: string }).token;
+ const w = await request.put("/api/report/window", { data: { project: P, clip: "c02", token: tok, end: 5.3 } });
+ expect(w.ok(), await w.text()).toBe(true);
+ await page.goto(urls.workspaceHref(P, { mode: "review" }));
+ await expect(pass(page)).toHaveAttribute("data-review-current", "c02", { timeout: 20_000 });
+ await expect(page.locator("[data-review-changed]")).toHaveText("changed since reviewed");
+ await expect(page.locator('[data-ws-block="c02"]')).toHaveAttribute("data-ws-block-review", "");
+ // The mark is still on disk, with what it was of: the answer is gone, not the record.
+ expect(json("review-pass.json").marks.c02).toMatchObject({ mark: "fix", note: "trim the tail" });
+});
diff --git a/umtool/e2e/take-walk.spec.ts b/umtool/e2e/take-walk.spec.ts
@@ -72,8 +72,12 @@ test("the bench's data is the draft's whatever a take is named: a take's clip is
expect(manifestText()).toBe(masterBefore);
});
-test("the walk's old address asks to open the take in the draft; the walk's data route still reads the take", async ({ page, request }) => {
+test("the walk's old address is the take's review pass (L7b), whose Open in draft asks; the walk's data route still reads the take", async ({ page, request }) => {
await page.goto(urls.takeWalkHref(PROJECT, TAKE));
+ // A 308 to the take's review pass: read-only, its Open in draft the page that asks.
+ await expect(page.locator("[data-review-pass]")).toHaveAttribute("data-review-pass", TAKE, { timeout: 30_000 });
+ await expect(page.locator("[data-review-open-draft]")).toHaveAttribute("href", urls.openInDraftHref(PROJECT, TAKE));
+ await page.locator("[data-review-open-draft]").click();
const ask = page.locator(`[data-open-draft="${TAKE}"]`);
await expect(ask).toContainText(`Open ${TAKE} in draft?`);
// The draft (from v1, the master unchanged: no edits) has nothing to save.
@@ -116,7 +120,10 @@ test("the draft's own parent with no edits: the old bench address goes straight
const res = await request.get(urls.takeClipHref(PROJECT, "v2", "t01c"), { maxRedirects: 0 });
expect(res.status()).toBe(307);
expect(res.headers()["location"]).toMatch(/\/projects\/reports\/take-walk-fixture\/clip\/t01c$/);
- // A take that is not the parent still asks.
- const asks = await request.get(urls.takeWalkHref(PROJECT, TAKE), { maxRedirects: 0 });
+ // A take that is not the parent still asks (its walk's old address is its review pass, whose Open in draft asks).
+ const walk = await request.get(urls.takeWalkHref(PROJECT, TAKE), { maxRedirects: 0 });
+ expect(walk.status()).toBe(308);
+ expect(walk.headers()["location"]).toBe(urls.versionReviewHref(PROJECT, TAKE));
+ const asks = await request.get(urls.openInDraftHref(PROJECT, TAKE), { maxRedirects: 0 });
expect(asks.status()).toBe(200);
});
diff --git a/umtool/e2e/urls.ts b/umtool/e2e/urls.ts
@@ -8,7 +8,7 @@
// Assertions on hrefs (`toHaveAttribute("href", …)`) should build the expected
// value here too, so a URL change is one edit in lib/hrefs.ts.
import { projectHref } from "../lib/hrefs";
-import { tabOfSection } from "../lib/pieces/tabs.mjs";
+import { ARTICLE_SECTION_TAB, PIECE_FOLDED, tabOfSection } from "../lib/pieces/tabs.mjs";
import { songTabOfSection } from "../lib/pieces/song-tabs.mjs";
export * from "../lib/hrefs";
@@ -21,7 +21,10 @@ export { REDIRECTS } from "../redirects.mjs";
* section says which, so a section moving tab is one edit in that table.
*/
export function section(project: string, name: string, q: { all?: boolean; note?: string } = {}): string {
- return projectHref(project, { tab: tabOfSection(name), ...q });
+ // A section of what folded into Deliver (L7b: Build's, Media's) is asked for by its old tab: an unclaimed project
+ // 308s it to Deliver, a claimed one goes to its article piece's own Build or Media tab (which it keeps).
+ const was = (ARTICLE_SECTION_TAB as Record<string, string>)[name];
+ return projectHref(project, { tab: was && was in PIECE_FOLDED ? was : tabOfSection(name), ...q });
}
/**
@@ -32,3 +35,18 @@ export function section(project: string, name: string, q: { all?: boolean; note?
export function songSection(song: string, name: string, q: { note?: string } = {}): string {
return projectHref(song, { tab: songTabOfSection(name), ...q });
}
+
+// ── the addresses L7b moved into the workspace (umtool redesign): what a redirect spec asks for ────────────────
+// The app no longer builds these (lib/hrefs.ts builds where they land), so a spec that checks the redirect names
+// the old address here, once.
+import { encodePath, withQuery } from "../lib/hrefs";
+
+/** The old present-mode page: `/projects/<p>/present` (it 308s to the workspace's `?mode=present`). */
+export function legacyPresentHref(project: string, q: { take?: string | null } = {}): string {
+ return withQuery(`/projects/${encodePath(project)}/present`, { take: q.take });
+}
+
+/** A bare `/projects/<p>/play` (it 308s to the workspace; Play's own page always carries a query). */
+export function barePlayHref(project: string): string {
+ return `/projects/${encodePath(project)}/play`;
+}
diff --git a/umtool/e2e/visual-audit.spec.ts b/umtool/e2e/visual-audit.spec.ts
@@ -43,9 +43,12 @@ const PAGES: [string, string][] = [
),
["article-evidence", urls.articleEvidenceHref({ site: "articles", id: "delta" })],
["article-compare", urls.articleCompareHref("zeta", { a: "1", b: "3" })],
- ...["overview", "cut", "media", "build", "deliver", "sources", "history"].map(
+ // A project piece's four tabs since the workspace (L7b) -- Media and Build fold into Deliver -- and the views out of
+ // the tab bar (the Overview, the cut as a list), and the workspace itself.
+ ...["overview", "cut", "deliver", "sources", "history"].map(
(tab) => [`project-${tab}`, urls.projectHref(PROJECT, { tab })] as [string, string],
),
+ ["project-workspace", urls.workspaceHref(PROJECT)],
...["overview", "cuts", "spec", "cover", "notes"].map((tab) => [`song-${tab}`, urls.projectHref(SONG, { tab })] as [string, string]),
["song-cut", urls.cutHref(SONG, "wide")],
["bench-clip", urls.clipBenchHref("reports/bench-shell-fixture", "s01")],
diff --git a/umtool/e2e/workspace.spec.ts b/umtool/e2e/workspace.spec.ts
@@ -163,7 +163,9 @@ test("Save version: the versions menu lists it; E opens the bench in place and B
test("the piece page's tabs stay at ?tab=; the Overview is written out", async ({ page }) => {
await page.goto(urls.projectHref(P, { tab: "overview" }));
await expect(page.locator("[data-workspace]")).toHaveCount(0);
- await expect(page.locator("[data-piece-tabs]")).toHaveAttribute("data-piece-tabs", "overview");
+ // The Overview is a view of the workspace's (L7b): its tab is lit, the view drawn.
+ await expect(page.locator("[data-piece-tabs]")).toHaveAttribute("data-piece-tabs", "workspace");
+ await expect(page.locator("[data-piece-tab]")).toHaveAttribute("data-piece-tab", "overview");
// ...and the piece page's ⋯ More goes back to it.
await page.getByRole("button", { name: "More" }).click();
await expect(page.locator("[data-primary-workspace]")).toHaveAttribute("href", urls.workspaceHref(P));
diff --git a/umtool/lib/annotations/digest.mjs b/umtool/lib/annotations/digest.mjs
@@ -130,10 +130,12 @@ function anchorLines(a, ctx) {
return lines;
}
case "entry": {
+ // A note taken on a saved version (its review pass) says which: the draft's entry may differ from it.
+ const on = a.take ? ` of version \`${a.take}\`` : "";
const e = (manifest?.timeline ?? []).find((x) => x.id === a.entry);
- if (!e) return [`**On:** timeline entry \`${a.entry}\` (no longer in the manifest)`];
+ if (!e) return [`**On:** timeline entry \`${a.entry}\`${on} (no longer in the manifest)`];
const title = e.title ?? e.onscreen?.title;
- const lines = [`**On:** timeline entry \`${a.entry}\` (${e.type ?? "entry"})${title ? ` “${clip(title, 160)}”` : ""}`];
+ const lines = [`**On:** timeline entry \`${a.entry}\`${on} (${e.type ?? "entry"})${title ? ` “${clip(title, 160)}”` : ""}`];
if (e.quote) lines.push(quoteLine(e.quote));
if (e.type === "clip" && e.channel && e.video) lines.push(`source ${e.channel}/${e.video}@${e.start}-${e.end}`);
return lines;
diff --git a/umtool/lib/annotations/shape.mjs b/umtool/lib/annotations/shape.mjs
@@ -79,7 +79,9 @@ export function validateAnchor(raw) {
return { anchor: { kind: "cite", cite: a.cite } };
case "entry":
if (!short(a.entry, 128) || !ID.test(a.entry)) return { error: "entry anchor needs an entry id" };
- return { anchor: { kind: "entry", entry: a.entry } };
+ // `take`: the saved version the note was taken on (a version's review pass, umtool redesign L7b).
+ if (a.take !== undefined && (!isStr(a.take) || !TAKE_ID.test(a.take))) return { error: "entry take is not a take id" };
+ return { anchor: { kind: "entry", entry: a.entry, ...(a.take !== undefined ? { take: a.take } : {}) } };
case "take":
if (!isStr(a.take) || !TAKE_ID.test(a.take)) return { error: "take anchor needs a take id" };
return { anchor: { kind: "take", take: a.take } };
diff --git a/umtool/lib/annotations/store.test.mjs b/umtool/lib/annotations/store.test.mjs
@@ -130,6 +130,10 @@ test("anchors: every kind validates; bad ones refuse", () => {
assert.equal(validateAnchor(ok[4]).anchor.t, 12.35);
assert.deepEqual(validateAnchor(ok[4]).anchor.resolved, { title: "T", sourceT: 81.23, approx: true });
assert.equal(validateAnchor({ kind: "text", section: "s", quote: "q" }).anchor.prefix, "");
+ // A note on a block of a saved version (its review pass, L7b) records the version.
+ assert.deepEqual(validateAnchor({ kind: "entry", entry: "c02", take: "v3" }).anchor, { kind: "entry", entry: "c02", take: "v3" });
+ assert.deepEqual(validateAnchor({ kind: "entry", entry: "c02" }).anchor, { kind: "entry", entry: "c02" });
+ assert.ok("error" in validateAnchor({ kind: "entry", entry: "c02", take: "Bad Id" }));
const bad = [
null,
{ kind: "text", section: "s" },
diff --git a/umtool/lib/annotations/types.ts b/umtool/lib/annotations/types.ts
@@ -39,7 +39,7 @@ export type Anchor =
| { kind: "section"; section: string }
| { kind: "whole" }
| { kind: "moment"; file: string; t: number; take?: string; entry?: string; resolved?: MomentResolved }
- | { kind: "entry"; entry: string }
+ | { kind: "entry"; entry: string; take?: string }
| { kind: "take"; take: string }
| { kind: "edit"; entry?: string; field: string; from: unknown; to: unknown }
/** A moment of the cut as the Play view plays it: the cut second, the clip and its source second, the take. */
diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs
@@ -254,6 +254,23 @@ export const GROUPS = [
],
},
{
+ cmd: "review-pass",
+ usage: [
+ " umtool review-pass <project> [ls] [--json] the workspace's REVIEW PASS: each block's answer (a clip's is its",
+ " walk verdict; a post's or a card's review-pass.json) and the block it resumes on",
+ " umtool review-pass <project> mark <block> keep|fix|clear [--note T] a block's mark: a Fix (\"needs work\", saying",
+ " what) on any block, a clip too; Keep on a post or a card (a clip's Keep is its walk verdict)",
+ " umtool review-pass <project> verdict like|maybe|no|clear [--note T] the draft's verdict: its parent's when only",
+ " the walk's and the pass's fields differ, else the draft saved as the next version and judged",
+ ],
+ docs: [
+ ["`review-pass <project> [ls] [--json]` · `review-pass <project> mark <block> keep\\|fix\\|clear [--note T]`",
+ "the workspace's **review pass** (`?mode=review`): every block but the intro and a clip rejected for a cut reason, its answer and the block the pass resumes on; a Fix (\"needs work\", saying what) is a mark in `<project>/review-pass.json` on any block, a clip too — never a clip's verdict (`incorrect` is the bench's fact-error ruling, never written or overwritten here); a clip's Keep is its walk verdict (`window --verdict confirmed`), a post's or a card's a mark — `mark` writes one (a Fix needs `--note`; a clip takes `fix` and `clear`) ([knobs.md](knobs.md#the-review-pass))"],
+ ["`review-pass <project> verdict like\\|maybe\\|no\\|clear [--note T] [--json]`",
+ "the pass's **verdict on the draft**, one locked call: a draft that differs from its parent version only by what the walk and the review pass write (verdict, correction, reason, reject note, walk note, ★) judges the PARENT and saves nothing; otherwise the draft is saved as the next version and that is judged (`takes/verdicts.json`)"],
+ ],
+ },
+ {
cmd: "present",
usage: [
" umtool present <project> [--take <id> | --cut] [--json] [--public] [--open] PRESENT MODE: the cut as slides,",
diff --git a/umtool/lib/cli/verbs.mjs b/umtool/lib/cli/verbs.mjs
@@ -177,6 +177,15 @@ export const VERBS = Object.freeze([
takeOpt(),
], B(["clip"], { clip: "{id}" })),
form("walk", "project", "the clip bench's walk: clips in walk order, verdicts, fetched", [project(), takeOpt({ help: "walk a take (a draft too)" }), bool("--all", "every fetched clip")]),
+ // The workspace's review pass (umtool redesign L7b, lib/report/reviewPass.mjs): a clip's Keep / Fix is its walk
+ // verdict (`window --verdict`); a post's or a card's lives in review-pass.json.
+ form("review-pass ls", "project", "the review pass: each block's answer, and where it resumes", [project()], { shape: "review-pass <project> ls" }),
+ form("review-pass mark", "project", "a block's review-pass mark: keep (a post, a card), fix (needs work, saying what; any block) or clear", [
+ project(), arg("block", { help: "the block's id: a clip, a post item, a card" }), pick("mark", ["keep", "fix", "clear"], { required: true }), opt("--note", { type: "text", help: "a Fix: what needs work" }),
+ ], { shape: "review-pass <project> mark <block> <mark>" }),
+ form("review-pass verdict", "project", "the draft's verdict at the pass's end: its parent's when only review fields differ, else saved as a version and judged", [
+ project(), pick("verdict", ["like", "maybe", "no", "clear"], { required: true }), opt("--note", { type: "text", help: "the verdict's note" }),
+ ], { shape: "review-pass <project> verdict <verdict>" }),
form("present", "project", "present mode's address and slides", [project(), takeOpt({ help: "that take's cut (default the latest)" }), bool("--cut", "the manifest alone"), bool("--public", "as a public page would carry it")]),
form("set", "draft", "a clip's knobs: claim, marks, audio, blur, fx …", [project(), clip(), pairs({ help: "key=value, one per line (claim.at=190.2, audio.gain=-3, `key=` clears)" }), opt("--mark", { help: "the mark the claim.* keys set" }), takeOpt()], B(["clip"], { clip: "{id}" })),
form("intro", "draft", "the intro the cut opens on (render.intro)", [project(), pairs({ required: false, help: "key=value, one per line (style=boot-dark, seconds=4); none: print it" }), bool("--off", "take the intro off"), takeOpt({ help: "a version: --off opens it on no intro, --on on the cut's" }), bool("--on")], B(["intro"], {})),
diff --git a/umtool/lib/hrefs.test.mjs b/umtool/lib/hrefs.test.mjs
@@ -63,6 +63,16 @@ test("empty, null and false values are left out; true is 1", () => {
assert.equal(H.projectHref("a/b", { tab: "overview" }), "/projects/a/b?tab=overview");
assert.equal(H.workspaceHref("a/b"), "/projects/a/b");
assert.equal(H.workspaceHref("a/b", { block: "c01" }), "/projects/a/b?block=c01");
+ // L7b: the modes, a version reviewed or presented, a block and the seconds into it.
+ assert.equal(H.workspaceHref("a/b", { mode: "review" }), "/projects/a/b?mode=review");
+ assert.equal(H.workspaceHref("a/b", { mode: "review", take: "v1" }), "/projects/a/b?mode=review&take=v1");
+ assert.equal(H.workspaceHref("a/b", { take: "v1" }), "/projects/a/b");
+ assert.equal(H.workspaceHref("a/b", { block: "c02", at: 1.234 }), "/projects/a/b?block=c02&at=1.23");
+ assert.equal(H.presentHref("a/b", { take: "v1", slide: "c01" }), "/projects/a/b?mode=present&take=v1#c01");
+ assert.equal(H.versionReviewHref("a/b", "v2"), "/projects/a/b?mode=review&take=v2");
+ // A take walk's old query rides into its review pass, note last; without a mode they are not the workspace's.
+ assert.equal(H.workspaceHref("a/b", { mode: "review", take: "v2", all: true, note: "n1" }), "/projects/a/b?mode=review&take=v2&all=1¬e=n1");
+ assert.equal(H.workspaceHref("a/b", { all: true, note: "n1" }), "/projects/a/b");
assert.equal(H.projectHref("a/b", { tab: "cut", all: true, note: "n1" }), "/projects/a/b?tab=cut&all=1¬e=n1");
assert.equal(H.projectsHref({ kind: "k1", new: false }), "/projects?kind=k1");
assert.equal(H.projectsHref({ new: true }), "/projects?new=1");
@@ -137,7 +147,9 @@ test("Play the cut ↔ the clip bench: Edit this clip carries the way back, Back
assert.equal(H.playHref("a/b", { clip: "c02", at: 0.5 }), "/projects/a/b/play?clip=c02&at=0.50");
assert.equal(H.playHref("a/b", { clip: "c02", at: 0 }), "/projects/a/b/play?clip=c02");
// No clip, no offset: `at` means nothing on its own.
- assert.equal(H.playHref("a/b", { at: 3 }), "/projects/a/b/play");
+ assert.equal(H.playHref("a/b", { at: 3 }), "/projects/a/b/play?cut=1");
+ // Play's own page always carries a query: a bare /play is the workspace's (a 308, L7b).
+ assert.equal(H.playHref("a/b"), "/projects/a/b/play?cut=1");
assert.equal(H.playHref("a/b", { take: "t1", note: "n" }), "/projects/a/b/play?take=t1¬e=n");
});
diff --git a/umtool/lib/hrefs.ts b/umtool/lib/hrefs.ts
@@ -276,12 +276,37 @@ export function projectHref(id: string, q: { tab?: string; all?: boolean } & Not
return withQuery(`/projects/${encodePath(id)}`, { ...(tab ? { tab } : {}), ...rest }, note);
}
+/** The workspace's modes besides Edit (its bare address): the review pass and present (umtool redesign L7b). */
+export const WORKSPACE_MODES = ["review", "present"] as const;
+export type WorkspaceMode = (typeof WORKSPACE_MODES)[number];
+export const isWorkspaceMode = (v: unknown): v is WorkspaceMode => typeof v === "string" && (WORKSPACE_MODES as readonly string[]).includes(v);
+
/**
* THE WORKSPACE (umtool redesign L7a): a report video's one screen -- the draft playing, its blocks, the
- * inspector. `block`: open with that block (a timeline entry's id, or `intro`) selected.
+ * inspector. `block`: open with that block (a timeline entry's id, or `intro`) selected; `at` seconds into it.
+ * `mode` (L7b): `review` the review pass (Keep · Fix · Note per block, a verdict at the end), `present` the viewer
+ * full screen as slides; Edit is the bare address. `take`: a saved version, reviewed or presented read-only.
+ * `slide`: present mode's slide (its `#<slide id>`).
*/
-export function workspaceHref(id: string, q: { block?: string | null } = {}): string {
- return withQuery(`/projects/${encodePath(id)}`, q.block ? { block: q.block } : {});
+export function workspaceHref(
+ id: string,
+ q: { block?: string | null; at?: number | null; mode?: WorkspaceMode | null; take?: string | null; slide?: string | null; all?: boolean; note?: string | null } = {},
+): string {
+ // `all`, `note`: what a take walk's old address carried, kept on its review pass (with a mode only: without one
+ // they are the piece page's keys).
+ return (
+ withQuery(
+ `/projects/${encodePath(id)}`,
+ {
+ mode: q.mode ?? null,
+ take: q.mode ? (q.take ?? null) : null,
+ block: q.block ?? null,
+ at: q.block && q.at != null && q.at > 0 ? q.at.toFixed(2) : null,
+ all: q.mode ? q.all : null,
+ },
+ q.mode ? q.note : null,
+ ) + (q.mode === "present" && q.slide ? `#${q.slide}` : "")
+ );
}
/** A project by its path, for an id that a tool page shadows at its own URL. */
@@ -367,6 +392,11 @@ export function takeWalkHref(project: string, take: string, q: NoteOpt & { all?:
return withQuery(`/projects/${encodePath(project)}/takes/${encodeURIComponent(take)}/walk`, { all: q.all }, q.note);
}
+/** A version's review pass (umtool redesign L7b): watched block by block, read-only, its verdict at the end. */
+export function versionReviewHref(project: string, take: string): string {
+ return workspaceHref(project, { mode: "review", take });
+}
+
/**
* The clip bench on one of a take's clips: its saves go into the take's patch, never the project's manifest.
* `play`: opened from Play on this take (Edit this clip, on a take with its own timeline) -- the bench offers
@@ -437,16 +467,19 @@ export function playHref(
project: string,
q: NoteOpt & {
take?: string | null;
- /** The project's manifest alone, no take's patch (`?cut=1`); without it and a take, the latest take plays. */
+ /** The project's manifest alone, no take's patch (`?cut=1`): the draft, which is the default too. */
bare?: boolean;
/** Start on this clip, `at` seconds into what the page shows of it (the bench's Back to the cut). */
clip?: string | null;
at?: number | null;
} = {},
): string {
+ // A BARE `/play` is the workspace's now (umtool redesign L7b: a 308 to the project's own address), so Play's
+ // own page is always asked for with something in its query: `?cut=1` (the draft) when nothing else is.
+ const clip = q.clip || null;
return withQuery(
`/projects/${encodePath(project)}/play`,
- { take: q.take, cut: !q.take && q.bare ? "1" : null, clip: q.clip, at: q.clip && q.at != null && q.at > 0 ? q.at.toFixed(2) : null },
+ { take: q.take, cut: !q.take && (q.bare || (!clip && !q.note)) ? "1" : null, clip, at: clip && q.at != null && q.at > 0 ? q.at.toFixed(2) : null },
q.note,
);
}
@@ -457,7 +490,8 @@ export function playHref(
* With no take, the latest take (the working cut), as Play.
*/
export function presentHref(project: string, q: { take?: string | null; bare?: boolean; slide?: string | null } = {}): string {
- return withQuery(`/projects/${encodePath(project)}/present`, { take: q.take, cut: !q.take && q.bare ? "1" : null }) + (q.slide ? `#${q.slide}` : "");
+ // The workspace's present mode (umtool redesign L7b); the old `/present` address 308s here.
+ return workspaceHref(project, { mode: "present", take: q.take ?? null, slide: q.slide ?? null });
}
/** The narration script, card by card. */
diff --git a/umtool/lib/inbox/projectCalls.ts b/umtool/lib/inbox/projectCalls.ts
@@ -89,6 +89,11 @@ async function callsOf(ref: ProjectRef): Promise<Decision[]> {
return out;
}
+/** One report video's calls (the readiness bar's, umtool redesign L7b): the same memo the Inbox reads. Never throws. */
+export async function projectCallsOf(ref: ProjectRef): Promise<Decision[]> {
+ return projectCalls(ref).catch(() => [] as Decision[]);
+}
+
async function projectCalls(ref: ProjectRef): Promise<Decision[]> {
const sig = await signatureOf(ref.dir);
const hit = memo.get(ref.id);
diff --git a/umtool/lib/inbox/readiness.mjs b/umtool/lib/inbox/readiness.mjs
@@ -0,0 +1,121 @@
+// THE READINESS BAR (umtool redesign L7b; the workspace's row under its top bar): one pill each for the quote
+// check, the links, the captures, the render and X's jar -- ✓, a count, ! or — -- each a click to its fix or its
+// page. Read-only, and derived from nothing of its own: the rows are the Inbox's (the project reducer's
+// decisions, lib/projects/report.mjs; the report video's calls, lib/inbox/projectCalls.ts; X's jar,
+// lib/inbox/xJar.ts), bucketed here by kind. Pure: lib/inbox/readiness.ts reads them.
+//
+// state "bad" a blocking row (or X's jar stale): something downstream would lie or die
+// "count" rows that are open or informational, `count` of them
+// "ok" none, and the check applies (it has run, or there is something for it to judge)
+// "none" it does not apply here (no quote check, no clip, nothing rendered, no X post) -- or it is NOT
+// KNOWN: the project's checks did not read, the editor did not answer for X's jar. Never ✓ then.
+
+/** Which pill a row of the Inbox's is. */
+export const PILL_KINDS = {
+ "quote-check": ["clip-quote-moved", "clip-quote-missing", "quote-check-stale"],
+ links: ["link-dead", "links-unverified", "links-unchecked", "site-deploy-behind", "clip-link-policy"],
+ captures: ["clip-unfetchable", "clip-no-cues", "clip-unchecked"],
+ render: ["stale-build", "version-unjudged"],
+ "x-jar": ["x-jar-stale"],
+};
+
+export const PILLS = [
+ { id: "quote-check", label: "Quote check" },
+ { id: "links", label: "Links" },
+ { id: "captures", label: "Captures" },
+ { id: "render", label: "Render" },
+ { id: "x-jar", label: "X jar" },
+];
+
+const pillOfKind = new Map(Object.entries(PILL_KINDS).flatMap(([pill, kinds]) => kinds.map((k) => [k, pill])));
+/** The pill a decision kind feeds, or null. */
+export const pillOf = (kind) => pillOfKind.get(kind) ?? null;
+
+/**
+ * @typedef {{ kind: string, target: string, why: string, href: string, severity: "blocking" | "open" | "info" }} Row
+ * @typedef {{ id: string, label: string, state: "bad" | "count" | "ok" | "none", count: number, title: string, href: string | null, select?: string | null }} Pill
+ */
+
+/**
+ * The five pills.
+ *
+ * @param {{
+ * rows: Row[],
+ * facts: { quoteCheck: boolean, linksChecked: boolean, clips: number, xPosts: number, built: boolean, rendered: boolean, missing?: string[],
+ * decisionsKnown?: boolean, xKnown?: boolean },
+ * hrefs: { decisions: string, home: string, deliver: string, takes: string, cut: string, xSettings: string, review: (take: string) => string },
+ * }} o
+ * @returns {Pill[]}
+ */
+export function readinessPills({ rows, facts, hrefs }) {
+ const by = new Map(PILLS.map((p) => [p.id, /** @type {Row[]} */ ([])]));
+ for (const r of rows ?? []) {
+ const p = pillOf(r?.kind);
+ if (p) by.get(p).push(r);
+ }
+ const words = (rs) => rs.slice(0, 4).map((r) => `${r.target}: ${r.why}`).join(" · ") + (rs.length > 4 ? ` · and ${rs.length - 4} more` : "");
+ /** @returns {Pill} */
+ const pill = (id, { ok, none, okTitle, noneTitle, okHref = null, badHref, countHref = badHref, extra = [] }) => {
+ const label = PILLS.find((p) => p.id === id).label;
+ const rs = by.get(id);
+ const bad = rs.filter((r) => r.severity === "blocking");
+ if (bad.length) return { id, label, state: "bad", count: bad.length, title: words(bad), href: badHref(bad), select: null };
+ const n = rs.length + extra.length;
+ if (n) return { id, label, state: "count", count: n, title: [rs.length ? words(rs) : null, ...extra.map((x) => x.why)].filter(Boolean).join(" · "), href: countHref(rs), select: extra[0]?.select ?? null };
+ // A check that did not read is not known: "—", never ✓ (the reducer threw; its rows are not "nothing wrong").
+ if (ok && id !== "x-jar" && facts.decisionsKnown === false) return { id, label, state: "none", count: 0, title: "the project's checks could not be read", href: okHref, select: null };
+ if (ok) return { id, label, state: "ok", count: 0, title: okTitle, href: okHref, select: null };
+ return { id, label, state: "none", count: 0, title: noneTitle, href: okHref, select: null };
+ };
+ const missing = facts.missing ?? [];
+ return [
+ pill("quote-check", {
+ ok: facts.quoteCheck,
+ okTitle: "every quoted clip heard where it plays (quote-check.json)",
+ noneTitle: "no quote check here yet (umtool quote-check <p>)",
+ okHref: hrefs.decisions,
+ // A failing row is the piece's own decision (its settle on the Overview); stale rows are home's one press.
+ badHref: () => hrefs.decisions,
+ countHref: (rs) => (rs.every((r) => r.kind === "quote-check-stale") ? hrefs.home : hrefs.decisions),
+ }),
+ pill("links", {
+ ok: facts.clips > 0 && facts.linksChecked,
+ okTitle: "every QR opens on its site (out/links.json)",
+ noneTitle: facts.clips ? "the QR links were never checked (umtool links <p>)" : "no clip, no QR link",
+ okHref: hrefs.decisions,
+ badHref: () => hrefs.decisions,
+ }),
+ pill("captures", {
+ ok: facts.clips > 0,
+ okTitle: "every clip's window is fetched and its source answers",
+ noneTitle: "no clip to fetch",
+ okHref: hrefs.cut,
+ badHref: () => hrefs.decisions,
+ countHref: (rs) => (rs.length ? hrefs.decisions : hrefs.cut),
+ extra: missing.map((id) => ({ why: `${id}: no media fetched`, select: id })),
+ }),
+ pill("render", {
+ // A render on record (a take's preview, the take panel's reader) or a build the checks call current.
+ ok: facts.built || facts.rendered,
+ okTitle: facts.rendered ? "rendered; every version judged" : "the build is current with the draft",
+ noneTitle: "never rendered (Render ▾)",
+ okHref: hrefs.takes,
+ badHref: () => hrefs.deliver,
+ countHref: (rs) => {
+ const v = rs.find((r) => r.kind === "version-unjudged");
+ return v ? hrefs.review(v.target) : hrefs.deliver;
+ },
+ }),
+ // X's jar is the machine's: stale while X work waits on it (the editor's alert), whichever piece it is for.
+ ((p) => (p.state === "count" ? { ...p, state: "bad" } : p))(
+ pill("x-jar", {
+ // ✓ only on the editor's word: a jar it did not answer for is not known.
+ ok: facts.xPosts > 0 && facts.xKnown !== false,
+ okTitle: "X's cookie jar: no X work waiting on it",
+ noneTitle: facts.xKnown === false ? "the editor did not answer: X's jar is not known" : "no X post in the cut",
+ okHref: hrefs.xSettings,
+ badHref: (rs) => rs[0]?.href ?? hrefs.xSettings,
+ }),
+ ),
+ ];
+}
diff --git a/umtool/lib/inbox/readiness.test.mjs b/umtool/lib/inbox/readiness.test.mjs
@@ -0,0 +1,31 @@
+// The readiness bar's pills (lib/inbox/readiness.mjs): the Inbox's rows bucketed, and what is NOT known never ✓.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { readinessPills } from "./readiness.mjs";
+
+const hrefs = { decisions: "/d", home: "/", deliver: "/deliver", takes: "/takes", cut: "/cut", xSettings: "http://e/settings", review: (t) => `/review/${t}` };
+const facts = { quoteCheck: true, linksChecked: true, clips: 3, xPosts: 1, built: true, rendered: true, decisionsKnown: true, xKnown: true };
+const state = (pills) => Object.fromEntries(pills.map((p) => [p.id, p.state]));
+
+test("a piece with nothing waiting: ✓ each, the checks known", () => {
+ assert.deepEqual(state(readinessPills({ rows: [], facts, hrefs })), { "quote-check": "ok", links: "ok", captures: "ok", render: "ok", "x-jar": "ok" });
+});
+
+test("rows: blocking is !, the rest a count; X's stale jar is ! wherever it is", () => {
+ const rows = [
+ { kind: "clip-quote-moved", target: "c1", why: "heard 13 s early", href: "/d", severity: "blocking" },
+ { kind: "links-unchecked", target: "QR links", why: "never checked", href: "/d", severity: "info" },
+ { kind: "version-unjudged", target: "v2", why: "no verdict", href: "/p", severity: "open" },
+ { kind: "x-jar-stale", target: "x", why: "3 h old", href: "http://e/settings", severity: "blocking" },
+ ];
+ const p = readinessPills({ rows, facts, hrefs });
+ assert.deepEqual(state(p), { "quote-check": "bad", links: "count", captures: "ok", render: "count", "x-jar": "bad" });
+ assert.equal(p.find((x) => x.id === "render").href, "/review/v2");
+});
+
+test("not known is never ✓: the checks did not read -- —; the editor did not answer for X's jar -- —; nothing rendered -- —", () => {
+ assert.deepEqual(state(readinessPills({ rows: [], facts: { ...facts, decisionsKnown: false }, hrefs })), { "quote-check": "none", links: "none", captures: "none", render: "none", "x-jar": "ok" });
+ const x = readinessPills({ rows: [], facts: { ...facts, xKnown: false }, hrefs }).find((p) => p.id === "x-jar");
+ assert.deepEqual([x.state, x.title], ["none", "the editor did not answer: X's jar is not known"]);
+ assert.equal(readinessPills({ rows: [], facts: { ...facts, built: false, rendered: false }, hrefs }).find((p) => p.id === "render").state, "none");
+});
diff --git a/umtool/lib/inbox/readiness.ts b/umtool/lib/inbox/readiness.ts
@@ -0,0 +1,64 @@
+import { stat } from "node:fs/promises";
+import path from "node:path";
+import type { ProjectRef } from "@/lib/project-types";
+import { decisionsRead } from "@/lib/projects";
+import { listTakes } from "@/lib/report/takes.mjs";
+import { readManifest } from "@/lib/projects/report.mjs";
+import { homeHref, projectHref, takesHref, versionReviewHref } from "@/lib/hrefs";
+import { editorUrl } from "@/lib/articles/generation";
+import { QUOTE_CHECK_FILE } from "@/lib/report/quoteCheck.mjs";
+import { projectCallsOf } from "./projectCalls";
+import { xJarStatus } from "./xJar";
+import { readinessPills } from "./readiness.mjs";
+
+// ---------------------------------------------------------------------------
+// THE READINESS BAR's read (umtool redesign L7b; lib/inbox/readiness.mjs buckets): the rows the Inbox reads for
+// this one piece -- the reducer's decisions (decisionsForProject, memoised on the project's files), its calls
+// (projectCallsOf, the same memo) and X's jar (xJarDecisions: a minute's memo, never waited on past 0.4 s) --
+// and four stats. Never throws: a piece that cannot be read is a bar of —. SERVER ONLY.
+// ---------------------------------------------------------------------------
+
+export type ReadinessPill = { id: string; label: string; state: "bad" | "count" | "ok" | "none"; count: number; title: string; href: string | null; select?: string | null };
+export type Readiness = { project: string; pills: ReadinessPill[] };
+
+const exists = (f: string) => stat(/* turbopackIgnore: true */ f).then(() => true, () => false);
+
+export async function readinessOf(ref: ProjectRef): Promise<Readiness> {
+ try {
+ const [read, calls, jar, manifest, quoteCheck, linksChecked, takes] = await Promise.all([
+ decisionsRead(ref).catch(() => ({ value: [], failed: true })),
+ projectCallsOf(ref),
+ xJarStatus(),
+ readManifest(ref.dir).catch(() => null) as Promise<Record<string, unknown> | null>,
+ exists(path.join(ref.dir, QUOTE_CHECK_FILE)),
+ exists(path.join(ref.dir, "out", "links.json")),
+ listTakes(ref.dir).then((r) => r.takes, () => []),
+ ]);
+ const decisions = read.value;
+ const xjar = jar.row ? [jar.row] : [];
+ const timeline = (Array.isArray(manifest?.timeline) ? manifest.timeline : []) as Record<string, unknown>[];
+ const clips = timeline.filter((e) => e?.type === "clip").length;
+ const xPosts = timeline.filter((e) => e?.type === "post" && (e.platform === "x" || /^https?:\/\/(x|twitter)\.com\//.test(String(e.url ?? "")))).length;
+ const rows = [...decisions, ...calls, ...xjar];
+ // Current only when the checks read and say so (no unbuilt or stale-build row).
+ const built = !read.failed && !rows.some((r) => r.kind === "unbuilt" || r.kind === "stale-build");
+ // A render on record: a take or version with a preview on disk (the take panel's own test, previewSize).
+ const rendered = (takes as { previewSize: number | null }[]).some((t) => t.previewSize != null);
+ const pills = readinessPills({
+ rows: rows as never,
+ facts: { quoteCheck, linksChecked, clips, xPosts, built, rendered, decisionsKnown: !read.failed, xKnown: jar.known },
+ hrefs: {
+ decisions: projectHref(ref.id, { tab: "overview" }),
+ home: homeHref(),
+ deliver: projectHref(ref.id, { tab: "deliver" }),
+ takes: takesHref(ref.id),
+ cut: projectHref(ref.id, { tab: "cut" }),
+ xSettings: `${editorUrl()}/settings`,
+ review: (take: string) => versionReviewHref(ref.id, take),
+ },
+ }) as ReadinessPill[];
+ return { project: ref.id, pills };
+ } catch {
+ return { project: ref.id, pills: [] };
+ }
+}
diff --git a/umtool/lib/inbox/xJar.ts b/umtool/lib/inbox/xJar.ts
@@ -18,7 +18,9 @@ const memoMs = () => {
/** The editor's services answer from a stat: a late answer still lands in the memo for the next read. */
const WAIT_MS = 400;
-type Memo = { at: number; value: Promise<Decision | null> } | null;
+/** What the editor said of X's jar: its row when X work waits on a stale jar; `known` false when it did not answer. */
+type JarRead = { row: Decision | null; known: boolean };
+type Memo = { at: number; value: Promise<JarRead> } | null;
const g = globalThis as typeof globalThis & { __umtoolXJarMemo?: Memo };
/** Forget the memo (a spec that changed the stub's services; a Recheck). */
@@ -26,21 +28,29 @@ export function clearXJarMemo(): void {
g.__umtoolXJarMemo = null;
}
-async function ask(): Promise<Decision | null> {
+async function ask(): Promise<JarRead> {
const payload = await askEditor("/api/ops/services", { fresh: true });
- return xJarDecision(payload, { href: `${editorUrl()}/settings` }) as Decision | null;
+ return { row: xJarDecision(payload, { href: `${editorUrl()}/settings` }) as Decision | null, known: !!payload && typeof payload === "object" };
}
-/** The X jar's row when X work waits on it, else none. Never throws. */
-export async function xJarDecisions({ fresh = false }: { fresh?: boolean } = {}): Promise<Decision[]> {
+/**
+ * What the editor says of X's jar, never waited on past WAIT_MS: `known` false when it did not answer (down, slow,
+ * an error) -- the readiness bar says "—" then, never ✓ (umtool redesign L7b). Never throws.
+ */
+export async function xJarStatus({ fresh = false }: { fresh?: boolean } = {}): Promise<JarRead> {
const m = g.__umtoolXJarMemo;
- let value: Promise<Decision | null>;
+ let value: Promise<JarRead>;
if (m && !fresh && Date.now() - m.at < memoMs()) value = m.value;
else {
- value = ask().catch(() => null);
+ value = ask().catch(() => ({ row: null, known: false }));
g.__umtoolXJarMemo = { at: Date.now(), value };
}
- const timeout = new Promise<null>((resolve) => setTimeout(() => resolve(null), WAIT_MS).unref?.());
- const row = await Promise.race([value, timeout]).catch(() => null);
+ const timeout = new Promise<JarRead>((resolve) => setTimeout(() => resolve({ row: null, known: false }), WAIT_MS).unref?.());
+ return Promise.race([value, timeout]).catch(() => ({ row: null, known: false }));
+}
+
+/** The X jar's row when X work waits on it, else none. Never throws. */
+export async function xJarDecisions({ fresh = false }: { fresh?: boolean } = {}): Promise<Decision[]> {
+ const { row } = await xJarStatus({ fresh });
return row ? [row] : [];
}
diff --git a/umtool/lib/pieces/article.ts b/umtool/lib/pieces/article.ts
@@ -8,7 +8,7 @@ import { articlePieceId, readPieceGraph, type Piece, type PieceGraph, type Piece
import { boardOfArticle } from "./board.mjs";
import { readCases } from "./cases";
import type { PieceFrame } from "./frame";
-import { PIECE_TAB_IDS, pieceSteps, stageOfPiece, tabOfNoteAnchor } from "./tabs.mjs";
+import { PIECE_ADDRESS_TAB_IDS, PIECE_FOLDED, pieceSteps, stageOfPiece, tabOfNoteAnchor } from "./tabs.mjs";
// ---------------------------------------------------------------------------
// THE ARTICLE-ROOTED PIECE (plans/umtool-redesign.md, P4a-2): an article and
@@ -68,11 +68,11 @@ export async function articleVideo(piece: Piece, graph: PieceGraph, want?: strin
}
/** The tab a `?note=` on a PROJECT opens: where the note's anchor is drawn (its notes.json), or null. */
-export async function projectNoteTab(dir: string, note: string | undefined): Promise<string | null> {
+export async function projectNoteTab(dir: string, note: string | undefined, { piece = "project" }: { piece?: "project" | "article" } = {}): Promise<string | null> {
if (!note) return null;
const { doc } = await readNotes(path.join(/* turbopackIgnore: true */ dir, "notes.json")).catch(() => ({ doc: null }));
const n = doc?.notes?.find((x: { id: string }) => x.id === note) as { anchor?: { kind?: string } } | undefined;
- return n?.anchor?.kind ? tabOfNoteAnchor(n.anchor.kind) : null;
+ return n?.anchor?.kind ? tabOfNoteAnchor(n.anchor.kind, { piece }) : null;
}
type TabQuery = { tab?: string; all?: boolean; note?: string | null };
@@ -85,7 +85,10 @@ type TabQuery = { tab?: string; all?: boolean; note?: string | null };
export async function pieceHrefOfProject(projectId: string, q: TabQuery = {}): Promise<string> {
const graph = await readPieceGraph().catch(() => null);
const piece = graph ? graph.byId.get(graph.pieceOfProject.get(projectId) ?? "") : undefined;
- if (!graph || !piece || piece.kind !== "article" || !piece.site || !piece.report) return projectHref(projectId, q);
+ // On its own page a folded tab (L7b: Build and Media) is Deliver; an article piece keeps them.
+ if (!graph || !piece || piece.kind !== "article" || !piece.site || !piece.report) {
+ return projectHref(projectId, { ...q, tab: q.tab ? ((PIECE_FOLDED as Record<string, string>)[q.tab] ?? q.tab) : q.tab });
+ }
const v = await articleVideo(piece, graph, projectId);
return articleHref(
{ site: piece.site, id: piece.report },
@@ -110,9 +113,9 @@ export async function claimedProjectRedirect(
const all = one("all") === "1";
const asked = one("tab");
const tab =
- asked && PIECE_TAB_IDS.includes(asked)
+ asked && PIECE_ADDRESS_TAB_IDS.includes(asked)
? asked
- : ((note ? await projectNoteTab(project.dir, note) : null) ?? (all ? "cut" : "overview"));
+ : ((note ? await projectNoteTab(project.dir, note, { piece: "article" }) : null) ?? (all ? "cut" : "overview"));
return pieceHrefOfProject(project.id, { tab, all, note });
}
diff --git a/umtool/lib/pieces/tabs.mjs b/umtool/lib/pieces/tabs.mjs
@@ -107,19 +107,44 @@ export function stepOfPiece({ kind, reached }) {
return stageOfPiece({ kind, reached });
}
-/** The tabs of a report-video piece, in order; the key that opens each is its position. */
+/**
+ * The tabs of a report-video piece, in order; the key that opens each is its position. Since the workspace
+ * (umtool redesign L7b) they are FOUR: the workspace itself (the project's own address: the draft playing, its
+ * blocks, the inspector, the review pass, present), then Sources, Deliver and History.
+ *
+ * What the seven tabs before it held, and where it is now:
+ * Build, Media folded into Deliver (PIECE_FOLDED): the build chain and the final mp4, the drafted fields,
+ * the upload's text and the on-screen panel are what ships -- `?tab=build|media` 307s there (temporary: it moves again)
+ * Overview, Cut addressable VIEWS still (PIECE_VIEWS), out of the tab bar, under the workspace: the piece's
+ * decisions, README and iterations, and the cut as a list with its every tool (fetch windows,
+ * candidates, groups, prep …) have no home in the workspace yet. The workspace's Piece ▾ and
+ * the piece page's ⋯ open them.
+ */
export const PIECE_TABS = [
- { id: "overview", label: "Overview" },
- { id: "cut", label: "Cut" },
- { id: "media", label: "Media" },
- { id: "build", label: "Build" },
- { id: "deliver", label: "Deliver" },
+ { id: "workspace", label: "Workspace" },
{ id: "sources", label: "Sources" },
+ { id: "deliver", label: "Deliver" },
{ id: "history", label: "History" },
];
export const PIECE_TAB_IDS = PIECE_TABS.map((t) => t.id);
+/** The piece page's views out of the tab bar (the workspace's, until it holds them): `?tab=overview`, `?tab=cut`. */
+export const PIECE_VIEWS = [
+ { id: "overview", label: "Overview" },
+ { id: "cut", label: "The cut as a list" },
+];
+export const PIECE_VIEW_IDS = PIECE_VIEWS.map((t) => t.id);
+
+/** The tabs that folded into another (L7b): their address 307s to it (temporary), the rest of the query kept. */
+export const PIECE_FOLDED = { build: "deliver", media: "deliver" };
+
+/**
+ * Every `?tab=` a report video's address has ever answered (the seven of P4a-1): what a claimed project's address
+ * carries over to its article piece, which keeps all seven (ARTICLE_PIECE_TABS).
+ */
+export const PIECE_ADDRESS_TAB_IDS = ["overview", "cut", "media", "build", "deliver", "sources", "history"];
+
/**
* Every section ReportProject draws, by the name a spec says, and the tab it
* is on. The names are the sections' own data attributes where they have one.
@@ -139,17 +164,17 @@ export const SECTION_TAB = {
cut: "cut",
takes: "cut",
corrections: "cut",
- // Media: every drafted field and each section's Draft with (P4b's one surface),
+ // What was Media: every drafted field and each section's Draft with (P4b's one surface),
// the review and narration benches' links, the on-screen panel (moved from
- // Build in P4b) and the upload's text.
- drafts: "media",
- review: "media",
- narration: "media",
- youtube: "media",
- onscreen: "media",
- // Build: the build chain and the final mp4.
- build: "build",
- final: "build",
+ // Build in P4b) and the upload's text -- on Deliver since L7b.
+ drafts: "deliver",
+ review: "deliver",
+ narration: "deliver",
+ youtube: "deliver",
+ onscreen: "deliver",
+ // What was Build: the build chain and the final mp4 -- on Deliver since L7b.
+ build: "deliver",
+ final: "deliver",
// Deliver: the deliver panel and the exports.
deliver: "deliver",
exports: "deliver",
@@ -170,10 +195,11 @@ export function tabOfSection(name) {
}
/** Where a note's anchor is drawn: a row's on the Cut, a timed note on the final video on Build. */
-export function tabOfNoteAnchor(kind) {
+export function tabOfNoteAnchor(kind, { piece = "project" } = {}) {
// A Play-view note (`cut`) is reached from the Cut tab's Play the cut; its own link opens the Play view.
if (kind === "entry" || kind === "edit" || kind === "cut" || kind === "reel") return "cut";
- if (kind === "moment") return "build";
+ // The final video's timed notes: on Deliver since Build folded into it (L7b); an article piece keeps its Build.
+ if (kind === "moment") return piece === "article" ? "build" : "deliver";
return "overview";
}
@@ -184,14 +210,16 @@ export function tabOfNoteAnchor(kind) {
* @param {{ noteTab?: string | null }} [opts] the tab the `note`'s anchor is on, when the page looked it up
*/
export function tabOf(search, { noteTab = null } = {}) {
+ const shown = (t) => (PIECE_FOLDED[t] ?? t);
+ const known = (t) => !!t && t !== "workspace" && (PIECE_TAB_IDS.includes(shown(t)) || PIECE_VIEW_IDS.includes(t));
const t = search?.tab;
- if (t && PIECE_TAB_IDS.includes(t)) return t;
- if (search?.note && noteTab && PIECE_TAB_IDS.includes(noteTab)) return noteTab;
+ if (known(t)) return shown(t);
+ if (search?.note && known(noteTab)) return shown(noteTab);
if (search?.all === "1") return "cut";
return "overview";
}
-/** The tab a number key opens (`1` … `7`), or null. */
+/** The tab a number key opens (`1` … `4`: the workspace, Sources, Deliver, History), or null. */
export function tabOfKey(key) {
const n = Number(key);
return Number.isInteger(n) && n >= 1 && n <= PIECE_TABS.length ? PIECE_TABS[n - 1].id : null;
@@ -220,8 +248,8 @@ export const ARTICLE_PIECE_TABS = [
export const ARTICLE_PIECE_TAB_IDS = ARTICLE_PIECE_TABS.map((t) => t.id);
-/** The tabs an article piece draws from its video project (every tab of a project piece but its Overview). */
-export const VIDEO_TAB_IDS = PIECE_TAB_IDS.filter((t) => t !== "overview");
+/** The tabs an article piece draws from its video project (every tab a project piece had but its Overview). */
+export const VIDEO_TAB_IDS = PIECE_ADDRESS_TAB_IDS.filter((t) => t !== "overview");
/**
* The sections an article piece adds to SECTION_TAB, by the name a spec says.
@@ -231,6 +259,14 @@ export const VIDEO_TAB_IDS = PIECE_TAB_IDS.filter((t) => t !== "overview");
*/
export const ARTICLE_SECTION_TAB = {
...SECTION_TAB,
+ // An article piece keeps the video's Media and Build tabs (the project piece folded them into Deliver, L7b).
+ drafts: "media",
+ review: "media",
+ narration: "media",
+ youtube: "media",
+ onscreen: "media",
+ build: "build",
+ final: "build",
next: "overview",
sections: "overview",
article: "article",
diff --git a/umtool/lib/pieces/tabs.test.mjs b/umtool/lib/pieces/tabs.test.mjs
@@ -6,6 +6,9 @@ import {
ARTICLE_PIECE_TAB_IDS,
PIECE_TABS,
PIECE_TAB_IDS,
+ PIECE_ADDRESS_TAB_IDS,
+ PIECE_FOLDED,
+ PIECE_VIEW_IDS,
SECTION_TAB,
STAGE_STEPS,
VIDEO_TAB_IDS,
@@ -19,36 +22,49 @@ import {
tabOfSection,
} from "./tabs.mjs";
-test("seven tabs, in the canvas's order; keys 1–7 open them", () => {
- assert.deepEqual(PIECE_TAB_IDS, ["overview", "cut", "media", "build", "deliver", "sources", "history"]);
- assert.equal(tabOfKey("1"), "overview");
- assert.equal(tabOfKey("7"), "history");
- for (const k of ["0", "8", "n", "", "1.5"]) assert.equal(tabOfKey(k), null, k);
- assert.equal(PIECE_TABS.length, 7);
+test("four tabs since the workspace (L7b): the workspace, Sources, Deliver, History; keys 1–4 open them", () => {
+ assert.deepEqual(PIECE_TAB_IDS, ["workspace", "sources", "deliver", "history"]);
+ assert.equal(tabOfKey("1"), "workspace");
+ assert.equal(tabOfKey("4"), "history");
+ for (const k of ["0", "5", "n", "", "1.5"]) assert.equal(tabOfKey(k), null, k);
+ assert.equal(PIECE_TABS.length, 4);
+ // The seven a project's address ever answered: an article piece carries them over, and keeps them.
+ assert.deepEqual(PIECE_ADDRESS_TAB_IDS, ["overview", "cut", "media", "build", "deliver", "sources", "history"]);
+ assert.deepEqual(VIDEO_TAB_IDS, ["cut", "media", "build", "deliver", "sources", "history"]);
+ assert.deepEqual(PIECE_VIEW_IDS, ["overview", "cut"]);
+ assert.deepEqual(PIECE_FOLDED, { build: "deliver", media: "deliver" });
});
-test("the address picks the tab: ?tab= first, then a note's anchor, then ?all=1, else the Overview", () => {
+test("the address picks the tab: ?tab= first (a folded one its fold), then a note's anchor, then ?all=1, else the Overview", () => {
assert.equal(tabOf({}), "overview");
- assert.equal(tabOf({ tab: "build" }), "build");
+ assert.equal(tabOf({ tab: "build" }), "deliver");
+ assert.equal(tabOf({ tab: "media" }), "deliver");
+ assert.equal(tabOf({ tab: "cut" }), "cut");
+ assert.equal(tabOf({ tab: "workspace" }), "overview");
assert.equal(tabOf({ tab: "nonsense" }), "overview");
assert.equal(tabOf({ all: "1" }), "cut");
assert.equal(tabOf({ tab: "sources", all: "1" }), "sources");
- assert.equal(tabOf({ note: "n1" }, { noteTab: "build" }), "build");
+ assert.equal(tabOf({ note: "n1" }, { noteTab: "build" }), "deliver");
+ assert.equal(tabOf({ note: "n1" }, { noteTab: "cut" }), "cut");
assert.equal(tabOf({ note: "n1" }), "overview");
- assert.equal(tabOf({ tab: "media", note: "n1" }, { noteTab: "cut" }), "media");
+ assert.equal(tabOf({ tab: "history", note: "n1" }, { noteTab: "cut" }), "history");
});
test("a note opens where its anchor is drawn", () => {
assert.equal(tabOfNoteAnchor("entry"), "cut");
assert.equal(tabOfNoteAnchor("edit"), "cut");
- assert.equal(tabOfNoteAnchor("moment"), "build");
+ assert.equal(tabOfNoteAnchor("moment"), "deliver");
assert.equal(tabOfNoteAnchor("whole"), "overview");
});
-test("every section is on a real tab; an unknown one throws", () => {
- for (const [name, tab] of Object.entries(SECTION_TAB)) assert.ok(PIECE_TAB_IDS.includes(tab), name);
- assert.equal(tabOfSection("onscreen"), "media"); // moved from Build in P4b
+test("every section is on a real tab or view; an unknown one throws", () => {
+ for (const [name, tab] of Object.entries(SECTION_TAB)) assert.ok(PIECE_TAB_IDS.includes(tab) || PIECE_VIEW_IDS.includes(tab), name);
+ assert.equal(tabOfSection("onscreen"), "deliver"); // Media folded into Deliver (L7b)
+ assert.equal(tabOfSection("final"), "deliver"); // Build too
assert.equal(tabOfSection("deliver"), "deliver");
+ assert.equal(tabOfSection("timeline"), "cut");
+ assert.equal(articleTabOfSection("onscreen"), "media"); // an article piece keeps them
+ assert.equal(articleTabOfSection("final"), "build");
assert.throws(() => tabOfSection("nope"), /no section "nope"/);
});
diff --git a/umtool/lib/projects.ts b/umtool/lib/projects.ts
@@ -67,7 +67,7 @@ export const ALL_DECISION_KINDS: string[] = [
type ProjectCaches = {
walk: { at: number; refs: ProjectRef[] } | null;
summary: Map<string, { sig: string; value: ProjectSummary }>;
- decision: Map<string, { sig: string; value: Decision[] }>;
+ decision: Map<string, { sig: string; value: Decision[]; failed?: boolean }>;
};
const CACHES = ((globalThis as { __umtoolProjectCaches?: ProjectCaches }).__umtoolProjectCaches ??= {
walk: null,
@@ -276,11 +276,20 @@ export async function listFolders(): Promise<Map<string, FolderNode>> {
// literal the app needs inside the registry's own module.
// ---------------------------------------------------------------------------
export async function decisionsForProject(p: ProjectRef): Promise<Decision[]> {
+ return (await decisionsRead(p)).value;
+}
+
+/**
+ * The project's decisions and whether its kind's reducer READ (the readiness bar, umtool redesign L7b: a reducer
+ * that threw is "not known", never "nothing wrong"). Same cache as decisionsForProject.
+ */
+export async function decisionsRead(p: ProjectRef): Promise<{ value: Decision[]; failed: boolean }> {
const sig = await signatureOf(p);
const hit = decisionCache.get(p.id);
- if (hit && hit.sig === sig) return hit.value;
+ if (hit && hit.sig === sig) return { value: hit.value, failed: !!hit.failed };
let out: Decision[] = [];
+ let failed = false;
try {
if (p.kind === SONG_KIND) {
// Keyed by BASENAME while the song routes still are -- and the test for
@@ -298,6 +307,7 @@ export async function decisionsForProject(p: ProjectRef): Promise<Decision[]> {
}
} catch {
out = [];
+ failed = true;
}
// Routing failures are kind-independent, so they are added here rather than
@@ -340,8 +350,8 @@ export async function decisionsForProject(p: ProjectRef): Promise<Decision[]> {
const title = (await summariseProject(p)).title;
const value = out.map((d) => ({ ...d, project: p.id, projectTitle: title, projectKind: p.kind }));
- decisionCache.set(p.id, { sig, value });
- return value;
+ decisionCache.set(p.id, { sig, value, failed });
+ return { value, failed };
}
const RANK: Record<string, number> = { blocking: 0, open: 1, info: 2 };
diff --git a/umtool/lib/projects/kinds.mjs b/umtool/lib/projects/kinds.mjs
@@ -222,7 +222,10 @@ export const kindHasWorkspace = (id) => kindById(id)?.workspace === true;
* @param {string} kind
* @param {Record<string, string | string[] | undefined>} search
*/
-export const opensWorkspace = (kind, search) => kindHasWorkspace(kind) && !search?.tab && !search?.note && search?.all !== "1";
+// A workspace MODE in the address (L7b: `?mode=review|present`) is the workspace whatever else rides along -- a
+// take walk's old `?note=` and `?all=` carried into its review pass (they say where it came from, nothing more).
+export const opensWorkspace = (kind, search) =>
+ kindHasWorkspace(kind) && (search?.mode === "review" || search?.mode === "present" || (!search?.tab && !search?.note && search?.all !== "1"));
/** Can a project of this kind be an article's video (lib/articles/links.mjs)? Declared on the kind. */
export const kindLinksArticles = (id) => kindById(id)?.linksArticles === true;
diff --git a/umtool/lib/projects/report.mjs b/umtool/lib/projects/report.mjs
@@ -1134,8 +1134,9 @@ export const REPORT_DECISION_KINDS = [
* @param {string} target
*/
export function decisionTab(kind, target) {
- if (kind === "stale-build" || kind === "unbuilt") return "build";
- if (kind === "storage-unreachable" || kind === "storage-mismatch") return target === "out" ? "build" : "deliver";
+ // Build folded into Deliver (umtool redesign L7b): the build's rows are settled there.
+ if (kind === "stale-build" || kind === "unbuilt") return "deliver";
+ if (kind === "storage-unreachable" || kind === "storage-mismatch") return "deliver";
if (kind === "manifest-invalid" && target === "storage.deliverables") return "deliver";
if (kind === "no-punctuation") return "sources";
return null;
diff --git a/umtool/lib/report/present.mjs b/umtool/lib/report/present.mjs
@@ -424,7 +424,9 @@ export function presentFrom({ view, manifest, red, canUncensor = true }) {
title: view.title,
capabilities: { canUncensor: !!canUncensor },
settings: PRESENT_DEFAULTS,
- box: { width: fin(render.width) ? render.width : 1920, height: fin(render.height) ? render.height : 1080 },
+ // A 9:16 cut (`render.format: "vertical"`) is built 1080x1920 whatever its width and height say
+ // (takePreview.mjs previewKnobs): it presents tall (umtool redesign L7b).
+ box: render.format === "vertical" ? { width: 1080, height: 1920 } : { width: fin(render.width) ? render.width : 1920, height: fin(render.height) ? render.height : 1080 },
zone,
blurRendered: view.blurRendered !== false,
sections,
diff --git a/umtool/lib/report/reviewPass.mjs b/umtool/lib/report/reviewPass.mjs
@@ -0,0 +1,231 @@
+// THE REVIEW PASS (umtool redesign L7b; the workspace's `?mode=review`): the draft watched block by block, each
+// block answered Keep · Fix · Note, and the draft (or a version) given a verdict at the end. It replaces the walk
+// as the way through a cut; the clip bench stays the deep tool for one clip.
+//
+// Where each answer lands -- no new store for what already has one:
+//
+// Keep on a clip its WALK VERDICT `confirmed` (the bench's writer), and only when it has none or is confirmed
+// already: a clip the bench ruled incorrect (a fact error, wrong speaker) is never overwritten
+// here -- the bench changes it. Twin: `umtool window <p> <clip> --verdict confirmed`.
+// Fix ("needs `<project>/review-pass.json` (this file's) on ANY block, a clip too: `{ mark: "fix", note }` --
+// work"), Keep on NEVER a clip's verdict (`incorrect` is the fact-error verdict: a blocking check and `umtool
+// anything else corrections`). Twin: `umtool review-pass <p> mark <block> keep|fix|clear` (a clip: fix, clear).
+// Note the notes store (notes.json), anchored to the block (`{ kind: "entry", entry }`): `umtool notes`.
+// the end verdict takes/verdicts.json, L4's writer (`umtool takes verdict <p> <take> like|maybe|no`).
+//
+// What the pass walks: the cut's entries in order but the intro (watched, never judged -- the walk's own rule) and
+// a clip rejected for a cut reason (it is out of the cut's playback already; the bench re-rules it). A clip ruled
+// incorrect stays in the list: it is a Fix. Progress is "N / M reviewed", and the pass resumes on the first block
+// with no answer.
+//
+// Plain ESM: the CLI runs under bare node; the app reads the same functions.
+import { createHash } from "node:crypto";
+import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
+import path from "node:path";
+import { blockAnswer, reviewBlocks, reviewProgress } from "./reviewPassModel.mjs";
+
+export { blockAnswer, reviewBlocks, reviewProgress };
+
+export const REVIEW_PASS_FILE = "review-pass.json";
+export { REVIEW_MARKS } from "./reviewPassModel.mjs";
+import { REVIEW_MARKS } from "./reviewPassModel.mjs";
+/** A Fix's note, at most (a correction is the bench's sixth field; this is its post-and-card twin). */
+export const REVIEW_NOTE_LIMIT = 2000;
+
+/** @typedef {import("./reviewPassModel.mjs").ReviewMark} ReviewMark */
+/** @typedef {{ version: 1, marks: Record<string, ReviewMark> }} ReviewPassDoc */
+
+const empty = () => /** @type {ReviewPassDoc} */ ({ version: 1, marks: {} });
+
+/** Keep only well-formed marks: a hand-edited file never breaks the pass, it loses the rows it garbled. */
+function clean(raw) {
+ const out = empty();
+ const marks = raw && typeof raw === "object" && raw.marks && typeof raw.marks === "object" ? raw.marks : {};
+ for (const [id, m] of Object.entries(marks)) {
+ if (!m || typeof m !== "object" || !REVIEW_MARKS.includes(m.mark)) continue;
+ out.marks[id] = { mark: m.mark, ...(typeof m.note === "string" && m.note.trim() ? { note: m.note } : {}), ...(typeof m.sig === "string" ? { sig: m.sig } : {}), at: typeof m.at === "string" ? m.at : "" };
+ }
+ return out;
+}
+
+/** The project's review-pass.json; `{ version: 1, marks: {} }` when absent or unreadable. */
+export async function readReviewPass(dir) {
+ try {
+ return clean(JSON.parse(await readFile(path.join(dir, REVIEW_PASS_FILE), "utf8")));
+ } catch {
+ return empty();
+ }
+}
+
+// One write at a time per file, in this process (the app's route and a CLI run are separate processes: the
+// rename keeps a reader from ever seeing half a file, and the last write wins, as with the take verdicts).
+const chains = new Map();
+function serial(file, fn) {
+ const prev = chains.get(file) ?? Promise.resolve();
+ const run = prev.catch(() => {}).then(fn);
+ chains.set(file, run);
+ return run.finally(() => {
+ if (chains.get(file) === run) chains.delete(file);
+ });
+}
+
+/** What the walk and the review pass write on an entry: never part of what was reviewed. */
+const REVIEW_KEYS = new Set(["verdict", "correction", "reason", "rejectNote", "walkNote", "star"]);
+const canon = (v) => (Array.isArray(v) ? v.map(canon) : v && typeof v === "object" ? Object.fromEntries(Object.keys(v).sort().map((k) => [k, canon(v[k])])) : v);
+
+/**
+ * WHAT WAS REVIEWED, as a signature stored with each mark: a clip's source, the span it plays and its gaps; a post's
+ * or a card's every field but its id (and the review's own). A mark whose block no longer signs the same -- an edge
+ * moved, a post edited, another version opened into the draft, an id reused -- is "changed since reviewed":
+ * unanswered again.
+ *
+ * @param {Record<string, any>} e a timeline entry
+ */
+export function entrySignature(e) {
+ const what =
+ e?.type === "clip"
+ ? { type: "clip", channel: e.channel ?? null, video: e.video ?? null, src: e.src ?? null, from: e.cutStart ?? e.start ?? null, to: e.cutEnd ?? e.end ?? null, gaps: e.gaps ?? null }
+ : Object.fromEntries(Object.entries(e ?? {}).filter(([k]) => k !== "id" && !REVIEW_KEYS.has(k)));
+ return createHash("sha256").update(JSON.stringify(canon(what))).digest("hex").slice(0, 16);
+}
+
+/**
+ * The marks as they stand against the cut now: each with `stale: true` when its block is gone or no longer signs
+ * what was reviewed (a mark from before signatures is stale too). The model (reviewPassModel.mjs) reads a stale
+ * mark as no answer.
+ *
+ * @param {ReviewPassDoc} doc
+ * @param {{ timeline?: Array<Record<string, any>> } | null} manifest
+ */
+export function marksAgainst(doc, manifest) {
+ const byId = new Map((manifest?.timeline ?? []).filter((e) => e && typeof e.id === "string").map((e) => [e.id, e]));
+ return Object.fromEntries(
+ Object.entries(doc.marks).map(([id, m]) => {
+ const e = byId.get(id);
+ return [id, { ...m, ...(!e || !m.sig || m.sig !== entrySignature(e) ? { stale: true } : {}) }];
+ }),
+ );
+}
+
+/** The timeline entry kinds the pass marks here (a clip: its Fix and its clearing; its Keep is its walk verdict). */
+const MARKED_HERE = new Set(["clip", "post", "card", "teaser", "video"]);
+
+/**
+ * Set (or clear) one block's mark. Refused: a clip (its mark is its walk verdict), a block the timeline does not
+ * hold, a Fix with no note (say what needs fixing -- the rule the walk's `incorrect` has).
+ *
+ * @param {string} dir
+ * @param {{ timeline?: Array<Record<string, any>> } | null} manifest
+ * @param {string} block
+ * @param {"keep" | "fix" | null} mark null clears it
+ * @param {{ note?: string, now?: Date }} [o]
+ * @returns {Promise<{ doc: ReviewPassDoc, mark: ReviewMark | null }>}
+ */
+export async function setReviewMark(dir, manifest, block, mark, { note, now = new Date() } = {}) {
+ const e = (manifest?.timeline ?? []).find((x) => x && x.id === block);
+ if (!e) throw new Error(`no block "${block}" in the cut`);
+ if (e.type === "clip" && mark === "keep") {
+ throw new Error(`${block} is a clip: its Keep is its walk verdict (umtool window <p> ${block} --verdict confirmed); a Fix or a clear is a mark here`);
+ }
+ if (!MARKED_HERE.has(String(e.type))) throw new Error(`${block} is a ${e.type}: the review pass does not mark it`);
+ if (mark !== null && !REVIEW_MARKS.includes(mark)) throw new Error(`mark must be one of ${REVIEW_MARKS.join(", ")} (or clear)`);
+ const text = typeof note === "string" ? note.trim().slice(0, REVIEW_NOTE_LIMIT) : "";
+ if (mark === "fix" && !text) throw new Error("a Fix says what needs work (--note)");
+ const file = path.join(dir, REVIEW_PASS_FILE);
+ return serial(file, async () => {
+ const doc = await readReviewPass(dir);
+ if (mark === null) delete doc.marks[block];
+ else doc.marks[block] = { mark, ...(text ? { note: text } : {}), sig: entrySignature(e), at: now.toISOString() };
+ await mkdir(dir, { recursive: true });
+ const tmp = `${file}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 8)}`;
+ await writeFile(tmp, JSON.stringify(doc, null, 2) + "\n", "utf8");
+ await rename(tmp, file);
+ return { doc, mark: doc.marks[block] ?? null };
+ });
+}
+
+export const REVIEW_PASS_USAGE = [
+ "umtool review-pass <project> [ls] [--json]",
+ "umtool review-pass <project> mark <block> keep|fix|clear [--note T]",
+ "umtool review-pass <project> verdict like|maybe|no|clear [--note T] [--json]",
+];
+
+/**
+ * `umtool review-pass`: the pass's blocks with their answers and where it resumes (`ls`), or one post / card mark
+ * (`mark`). A clip's answer is its walk verdict -- `umtool window` writes it.
+ *
+ * @param {string[]} args
+ * @param {{ resolve?: (p: string) => Promise<{ id: string, dir: string } | null>, log?: Function, err?: Function }} [o]
+ */
+export async function reviewPassCommand(args, { resolve, log = console.log, err = console.error } = {}) {
+ const json = args.includes("--json");
+ const noteAt = args.indexOf("--note");
+ const note = noteAt >= 0 ? args[noteAt + 1] : undefined;
+ const pos = args.filter((a, i) => !a.startsWith("--") && !(noteAt >= 0 && i === noteAt + 1));
+ const [projectArg, verb = "ls", block, what] = pos;
+ if (!projectArg || args.includes("--help") || args.includes("-h")) {
+ (projectArg ? log : err)(REVIEW_PASS_USAGE.map((l) => `usage: ${l}`).join("\n"));
+ return projectArg ? 0 : 2;
+ }
+ const find = resolve ?? (async (a) => (await (await import("../projects/core.mjs")).resolveProject(a)).project ?? null);
+ const p = await find(projectArg);
+ if (!p) {
+ err(`no project "${projectArg}" (or more than one answers to that name: use its id)`);
+ return 2;
+ }
+ const manifest = JSON.parse(await readFile(path.join(p.dir, "video.manifest.json"), "utf8"));
+ if (verb === "mark") {
+ if (!block || !what || !["keep", "fix", "clear"].includes(what)) {
+ err(`usage: ${REVIEW_PASS_USAGE[1]}`);
+ return 2;
+ }
+ try {
+ const r = await setReviewMark(p.dir, manifest, block, what === "clear" ? null : /** @type {"keep" | "fix"} */ (what), { note });
+ if (json) log(JSON.stringify({ project: p.id, block, mark: r.mark }));
+ else log(r.mark ? `${block}: ${r.mark.mark}${r.mark.note ? ` — ${r.mark.note}` : ""}` : `${block}: cleared`);
+ return 0;
+ } catch (e) {
+ err(e instanceof Error ? e.message : String(e));
+ return 1;
+ }
+ }
+ if (verb === "verdict") {
+ // The pass's end: the draft's verdict (versions.mjs judgeDraft -- its parent when it differs only by review
+ // fields, else saved as the next version first). `block` is the verdict word here.
+ const word = block;
+ if (!word || !["like", "maybe", "no", "clear"].includes(word)) {
+ err(`usage: ${REVIEW_PASS_USAGE[2]}`);
+ return 2;
+ }
+ const { judgeDraft } = await import("./versions.mjs");
+ try {
+ const r = await judgeDraft(p, word === "clear" ? null : /** @type {"like" | "maybe" | "no"} */ (word), { note });
+ if (json) log(JSON.stringify({ project: p.id, judged: r.judged, saved: r.saved, verdict: r.entry?.verdict ?? null }));
+ else log(r.saved ? `saved ${r.judged} and judged it: ${word}` : `judged ${r.judged}: ${word}`);
+ return 0;
+ } catch (e) {
+ err(e instanceof Error ? e.message : String(e));
+ return 1;
+ }
+ }
+ if (verb !== "ls") {
+ err(`unknown: review-pass ${verb}\n${REVIEW_PASS_USAGE.map((l) => `usage: ${l}`).join("\n")}`);
+ return 2;
+ }
+ const doc = await readReviewPass(p.dir);
+ const timeline = Array.isArray(manifest.timeline) ? manifest.timeline : [];
+ const marks = marksAgainst(doc, manifest);
+ const prog = reviewProgress(timeline, marks);
+ const rows = reviewBlocks(timeline).map((e) => ({ id: e.id, type: e.type, answer: blockAnswer(e, marks), ...(marks[e.id]?.stale ? { changed: true } : {}) }));
+ if (json) {
+ log(JSON.stringify({ project: p.id, done: prog.done, total: prog.total, next: prog.next, blocks: rows }, null, 2));
+ return 0;
+ }
+ log(`${p.id}: ${prog.done} / ${prog.total} reviewed${prog.next ? ` · resumes at ${prog.next}` : " · every block answered: the verdict is next"}`);
+ for (const r of rows) {
+ const a = r.answer;
+ const said = !a ? (r.changed ? "— changed since reviewed" : "—") : a.mark === "fix" ? "needs work" : a.mark === "ruled" ? `${a.verdict} (the bench)` : a.mark;
+ log(` ${r.id === prog.next ? "→" : " "} ${r.id.padEnd(10)} ${String(r.type).padEnd(6)} ${said}${a?.note ? ` ${a.note}` : ""}`);
+ }
+ return 0;
+}
diff --git a/umtool/lib/report/reviewPass.test.mjs b/umtool/lib/report/reviewPass.test.mjs
@@ -0,0 +1,115 @@
+// THE REVIEW PASS's answers (lib/report/reviewPass.mjs): a clip's from its walk verdict, a post's or a card's from
+// review-pass.json; what the pass walks, where it resumes, and the store's refusals.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { mkdtempSync, readFileSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { clipKeepable } from "./reviewPassModel.mjs";
+import { blockAnswer, entrySignature, marksAgainst, readReviewPass, reviewBlocks, reviewPassCommand, reviewProgress, setReviewMark, REVIEW_PASS_FILE } from "./reviewPass.mjs";
+
+const timeline = [
+ { type: "clip", id: "c01", verdict: "confirmed" },
+ { type: "clip", id: "c02", verdict: "incorrect", correction: "the date is wrong" },
+ { type: "post", id: "p-5" },
+ { type: "card", id: "k01" },
+ { type: "clip", id: "c03", verdict: "rejected", reason: "weak" },
+ { type: "clip", id: "c04" },
+];
+
+test("the pass walks every block but the intro and a clip rejected for a cut reason; a clip the bench ruled incorrect is answered by the bench, a mark wins over a verdict", () => {
+ const view = [{ id: "intro", type: "intro" }, ...timeline.map((e) => ({ id: e.id, type: e.type, review: { verdict: e.verdict ?? null, correction: e.correction ?? null } }))];
+ assert.deepEqual(reviewBlocks(view).map((b) => b.id), ["c01", "c02", "p-5", "k01", "c04"]);
+ assert.deepEqual(reviewBlocks(timeline).map((b) => b.id), ["c01", "c02", "p-5", "k01", "c04"]);
+ assert.deepEqual(blockAnswer(timeline[0], {}), { mark: "keep", note: null });
+ assert.deepEqual(blockAnswer(timeline[1], {}), { mark: "ruled", note: "the date is wrong", verdict: "incorrect" });
+ // A Fix on a clip is a mark (never its verdict), and it is what the pass shows.
+ assert.deepEqual(blockAnswer(timeline[0], { c01: { mark: "fix", note: "trim the tail", at: "" } }), { mark: "fix", note: "trim the tail" });
+ assert.equal(clipKeepable(timeline[0]), true);
+ assert.equal(clipKeepable(timeline[1]), false);
+ assert.equal(clipKeepable(timeline[5]), true);
+ assert.equal(clipKeepable({ type: "clip", id: "w", verdict: "incorrect", reason: "wrong-speaker" }), false);
+ assert.equal(blockAnswer(timeline[2], {}), null);
+ assert.deepEqual(blockAnswer(timeline[2], { "p-5": { mark: "keep", at: "" } }), { mark: "keep", note: null });
+});
+
+test("progress counts the answered blocks and resumes on the first with none", () => {
+ assert.deepEqual(reviewProgress(timeline, {}), { done: 2, total: 5, next: "p-5", ids: ["c01", "c02", "p-5", "k01", "c04"] });
+ const marks = { "p-5": { mark: "fix", note: "crop", at: "" }, k01: { mark: "keep", at: "" } };
+ assert.deepEqual(reviewProgress(timeline, marks).next, "c04");
+ assert.deepEqual(reviewProgress([...timeline.slice(0, 4)], marks), { done: 4, total: 4, next: null, ids: ["c01", "c02", "p-5", "k01"] });
+});
+
+test("the store: a post's mark written and cleared; a clip, an unknown block and a Fix with no note refused", async () => {
+ const dir = mkdtempSync(path.join(tmpdir(), "review-pass-"));
+ try {
+ const m = { timeline };
+ assert.deepEqual((await readReviewPass(dir)).marks, {});
+ const r = await setReviewMark(dir, m, "p-5", "fix", { note: " the crop cuts his face ", now: new Date("2026-11-10T10:00:00Z") });
+ assert.deepEqual(r.mark, { mark: "fix", note: "the crop cuts his face", sig: entrySignature(timeline[2]), at: "2026-11-10T10:00:00.000Z" });
+ await setReviewMark(dir, m, "k01", "keep");
+ assert.deepEqual(Object.keys((await readReviewPass(dir)).marks).sort(), ["k01", "p-5"]);
+ await setReviewMark(dir, m, "k01", null);
+ assert.deepEqual(Object.keys(JSON.parse(readFileSync(path.join(dir, REVIEW_PASS_FILE), "utf8")).marks), ["p-5"]);
+ await assert.rejects(setReviewMark(dir, m, "c04", "keep"), /walk verdict/);
+ // A clip's Fix and its clearing are marks: its verdict is untouched.
+ assert.deepEqual((await setReviewMark(dir, m, "c04", "fix", { note: "trim the tail", now: new Date("2026-11-10T11:00:00Z") })).mark, { mark: "fix", note: "trim the tail", sig: entrySignature(timeline[5]), at: "2026-11-10T11:00:00.000Z" });
+ assert.equal((await setReviewMark(dir, m, "c04", null)).mark, null);
+ await assert.rejects(setReviewMark(dir, m, "nope", "keep"), /no block/);
+ await assert.rejects(setReviewMark(dir, m, "k01", "fix"), /what needs work/);
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+});
+
+test("umtool review-pass: ls says where it resumes; mark writes a card's", async () => {
+ const dir = mkdtempSync(path.join(tmpdir(), "review-pass-cli-"));
+ try {
+ const { writeFileSync } = await import("node:fs");
+ writeFileSync(path.join(dir, "video.manifest.json"), JSON.stringify({ timeline }));
+ const out = [];
+ const o = { resolve: async () => ({ id: "reports/x", dir }), log: (s) => out.push(String(s)), err: (s) => out.push(`ERR ${s}`) };
+ assert.equal(await reviewPassCommand(["reports/x"], o), 0);
+ assert.match(out[0], /2 \/ 5 reviewed · resumes at p-5/);
+ assert.equal(await reviewPassCommand(["reports/x", "mark", "k01", "keep"], o), 0);
+ assert.equal(await reviewPassCommand(["reports/x", "mark", "c04", "keep"], o), 1);
+ assert.equal(await reviewPassCommand(["reports/x", "mark", "c04", "fix", "--note", "the tail"], o), 0);
+ assert.equal(await reviewPassCommand(["reports/x", "mark", "c04", "clear"], o), 0);
+ out.length = 0;
+ assert.equal(await reviewPassCommand(["reports/x", "--json"], o), 0);
+ const j = JSON.parse(out.join("\n"));
+ assert.equal(j.done, 3);
+ assert.equal(j.next, "p-5");
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+});
+
+test("a mark is of what was reviewed: an edge moved, a post edited, an id reused -- changed since reviewed, unanswered", async () => {
+ const dir = mkdtempSync(path.join(tmpdir(), "review-pass-sig-"));
+ try {
+ const tl = [
+ { type: "clip", id: "c1", video: "v", start: 1, end: 3, verdict: "confirmed" },
+ { type: "post", id: "p1", post: "x/1", text: "the scale said 291" },
+ { type: "card", id: "k1", heading: "Between", seconds: 1.5 },
+ ];
+ for (const [id, mark] of [["c1", "fix"], ["p1", "keep"], ["k1", "keep"]]) await setReviewMark(dir, { timeline: tl }, id, mark, { note: mark === "fix" ? "trim" : undefined });
+ const doc = await readReviewPass(dir);
+ const same = marksAgainst(doc, { timeline: tl });
+ assert.deepEqual(Object.values(same).map((m) => !!m.stale), [false, false, false]);
+ // The walk's own fields are not what was reviewed: a verdict or a note added since changes nothing.
+ assert.equal(marksAgainst(doc, { timeline: tl.map((e) => ({ ...e, walkNote: "ok", star: true })) }).c1.stale, undefined);
+ const moved = [{ ...tl[0], cutEnd: 2.5 }, { ...tl[1], text: "the scale said 290" }, { type: "teaser", id: "k1", lines: ["reused"] }];
+ const now = marksAgainst(doc, { timeline: moved });
+ assert.deepEqual([now.c1.stale, now.p1.stale, now.k1.stale], [true, true, true]);
+ // Stale is no answer: the clip falls back to its verdict, the post and the card are unanswered.
+ assert.deepEqual(blockAnswer(moved[0], now), { mark: "keep", note: null });
+ assert.equal(blockAnswer(moved[1], now), null);
+ assert.equal(reviewProgress(moved, now).next, "p1");
+ // A block gone: its mark is stale; a mark from before signatures too.
+ assert.equal(marksAgainst(doc, { timeline: [] }).c1.stale, true);
+ assert.equal(marksAgainst({ version: 1, marks: { c1: { mark: "keep", at: "" } } }, { timeline: tl }).c1.stale, true);
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+});
diff --git a/umtool/lib/report/reviewPassModel.mjs b/umtool/lib/report/reviewPassModel.mjs
@@ -0,0 +1,79 @@
+// THE REVIEW PASS's model (lib/report/reviewPass.mjs is the store and the CLI): what the pass walks, each block's
+// answer, the progress and where it resumes. Pure, no imports: the workspace's page reads it in the browser.
+
+export const REVIEW_MARKS = /** @type {const} */ (["keep", "fix"]);
+
+/** @typedef {{ mark: "keep" | "fix", note?: string, sig?: string, at: string, stale?: boolean }} ReviewMark */
+
+/**
+ * What the pass walks, from either shape of an entry: the play view's (`type`, `review.verdict`) or the
+ * manifest's (`type`, `verdict`). The intro and a clip rejected for a cut reason are left out.
+ *
+ * @param {Array<{ id: string, type: string, verdict?: string | null, review?: { verdict?: string | null } | null }>} entries
+ */
+export function reviewBlocks(entries) {
+ return (Array.isArray(entries) ? entries : []).filter((e) => {
+ if (!e || typeof e.id !== "string" || e.type === "intro") return false;
+ const v = e.review?.verdict ?? e.verdict ?? null;
+ return !(e.type === "clip" && v === "rejected");
+ });
+}
+
+/**
+ * One block's answer. null: not reviewed yet.
+ *
+ * a review-pass mark (review-pass.json), on any block keep, or fix ("needs work") with its note
+ * a clip the BENCH ruled incorrect (a fact error, "ruled": answered, by the bench -- the pass never
+ * wrong speaker), no mark overwrites it (its verdict and its words shown)
+ * a clip whose walk verdict is confirmed, no mark keep
+ *
+ * Fix never writes a clip's verdict: `incorrect` is the fact-error verdict (a blocking check, `umtool corrections`).
+ *
+ * @param {{ id: string, type: string, verdict?: string | null, reason?: string | null, correction?: string | null, review?: { verdict?: string | null, reason?: string | null, correction?: string | null } | null }} e
+ * @param {Record<string, ReviewMark>} marks
+ * @returns {{ mark: "keep" | "fix" | "ruled", note: string | null, verdict?: string } | null}
+ */
+export function blockAnswer(e, marks) {
+ // A mark whose block changed since it was reviewed (`stale`, reviewPass.mjs marksAgainst) is no answer.
+ const m = marks?.[e.id];
+ if (m && !m.stale) return { mark: m.mark, note: m.note ?? null };
+ if (e.type !== "clip") return null;
+ const v = clipVerdict(e);
+ if (v === "confirmed") return { mark: "keep", note: null };
+ if (v === "incorrect") {
+ const words = e.review?.correction ?? e.correction ?? e.review?.reason ?? e.reason ?? null;
+ return { mark: "ruled", note: typeof words === "string" && words ? words : null, verdict: v };
+ }
+ return null;
+}
+
+/** A clip's walk verdict, from either shape of an entry. */
+export const clipVerdict = (e) => e?.review?.verdict ?? e?.verdict ?? null;
+
+/**
+ * May the review pass's Keep write this clip's walk verdict (`confirmed`)? Only when it has none or is confirmed
+ * already: a clip the bench ruled incorrect (a fact error, wrong speaker) is the bench's to change.
+ */
+export const clipKeepable = (e) => {
+ const v = clipVerdict(e);
+ return v === null || v === undefined || v === "" || v === "confirmed";
+};
+
+/**
+ * The pass's progress: how many of its blocks have an answer, and where it resumes (the first with none; null when
+ * every block has one -- the verdict at the end).
+ *
+ * @param {Parameters<typeof reviewBlocks>[0]} entries
+ * @param {Record<string, ReviewMark>} marks
+ */
+export function reviewProgress(entries, marks) {
+ const blocks = reviewBlocks(entries);
+ let done = 0;
+ let next = null;
+ for (const b of blocks) {
+ if (blockAnswer(b, marks)) done += 1;
+ else if (next === null) next = b.id;
+ }
+ return { done, total: blocks.length, next, ids: blocks.map((b) => b.id) };
+}
+
diff --git a/umtool/lib/report/versions.mjs b/umtool/lib/report/versions.mjs
@@ -199,6 +199,51 @@ export async function saveVersion(project, { label = null, now = new Date(), for
}
/**
+ * What the walk and the review pass write on an entry: a verdict and its words, a walk note, the ★. A draft that
+ * differs from its parent only in these is still that version, for its verdict (judgeDraft).
+ */
+export const REVIEW_FIELDS = ["verdict", "correction", "reason", "rejectNote", "walkNote", "star"];
+
+/** A manifest with the review fields taken off every timeline entry (a copy). */
+export function withoutReviewFields(m) {
+ const out = JSON.parse(JSON.stringify(m ?? {}));
+ if (Array.isArray(out.timeline)) for (const e of out.timeline) if (isObj(e)) for (const k of REVIEW_FIELDS) delete e[k];
+ return out;
+}
+
+/**
+ * THE REVIEW PASS'S VERDICT ON THE DRAFT (umtool redesign L7b), one locked call: a verdict is a version's, so --
+ * the draft differs from its parent version ONLY in what the walk and the review pass write (REVIEW_FIELDS):
+ * it IS that version -- the parent is judged, nothing saved;
+ * else (or no parent): the draft is saved as the next version (saveVersionLocked; at no edits at all that is
+ * the parent again, nothing saved) and that version is judged.
+ * Returns `{ judged, saved, entry }`: which version took the verdict, and whether one was saved for it.
+ *
+ * @param {{ id: string, dir: string }} project
+ * @param {"like" | "maybe" | "no" | null} verdict null clears it
+ * @param {{ note?: string, now?: Date }} [o]
+ */
+export async function judgeDraft(project, verdict, { note, now = new Date() } = {}) {
+ const { setTakeVerdict } = await import("./takes.mjs");
+ const { versionManifestOf } = await import("./takeMaker.mjs");
+ return withManifestLock(async () => {
+ const text = await readFile(path.join(project.dir, MANIFEST), "utf8").catch(() => null);
+ if (text === null) throw new VersionRefused(`the project has no ${MANIFEST}`);
+ const working = await readWorkingCut(project.dir, { manifestText: text });
+ if (working.parent) {
+ const v = await versionManifestOf(project.dir, working.parent.id).catch(() => null);
+ if (v && sameContent(withoutReviewFields(JSON.parse(text)), withoutReviewFields(v.manifest))) {
+ const r = await setTakeVerdict(project.dir, working.parent.id, { verdict, ...(note !== undefined ? { note } : {}) });
+ return { judged: working.parent.id, saved: false, entry: r.entry };
+ }
+ }
+ const s = await saveVersionLocked(project.dir, { now, why: "Saved for its verdict (the review pass)" });
+ const r = await setTakeVerdict(project.dir, s.id, { verdict, ...(note !== undefined ? { note } : {}) });
+ return { judged: s.id, saved: !!s.saved, entry: r.entry };
+ });
+}
+
+/**
* What opening take `id` would write into the draft, and how:
* "frozen" a saved version: its base (with any patch laid over it since)
* "rendered" a legacy rendered take of the cut's own timeline: the manifest it was
diff --git a/umtool/lib/report/versions.test.mjs b/umtool/lib/report/versions.test.mjs
@@ -11,7 +11,7 @@ import path from "node:path";
import test from "node:test";
import { spawnSync } from "node:child_process";
-import { freezeTakes, nextVersionId, openVersion, readDraft, saveVersion } from "./versions.mjs";
+import { freezeTakes, judgeDraft, nextVersionId, openVersion, readDraft, saveVersion } from "./versions.mjs";
import { composeTake, checkSpec, makeTake, pickTake } from "./takeMaker.mjs";
import { resolveTakeManifest } from "./takeManifest.mjs";
import { isWorkingTake, listTakes, readVerdicts, setTakePicked } from "./takes.mjs";
@@ -516,3 +516,35 @@ test("a project naming a PRESET: its latest legacy take with no edits opens as n
await rm(root, { recursive: true, force: true });
}
});
+
+test("judgeDraft: a draft that differs from its parent only by the walk's and the review pass's fields judges the PARENT and saves nothing; any other edit saves the next version and judges it", async () => {
+ const { root, dir, proj } = await project();
+ try {
+ await saveVersion(proj);
+ // A Keep (the walk's verdict), a correction, a walk note, the star: the draft is still v1.
+ await updateClip(dir, "a", { verdict: "confirmed" });
+ await updateClip(dir, "b", { walkNote: "fine", star: true });
+ let r = await judgeDraft(proj, "like");
+ assert.deepEqual([r.judged, r.saved], ["v1", false]);
+ assert.equal((await readVerdicts(dir)).v1.verdict, "like");
+ assert.deepEqual((await listTakes(dir)).takes.filter((t) => t.version).map((t) => t.id), ["v1"]);
+ // An edge moved: another cut -- saved as v2, and v2 is judged.
+ await updateClip(dir, "c", { end: 48 });
+ r = await judgeDraft(proj, "maybe");
+ assert.deepEqual([r.judged, r.saved], ["v2", true]);
+ const v = await readVerdicts(dir);
+ assert.deepEqual([v.v1.verdict, v.v2.verdict], ["like", "maybe"]);
+ assert.equal((await readDraft(dir)).from, "v2");
+ // No parent at all: saved as the first version, judged.
+ const fresh = await project();
+ try {
+ r = await judgeDraft(fresh.proj, "no");
+ assert.deepEqual([r.judged, r.saved], ["v1", true]);
+ assert.equal((await readVerdicts(fresh.dir)).v1.verdict, "no");
+ } finally {
+ await rm(fresh.root, { recursive: true, force: true });
+ }
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});