Skip to content

fix(studio): a sealed gesture recording shows every recorded value live - #8598

Merged
miguel-heygen merged 43 commits into
mainfrom
fix/sealed-recording-sets-gsap-live
Nov 24, 2026
Merged

miguel-heygen merged 43 commits into
mainfrom
fix/sealed-recording-sets-gsap-live

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

What

On a sealed preview, a gesture recording now shows every recorded value live, the way an open preview does: scale and opacity (cmd), rotation (alt), 3D turns (shift) and depth (wheel), not only the move. A layer with its own position tween now shows the recorded position, not its tween plus an offset.

Stacked: waits on #8565 and #8587, and its base is #8587's branch. It goes back to main once those land. A stacked PR's CI skips the Build and Studio edit-accuracy gates, so they run after the retarget.

Why

An open preview's recorder seeks the film's timeline and calls gsap.set with every recorded value on each frame, then clearProps when it stops (applyRuntimePreview and releaseRuntimePreview in useGestureRecording.ts). A sealed frame doesn't expose its window, so #8592 could only draw the move, as a CSS translate over the layer's own GSAP state.

Related work

Builds on #8587's GSAP draft route, so there is one route that writes GSAP values from Studio into a sealed frame, and on #8592 (the move) and #8568 (the start values).

How

  • Core, editingPort.ts: a draft may carry props: { seconds, values }, where values are GSAP's x, y, opacity, scale, rotation, rotationX, rotationY and z. A draft whose props set x or y must have a null translate, so each draft has one writer of GSAP's position.
  • Core, editingDraft.ts: the frame seeks the film's timeline to seconds and gsap.sets the values in the same task, so no paint shows the seek without them. It reveals the clip as the open preview does. A new clear end (editingDraftEnd.ts) clears exactly the props the draft set, puts the inline style back and redraws the timeline at its time. restore is unchanged, for a cancelled drag.
  • Core, editingGestureStart.ts: the gesture-base reply says drawsProps, so Studio knows the frame can do this.
  • Studio, useGestureRecording.ts and previewDrafts.ts: when the reply says drawsProps, each sample goes as a props draft and the playhead moves in the store, as the open recorder moves it. Stopping ends the draft with clear. An older runtime keeps fix(studio): a sealed gesture recording moves the layer live in the preview #8592's move.
  • Samples queue in order: a draw waiting for the frame's reply is replaced by the next one only when neither carries props. Recording samples queue in order, so the frame applies every sample the recording saves, each after its own seek. Merging them per property instead would keep an older x past the next seek on a tweened layer, where the open recorder lets the tween drive it.
  • A live recording survives another draft ending: restoring another layer's draft, or ending another recording, redraws the timelines, which would put a layer still being recorded back to its timeline values. The redraw now replays each live draft through redrawOwned (from the base PR), which draws only the parts that draft carries; this PR adds the recorded values to it. A layer's live record keeps every value its recording has set so far, since a sample carries only what changed.

Before

Sealed preview, a layer tweening its own x/y, mid-recording after a move and then an alt-drag turn: no turn, and the box sits at its tween plus the drawn move.

Before: sealed, mid-recording, a tweened layer neither turns nor sits where the open preview puts it

After

Same recording: the layer is turned and placed as the open preview shows it (the same box at all four corners).

After: sealed, mid-recording, turned and placed as the open preview shows it

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

fails without the fix:

  • packages/core/src/runtime/editingDraft.test.ts: "seeks the film's timeline, then sets every recorded value, in one draw", "clears exactly what it set and gives the layer back its translate when the recording ends";
  • packages/core/src/runtime/editingGestureStart.test.ts: "reads GSAP's x, y, opacity and scale for a layer no tween touches";
  • packages/studio/src/hooks/useGestureRecording.sealed.test.tsx: "has a frame that can set every recorded value set them at the recording's time, and clear them on stop";
  • packages/studio/src/components/editor/previewDrafts.test.ts: "sends every recording sample that waited, in order, so none the recording saves goes unshown".
  • packages/core/src/runtime/editingDraftRestore.test.ts: "keeps another layer's live recording when a drag is restored", "keeps another layer's live recording when a recording ends", "replays every value another layer's live recording has set when a drag is restored". Each also fails alone with its own piece taken out: the clear path's replay, the recorded values in redrawOwned, and the live record's merge of earlier samples.

The refused props drafts in editingAgent.test.ts (empty, negative time, unknown prop, string value, extra key, and props with x beside a translate) pass before the change too, since the old parser refused any props.

  • With the fix, those files and previewDrafts.test.ts and useGestureCommit.test.tsx pass three runs in a row on Linux. Core's src/runtime (3,618 tests) and Studio's editor, hooks and player (6,876 tests) pass, and both typecheck clean.
  • In Studio built at this branch and before it, on Linux headless, on the edit bench's move-tween case (the layer tweens its own x/y), recording a move then an alt-drag turn: sealed, the layer's box mid-recording is the same as unsealed's at all four corners. Before, the sealed layer didn't turn and sat elsewhere.
  • Not checked live: scale and opacity, because cmd+wheel didn't reach the recorder in the headless run, unsealed included. They go through the same props path as rotation and are covered by the unit rows.

