Repository navigation
fix(studio): colour grading works in a sealed preview - #7999
Merged
Merged
Conversation
miguel-heygen
force-pushed
the
hfsupabase/colour-grading-editing-port
branch
3 times, most recently
from
November 17, 2026 02:17
ed6e853 to
86ae5a0
Compare
Contributor
Edit accuracy: accurate 267 (base branch 267), smooth 98 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
miguel-heygen
force-pushed
the
hfsupabase/colour-grading-editing-port
branch
2 times, most recently
from
November 17, 2026 03:15
7eb3f0b to
dca89eb
Compare
vanceingalls
approved these changes
Nov 17, 2026
vanceingalls
left a comment
Collaborator
There was a problem hiding this comment.
Approved at dca89eb.
- Handshake: the new message kinds use the existing editing-port handshake, which accepts
editing-connectonly fromevent.source === parentwithsource: 'hf-parent'. No new listener is added, so page content can't drive the editor through the port. - Exposure: status text and preview pixels are already visible in the frame, so the seal hides nothing extra.
- Inputs: params are capped (keys, length, count,
maxDimension <= 320) before the handler runs. - Studio side: it keeps only
data:image/URLs, checks the status shape and renders as text, so a faked__hf.colorGradingcan't do harm. - Test: the
fails without the fix:line is present (4 of 4 sealed tests fail on the base).
Should-fix, all low:
- Playback cleanup:
stopPlayingis module-level and isn't cleared on port close or agentdispose, so a muted video can keep looping until the frame reloads. - Stale reads: the non-opaque
refreshStatuspath doesn't bumpreads.current, so a stale sealed read can overwrite a newer direct one. - Unbounded sizes:
imagesanddataUrlsizes from the frame have no cap. - Size budget: the inspector budget went up 50,000 bytes for about 1.9 KB of growth.
miguel-heygen
force-pushed
the
hfsupabase/colour-grading-editing-port
branch
from
November 17, 2026 04:29
dca89eb to
a64886e
Compare
vanceingalls
approved these changes
Nov 17, 2026
miguel-heygen
force-pushed
the
hfsupabase/colour-grading-editing-port
branch
from
November 17, 2026 06:26
a64886e to
984032b
Compare
vanceingalls
approved these changes
Nov 17, 2026
miguel-heygen
force-pushed
the
hfsupabase/colour-grading-editing-port
branch
from
November 17, 2026 06:38
984032b to
93d2bd5
Compare
vanceingalls
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes for Studio users
With the sealed preview on (
VITE_STUDIO_OPAQUE_PREVIEW_ENABLED=true), the colour grading panel works again: its status line, the preset and effect cards, the live card preview on hover, and the graded frame capture. Before this, Studio read the frame's colour grading runtime straight off the preview's window, which a sealed preview refuses, so the cards stayed empty and the status stuck at "Waiting for runtime".With the flag off, Studio takes the same direct path as before.
Before
Sealed preview (
VITE_STUDIO_OPAQUE_PREVIEW_ENABLED=1), a graded video selected, on the base: the preset cards stay empty.After
Same project, same flag, this branch: the frame renders the 13 preset cards and Studio draws them.
Both captures use the repo's
graded-video-transitionsfixture withcrossorigin="anonymous"added to its videos (see Not in this change).How
packages/core/src/runtime/editing/:color-grading-status: the runtime'sgetStatusfor the selected media.color-grading-previews: the runtime renders the candidate looks in the frame and returns the batch as data.color-grading-playback: the frame starts or stops the muted, looping card playback and keeps the stop function itself, because a function cannot cross the port.maxDimensionmust be above 0 and at most 320 (the runtime clamps to 320 anyway).previewChannelhelpers only whenpreviewFrameOpaque(iframe)is true, so it is the same split as the element picker. Replies are frame data, so Studio checks their shape. Onlydata:image/URLs reach a card's<img>, and a status in any other shape reads as "Waiting for runtime".set-color-grading/set-color-grading-comparetocontentWindow, and checkingevent.source === iframe.contentWindowon the runtime'sreadymessage.@hyperframes/inspector's unpacked budget goes from 3,780,000 to 3,830,000 bytes. The inspector bundles the runtime, which grows by about 1.9 KB minified for the three handlers, and that put it 1,244 bytes past the 1% tolerance. The kind files declare the small slice of the grading runtime's types they use, so the port does not pullruntime/colorGrading.tsinto core's package..fallowrc.jsoncexemptsuseColorGradingController.tsfrom the health check. The hook's complexity was already there before this change, and the change adds no branch to it. Its two new import lines shift the hook's line, though, so fallow reports it as new, which is the same reason other files in that list are exempt.Tests
fails without the fix:
packages/studio/src/components/editor/useColorGradingController.sealed.test.ts("grade preview sealed"), the first commit, run on the base withVITE_STUDIO_OPAQUE_PREVIEW_ENABLED=true: 4 of 4 fail, for exampleuseColorGradingController.sealed.test.ts(first commit) puts the hook on an opaque frame served by the real editing agent. It covers the status, the preset cards (a non-image URL is dropped), the hover playback start and stop, and the capture.editing/color-grading.test.tschecks each kind's round trip through the agent, the null answers when the page has no grading runtime, and the rejection of bad params.Not in this change
In a sealed preview the frame's origin is opaque, so a
<video>loaded withoutcrossoriginis cross-origin data to WebGL and the grading shader itself fails (texImage2D ... The video element contains cross-origin data). With this change Studio now shows that message in the Grade status line instead of "Waiting for runtime". Making graded media load CORS-clean in a sealed preview is a runtime and server change, so it is left for a separate one.