commit 712eb62b4e334bf7df644cfdbb059ecb9d907c8f
parent c043ab89c109450c3243ba3ce1222f6fe95767f8
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 27 Oct 2026 18:02:31 -0400
Take prune tests: their temp projects removed at the end (/tmp may be memory), and smaller
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/umtool/lib/report/takePrune.test.mjs b/umtool/lib/report/takePrune.test.mjs
@@ -5,10 +5,10 @@
//
// Run with: pnpm test:scripts
import assert from "node:assert/strict";
-import { link, lstat, mkdir, mkdtemp, readFile, readdir, stat, symlink, utimes, writeFile } from "node:fs/promises";
+import { link, lstat, mkdir, mkdtemp, readFile, readdir, rm, stat, symlink, utimes, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
-import test from "node:test";
+import test, { after } from "node:test";
import {
BUILD_LOCK,
@@ -41,8 +41,13 @@ const later = () => new Date(Date.now() + 10 * DAY);
// No pipeline processes, and only this process's pid alive.
const quiet = { processes: [], alive: (pid) => pid === process.pid };
+// Every temp project, removed at the end (/tmp may be memory).
+const made = [];
+after(() => Promise.all(made.map((d) => rm(d, { recursive: true, force: true }))));
+
async function root() {
const r = await mkdtemp(path.join(tmpdir(), "takeprune-"));
+ made.push(r);
const reports = path.join(r, "reports");
const dir = path.join(reports, "proj");
await mkdir(path.join(dir, "takes"), { recursive: true });
@@ -56,7 +61,7 @@ const bytes = (n, ch = "x") => Buffer.alloc(n, ch);
* A take with final files and work: segments, two chrome layers' frames, a
* crossfade batch, encode chunks, the hash memo -- each `kib` KiB a file.
*/
-async function mkTake(dir, id, { group = "takes", builtAt = "2026-10-01T00:00:00Z", from, manifest, kib = 64, frames = 3, work = true } = {}) {
+async function mkTake(dir, id, { group = "takes", builtAt = "2026-10-01T00:00:00Z", from, manifest, kib = 16, frames = 3, work = true } = {}) {
const t = path.join(dir, "takes", id);
const v = path.join(t, "out", "sourced");
await mkdir(v, { recursive: true });
@@ -143,7 +148,6 @@ test("hard links: a take built --from another shares its inodes; pruning one fre
// b's segment and deck frames ARE a's (takeFrom.mjs links them in).
const va = path.join(a, "out", "sourced");
const vb = path.join(b, "out", "sourced");
- const { rm } = await import("node:fs/promises");
for (const f of ["s01.mp4", "s01.cut.json"]) {
await rm(path.join(vb, "segments", f));
await link(path.join(va, "segments", f), path.join(vb, "segments", f));
@@ -303,7 +307,6 @@ test("the symlink guard: a link is never work and never followed; a path resolvi
await writeFile(path.join(outside, "frame.png"), bytes(KiB, "o"));
const t = await mkTake(dir, "a");
const v = path.join(t, "out", "sourced");
- const { rm } = await import("node:fs/promises");
// segments/ is a link to the corpus: not work.
await rm(path.join(v, "segments"), { recursive: true });
await symlink(outside, path.join(v, "segments"));