History

pr-media prefers film.mp4 — the whole session, not just the browser hop

Rhys Sullivan committed 5 months ago

Commit 7eca7ab1 parent 30e118d1 file · +8 −4Browse files

Unified · Split

e2e/scripts/pr-media.ts+8−4
@@ -8,8 +8,9 @@ · 7 unmodified lines
8// the PR description.8// the PR description.
9//9//
10// Usage: bun e2e/scripts/pr-media.ts <run-dir-or-artifact> [...more]10// Usage: bun e2e/scripts/pr-media.ts <run-dir-or-artifact> [...more]
11// run dir e2e/runs/<target>/<scenario-slug> — picks session.mp4 or11// run dir e2e/runs/<target>/<scenario-slug> — picks film.mp4 (the
12// terminal.cast and labels the gif from result.json12// whole session), else session.mp4, else terminal.cast;
13// labels the gif from result.json
13// session.mp4 browser recording (ffmpeg -> gif)14// session.mp4 browser recording (ffmpeg -> gif)
14// terminal.cast terminal recording (agg -> gif; brew install agg)15// terminal.cast terminal recording (agg -> gif; brew install agg)
15// *.png run screenshot, uploaded as-is16// *.png run screenshot, uploaded as-is
@@ -48,10 +49,13 @@ const resolveArtifact = (input: string): Artifact => { · 32 unmodified lines
48 slug: basename(path).replace(/\.[^.]+$/, ""),49 slug: basename(path).replace(/\.[^.]+$/, ""),
49 };50 };
50 }51 }
51 const recording = ["session.mp4", "terminal.cast"]52 // film.mp4 (scripts/film.ts) is the whole session — terminal chat AND the
53 // browser hop, cut in time order; the bare browser session.mp4 is only the
54 // hop, so it must never win when a film exists.
55 const recording = ["film.mp4", "session.mp4", "terminal.cast"]
52 .map((name) => join(path, name))56 .map((name) => join(path, name))
53 .find(existsSync);57 .find(existsSync);
54 if (!recording) throw new Error(`${input} has no session.mp4 or terminal.cast`);58 if (!recording) throw new Error(`${input} has no film.mp4, session.mp4, or terminal.cast`);
55 let label = basename(path);59 let label = basename(path);
56 try {60 try {
57 const result = JSON.parse(readFileSync(join(path, "result.json"), "utf8")) as {61 const result = JSON.parse(readFileSync(join(path, "result.json"), "utf8")) as {