Skip to content

feat(producer): enforce expected output dimensions before capture - #7871

Merged
terencecho merged 2 commits into
mainfrom
fix/render-expected-output-dimensions
Nov 17, 2026
Merged

terencecho merged 2 commits into
mainfrom
fix/render-expected-output-dimensions

Conversation

@terencecho

Copy link
Copy Markdown
Contributor

What

Add an optional expectedOutputDimensions render contract. The producer rejects compiled output whose dimensions differ before browser probe/capture, and reports outputDimensionsChecked only when that check ran.

Why

Service callers need a reliable way to enforce a previously selected output size. Request metadata alone is insufficient because the compiler derives canvas dimensions from the HTML and output resolution settings.

Related work

Standalone producer capability; downstream integrations must require explicit confirmation when using it with mixed producer versions.

How

Carry the constraint through HTTP, render-request adapters and distributed planning into the shared compile stage. Return the confirmation in blocking/SSE results and the distributed onPlanned callback. The option does not resize content; existing callers that omit it retain their behavior.

Test plan

  • 70 focused Vitest tests pass, including real HTML compilation, mismatched dimensions, adapter round trips, invalid input and blocking/SSE confirmation transport.
  • Distributed plan-v2 suite: 71 tests pass. An initial audio-overlap test timed out; the isolated baseline and full current suite subsequently passed (no test or timeout changes).
  • Producer typecheck and full workspace build pass; changed TypeScript files pass oxlint/oxfmt.
  • Removing the compile-stage check makes the regression tests fail.
  • Documentation updated in docs/packages/producer.mdx.
  • No deployed service or full end-to-end render exercised.

@mintlify

mintlify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 17, 2026, 4:49 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 76e404710412045d94f50ea82a5cb1b647eacdbe.

compileStage.ts:417–420 checks the actual compiled output size after resolution scaling, before the probe/capture stage, and only then records confirmation. renderRequest.ts and the distributed synthetic-job path carry the same optional constraint; JSON/SSE completion and planV2WithPublisher.onPlanned forward the result without inventing it. The documentation correctly requires consumers to reject missing confirmation from older producers.

Checked that distributed encoding uses the same rounded authored-size × DPR calculation. The plan's existing width/height fields still mean authored CSS dimensions, whereas the new constraint means final output pixels. Omitting the constraint preserves the old path and emits no confirmation.

Validation: full bun run build passed. Gated Vitest on renderRequest.test.ts, server.referenceBackground.test.ts, and compileStage.test.ts: 70 passed. Removing only requireOutputDimensions(...) makes both mismatch regressions fail. After restoration, the compile suite plus reviewer probes gives 32 passed, including 1920×1080 → 3840×2160 scaling, rejecting an authored-size expectation after scaling, and an omitted constraint with no confirmation. Gated bun test packages/producer/src/services/distributed/planV2.test.ts: 71 passed (the initial Vitest invocation could not collect this Bun-only suite). An independent adversarial source pass found no blocker. No full video render or deployed service request was exercised.

Scope: audited the new helper, request adapters, compile stage and changed HTTP/planning functions; traced their orchestration and chunk-encoding consumers. This is not a fresh audit of every unrelated branch of the large rendering pipeline.

Need: yes · Size: ok · Reuse: shared compile stage and existing strictVariables confirmation path · Simpler: already minimal · Structure: fine (checked resolution resolver, request adapters, and planner callback; no split)
Risk: medium — new cross-process contract requires consumers to handle absent confirmation explicitly.

Verdict: APPROVE
Reasoning: The check enforces compiled output pixels at the shared boundary and preserves optional behavior for existing callers. The positive, negative and scaled controls support the contract.

— Rames

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 99 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@terencecho
terencecho marked this pull request as ready for review November 15, 2026 23:18

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at c1725f70 (re-stamp of 76e40471)

  • Merge commit parents are 76e40471 (the approved head) and main c8235f1. The PR's own diff is unchanged: the sorted +/- lines against each merge-base are identical, with the same 14 files and +243/-3.
  • Safe-error allowlist conflict: the merge adds only OUTPUT_DIMENSIONS_MISMATCH relative to main and only COMPOSITION_TOO_LARGE relative to the approved head. Neither side lost an entry, and there are no duplicates.
  • A real OutputDimensionsMismatch error and a real oversized-HTML error both keep their codes through extractSafeRenderErrorMetadata. COMPOSITION_TOO_LARGE also keeps owner=user and its bytes/limit metadata. Removing either code from the set makes the tests fail.
  • Full build, then 86 focused tests passing (errorCode, sizeLimit, compileStage, renderRequest, referenceBackground, plus a probe).
  • Both commits are verified.

Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅
Risk: low for this delta. It is a merge of main with a two-sided allowlist resolution, and the contract risk is unchanged from the prior approval.

— Rames

@terencecho
terencecho added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 8a13b2c Nov 17, 2026
92 checks passed
@terencecho
terencecho deleted the fix/render-expected-output-dimensions branch November 17, 2026 05:55

This branch was successfully deployed

1 active deployment
staging - docs — c1725f70 Deployed Nov 17, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants