fix(render): surface structured outcomes (#2153)

This commit is contained in:
James Russo
2026-07-13 19:07:39 -04:00
committed by GitHub
parent 6892b62662
commit cb69d3fe00
29 changed files with 1137 additions and 205 deletions
@@ -19,7 +19,9 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync
import { tmpdir } from "node:os";
import { join } from "node:path";
import { recomputePlanHashFromPlanDir } from "../render/stages/freezePlan.js";
import { RenderQualityError } from "../renderOrchestrator.js";
import {
applyDistributedAudioWarningPolicy,
buildChunkSlices,
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_PARALLEL_CHUNKS,
@@ -27,6 +29,7 @@ import {
plan,
resolveChunkPlan,
} from "./plan.js";
import { buildSyntheticRenderJob } from "./shared.js";
// Composition the tests render. `data-duration="1"` keeps the probe stage's
// `needsBrowser` gate `false` so plan() completes without launching Chrome.
@@ -54,6 +57,30 @@ afterAll(() => {
rmSync(runRoot, { recursive: true, force: true });
});
describe("distributed warning policy", () => {
const createJob = (strictness: "strict" | "best-effort") =>
buildSyntheticRenderJob({
fps: { num: 30, den: 1 },
format: "mp4",
quality: "high",
hdrMode: "force-sdr",
strictness,
entryFile: "index.html",
});
it("rejects distributed audio degradation in strict mode", () => {
const job = createJob("strict");
expect(() => applyDistributedAudioWarningPolicy(job, "mix failed")).toThrow(RenderQualityError);
expect(job.warnings.map((warning) => warning.code)).toEqual(["audio_processing_failed"]);
});
it("records distributed audio degradation in best-effort mode", () => {
const job = createJob("best-effort");
expect(() => applyDistributedAudioWarningPolicy(job, "mix failed")).not.toThrow();
expect(job.warnings.map((warning) => warning.code)).toEqual(["audio_processing_failed"]);
});
});
describe("resolveChunkPlan", () => {
it("returns 1 chunk when totalFrames fits in configChunkSize", () => {
const result = resolveChunkPlan(60, 240, 16);