feat(sdk,studio): ws-4 — add history:false option; disable unused sdk undo in studio#1496
Conversation
vanceingalls
left a comment
There was a problem hiding this comment.
Hey vance — small one to start the SDK side of the stack.
Summary of intent. Adds a history: false opt-out to openComposition so Studio (whose editHistory is the authoritative undo stack) can stop the SDK from spinning up its own history module that nobody reads. A trim of dead weight, not a feature.
PR-template flag. Filled boilerplate only — for a two-line surface change that's fine, no real ask here.
Per-file findings.
packages/sdk/src/session.ts:51-56— option introduced ashistory?: false(literal-false-only), nothistory?: boolean. Elegant: callers cannot enable history twice, only suppress the default. The default-undefinedbranch falls through to the existing!isEmbeddedattach.packages/sdk/src/session.ts:509— guard becomes!isEmbedded && opts?.history !== false. Embedded sessions remain untouched (they never got history anyway), and the new opt-out only matters in the standalone branch. Surface unchanged for every other caller.packages/studio/src/hooks/useSdkSession.ts:100-102— Studio passes{ history: false }. The doc-line above is the right archeology — explicit that Studio's editHistory is canonical and SDK history is unused.
Dispatch chain. Single boolean gate with one new caller. No switches, no fan-out — nothing to misroute.
CI. Preflight (lint + format) and preview-regression are failing across this whole stack — unlikely to be #1496-specific. Worth confirming once the parent of the stack re-runs clean.
Verdict. Clear-with-no-nits, modulo CI green. The trim is so small that it's effectively a no-op for any non-Studio consumer.
Cleared SHA: f1e6e32d. Any push past that voids this review.
Review by Via
340da02 to
cf38a71
Compare
f1e6e32 to
e32e1e5
Compare
cf38a71 to
d77c32b
Compare
e32e1e5 to
a413e2a
Compare
d77c32b to
21273b5
Compare
a413e2a to
2d44dfa
Compare
21273b5 to
fcf539d
Compare
2d44dfa to
17fbefc
Compare
fcf539d to
af8af62
Compare
17fbefc to
a0854e4
Compare
af8af62 to
ec90fd9
Compare
a0854e4 to
884b244
Compare
miga-heygen
left a comment
There was a problem hiding this comment.
Review: ws-4 — history:false option
Clean, well-scoped change. Two files, 10 additions, 2 deletions. Let me walk through what I found.
The good
Type design is sharp. history?: false as a literal type is exactly right — it communicates "this is an opt-out flag, not a boolean config knob." You can't accidentally pass true and think you're doing something. The undefined-or-false semantics are self-documenting.
The guard reads naturally. !isEmbedded && opts?.history !== false is clear at a glance — two independent reasons to skip history, and both are explicit. The optional chaining handles the undefined-opts case without a separate null check.
Existing undo/redo methods are already null-safe. historyModule?.undo() and canUndo() ?? false mean a session opened with history: false won't throw — undo is a silent no-op and canUndo() returns false. No downstream callers need changes.
The Studio call site is correct. useSdkSession already doesn't pass persist, so the only module being suppressed is the history module — exactly what's intended. The comment update explaining why SDK undo is dead weight in Studio (forceReloadSdkSession discards it) is a nice touch for future readers.
One thing to flag (non-blocking)
history: false also suppresses the persist queue because the persist-queue creation lives inside the same if (!isEmbedded && opts?.history !== false) block. Today this is fine — Studio doesn't pass persist, and no other caller passes both persist and history: false. But the coupling is a silent foot-gun: a future caller writing openComposition(html, { persist: adapter, history: false }) would expect auto-save without undo, and would get neither. Two options if you want to address this later:
- Split the guard: move persist-queue creation to its own
if (!isEmbedded && opts?.persist)block. - Document the coupling in the JSDoc for
history— "Note: also suppresses the persist queue."
Not blocking since no current call site hits this, and it's easy to unravel when the need arises. Just wanted to flag it before the interface calcifies.
Verdict
No bugs, no edge-case surprises, CI is green. The change does exactly what the PR says and nothing more.
LGTM — pinging @magi for the stamp. <@U0B1J4SL8H3>
— Miga
james-russo-rames-d-jusso
left a comment
There was a problem hiding this comment.
Independent pass, layered on top of Via and Miga.
Verdict. Approve-with-no-changes. Two files, ten lines, exactly the right shape. history?: false as a literal-false rather than boolean makes the API opt-out-only (the default-attach case is anchored to the source instead of split between two truthy values), and the !isEmbedded && opts?.history !== false guard reads correctly at a glance.
Cross-PR-coherence finding (the fresh angle for this stack). Group D adds four op-level primitives (set, removeGsapKeyframe by %, removeAllKeyframes, arc-path ops) on top of this history:false opt-out. None of those ops accept a history flag of their own — Studio's session-wide opt-out at useSdkSession.ts:100-102 is the only switch, and it's binary at composition-open time. That's the right design if Studio is the only host that needs per-session opt-out. If a future host wants per-op opt-out ("undo this batch via my own stack, undo this single op via SDK"), the door is still open — the SDK's historyModule?.undo() calls remain unaffected by the new ops. Just noting the shape so the design intent is on record before the API surface calcifies through Group E+.
On Miga's persist-queue coupling note (#1496 review). Concur — the persist queue creation is gated by the same !isEmbedded && opts?.history !== false block. Worth a one-line JSDoc clarification ("also suppresses the persist queue") even though no current caller hits the both-set-together case. Cheap to do in the next push.
CI. All green on 884b244.
— Rames D Jusso
(Reviewed at 884b2442dd4010fb04fd338b2a432d90d64216d2. Part of 18-PR HF SDK cutover stack, Group D review pass.)
vanceingalls
left a comment
There was a problem hiding this comment.
Second pass at HEAD 884b2442, after rebase from prior cleared SHA f1e6e32d. Co-reviewers (Miga, Rames) have already landed independent passes at this same SHA; layering rather than re-litigating.
Verdict. Clean — ready for stamp.
Re-verification. Two files, ten lines, exactly what the title says — history?: false literal-false opt-out on OpenCompositionOptions at packages/sdk/src/session.ts:51-56, guard reshaped to !isEmbedded && opts?.history !== false at session.ts:509, and useSdkSession.ts:100-102 passes { history: false } with the right archeology comment above it. The literal-false rather than boolean is the elegant part — you cannot accidentally pass true and think you've enabled anything; the only legal call shape is the opt-out.
Dispatch chain (re-checked at current head). Single boolean gate, single new caller (Studio). No switches, no fan-out. historyModule?.undo() and canUndo() ?? false are already null-safe, so a session opened with history: false is silent-no-op-safe for downstream undo callers — no surprise throws.
Concur with Miga's persist-queue coupling note. The persist queue and the history module share the same if (!isEmbedded && opts?.history !== false) block, so a hypothetical future caller writing openComposition(html, { persist: adapter, history: false }) would silently get neither persist nor history when they expected one. No live caller hits this — Studio doesn't pass persist — but a one-line JSDoc clarifier (or splitting the guard) closes the door before the API surface calcifies. Non-blocking; worth a follow-up commit.
Concur with Rames's history flag-shape forward note. The session-wide opt-out at composition-open time is the right shape for Studio's case (host owns the undo stack, full stop). If a future host wants per-op opt-out (some batches host-driven, some SDK-driven undo), the SDK's historyModule?.undo() calls are still unaffected, so the door's still open — just flagging that the API surface is session-wide-binary for now, which is sufficient until it isn't.
CI. Green on 884b2442 across regression, player-perf, preview-regression, preview-parity. No infra noise on this run.
Cleared at 884b2442. Re-verify if HEAD moves before stamp.
Review by Via
…ch undo, empty-arg guards, persist decouple Addresses the highest-severity round-3 review findings: - gsapWriterAcorn unroll (R3 #1/#2/#9): the round-2 AST-substitution fix emitted invalid GSAP for object shorthand `{ i }` (→ `{ 0 }`) and shadowed inner bindings (→ `for(let i=0;0<3;0++)`), and silently dropped sibling statements on non-`for` loops (forEach/for-of). The unroll now REFUSES (no-ops, leaving the dynamic loop intact) whenever siblings can't be safely reproduced — a non-`for` loop, an unmodeled statement, or an unsafe index use — instead of dropping or corrupting. Plain `for` loops with safe siblings still unroll. - session single-dispatch undo (R3 #5/#11): _dispatch now reverses the inverse patch list (parity with batch()). A single op emitting order-dependent inverse patches — a nested parent+child removeElement, an aliased multi-target — undid forward and dropped the child subtree / landed on an intermediate value. - materializeKeyframes empty-array (R3 #10): the unguarded twin of the just-fixed unrollDynamicAnimations. Writer no-ops on an empty keyframe list; validateOp rejects it as E_INVALID_ARGS (shared gsapScriptMissing helper). - history:false persist decouple (R3 #4): persist (auto-save) no longer lives inside the history-enable block, so opting out of SDK undo no longer silently disables all disk writes (data-loss trap for #1496's flag consumers). Tests: unroll refuse cases (shorthand/shadow/forEach) + safe-for-loop regression; nested removeElement undo; materializeKeyframes writer no-op + validateOp reject; history:false-still-persists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
miguel-heygen
left a comment
There was a problem hiding this comment.
Approved as part of SDK cutover stack. Reviewed by Miga, Rames D Jusso, and Via across R1-R4. LGTM.
jrusso1020
left a comment
There was a problem hiding this comment.
Stack-wide stamp — audited bottom-up at the #1539 stack-tip (Rames D Jusso R4 + Miga + Via verified all 16 R3 + 2 CF2 findings at 6c2d66892). SDK-cutover chain cleared end-to-end.
ec90fd9 to
21be124
Compare
The base branch was changed.
… undo in studio Co-authored-by: Miguel Ángel <miguel07alm@protonmail.com>
884b244 to
bffb56f
Compare
…ch undo, empty-arg guards, persist decouple Addresses the highest-severity round-3 review findings: - gsapWriterAcorn unroll (R3 #1/#2/#9): the round-2 AST-substitution fix emitted invalid GSAP for object shorthand `{ i }` (→ `{ 0 }`) and shadowed inner bindings (→ `for(let i=0;0<3;0++)`), and silently dropped sibling statements on non-`for` loops (forEach/for-of). The unroll now REFUSES (no-ops, leaving the dynamic loop intact) whenever siblings can't be safely reproduced — a non-`for` loop, an unmodeled statement, or an unsafe index use — instead of dropping or corrupting. Plain `for` loops with safe siblings still unroll. - session single-dispatch undo (R3 #5/#11): _dispatch now reverses the inverse patch list (parity with batch()). A single op emitting order-dependent inverse patches — a nested parent+child removeElement, an aliased multi-target — undid forward and dropped the child subtree / landed on an intermediate value. - materializeKeyframes empty-array (R3 #10): the unguarded twin of the just-fixed unrollDynamicAnimations. Writer no-ops on an empty keyframe list; validateOp rejects it as E_INVALID_ARGS (shared gsapScriptMissing helper). - history:false persist decouple (R3 #4): persist (auto-save) no longer lives inside the history-enable block, so opting out of SDK undo no longer silently disables all disk writes (data-loss trap for #1496's flag consumers). Tests: unroll refuse cases (shorthand/shadow/forEach) + safe-for-loop regression; nested removeElement undo; materializeKeyframes writer no-op + validateOp reject; history:false-still-persists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…) (#1539) * fix(studio): restore timeline move/resize fallback parity (review #1466) The §3.2 sdkTimingPersist rewrite regressed the non-SDK fallback path vs the pre-cutover behavior. Restored, on both fallback entry points (no-session and sdkTimingPersist-returned-unhandled): - Resize live DOM patch dropped the conditional data-playback-start/media-start attr — restored so a start-trim updates the preview's in-point immediately. - Move/resize fallback dropped the GSAP-position sync (shift/scaleGsapPositions) + reloadPreview — restored so server-path edits keep GSAP tweens in sync and refresh the preview (the SDK path folds both into setTiming). - Undo-coalesce drift: fallback enqueueEdit carried no coalesceKey while the SDK branch did — plumbed coalesceKey through persistTimelineEdit so undo granularity is identical on either path. - Documented the hasPbsAdjustment second clause + sdkTimingPersist before-capture transition limitation. Flag-off (dark launch) so this lands as one fix PR at the stack tip rather than restacking the mid-stack §3.2 commit. #1500 review items: parity-harness gap already closed at the tip (arc/unroll recast-vs-acorn parity added); blockRemoveRange flagged 'potential' but verified correct (no comma residue on any block position). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(sdk): retire duplicate removeGsapKeyframe keyframeIndex variant (review #1498) EditOp had two removeGsapKeyframe members with the same discriminant but different shapes (keyframeIndex vs percentage) — TS can't discriminate them and a handler could get the wrong shape. Per both reviewers (option 2): retire the keyframeIndex variant. It had no production caller (Studio dispatches percentage only); removed the dead by-index handleRemoveGsapKeyframe + simplified the dispatcher. resolveKeyframe stays (setGsapKeyframe still uses keyframeIndex). Converted the one by-index test to the percentage API. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(studio): gate ALL cutover persist paths on the flag — true dark launch (review #1469 finding #6) Only sdkCutoverPersist (style/text/attr) checked STUDIO_SDK_CUTOVER_ENABLED. sdkTimingPersist, dispatchGsapOpAndPersist (every GSAP op) and sdkDeletePersist guarded only on `!sdkSession` — and useSdkSession opens a session by default for shadow/selection, so timing/GSAP/keyframe/delete cutover was ALWAYS live regardless of the flag. Flipping the flag OFF could not disable it, so the data-loss bugs in those paths (single-prop wipe, wrong-keyframe match, tween collapse, arc strip) ship LIVE on merge instead of being dark-launched. Added the flag guard at all three chokepoints → flag OFF returns false → callers fall back to the legacy server path. Makes the stack genuinely dark-launchable: merge is now a no-op in prod, and the remaining cutover correctness bugs become flip-prerequisites rather than merge-blockers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(core,sdk): correct 8 GSAP write-path review findings (#1539) Eight correctness bugs from the SDK-cutover review. Several were cases where BOTH writers were identically wrong, so the recast-vs-acorn parity suite stayed green; the new tests assert the real-world-correct result, not agreement. - #2 findKfPropByPct: match the CLOSEST keyframe within tolerance, not the first within 2% — removing/updating 50% on 0/49/50/100 no longer hits 49%. - #3 handleSetTiming: shift each tween by the start DELTA and scale duration by the clip-duration RATIO per-tween, instead of writing absolute newStart/ newDuration onto every tween (which collapsed staggers and blew durations). - #4 enableArcPath: insert motionPath via appendRight at the object start so the insertion can't collide with the x/y remove-range end (which made MagicString discard the append and emit '{}'). - #5 splitAnimationsInScript: compute the inherited baseline in a forward pre-pass so the split-spanning midpoint sees earlier tweens (the reverse write loop is kept for stable count-suffixed ids). - #9 unrollDynamicAnimations: preserve non-target loop-body statements (e.g. tl.set initial-state) per iteration instead of overwriting the whole loop. - #10 buildMotionPathObjectCode (both writers): emit the cubic form when segment curviness varies so per-segment curviness survives, not just segments[0]. - #11 readLastWaypointXY: handle UnaryExpression so negative destination coords are recovered when disabling an arc path. - #15 no-bang: removed every `!` non-null assertion in the touched files, replaced with guards/fallbacks. Tests: gsapWriter.reviewFixes.test.ts (#2/#4/#5/#9/#10/#11) and mutate.gsap.test.ts setTiming GSAP-sync block (#3). All fail on the base and pass after the fix; tsc + full core/sdk suites + parity stay green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(studio): SDK cutover review fixes — merge tween props, stabilize debounce, serialize gsap writes, on-disk undo baseline, self-write identity Addresses 5 SDK-cutover review findings (studio-only): - #1 useGsapPropertyDebounce: editing one GSAP tween property no longer drops the tween's other animated props. setGsapTween REPLACES the property set, so merge the single edit into the tween's CURRENT properties (read from the SDK doc) before dispatching, mirroring the legacy server merge. - #7 useGsapPropertyDebounce: stabilize the flush callback by reading sdk deps from a ref instead of an unmemoized literal, so a parent re-render mid-edit no longer tears down + flushes the debounce (one commit/undo entry per render). - #8 sdkCutover/useGsapScriptCommits: route SDK gsap-write persists through the same per-file keyed serializer the legacy commitMutation uses, so concurrent same-file read-modify-writes can't interleave and lose an edit. - #12 sdkCutover/useTimelineEditing: capture the exact on-disk bytes as the undo 'before' for timing/GSAP persists (matching the style/delete paths) instead of a normalized SDK serialize() re-emit that reformatted the whole file on undo. - #14 useSdkSession/sdkSelfWriteRegistry: discriminate a cutover echo from an undo write by CONTENT identity (registered self-write hash), not just the 2 s timestamp window — an undo write always reloads the SDK session. Tests: useGsapPropertyDebounce(.test), useGsapPropertyDebounceFlush.test, sdkSelfWriteRegistry.test, and new sdkCutover.test cases; each reproduces the review scenario and asserts the corrected behavior (verified red before fix). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(core): extract split/collapse helpers to satisfy no-fallow-ignore rule The #5 (split) and #15 (no-bang guards) fixes pushed splitAnimationsInScript and removeAllKeyframesFromScript over fallow's complexity threshold, and a fallow-ignore had been added to splitAnimationsInScript. Per the hard rule (never ignore — fix), extracted buildSpanningSplit + applyTweenSplit (split) and buildCollapsedFlatVars (collapse), and removed the ignore. Both functions now under threshold; fallow new-only gate reports 0 new findings. Behavior unchanged — core 1811 green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(studio): pin dark-launch flag-gate contract (review #1539, Rames/Via) flag OFF ⇒ sdkTimingPersist / sdkGsapTweenPersist (GSAP-op chokepoint) / sdkDeletePersist all return false even with a valid session → legacy fallback. The prod flag-flip rests on this contract; sdkCutover.test.ts only mocks the flag TRUE, so a future gate refactor could silently re-enable cutover on flag-off without failing CI. This sibling file mocks it FALSE and locks the three guards. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(studio): leading flag-gate on sdkGsapTweenPersist (review #1539 nit, Via) The add-op getElement existence check ran before the inner gate, so flag-off did an SDK touch before falling back. Lead with the flag guard to match the other three chokepoints — flag-off is now a clean no-op at every entry point. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(core): unroll-preservation regressions — non-for loops + AST index substitution (review R2) The #9 unroll-preservation fix had two confirmed regressions: - Non-for loops (forEach/for-of/for-in/while): loopIndexVarName returns null, so substitution no-op'd and preserved siblings kept a now-undefined loop variable (e.g. `item`) → ReferenceError at render. Now returns null for those forms → caller falls back to the blanket loop overwrite (drops siblings, valid code). The #9 fixture only used `for(let i…)` so it never caught this. - substituteLoopIndex did a \bvar\b regex over raw source including string literals, corrupting selectors like ".row-i" → ".row-0". Now AST-based: substitutes only real Identifier uses, skipping string literals and non-computed member/key positions (extracted isIndexBindingPosition helper to stay under the fallow complexity threshold — no ignore added). Two regression tests added (forEach no-dangling-var; for-loop string-literal intact). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(sdk,core): unrollDynamicAnimations rejects empty element list (R1 #1501b) An empty `elements` array has no unrolled form — the writer would overwrite the loop/statement with zero tween calls, silently deleting the animation. - gsapWriterAcorn: unrollDynamicAnimations returns the script verbatim on an empty list (no-op instead of a destructive overwrite). - validateOp: reject unrollDynamicAnimations with empty elements as E_INVALID_ARGS so callers get a clean error rather than silent corruption. - Tests: writer no-op on []; validateOp E_INVALID_ARGS on []. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * perf(sdk): cache draft element in applyDraft, drop HTMLElement casts (R1 #1490a) applyDraft runs at 60fps during a drag but re-ran doc.querySelector on every call — the _draftEl/_draftId fields were only consumed by commit/cancel, never to skip the query. Reuse the tracked element when the id matches and the node is still connected; re-query only on id change or detach (iframe reload). Retypes _draftEl to HTMLElement | null (only ever set from querySelector<HTMLElement>), which removes the `as HTMLElement` casts in commitPreview / _clearDraft. Test asserts a repeated same-id drag queries once. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(sdk,core): round-3 correctness — unroll AST safety, single-dispatch undo, empty-arg guards, persist decouple Addresses the highest-severity round-3 review findings: - gsapWriterAcorn unroll (R3 #1/#2/#9): the round-2 AST-substitution fix emitted invalid GSAP for object shorthand `{ i }` (→ `{ 0 }`) and shadowed inner bindings (→ `for(let i=0;0<3;0++)`), and silently dropped sibling statements on non-`for` loops (forEach/for-of). The unroll now REFUSES (no-ops, leaving the dynamic loop intact) whenever siblings can't be safely reproduced — a non-`for` loop, an unmodeled statement, or an unsafe index use — instead of dropping or corrupting. Plain `for` loops with safe siblings still unroll. - session single-dispatch undo (R3 #5/#11): _dispatch now reverses the inverse patch list (parity with batch()). A single op emitting order-dependent inverse patches — a nested parent+child removeElement, an aliased multi-target — undid forward and dropped the child subtree / landed on an intermediate value. - materializeKeyframes empty-array (R3 #10): the unguarded twin of the just-fixed unrollDynamicAnimations. Writer no-ops on an empty keyframe list; validateOp rejects it as E_INVALID_ARGS (shared gsapScriptMissing helper). - history:false persist decouple (R3 #4): persist (auto-save) no longer lives inside the history-enable block, so opting out of SDK undo no longer silently disables all disk writes (data-loss trap for #1496's flag consumers). Tests: unroll refuse cases (shorthand/shadow/forEach) + safe-for-loop regression; nested removeElement undo; materializeKeyframes writer no-op + validateOp reject; history:false-still-persists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(core): stripGsapForId re-parses per removal so all tweens for a deleted element are stripped (R3 #3) Animation ids are count-based (positional), so removing one tween renumbers the survivors. stripGsapForId captured every matching id from a single up-front parse then removed against the mutating script — after the first removal the later ids were stale and silently no-op'd, leaving an orphaned tl.to() referencing the just-deleted element. Now re-parse after each removal and strip the first still-matching animation until none remain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(core): gsap writer — keyframe ease routing, convert preserves delay, addLabel dedup (R3 #7/#8/#12) - #7: updateAnimationInScript routes an ease update on a keyframe tween to keyframes.easeEach (per-keyframe), not a top-level ease that GSAP ignores — the user's keyframe-easing edit was silently a no-op. - #8: convertToKeyframesFromScript now preserves every non-editable vars key (delay/callbacks/stagger/yoyo/…) verbatim via preservedVarsEntries instead of rebuilding from the GsapAnimation object, which had no `delay` field and dropped it — shifting the tween's start time. - #12: addLabelToScript moves an existing same-named label (overwrites its position) instead of appending a duplicate; duplicates made removeLabel over-remove (it deletes every match, including a pre-existing label). Tests: easeEach routing, delay preservation, addLabel move-not-duplicate + hand-authored-dup removal. Updated the old "no dedup contract" corpus test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(sdk): handleSetTiming #domId + data-duration sync; validateOp resolves ids + arc/selector (R3 #6/#13, CF2 #15/#16) CF2 #15: handleSetTiming re-synced GSAP tweens only when the selector matched the element's hf-id. The common #domId-targeted tween (authored by the Studio panel) never matched, so moving/resizing a clip via the SDK timing path left its animations unsynced. Now match the tween selector against the DOM id too. CF2 #16: handleSetTiming read/wrote only data-end. Clips authored with data-duration (what the runtime prefers) got a fresh data-end beside a stale data-duration (no playback change) and oldDuration=null collapsed the GSAP duration-scale ratio to 1. Now read duration preferring data-duration, and write back to whichever attribute the clip uses (timingPath gains a "duration" field). R3 #13b: deleteAllForSelector compared selectors with strict === and missed the alternate quote style ([data-hf-id='x'] vs "x"); now quote-insensitive. R3 #6/#13a: validateOp now resolves the animationId for id-bearing GSAP ops (E_TARGET_NOT_FOUND instead of a misleading ok that no-ops at apply), and updateArcSegment validates the arc is enabled + the segment index is in range. Tests: #domId move sync, data-duration resize + scale, quote-insensitive delete, unresolved-id rejection, arc-segment preconditions. Updated the loose-can() test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(core,sdk): name the acorn-node type alias; keyToPath round-trips timing.duration (R3 #14) - gsapWriterAcorn: replace the bare `: any` AST-node annotations with the named `type Node = any` alias, matching the established convention in gsapParserAcorn.ts / gsapInline.ts ("acorn ESTree nodes are structurally untyped"). Documents intent and is greppable; type-identical (zero runtime change). A full ESTree typing is a deliberate architecture decision the codebase has not taken and is out of scope here. - patches: keyToPath/timingPath now include the "duration" timing field added for the data-duration resize fix, so a timing.duration override round-trips on T3 replay instead of being dropped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(sdk): cascadeRemoveAnimations re-parses per removal (R4 — SDK twin of #3) cascadeRemoveAnimations captured every matching animation id from a single up-front parse, then removed against the mutating script — the SDK-side twin of the stripGsapForId bug (R3 #3). Animation ids are positional, so removing the first tween for an element renumbered the survivors and the stale later ids no-op'd, orphaning those tweens on the just-removed element. Now re-parse after each removal and strip the first still-matching animation until none remain. Also adds the reviewer's defense-in-depth test: an aliased multi-target setStyle (same id twice) undoes to the original, not the intermediate (exercises the single-dispatch inverse reversal from R3 #5/#11). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Summary
Adds a
history?: falseoption toopenComposition()so hosts that own their own undo stack can skip attaching the SDK's internal history module. Applies it in Studio, where the existing hotkey-driven undo was silently firing on Cmd-Z but calling the SDK undo (a no-op write) instead of the Studio undo.packages/sdk/src/session.ts: adds optionalhistory?: falseto theOpenCompositionOptionsinterface; when set, the history module is not attached to the session (standalone non-embedded mode still gets history by default)packages/studio/src/hooks/useSdkSession.ts: passeshistory: falsetoopenComposition()— Studio owns the undo stack via its own edit history, SDK undo is dead weight here and was producing confusing no-opCmd-ZpressesTest plan
bun test packages/sdk— passesopenComposition(html)without opts still attaches history normally (standalone mode unaffected)🤖 Generated with Claude Code