Repository navigation
feat(studio): Studio's preview runs sealed by default - #7846
miguel-heygen wants to merge 12 commits into
Conversation
a907dbb to
43c5ac8
Compare
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at 43c5ac83e495512b70c25d1e70c5c6bb70f6b97a.
Important — complete the token-path proxy CORS contract before default-on. packages/core/src/runtime/proxyWait.ts:20–24 sends X-HF-Proxy-Priority for at-playhead and background requests. The opaque token route in packages/studio-server/src/helpers/opaqueFrameLoads.ts does not answer that preflight with the required method/header grant. In real Chrome, the actual waitForServedProxy helper succeeds unsealed for a ready H264 copy of a MOV, but returns false sealed. mediaProxy then reports proxy_playback_failed instead of installing the playable copy. This prevents proxy-backed playback for the demonstrated MOV fixture, rather than taking the disclosed full-reload fallback.
Add a narrowly scoped OPTIONS response after token validation for the supported proxy GET headers, and expose Content-Range, Retry-After and X-HF-Proxy-Progress on the matching responses. Reuse the header contract already defined for trusted capture loads, while retaining the server's token and private-file boundary. Add a real-browser sealed proxy regression. A temporary fixture-only preflight/header response makes both sealed and unsealed controls pass; no production fix was pushed.
Native evidence: temporary vitest run src/routes/reviewDefaultSeal.test.ts reports 1 passed, 1 failed (unsealed proxy=true, sealed proxy=false); the fixture-only header fix reports 2 passed. Real token/preview server and bundled runtime helper, same media/cache fixture. Ordinary image, media metadata, JSON/XHR, CSS, font, module and 206 body loads work in both modes. Sealed JavaScript cannot read Content-Range, so the runtime's source-size probe also loses its total-size input. This does not show ordinary range-body seeking itself failing.
The package-scoped flag/Player/NLEPreview suites, including an explicit-false control, pass 71 tests. The flag reaches live, shadow and backdrop players; explicit false selects the prior path. The sandbox and expected-frame message checks remain in place. The listed empty-filmstrip/full-reload limitations are product trade-offs, not my blocker. I did not walk all remaining “to walk” features or certify that list complete.
Need: yes · Size: ok · Reuse: token validation and existing capture header contract · Simpler: scoped server preflight/header support · Structure: fine (checked player propagation and runtime proxy callers; no split)
Risk: high — changes the default execution boundary and media-loading behavior.
Verdict: REQUEST_CHANGES
Reasoning: Default-on activates a demonstrated proxy playback failure. The scoped header fix should land and pass the sealed browser control first.
— Rames
Edit accuracy: accurate 273 (base branch 271), smooth 21 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) Unstable (1)
|
43c5ac8 to
2156a42
Compare
|
On the token-path preflight: this is met. hyperframes#7856 (merged, and in this branch) makes the opaque token route answer the proxy wait's preflight. On main, |
2156a42 to
859e193
Compare
|
Reply to the change request at The token-path proxy CORS contract landed in #7856 (
|
…ugh its frame Both walks read the preview through iframe.contentDocument, which is null for a sealed frame, so each timed out at its first wait. They now reach the frame with contentFrame(), as graded-video-transitions.mjs does. aroll-backdrop.mjs passes sealed. inline-text-caret.mjs gets past the frame and fails at its first edit: no caret opens, because sealed in-place text editing is not on this branch. That is the gap #8181 and #8183 close.
jrusso1020
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES. Re-reviewed at 504645c9de13daca50ad7de5b1a7bd398226f8c5.
My earlier two points are resolved. #7856 (ae5829db7e) is an ancestor of this head. At this head, serveTokenPreviewPaths still answers the proxy wait's OPTIONS after token validation (answersProxyPreflight → 204 with Range, X-HF-Proxy-Priority), and tokenPathHeaders exposes Retry-After, X-HF-Proxy-Progress, Content-Range on granted responses. The later fetchAgain/seek-reapply changes to that file leave both in place. The real-browser regression (sealed-preview-proxy.mjs) runs in CI. Nothing more is needed there.
What still blocks: the default flip regresses 15 editing cases. This PR's only production change is STUDIO_OPAQUE_PREVIEW_ENABLED defaulting to true. The edit accuracy gate at this head (run 45491729250) reports 258 accurate cases against 271 on the base branch. Fifteen cases marked passing in baseline.json now fail:
- resize:
resize-late-px-r0-root-z100-{on,after,before},resize-late-px-r0-nested-z100-on,resize-size-px-r0-{root,nested}-z100-on,resize-size-px-r0-root-z100-{after,mid} - sequences:
seqab-none-{center,px,pct}-r0-{root,nested}-z100,seqfastkeys-none-px-r0-root-z100,seqnudge-none-px-r0-nested-z100
The unstable rows show what a user would see. seqab-none-center-r0-* runs end with undo false and a reload jump of 300–437 px in 2 of 3 runs. These are edits that work today with the preview unsealed and break once it is sealed by default, so this is the change itself rather than flakiness.
To clear it: this branch is also behind main and conflicts in packages/studio/tests/e2e/aroll-backdrop.mjs, and main has landed several sealed-mode editing fixes since the last merge (#8772, #8736, #8719, #8777). Merge main, resolve the walk conflict, and get the edit accuracy gate back to the base branch's count (or quarantine named cases with a stated reason). I'll approve that head. The timeline viewport gate failed in both the flag-on and flag-off attempts (interaction p95 over budget either way), so I'm not counting it against this PR. The Windows studio-1 shard is likewise separate.
The conflict alone would not block an approval; it's noted only because the merge it needs is also the likely route to the gate.
Need ✅ (default-on is the goal) · Size ✅ (one production line plus walk updates) · Reuse ✅ (smoke serves the real runtime; walks read the frame through its token) · Simpler ✅ · Structure ✅
Risk: high. Flipping the default changes the preview's execution boundary for every Studio user, and the gate shows resize and A/B-sequence edits regressing under it.
— Rames
What
Studio's preview now runs on an opaque origin by default:
VITE_STUDIO_OPAQUE_PREVIEW_ENABLEDdefaults to on, so the live, shadow and backdrop players getsandbox-originand load under the frame-token path (#7817). Setting the variable tofalsekeeps today's same-origin preview.Why
A composition's scripts should run apart from Studio's own page. The editing port and the token path now carry what Studio needs for playback, selection, the console errors panel and playback keys.
What does not work yet on a sealed preview
These still read the preview's window directly. On a sealed frame they fall back or do nothing until each moves to the editing port. Each row says whether I saw it in a browser or read it in code.
findParsedTween,gsapLivePreview,applySoftReloadFinalization)applySoftReloadFinalizationcallers)inline-text-caret.mjs, sealed)studio_looklists no elements: the scene is read from the frame's documentundo-socket-pool.mjs, sealed)Already on the port and working sealed: element picking and selection (#7561), loop start, the clip manifest, the console errors panel (#7824), playback keys with focus in the preview (#7844), composition thumbnails (already opaque).
Related work
Needs #7856 (a sealed preview's video proxy wait passes its preflight; found in review here), #7824 and #7844 in the same release. #7817 is merged.
Merge order
Do not merge before v0.9.54 is cut: that release carries #7811 and #7817 with the flag still off by default. This default lands in the release after it at the earliest. Desktop embeds Studio and must not take a release with this default before its own sealed-preview loads are on its main.
Before
main, flag unset, headless Chrome at 1600x900, the blank template: the preview frame runs on Studio's origin (http://127.0.0.1:<port>) and the timeline clip shows its filmstrip.After
This branch, flag unset: the frame loads under the frame-token path on origin
null; the preview looks the same, and the timeline clip's filmstrip is empty (first row above).Test plan
Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments"
One line: the flag's default. On Linux, Node 24,
packages/studiovitest run(the whole package) with the new default: 759 files, 8660 tests pass (1 skipped file, 16 todo), so no test depends on the old default.A browser walk of every row above, sealed against same-origin, follows in this PR.
fails without the fix:
packages/studio/tests/e2e/aroll-backdrop.mjs, run against a sealed Studio, stops at its first wait at9028129a(walk stopped at "undefined": Waiting failed: 60000ms exceeded) and passes at369259e4. It andinline-text-caret.mjsread the preview throughiframe.contentDocument, which is null for a sealed frame. They now reach it withcontentFrame(), asgraded-video-transitions.mjsdoes.inline-text-caret.mjsnow gets past the frame and fails at its first edit: no caret opens, because sealed in-place text editing is not on this branch. #8181 and #8183 close that gap.