commit f82aa86c8e0e11487deaee179c13b7b1c10e2708
parent c78931324b69954c71129bd594872bdfad265f6c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 18:55:37 -0500
umtool: a render finishing after an open leaves the draft's pointer alone (L3 review 6)
makeTake repointed takes/draft.json to every working take it made, even when
an Open in draft happened during the render. The pointer is read as the render
starts and written only if it is unchanged at the end; otherwise the log says
the parent was left as the open made it. Test: versions.test.mjs, "a working
take rendered while the draft was opened".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/umtool/lib/report/takeMaker.mjs b/umtool/lib/report/takeMaker.mjs
@@ -750,6 +750,9 @@ async function makeTakeLocked(projectDir, rawSpec, opts) {
const preview = path.join(takeDir, PREVIEW);
await unlinkIfSameFile(path.join(takeOut, `${String(manifest.slug ?? "")}.mp4`), preview);
+ // The draft pointer as the render starts (versions.mjs): a working take repoints it when it is made, but
+ // only if nothing moved it meanwhile (an Open in draft during a long render keeps what was opened).
+ const draftPointerAtStart = frozen ? null : await readFile(path.join(takesDirOf(projectDir), DRAFT_FILE), "utf8").catch(() => "");
const transition = Number(manifest.render?.transition ?? 0);
const xfade = patches.some((p) => getPath(p, "render.transition") !== undefined) && transition > 0;
emit({ ev: "take", id: spec.id, phase: "render", window: spec.window, entries: covered?.ids ?? null, basis: covered?.basis ?? null });
@@ -842,8 +845,11 @@ async function makeTakeLocked(projectDir, rawSpec, opts) {
await rename(tmp, takeFile);
// A whole-cut take of the DRAFT as it is (not a frozen version re-rendered) is the draft's parent now (versions.mjs).
if (!frozen && isWorkingTake(doc)) {
- const { writeDraft } = await import("./versions.mjs");
- await writeDraft(projectDir, { from: spec.id, hash: doc.baseHash, at: doc.builtAt }).catch(() => {});
+ const nowPointer = await readFile(path.join(takesDirOf(projectDir), DRAFT_FILE), "utf8").catch(() => "");
+ if (nowPointer === draftPointerAtStart) {
+ const { writeDraft } = await import("./versions.mjs");
+ await writeDraft(projectDir, { from: spec.id, hash: doc.baseHash, at: doc.builtAt }).catch(() => {});
+ } else log(`${spec.id}: the draft was opened or saved while this rendered — its parent is left as that made it`);
}
// A whole-cut take of the manifest is its group's pick now (takes.mjs autoPickTake): mark only.
const group = ((listing ?? (await listTakes(projectDir))).takes ?? []).filter((t) => t.group === doc.group).map((t) => t.id);