commit f083298e8958a03ee3a99a1acacb3f6b2bd5a8e5
parent f4486f4c8001ade8010460e2cf2529c02995fb98
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 23:24:32 -0500
umtool e2e: post-narration no longer depends on run order -- the shared fixture's narration/ is reset
long-reads.spec and post-narration.spec share post-narration-fixture's p-11. long-reads leaves a take-7 of it
(and its re-reads) on disk, and a new take is numbered past every take-N there (nextTakeNumber), so after
long-reads post-narration's re-take became take-8, not take-2: five failures in a whole run, green alone.
post-narration-fixture.mjs now names the files it builds under narration/ (POST_NARRATION_OWN_FILES) and
exports resetPostNarrationFiles, which prunes everything else; post-narration's beforeEach calls it (in place
of its list of its own leftovers), and long-reads' new afterAll puts the manifest back and calls it, so the
specs after it read the project as built.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/umtool/e2e/fixtures/post-narration-fixture.mjs b/umtool/e2e/fixtures/post-narration-fixture.mjs
@@ -13,7 +13,7 @@
// it back before each test.
//
// Synthetic, like every fixture.
-import { mkdirSync, writeFileSync } from "node:fs";
+import { mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
import { spawnSync } from "node:child_process";
import path from "node:path";
@@ -22,6 +22,45 @@ const ff = (args) => {
if (r.status !== 0) throw new Error(`ffmpeg ${args.join(" ")}: ${String(r.stderr)}`);
};
+/**
+ * Every file the fixture writes under its narration/, relative to it. Nothing
+ * else under narration/ is the fixture's: it is a take, a part, a cache or a
+ * trash a spec made.
+ */
+export const POST_NARRATION_OWN_FILES = ["posts/11/take-1.orpheus-zac.wav", "posts/11/take-1.orpheus-zac.wav.heard.json"];
+
+/**
+ * Put the fixture's narration/ back to what it built, removing what any spec
+ * left there. Several specs share this project (long-reads writes a take-7 of
+ * p-11 and re-reads it into more), and a new take is numbered past every
+ * take-N on disk (report-to-video/post-narration.mjs nextTakeNumber) -- so
+ * without this, which spec ran first decided post-narration's take numbers.
+ * @param {string} dir the project's directory
+ */
+export function resetPostNarrationFiles(dir) {
+ const root = path.join(dir, "narration");
+ const keep = new Set(POST_NARRATION_OWN_FILES.map((f) => path.join(root, f)));
+ const prune = (d) => {
+ let entries = [];
+ try {
+ entries = readdirSync(d, { withFileTypes: true });
+ } catch {
+ return false;
+ }
+ let kept = false;
+ for (const e of entries) {
+ const p = path.join(d, e.name);
+ if (e.isDirectory() && !e.isSymbolicLink()) {
+ if (prune(p)) kept = true;
+ else rmSync(p, { recursive: true, force: true });
+ } else if (keep.has(p)) kept = true;
+ else rmSync(p, { force: true });
+ }
+ return kept;
+ };
+ prune(root);
+}
+
/** @param {{ reports: string, deckManifest: Function }} o */
export function makePostNarrationFixture({ reports, deckManifest }) {
const name = "post-narration-fixture";
diff --git a/umtool/e2e/long-reads.spec.ts b/umtool/e2e/long-reads.spec.ts
@@ -4,6 +4,7 @@ import { copyFileSync, existsSync, readFileSync, rmSync, writeFileSync } from "n
import path from "node:path";
import { fileURLToPath } from "node:url";
import * as urls from "./urls";
+import { resetPostNarrationFiles } from "./fixtures/post-narration-fixture.mjs";
// ---------------------------------------------------------------------------
// LONG READS (operator, 4 Nov, a 6.5-minute post): a read's parts RE-TIMED with
@@ -38,6 +39,13 @@ const picked = () => {
test.beforeAll(() => {
if (!existsSync(`${MANIFEST}.pristine`)) copyFileSync(MANIFEST, `${MANIFEST}.pristine`);
});
+// The project is shared (post-narration, post-captions, picture-replies, thread-* read it after this file): leave
+// it as the fixture built it -- its manifest, and no take-7 or re-read of p-11 on disk to number their takes past.
+test.afterAll(() => {
+ copyFileSync(`${MANIFEST}.pristine`, MANIFEST);
+ rmSync(path.join(DIR, "revisions"), { recursive: true, force: true });
+ resetPostNarrationFiles(DIR);
+});
test.beforeEach(() => {
test.setTimeout(120_000);
copyFileSync(`${MANIFEST}.pristine`, MANIFEST);
diff --git a/umtool/e2e/post-narration.spec.ts b/umtool/e2e/post-narration.spec.ts
@@ -5,6 +5,7 @@ import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSyn
import path from "node:path";
import { fileURLToPath } from "node:url";
import * as urls from "./urls";
+import { resetPostNarrationFiles } from "./fixtures/post-narration-fixture.mjs";
// ---------------------------------------------------------------------------
// NARRATED POST ITEMS (report-to-video/post-narration.mjs; knobs.md, "A narrated
@@ -47,12 +48,10 @@ test.beforeEach(() => {
copyFileSync(`${MANIFEST}.pristine`, MANIFEST);
rmSync(path.join(DIR, "revisions"), { recursive: true, force: true });
rmSync(path.join(DIR, "notes.json"), { force: true });
- for (const f of ["take-2.orpheus-zac.wav", "take-2.recorded-operator.wav", "take-3.recorded-operator.wav", "take-2.convert-zac.wav", "take-3.convert-zac.wav", "take-2.pause-orpheus.wav", "take-2.revoice-orpheus.wav"]) rmSync(path.join(DIR, "narration", "posts", "11", f), { force: true });
- rmSync(path.join(DIR, "narration", "posts", "11", "take-2.recorded-operator.parts"), { recursive: true, force: true });
- // The parts cache a re-voice's phrase lands in (the fixture has none of its own).
- rmSync(path.join(DIR, "narration", "parts-cache"), { recursive: true, force: true });
- rmSync(path.join(DIR, "narration", "posts", "11", ".trash"), { recursive: true, force: true });
- rmSync(path.join(DIR, "narration", "posts", "11", ".recording-operator"), { recursive: true, force: true });
+ // narration/ back to the fixture's own two files: this test's takes, parts, the parts cache a re-voice's phrase
+ // lands in, .trash and .recording-* -- and ANOTHER spec's (long-reads leaves a take-7 of p-11, and a new take is
+ // numbered past every take-N on disk, so the run order used to decide this spec's take numbers).
+ resetPostNarrationFiles(DIR);
});
const root = (page: Page) => page.locator("[data-play-cut]");