commit c6f2fe0532d5a9076469428160331f2094c24c3a
parent 6a7237615189dd4319a3769ced2e4fce4afe37f4
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 1 Nov 2026 22:23:08 -0500
umtool variants --list: the master item is the build itself (<slug>.mp4, or a take's preview), not a <slug>.master.mp4 that never exists -- it no longer prints GONE beside a master that is there
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/umtool/lib/report/knobs.test.mjs b/umtool/lib/report/knobs.test.mjs
@@ -245,6 +245,27 @@ test("variantsState: the build, the variants made, the sync report with the lags
await assert.rejects(variantsState({ id: "p", dir }, await read(dir), "../x"), /not a take id/);
});
+test("variantsState: the `master` item is the build itself (<slug>.mp4), never a <slug>.master.mp4", async () => {
+ const dir = await project();
+ const out = path.join(dir, "out");
+ await mkdir(out, { recursive: true });
+ await writeFile(path.join(out, "t.mp4"), "m".repeat(120));
+ await writeFile(path.join(out, "t.720p.mp4"), "x".repeat(40));
+ await writeFile(path.join(out, "variants.json"), JSON.stringify({
+ at: new Date(Date.now() + 5000).toISOString(), source: path.join(out, "t.mp4"),
+ items: [
+ { name: "master", path: path.join(out, "t.mp4"), width: 1920, height: 1080, bytes: 120, kbps: 1919 },
+ { name: "720p", path: path.join(out, "t.720p.mp4"), width: 1280, height: 720, bytes: 40, kbps: 899 },
+ ],
+ }));
+ let s = await variantsState({ id: "p", dir }, await read(dir));
+ assert.deepEqual(s.made.items.map((i) => [i.name, i.exists, i.bytes]), [["master", true, 120], ["720p", true, 40]]);
+ // The build gone: the master is gone with it.
+ await rm(path.join(out, "t.mp4"));
+ s = await variantsState({ id: "p", dir }, await read(dir));
+ assert.deepEqual(s.made.items.map((i) => [i.name, i.exists]), [["master", false], ["720p", true]]);
+});
+
test("variantsState on a take: its out/<slug>.mp4, else its finished preview.mp4 (the encoder pointed at it)", async () => {
const dir = await project();
const takeDir = path.join(dir, "takes", "final");
diff --git a/umtool/lib/report/variantsView.mjs b/umtool/lib/report/variantsView.mjs
@@ -107,7 +107,9 @@ export async function variantsState(project, manifest, take = null) {
if (isObj(doc) && Array.isArray(doc.items)) {
for (const it of doc.items) {
if (!isObj(it) || typeof it.name !== "string" || !VARIANT_NAME_RE.test(it.name)) continue;
- const f = await fileInfo(path.join(outDir, `${slug}.${it.name}.mp4`));
+ // The `master` variant is the build itself (`<slug>.mp4`, or a take's
+ // preview), not a `<slug>.master.mp4`: it is there when the build is.
+ const f = it.name === "master" ? built : await fileInfo(path.join(outDir, `${slug}.${it.name}.mp4`));
items.push({
name: it.name,
width: fin(it.width) ? it.width : null,