// Editing a take with --take is a supported path (12 Nov 2026): `window --take`, `set --take`, `timeline --take`, // `posts … --in-take` write the take's patch with an undo point of its own and never the project's manifest (the // operator's draft). They said "deprecated -- edits land in the draft now; open the take there first (umtool takes // open …)", and that advice is the one path here that writes over the draft. They now say nothing on stderr. import assert from "node:assert/strict"; import { spawnSync } from "node:child_process"; import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; import test from "node:test"; import { fileURLToPath } from "node:url"; import { draftTake } from "./takeMaker.mjs"; const CLI = fileURLToPath(new URL("../../bin/umtool.mjs", import.meta.url)); test("window --take and set --take: the take's patch written, the draft byte for byte the same, no deprecation line", async () => { const root = await mkdtemp(path.join(tmpdir(), "umtool-take-edit-")); try { const dir = path.join(root, "proj"); await mkdir(dir, { recursive: true }); const manifest = { schemaVersion: 1, slug: "proj", timeline: [{ type: "clip", id: "e1", channel: "ch", video: "v1", start: 10, end: 20 }, { type: "clip", id: "e2", channel: "ch", video: "v2", start: 30, end: 40 }] }; await writeFile(path.join(dir, "video.manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`); await draftTake(dir, { id: "t1", label: "T1", patch: { timeline: manifest.timeline } }); const draftBefore = await readFile(path.join(dir, "video.manifest.json"), "utf8"); const run = (...args) => spawnSync(process.execPath, [CLI, ...args], { cwd: root, env: { ...process.env, REPORTS_DIR: root }, encoding: "utf8" }); let r = run("window", dir, "e1", "--take", "t1", "--start", "11", "--end", "21"); assert.equal(r.status, 0, r.stderr); assert.match(r.stdout, /e1 \(take t1\): 10–20 -> 11–21/); assert.match(r.stdout, /undo point: takes\/t1\//); assert.doesNotMatch(r.stderr, /deprecated/); assert.equal(r.stderr.trim(), ""); r = run("set", dir, "e2", "audio.gain=3", "--take", "t1"); assert.equal(r.status, 0, r.stderr); assert.doesNotMatch(r.stderr, /deprecated/); const take = JSON.parse(await readFile(path.join(dir, "takes", "t1", "take.json"), "utf8")); assert.equal(take.patch.timeline.find((e) => e.id === "e1").start, 11); assert.equal(take.patch.timeline.find((e) => e.id === "e2").audio?.gain, 3); assert.equal(await readFile(path.join(dir, "video.manifest.json"), "utf8"), draftBefore, "the operator's draft is never written"); } finally { await rm(root, { recursive: true, force: true }); } });