commit 16d7fa8670a3fdbc29b2178fc94e72008f09a351
parent d5532f6cc30951d0a3a0cd98323e5bda0273525f
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 4 Nov 2026 17:33:50 -0500
umtool: a unit a build reuses from its own out/ that the render pool has not got (built before the pool, linked in by --from) is filed then -- post segments (the plain one of a badged item), clip segments, chunks, the sound
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -1974,7 +1974,9 @@ unit is for the same inputs; the build's own key versions are in the keys too.
`render-pool.test.mjs` mutates every field of a fixture post, chunk, sound and clip and fails if one
leaves its key as it was.
-So `--from` keeps working but is no longer needed: a take finds any unit any take built. A take
+So `--from` keeps working but is no longer needed: a take finds any unit any take built. A unit a
+build reuses from its own `out/` that the pool has not got (built before the pool, or linked in by
+`--from`) is filed then, so the first build after the pool fills it. A take
stopped mid-render and run again finds every chunk it finished, in its own `out/` or in the pool.
- **Where:** `UMTOOL_RENDER_POOL` (a directory), else `<media root>/.render-pool` (`UMTOOL_MEDIA_DIR`'s,
diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs
@@ -5109,12 +5109,13 @@ export async function startHardCutSound({ segments, render, joins = null, outDir
}
async function makeHardCutSound({ segments, durs, joins = null, render, dir, workDir }, audio) {
+ const pool = await poolFor(workDir);
if (await exists(audio)) {
EMIT("note", { message: "final encode: the cut's sound unchanged — reused" });
+ await poolPut(pool, "sound", path.basename(audio), { "sound.m4a": audio });
return { audio, reused: true };
}
await mkdir(dir, { recursive: true });
- const pool = await poolFor(workDir);
if (await poolFetch(pool, "sound", path.basename(audio), { "sound.m4a": audio })) {
EMIT("note", { message: "final encode: the cut's sound from the render pool" });
return { audio, reused: true };
@@ -5304,6 +5305,8 @@ export async function planChunks({ segments, render, chrome = null, joins = null
if (got === p.span.b - p.span.a) pooled.add(p.rec.key);
}
if (pooled.has(p.rec.key)) p.pooled = true;
+ // (A chunk of its own the pool has not got -- encoded before it, or linked in by --from -- is filed.)
+ else if (got === p.span.b - p.span.a && pool) await poolPut(pool, "chunk", p.rec.key, { "chunk.mp4": p.file });
if (got === p.span.b - p.span.a) p.reused = true;
else todo.push(p);
}
diff --git a/umtool/report-to-video/hardcut-deck.test.mjs b/umtool/report-to-video/hardcut-deck.test.mjs
@@ -137,7 +137,7 @@ test("a hard-cut deck build: keyed chunks, and the deck drawn only where a chunk
assert.deepEqual(record().chunks.map((c) => c.key), rec3.chunks.map((c) => c.key));
});
-test("the render pool: another project's build of the same cut takes every chunk and the sound from it", { skip: !have && "needs ffmpeg and ffprobe" }, async (t) => {
+test("the render pool: a cut built before it is filed by its next build; another project's build of the same cut takes every chunk and the sound from it", { skip: !have && "needs ffmpeg and ffprobe" }, async (t) => {
const root = mkdtempSync(path.join(tmpdir(), "rtv-hcpool-"));
const env = { bin: process.env.HYPERFRAMES_BIN, log: process.env.HF_LOG, pool: process.env.UMTOOL_RENDER_POOL };
t.after(() => {
@@ -178,13 +178,17 @@ test("the render pool: another project's build of the same cut takes every chunk
setProgressMode((e) => {
if (e.ev === "note") notes.push(e.message);
});
- await buildVideo({ manifestPath: project("a"), opts: {} });
+ // Built before the pool (off), then again with it: what it reused of its own is filed.
+ process.env.UMTOOL_RENDER_POOL = "0";
+ const ma = project("a");
+ await buildVideo({ manifestPath: ma, opts: {} });
+ process.env.UMTOOL_RENDER_POOL = pool;
+ await buildVideo({ manifestPath: ma, opts: {} });
const runs = drawn().length;
const { poolStats } = await import("./render-pool.mjs");
const s1 = await poolStats(pool);
- assert.equal(s1.kinds.chunk.objects, 2);
- assert.equal(s1.kinds.sound.objects, 1);
- assert.ok(s1.kinds.frame.objects >= 1, "the deck's distinct frames");
+ assert.equal(s1.kinds.chunk.objects, 2, "its chunks filed");
+ assert.equal(s1.kinds.sound.objects, 1, "its sound filed");
// Project b: the same cut, built anew -- from the pool.
notes.length = 0;
diff --git a/umtool/report-to-video/post-render.mjs b/umtool/report-to-video/post-render.mjs
@@ -1009,12 +1009,20 @@ export async function buildPostSegment(entry, { render, outDir, manifestDir, box
const key = postSegmentKey(postSegmentKeyOf({ entry, redaction, box, place, render, encode, stamps, avatars, take, plan, bleeps, layout, from, prev }));
const record = postRecordPath(seg);
const had = await readFile(record, "utf8").then((t) => JSON.parse(t), () => null);
+ // The render pool (render-pool.mjs): this item, by this key, built by any take of any project.
+ const pool = await poolFor(outDir);
if (had?.key === key && (await stat(seg).catch(() => null))) {
emit("note", { message: `${entry.id}: post item unchanged — its segment kept` });
+ // (One the pool has not got -- built before it, or linked in by --from -- is filed now: the item as
+ // post-render made it, which a combo badge's pass keeps beside it as `.plain.mp4`.)
+ if (pool) {
+ const badged = await stat(seg.replace(/\.mp4$/, ".combo.json")).catch(() => null);
+ const plain = seg.replace(/\.mp4$/, ".plain.mp4");
+ const made = !badged ? seg : (await stat(plain).catch(() => null)) ? plain : null;
+ if (made) await poolPut(pool, "post", key, { "seg.mp4": made, "post.json": record });
+ }
return seg;
}
- // The render pool (render-pool.mjs): this item, by this key, built by any take of any project.
- const pool = await poolFor(outDir);
if (pool && (await poolFetch(pool, "post", key, { "seg.mp4": seg, "post.json": record }))) {
emit("note", { message: `${entry.id}: post item from the render pool (key ${key.slice(0, 12)})` });
return seg;
diff --git a/umtool/report-to-video/segment-cache.mjs b/umtool/report-to-video/segment-cache.mjs
@@ -174,6 +174,8 @@ export async function encodeSegmentCached({ seg, argv, record, outDir, fps, ffmp
const got = await probe(seg).catch(() => null);
if (got != null && Math.abs(got - prev.segSeconds) <= tol) {
emit("note", { message: `${id}: segment unchanged (key ${key.slice(0, 12)}) — reused` });
+ // (Filed in the render pool when it has not got it: built before it, or linked in by --from.)
+ await poolPut(await poolFor(outDir), "clip", key, { "seg.mp4": seg, "cut.json": cutRecordOf(seg) });
return { reused: "key", key, seconds: prev.segSeconds };
}
emit("note", { message: `${id}: segment key matches but the file probes ${got ?? "unreadable"}s, not ${prev.segSeconds}s — rebuilt` });