Archilyzer · Source

archilyzer

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

commit 36d42e633a871fbd5ca2ba323a29d9e680a982fc
parent eab4ee6e0d3fc08cab182f7544c896776f6c0db6
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 10 Nov 2026 15:58:15 -0500

umtool: the review pass's verdict on the draft is one locked server call (versions.mjs judgeDraft) -- a draft that differs from its parent only by the walk's and the pass's fields judges the PARENT and saves nothing, else it is saved as the next version and that is judged; the panel says "Judged v5" / "Saved v6 and judged it"; POST /api/report/review-pass/verdict, `umtool review-pass <p> verdict`; both branches unit-tested -- L7b review item 5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Diffstat:
Aumtool/app/api/report/review-pass/verdict/route.ts | 31+++++++++++++++++++++++++++++++
Mumtool/components/projects/workspace/ReviewPass.tsx | 34++++++++++++++++++++--------------
Mumtool/docs/cli.md | 2++
Mumtool/docs/knobs.md | 8+++++---
Mumtool/e2e/review-pass.spec.ts | 2++
Mumtool/lib/cli/groups.mjs | 4++++
Mumtool/lib/cli/verbs.mjs | 3+++
Mumtool/lib/report/reviewPass.mjs | 20++++++++++++++++++++
Mumtool/lib/report/versions.mjs | 45+++++++++++++++++++++++++++++++++++++++++++++
Mumtool/lib/report/versions.test.mjs | 34+++++++++++++++++++++++++++++++++-
10 files changed, 165 insertions(+), 18 deletions(-)

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/components/projects/workspace/ReviewPass.tsx b/umtool/components/projects/workspace/ReviewPass.tsx @@ -114,16 +114,24 @@ const VERDICTS = [ 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<string | null>(null); + 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}> - <span className="text-[12px] text-text-2"> - judged <span className="font-mono text-text">{saved}</span>: + <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} /> + <VersionVerdict project={project} take={saved.id} /> </span> ); } @@ -131,13 +139,11 @@ function DraftVerdict({ project, draft }: { project: string; draft: { line: stri setBusy(true); setErr(null); try { - const s = await fetch("/api/report/takes/save", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ project }) }); - const sj = (await s.json().catch(() => ({}))) as { id?: string; error?: string }; - if (!s.ok || !sj.id) throw new Error(sj.error ?? `HTTP ${s.status}`); - const r = await fetch("/api/report/takes/verdict", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ project, take: sj.id, verdict: v }) }); - const rj = (await r.json().catch(() => ({}))) as { error?: string }; - if (!r.ok) throw new Error(rj.error ?? `HTTP ${r.status}`); - setSaved(sj.id); + // 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 }); } catch (e) { setErr(e instanceof Error ? e.message : String(e)); } finally { @@ -146,8 +152,8 @@ function DraftVerdict({ project, draft }: { project: string; draft: { line: stri }; 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: the draft is saved as the next version first (umtool takes save), then judged (umtool takes verdict)"> - {draft?.line ?? "The draft"} — saved as a version, then: + <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" })}> diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -43,6 +43,7 @@ Inbox cannot disagree about what is wrong with one. | `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 clip's Keep · Fix is its walk verdict (`window --verdict confirmed\|incorrect --correction`), a post's or a card's lives in `<project>/review-pass.json` — `mark` writes one (a Fix needs `--note`, what needs fixing); a clip is refused here ([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)) | @@ -193,6 +194,7 @@ draft (the project's manifest); *project*: a project's other files, or reads; *c | `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 post's or a card's review-pass answer: keep, fix (with what) 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 @@ -798,8 +798,10 @@ rejected for a cut reason is in it, **"4 / 12 reviewed"**, and it resumes on the 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`): the draft is saved as a version first when it has edits (a verdict is a -version's; with none, it is its parent's), a version reviewed (`&take=`) is judged as itself. **Done** is back to +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). @@ -809,7 +811,7 @@ changes it). The take walk's old address (`/takes/<t>/walk`) is that version's p | a post's or a card's answer | `umtool review-pass <p> mark <block> keep\|fix\|clear [--note T]` | | a clip's | `umtool window <p> <clip> --verdict confirmed` · `--verdict incorrect --correction T` | | a note on a block | `umtool notes <p>` (reading); the app writes it | -| the verdict | `umtool takes save <p>` then `umtool takes verdict <p> <v> like\|maybe\|no` | +| 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) diff --git a/umtool/e2e/review-pass.spec.ts b/umtool/e2e/review-pass.spec.ts @@ -144,6 +144,8 @@ test("past the last block, the verdict: Like saves the draft as a version and wr 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=/); diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs @@ -259,10 +259,14 @@ export const GROUPS = [ " 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 post's or a card's answer (a Fix says what)", + " 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 clip's Keep · Fix is its walk verdict (`window --verdict confirmed\\|incorrect --correction`), a post's or a card's lives in `<project>/review-pass.json` — `mark` writes one (a Fix needs `--note`, what needs fixing); a clip is refused here ([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`)"], ], }, { diff --git a/umtool/lib/cli/verbs.mjs b/umtool/lib/cli/verbs.mjs @@ -170,6 +170,9 @@ export const VERBS = Object.freeze([ form("review-pass mark", "project", "a post's or a card's review-pass answer: keep, fix (with what) or clear", [ project(), arg("block", { context: "post", help: "the post item's or the card's id" }), pick("mark", ["keep", "fix", "clear"], { required: true }), opt("--note", { type: "text", help: "a Fix: what needs fixing" }), ], { 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()]), 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")]), diff --git a/umtool/lib/report/reviewPass.mjs b/umtool/lib/report/reviewPass.mjs @@ -107,6 +107,7 @@ export async function setReviewMark(dir, manifest, block, mark, { note, now = ne 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]", ]; /** @@ -148,6 +149,25 @@ export async function reviewPassCommand(args, { resolve, log = console.log, err 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; 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 }); + } +});