Repository navigation
fix(studio): a sealed preview's failed reload says only what the preview reported - #8194
Conversation
Edit accuracy: accurate 271 (base branch 271), smooth 81 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (2)
|
terencecho
left a comment
There was a problem hiding this comment.
[P2] A sealed shadow can report that it never sent a timeline after Studio has accepted one. In packages/studio/src/player/hooks/useShadowPreviewReload.ts:209, the diagnostic equates an unset pending commit with an absent timeline. The pending commit is only set after the restore seek at line 342. In Chromium, a sandboxed shadow sent a timeline just before the normal reload deadline and received a seek command, but the failure toast still said it was waiting for the runtime to report a timeline. The original preview stayed visible. Track timeline receipt separately so the diagnostic identifies the stage Studio actually reached.
The named regression passed and failed as expected with the preceding implementation. The workspace build, Studio typecheck, lint and format, 157 focused tests, and the full 2,593-test Studio player suite passed. The Chromium check used a controlled shadow response.
— tai (automated review)
|
Fixed in fbb6b72. [P2] A failed reload now says when the timeline already arrived. Studio records the shadow's timeline when it accepts it, before the restore seek ( fails without the fix: |
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at fbb6b722347c13db6cac507447331e42743fc601, including Tai's finding at c4087372.
Tai's reported stage mismatch is resolved. packages/studio/src/player/hooks/useShadowPreviewReload.ts:340 records timeline acceptance before waiting for restore-seek paint; :217 uses that fact independently of the pending commit. The marker is generation-bound and cleared by the shared stop path. Sealed previews no longer infer a page stage from inaccessible document state. Independent source review found no introduced blocker.
Validation: frozen-lockfile install and full bun run build passed. Through the shared test gate, bun run --cwd packages/studio test src/player/hooks/useTimelinePlayer.shadowReload.test.ts src/player/hooks/useTimelineSyncCallbacks.sealed.test.ts --maxWorkers=2 passed 62 tests. Restoring only the hook to c4087372 made names the restore seek when a shadow's timeline arrived but its seek never painted fail: it reported "its timeline to be ready". Restoring this head passed that test. Happy-dom emitted iframe teardown AbortError/NetworkError diagnostics; the runner completed successfully. No real-browser failure walk or full player-suite rerun performed. The PR body contains the required fails without the fix: line.
Nit: the body's How section still describes only the timeline/loaders split; add the restore-seek stage and note that open previews gain that distinction too.
Need: yes · Size: ok · Reuse: existing readiness callback and shared cleanup · Simpler: already minimal · Structure: fine (checked timeline callback, seek helper and generation cleanup; no split)
Risk: low — diagnostic-only stage tracking, with existing promotion behavior unchanged.
— hf-review
Verdict: APPROVE
Reasoning: The previously reported stage mismatch is fixed and the regression fails on the prior implementation and passes at this head.
vanceingalls
left a comment
There was a problem hiding this comment.
Approving at 3ab857a6. Rames approved fbb6b722. The only code change since then is 3ab857a6, which shortens one test comment in useTimelinePlayer.shadowReload.test.ts to fit the 120-character limit, with no behaviour change.
- Lane rule: met.
fails without the fix:names "says only what a sealed shadow reported when it fails to reload" inuseTimelinePlayer.shadowReload.test.ts. - Captures: the body now has
## Beforeand## Afterwith images. The first "Studio and player captures" run (23:31:58Z) read the body before those headings existed. The re-run at 23:32:40Z passed, so the red entry in the rollup is stale. - Terence's change request at
c4087372(the P2 atuseShadowPreviewReload.ts:209, where an accepted timeline was read as absent before the restore seek) was answered atfbb6b722. The new test "names the restore seek when a shadow's timeline arrived but its seek never painted" pins it. GitHub will still show his change request until he dismisses or re-reviews it.
Every point of this change request is answered at the current head, which has approvals; dismissing the stale request so the PR can merge. Happy to take a fresh review.
What
When a sealed preview (
VITE_STUDIO_OPAQUE_PREVIEW_ENABLED=true) fails to reload, Studio's message now says only what the preview actually reported. Before, every sealed failure said the page and its runtime never loaded, and named a page stage (no-page), whatever really happened.Why
To say how far a failed reload got, Studio reads the new preview's window and document. A sealed preview refuses both reads, so Studio took every sealed preview for a page that never loaded.
How
failShadow(player/hooks/useShadowPreviewReload.ts) checks whether the new preview is sealed. If it is, the message relies only on what reached Studio, and it no longer names a page stage.Test plan
packages/studio/src/player/hooks/useTimelinePlayer.shadowReload.test.ts, the first commit. It reloads into a frame Studio cannot read, with the real editing agent behind it. On main's code, on a Linux box, the message says the page and its runtime never loaded.useTimelinePlayer.shadowReload.test.tspasses 3 of 3 runs (59 tests). The Studio player suite (src/player) passes 211 files, 2,593 tests. Studio typecheck exits 0.Before
Studio from main (
a1ee4009), built with the preview sealed, opens a project, then its file is saved with a script that holds the new page before its runtime starts, so the reload times out after 15 s: "It was still waiting for the page and its runtime to load. Its page had got to: no-page."After
The same steps at this branch (
fbb6b722; the head since only shortens a test comment): "It was still waiting for its runtime to report a timeline."What I did not exercise