commit ad41c56019fcb6ccf3460fa29773e448ebb65dc3
parent da65bb1beb152bc525316b162c4c3410788226d7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 2 Nov 2026 23:06:00 -0500
umtool: posts narrate --import brings what is on disk; a take still being made comes with a later run; post-narration.spec's fake microphone for the whole file
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/umtool/e2e/post-narration.spec.ts b/umtool/e2e/post-narration.spec.ts
@@ -35,6 +35,9 @@ if (!existsSync(MIC_WAV)) {
execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=1000:sample_rate=48000:duration=2", "-ac", "1", MIC_WAV]);
}
+// A fake microphone (the recording session) and audio that may start without a gesture, for the whole file.
+test.use({ launchOptions: { args: ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream", `--use-file-for-fake-audio-capture=${MIC_WAV}`, "--autoplay-policy=no-user-gesture-required"] } });
+
test.beforeAll(() => {
if (!existsSync(`${MANIFEST}.pristine`)) copyFileSync(MANIFEST, `${MANIFEST}.pristine`);
});
@@ -127,8 +130,6 @@ test("the post bench: the lanes, a re-take with direction (the editor's tts job)
});
test.describe("the recording session", () => {
- test.use({ launchOptions: { args: ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream", `--use-file-for-fake-audio-capture=${MIC_WAV}`, "--autoplay-policy=no-user-gesture-required"] } });
-
test("record a long script part by part, play it back, Keep: a recorded take, picked, and it plays", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1400 });
await page.goto(urls.postBenchHref(PROJECT, "p-11"));
diff --git a/umtool/lib/report/postNarrationCli.mjs b/umtool/lib/report/postNarrationCli.mjs
@@ -93,6 +93,7 @@ export function findPostItem(manifest, ref) {
export async function importPatches(manifest, rows, measure) {
const patches = [];
const missing = [];
+ const absent = [];
let takes = 0;
for (const row of rows) {
const e = findPostItem(manifest, row?.entry) ?? findPostItem(manifest, row?.id);
@@ -106,6 +107,11 @@ export async function importPatches(manifest, rows, measure) {
for (const t of Array.isArray(row.takes) ? row.takes : []) {
if (typeof t?.file !== "string" || files.has(t.file)) continue;
const m = await measure(t.file);
+ // A take still being made (not on disk yet) comes in with a later run.
+ if (!m) {
+ absent.push(t.file);
+ continue;
+ }
add.push({
file: t.file,
engine: t.engine ?? "orpheus",
@@ -135,7 +141,7 @@ export async function importPatches(manifest, rows, measure) {
for (const p of list) patches.push({ id: e.id, patch: p });
takes += add.length;
}
- return { patches, missing, takes };
+ return { patches, missing, takes, absent };
}
const fmtKnob = (k, v) => `${k}=${typeof v === "boolean" ? (v ? "on" : "off") : v}`;
@@ -276,21 +282,22 @@ export async function narrateCommand(project, words, flags, { json = false, dryR
const measure = async (rel) => {
const abs = path.join(project.dir, ...String(rel).split("/"));
const st = await stat(abs).catch(() => null);
- if (!st?.isFile()) throw new NarrateError(`${rel} (named in ${NARRATION_INDEX}) is not in the project`);
+ if (!st?.isFile()) return null;
const parts = await readFile(path.join(project.dir, ...partsFileOf(rel).split("/")), "utf8").then((t) => JSON.parse(t), () => null);
return { ...(await measureTake(abs)), at: new Date(st.mtimeMs).toISOString(), parts };
};
- const { patches, missing, takes } = await importPatches(manifest, rows, measure);
+ const { patches, missing, takes, absent } = await importPatches(manifest, rows, measure);
+ const notYet = absent.length ? `; ${absent.length} take(s) not on disk yet (a later --import brings them): ${absent.slice(0, 5).join(", ")}${absent.length > 5 ? ", …" : ""}` : "";
const items = new Set(patches.map((p) => p.id)).size;
if (dryRun || !patches.length) {
- if (json) out(JSON.stringify({ ok: true, dryRun, items, takes, missing, patches }, null, 2));
- else out(`${dryRun ? "would import" : "nothing new to import:"} ${takes} take(s) into ${items} post item(s)${missing.length ? `; ${missing.length} row(s) name no post item of the cut: ${missing.join(", ")}` : ""}`);
+ if (json) out(JSON.stringify({ ok: true, dryRun, items, takes, missing, absent, patches }, null, 2));
+ else out(`${dryRun ? "would import" : "nothing new to import:"} ${takes} take(s) into ${items} post item(s)${missing.length ? `; ${missing.length} row(s) name no post item of the cut: ${missing.join(", ")}` : ""}${notYet}`);
return 0;
}
const { result, editNotes } = await write((token) => updatePostNarrations(project.dir, patches, { token, op: "post-narration-import" }));
- if (json) out(JSON.stringify({ ok: true, items, takes, missing, snapshot: result.snapshot, token: result.token, editNotes }, null, 2));
+ if (json) out(JSON.stringify({ ok: true, items, takes, missing, absent, snapshot: result.snapshot, token: result.token, editNotes }, null, 2));
else {
- out(`imported ${takes} take(s) into ${items} post item(s) from ${NARRATION_INDEX}${missing.length ? `; ${missing.length} row(s) name no post item of the cut: ${missing.join(", ")}` : ""}`);
+ out(`imported ${takes} take(s) into ${items} post item(s) from ${NARRATION_INDEX}${missing.length ? `; ${missing.length} row(s) name no post item of the cut: ${missing.join(", ")}` : ""}${notYet}`);
if (result.snapshot?.rel && !result.snapshot.skipped) out(` undo point: ${result.snapshot.rel} (umtool timeline ${project.id} undo)`);
}
return 0;