Before: sealed, mid-recording, a tweened layer neither turns nor sits where the open preview puts it

After: sealed, mid-recording, turned and placed as the open preview shows it

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 — Preserve sparse recording updates when a draft is in flight. packages/studio/src/components/editor/previewDrafts.ts:118–133 replaces the entire pending draft for a handle. Recording samples only include the properties changed by that frame. I held a draft reply, queued a depth update, then queued a position update. After the reply, the frame received only position. In the recorder, the wheel delta is cleared after that sample, so the depth change can be present in the saved recording without ever appearing in the sealed preview. Preserve pending updates to distinct properties in order, or send an equivalent state that respects the timeline seek.

All 244 focused core and Studio tests passed. A held-reply test reproduced the dropped property at this head. I did not rerun the browser bench.

— tai (automated review)

… fix/sealed-recording-sets-gsap-live

# Conflicts:
#	packages/studio/src/hooks/useGestureRecording.sealed.test.tsx
#	packages/studio/src/hooks/useGestureRecording.ts
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Fixed in 2e7040a: a waiting draw is replaced only when neither it nor the new one carries props, so recording samples queue in order and the frame applies each one after its own seek. Merging per property instead would keep an older x past the next seek on a tweened layer, where the open recorder lets the tween drive it. Your held-reply case is the row "sends every recording sample that waited, in order, so none the recording saves goes unshown" (previewDrafts.test.ts), which fails at d94502b. The branch also merged #8587's latest head, and the PR now shows only this change (11 files).

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The queue now preserves sparse recording samples in order, with each sample tied to its own seek. The held-reply regression reproduced the dropped depth update against the previous implementation and passed at this head. The merged recorder also keeps a single move-only fallback. All 245 focused tests passed. I did not rerun the browser bench. Full CI checks remain deferred until retargeting, as described in the PR.

— tai (automated review)

…draft

# Conflicts:
#	packages/studio/src/components/editor/gsapMoveSealedPreview.test.ts
#	packages/studio/src/components/editor/manualOffsetDrag.ts
… secpub/sealed-recording-sets-gsap-live

# Conflicts:
#	packages/studio/src/hooks/useGestureRecording.ts

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The patch against the merged base matches the previously reviewed changes. The focused Core and Studio suites passed all 136 tests, covering queued recording samples, draft clearing, and the merged tween-restore behavior. The PR body names the regression tests. The browser edit-accuracy run was outside this merge-delta review.

— tai (automated review)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The import conflict resolution preserves both sides. Compared against their respective bases, the recording patches match apart from import placement. All 134 focused Core and Studio tests passed, and the PR body names the failing tests.

P2 — The inherited restore redraw can also overwrite a live recording sample. I exercised this head with real GSAP. A recording props draft on B drew x=81. Restoring an independent drag on A then returned B to the timeline's x=10, although B's recording draft was still active. That is the same redraw blocker reported on #8587, now verified for the props route here. The two PRs can share the fix that preserves active drafts during restore. Base review

I did not rerun the full browser bench.

— tai (automated review)

# Conflicts:
#	packages/core/src/runtime/editingDraft.ts
#	packages/core/src/runtime/editingDraftRestore.test.ts
# Conflicts:
#	packages/core/src/runtime/editingDraft.ts
#	packages/core/src/runtime/editingDraftRestore.test.ts

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 — Restoring one draft can rewind the shared playhead. In editingDraft.ts:267–276, restoring one element replays another element’s recording via drawProps, which seeks the root timeline to the recording’s last sample time. In a real GSAP runtime probe, B’s live sample was drawn at 1 s, the player then sought to 2 s, and restoring A rewound the root timeline to 1 s. Reapply the recorded values without seeking during restoration. The seek still belongs on the initial sample draw.

The earlier independent-layer recording and unowned-width cases pass. The runtime built and all 147 focused Core and Studio tests passed. The new playhead probe failed as described. I did not rerun the browser bench.

— tai (automated review)

Base automatically changed from fix/sealed-gsap-move-draft to main November 24, 2026 07:25
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 74 of those

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

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

# Conflicts:
#	packages/core/src/runtime/editingDraft.test.ts
#	packages/core/src/runtime/editingDraft.ts
#	packages/core/src/runtime/editingDraftRestore.test.ts
#	packages/core/src/runtime/editingPort.ts

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Restoring one layer now reapplies another layer’s live values without seeking the timeline. The regression test checks both the playhead and the replayed value. The latest delta preserves the rotation and property merge behavior, and Fallow passed. All 69 targeted runtime tests passed locally. The broader CI matrix is still running.

— tai (automated review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 7b2bffe Nov 24, 2026
102 checks passed
@miguel-heygen
miguel-heygen deleted the fix/sealed-recording-sets-gsap-live branch November 24, 2026 09:57
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