Repository navigation
fix(studio): a timing drag moves the animation in place in a sealed preview - #8163
Conversation
24df97c to
88dca71
Compare
17341fa to
e7a6bff
Compare
eddy-heygen
left a comment
There was a problem hiding this comment.
(Eddy's agent) Reviewed by Eddy's Claude agent at commit e7a6bff.
Verdict: comment only, not approved (stacked PR, and lint is failing at this head). No open blocker found.
Summary. The PR adds one request kind, a live retime, to the editing port of a sealed preview, so a timeline drag moves the frame's existing tweens in place instead of re-running the script; the move logic is relocated from Studio into core and reused by the unsealed path. The full review was done at 17341fa. At that commit there was one blocking finding: a sealed in-place move ended with the frame's clip timing attributes at the old values and no reload. The head has since moved, and I read the change myself: the request now carries the saved file's timing, the frame refuses the request unless every entry is an allowlisted timing attribute with bounded size, and it writes those attributes before the rebind derives clip windows (packages/core/src/runtime/editing/liveRetime.ts:240-248), with a test for that order. By reading, that finding is addressed. I did not re-review the rest of the restacked diff line by line.
What holds from the review: the handshake and sender check are unchanged; the request needs an exact key set, bounded strings, at most 1,000 tweens and finite numbers; it adds no script execution or markup path; the frame pairs every planned tween with the live one and moves nothing on a mismatch; the editor builds the plan from saved files only and treats any reply other than a known result as a failure that reloads.
Blockers
None open.
Non-blockers
packages/core/src/runtime/editing/liveRetime.ts:243-244: the frame checks for the rebind hook only after it has moved the tweens; a frame without the hook is left moved and answers "failed" (the editor then reloads, so the end state is correct). Checking first would leave nothing touched.packages/studio/src/utils/gsapLiveRetime.ts: a request the frame refuses outright, a timeout or a missing agent is treated like a half-moved failure and forces a full reload where a re-run would do. Edits made through the SDK session carry no "before" file, so they never take the new path and still fully reload.moveLiveTweensreturns a boolean or a promise; a future caller that forgets to await would always take the handled branch in a sealed preview. Making it always async removes the trap.
CI: at this head 7 checks pass, 6 fail, 2 pending, 3 skipped. The failing lint job on this stack reports one lint error, "Unsafe usage of optional chaining" (I read the log on the PR below this one; it does not name the file). The workflow that runs type checks and unit tests only triggers for pull requests based on the default branch, so this PR's own new tests have not been run by CI.
How this was reviewed: a code-review pass and a security-review pass by a reviewer agent in an isolated checkout of 17341fa; I then read the timing change at the current head myself. Nothing was built or run.
e7a6bff to
c3bc0ef
Compare
c66fb25 to
9cee4cc
Compare
c3bc0ef to
2217910
Compare
9cee4cc to
f72fee8
Compare
2217910 to
92f5aed
Compare
f72fee8 to
2539c18
Compare
92f5aed to
3eb25f9
Compare
2539c18 to
06fc384
Compare
3eb25f9 to
cfd070a
Compare
06fc384 to
6fc7a25
Compare
cfd070a to
49197a2
Compare
6fc7a25 to
4791316
Compare
49197a2 to
3267840
Compare
…election in a sealed preview
…m length with its tweens
…efore comparing them
4791316 to
34b2647
Compare
b98310c to
426f2f5
Compare
# Conflicts: # packages/core/src/runtime/editingAgent.test.ts # packages/core/src/runtime/editingAgent.ts # packages/core/src/runtime/editingPort.test.ts # packages/core/src/runtime/editingPort.ts
vanceingalls
left a comment
There was a problem hiding this comment.
Approving at 426f2f50. I found no blockers.
- Lane rule: met.
fails without the fix:namesgsapLiveRetime.sealed.test.ts("sends a sealed preview the move planned from the saved file before and after the edit"). On the base,moveLiveTweenshas no sealed path and never callspreviewRequest. - Eddy's blocker at
e7a6bff8(stale clip timing after a sealed move) is fixed.liveRetimerunsapplyTimingPlanbeforefinalizeSoftReload, and the test pins the order (seen == ["1.5"]). - Frame side:
retimeLiveTweenspairs every planned tween with a live one (target, start − delay, duration) before moving any of them. Any mismatch moves nothing and answersunchanged, and a test pins that the timing attributes stay untouched. - Port:
live-retimeappears once in each ofEDITING_REQUEST_KINDS,EditingRequests,PARAM_PARSERSandHANDLERS, and the kind-list tests are updated. The parser takes an exact key set, at most 1,000 tweens, a script of at most 1M characters, finite numbers, and no negative duration ortime. - Studio side: it accepts exactly
{ result }.failed, no reply or an extra field reloads, andunchangedre-runs. Tests cover each case, plus a missing before-file. - Unsealed previews: the move logic moves into core unchanged, and the existing real-GSAP tests run against it.
currentTime()is read before the await. - Cancel and undo: the only caller is
syncTimingEditPreview, after a saved commit, so a cancelled drag leaves no partial state. Undo and redo aren't touched.
CI: the only red job is "Heavy films: Safari vs Chrome", a Safari WebDriver execute/sync 60 s timeout in the perf harness. It's unrelated, and the same workflow fails on main at 592a9fe. Preflight, regression shards, preview-regression and Perf are green. The unit-test and typecheck workflow only runs on main-based PRs, so this stacked PR's new tests haven't run in CI yet. Please make sure they run once it retargets to main.
Non-blocking:
parseLiveRetimerequirestweens.length >= 1, so a zero-tween plan comes back null and does a full reload where a re-run would do.- The parser doesn't check
start >= 0. That's fine while the planner only reads saved-file values. - Eddy's earlier notes still stand. They're harmless, because every bad path ends in a reload.
- The Before/After captures and the manual sealed-session walk are still unchecked in the body.
…ix/studio-sealed-live-retime # Conflicts: # packages/core/src/runtime/editingAgent.test.ts # packages/core/src/runtime/editingAgent.ts # packages/core/src/runtime/editingPort.test.ts # packages/core/src/runtime/editingPort.ts
vanceingalls
left a comment
There was a problem hiding this comment.
Re-approving at 89b57f62. This head only merges the parent branch and main. The PR's own net diff (12 files) is identical to 426f2f50, which I approved, and every check is green on this head, including the Safari vs Chrome heavy-films job.
The base branch was changed.
…e-retime # Conflicts: # packages/core/package-subpaths.json # packages/core/package.json # packages/core/src/runtime/editingAgent.test.ts # packages/core/src/runtime/editingAgent.ts # packages/core/src/runtime/editingPort.test.ts # packages/core/src/runtime/editingPort.ts
Edit accuracy: accurate 271 (base branch 271), smooth 85 of thoseThe gate passes. Quarantined, measured but not gated (0) |
eddy-heygen
left a comment
There was a problem hiding this comment.
(Eddy's agent) Re-review by Eddy's Claude agent at commit 2d1b415 (this PR's own diff compared with the one I reviewed at e7a6bff; the differences read by me).
Verdict: approve. My earlier review found no open blocker and withheld approval only because the PR was stacked and its tests had not run. It now targets main and its checks pass.
Summary
One request kind is added to the sealed preview's editing port: a live retime, so a timeline drag moves the frame's existing tweens in place instead of re-running the film's script. The move logic lives in core and the unsealed path uses the same code.
What I checked
- Compared with e7a6bff, the files that belonged to the PRs underneath are gone from this diff because they are on main now. What remains is the same change, with two refactors: the request's field checks are split into small functions with the same rules (bounded selector, finite times, non-negative durations, whole non-negative source index, boolean moved flag), and the editor's plan building is pulled into one helper.
- What held before still holds: the request needs an exact key set and bounded sizes, adds no script or markup path, pairs every planned tween with a live one and moves nothing on a mismatch, and the editor builds its plan from saved files only.
- The sealed timing test now asserts that the live retime and the soft reload carry the same timing.
Non-blockers (carried over, unchanged)
- The frame checks for its rebind hook only after moving the tweens; checking first would leave nothing touched when the hook is missing.
- A refused request, a timeout or a missing agent forces a full reload where a re-run would do.
- The move function returns either a value or a promise; making it always asynchronous removes a trap for a future caller.
CI: 68 pass, 37 skipped, none failing or pending.
What
In a sealed Studio preview, dragging a clip on the timeline now moves its animations in place, as in an unsealed preview. Before, a sealed preview re-ran the whole script (or reloaded) for every timing drag.
Why
Studio moved the live tweens by reading the preview frame's running script and reaching into its timeline, which a sealed frame does not allow. This is one of the remaining writers to move onto the editing port before Studio's preview can run sealed by default.
Related work
Stacked on the sealed scene swap PR, which is stacked on #8158. Same pattern as the earlier sealed preview units: the frame-side logic moves into core, Studio's unsealed path calls the same code, and the sealed path sends one editing port request and falls back when the reply says it did not apply.
How
live-retime. For a sealed preview Studio plans the move from its own saved files only: the composition before the edit and after it. It never reads the frame's script. The frame first checks its live timeline sits exactly where the plan says each tween was, and moves nothing otherwise.failed, with nothing moved.moved,unchanged(nothing moved: Studio re-runs the script in place instead) orfailed(Studio reloads). Studio accepts only exactly{ result }with one of those; anything else, no answer included, reloads.Test plan
fails without the fix:
packages/studio/src/utils/gsapLiveRetime.sealed.test.ts("sends a sealed preview the move planned from the saved file before and after the edit") fails on the base, where a sealed preview cannot move its tweens. The same file checks thatunchangedfalls back to a re-run, thatfailed, no answer or an extra field reloads, and that nothing is sent when the file before the edit is unknown.packages/core/src/runtime/editing/liveRetime.test.tsruns real GSAP in the frame: the tween moves, the saved script is recorded and the playhead re-seeks, and a plan that does not match the live timeline moves nothing. Studio's existing real-GSAP live retime tests now run against the moved core code.Before
Studio from main (
012f2635), built with the preview sealed, on a 6 s film with one box clip (0 to 3 s) and one GSAP tween on it (0.5 to 2.5 s). The film's script counts its own runs. With the playhead at 1.5 s, the clip is dragged 0.5 s later on the timeline, twice. On the second drag the preview re-runs the film's script in place: no new document loads, and the script has now run twice. Shot after the second drag:After
The same steps at this branch (
2d1b4152): on the second drag the frame moves the tween with the clip (live-retimeanswersmoved). No new document loads, the script has still run once, and the box sits where the moved tween puts it at 1.5 s (x 0, its start). The saved file has the clip at 1 s on both refs. Same moment:The first drag on this film reloads the whole preview on both refs: the film's elements have no Studio ids yet, the save writes them, and the live preview still carries the ids it was served with, so the frame cannot match the saved timing and answers
failed. That happens on main the same way (in its sealed soft reload), so it is not from this change.What I measured
Measured on the whole stack (scene swap, live retime, gesture hold together) after building core so Studio reads it: core 191 tests in the touched files plus the new port test, Studio 311 tests across 21 files (scene swap and hold, live retime including the real-GSAP tests, timing sync, gesture holds, shadow reload and retry, undo history, selection and drafts); core, core runtime and Studio type checks pass, and the subpaths check verifies the new export. With the frame skipping the was-start check, the frame never re-seeking, no sealed path (the base), a reply with an extra field accepted, or no reload when the move failed, the matching test fails each time.
What I did NOT exercise
Selecting in a real sealed Studio session, for the same selection reason as the earlier sealed PRs (the captures above drag on the timeline only). A sealed preview whose running script differs from the saved file before the edit in something other than timing (an external edit not yet reloaded) is caught only when the timings or targets disagree; Studio cannot compare the scripts themselves without reading the frame's.