mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 10:06:21 +00:00
feat(cli): emit render_preflight_rejected telemetry for P1-3 pre-flight saves (#1856)
The P1-3 aspect/alpha/HDR pre-flight (#1843) aborts an incompatible render before any browser/ffmpeg work, but that "save" was invisible on dashboard 1783183 — indistinguishable from a deep failure or a user giving up. checkRenderResolutionPreflight now returns { message, kind } (kind = the existing low-cardinality OutputResolutionIssueKind), and the render command emits render_preflight_rejected { kind } before exiting. No parsers change — the helper already carried kind. trackRenderPreflightRejected is typed to the union so the metric can't carry free text. Tests: preflight tests assert kind for all five kinds; an events test locks the emit. Further follow-up (still log-only): encoder-frame-0-exit counter and a P1-4 doctor cli_env_check event. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
438474c968
commit
9b41891f3a
@@ -439,22 +439,22 @@ describe("checkRenderResolutionPreflight", () => {
|
||||
expect(await checkRenderResolutionPreflight(portraitHtml, "portrait", noModes)).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns a suggestion when a landscape preset is used on a portrait composition", async () => {
|
||||
const message = await checkRenderResolutionPreflight(portraitHtml, "landscape", noModes);
|
||||
expect(message).toBeDefined();
|
||||
expect(message).toContain("--resolution portrait");
|
||||
it("returns a suggestion + aspect-mismatch kind when a landscape preset is used on a portrait composition", async () => {
|
||||
const result = await checkRenderResolutionPreflight(portraitHtml, "landscape", noModes);
|
||||
expect(result?.message).toContain("--resolution portrait");
|
||||
expect(result?.kind).toBe("aspect-mismatch");
|
||||
});
|
||||
|
||||
it("suggests landscape for a landscape composition rendered with a portrait preset", async () => {
|
||||
const message = await checkRenderResolutionPreflight(landscapeHtml, "portrait", noModes);
|
||||
expect(message).toContain("--resolution landscape");
|
||||
const result = await checkRenderResolutionPreflight(landscapeHtml, "portrait", noModes);
|
||||
expect(result?.message).toContain("--resolution landscape");
|
||||
});
|
||||
|
||||
it("preserves the 4K tier when suggesting a matching preset (square comp + landscape-4k → square-4k)", async () => {
|
||||
// Tier-aware suggestion is the load-bearing new behavior; square-4k is the
|
||||
// preset that only surfaces via a same-tier swap, so guard it explicitly.
|
||||
const message = await checkRenderResolutionPreflight(comp(2160, 2160), "landscape-4k", noModes);
|
||||
expect(message).toContain("--resolution square-4k");
|
||||
const result = await checkRenderResolutionPreflight(comp(2160, 2160), "landscape-4k", noModes);
|
||||
expect(result?.message).toContain("--resolution square-4k");
|
||||
});
|
||||
|
||||
it("does not false-abort a landscape registry-block composition (data-width/height, no data-resolution)", async () => {
|
||||
@@ -467,11 +467,34 @@ describe("checkRenderResolutionPreflight", () => {
|
||||
});
|
||||
|
||||
it("flags alpha output combined with outputResolution", async () => {
|
||||
const message = await checkRenderResolutionPreflight(landscapeHtml, "landscape-4k", {
|
||||
const result = await checkRenderResolutionPreflight(landscapeHtml, "landscape-4k", {
|
||||
alphaRequested: true,
|
||||
hdrRequested: false,
|
||||
});
|
||||
expect(message).toContain("alpha output");
|
||||
expect(result?.message).toContain("alpha output");
|
||||
expect(result?.kind).toBe("alpha-incompatible");
|
||||
});
|
||||
|
||||
// The three remaining kinds share the same rejection sink (→ one emit each);
|
||||
// guard their classification so the telemetry dimension stays accurate.
|
||||
it("classifies an HDR + outputResolution combination as hdr-incompatible", async () => {
|
||||
const result = await checkRenderResolutionPreflight(landscapeHtml, "landscape", {
|
||||
alphaRequested: false,
|
||||
hdrRequested: true,
|
||||
});
|
||||
expect(result?.kind).toBe("hdr-incompatible");
|
||||
});
|
||||
|
||||
it("classifies a preset smaller than the composition as downsampling", async () => {
|
||||
// 3840×2160 comp + landscape (1920×1080): same 16:9 aspect, target smaller.
|
||||
const result = await checkRenderResolutionPreflight(comp(3840, 2160), "landscape", noModes);
|
||||
expect(result?.kind).toBe("downsampling");
|
||||
});
|
||||
|
||||
it("classifies a non-integer upscale as non-integer-scale", async () => {
|
||||
// 1280×720 comp + landscape (1920×1080): same 16:9 aspect, 1.5× scale.
|
||||
const result = await checkRenderResolutionPreflight(comp(1280, 720), "landscape", noModes);
|
||||
expect(result?.kind).toBe("non-integer-scale");
|
||||
});
|
||||
|
||||
it("returns undefined when composition dimensions can't be determined (defers to the pipeline)", async () => {
|
||||
|
||||
Reference in New Issue
Block a user