Skip to content

fix(core): prevent Figma motion property key collisions - #6800

Merged
jrusso1020 merged 1 commit into
heygen-com:mainfrom
Muzzy5150:fix/figma-motion-key-boundary
Oct 30, 2026
Merged

jrusso1020 merged 1 commit into
heygen-com:mainfrom
Muzzy5150:fix/figma-motion-key-boundary

Conversation

@Muzzy5150

Copy link
Copy Markdown
Contributor

What

Prevent Figma motion property lookups from matching a key inside a longer property name. This keeps simultaneous opacity and y tracks independent regardless of their order in the motion.dev snippet.

Why

On the upstream baseline (f43bec76e7ceef13e65b930496f7e1f66779250b), I ran the issue fixture through the built @hyperframes/core output. The emitted y track incorrectly copied opacity:

  • actual values: [0, 0, 1, 1]
  • actual times: [0, 0.0444, 0.1333, 1]
  • expected values: [120, 120, 0, 0]
  • expected times: [0, 0.0444, 0.2222, 1]

The parser's array and scalar regexes had no left key boundary, and the transition-block lookup used an unanchored substring search. Therefore y: ... could match the suffix of opacity: ....

Related work

Fixes #6756.

I searched open and recently merged PRs by issue number, motionContextToDocs, and Figma key-collision terms before starting and again before pushing; no competing fix was present.

How

  • Add one shared key pattern that rejects matches preceded by an identifier character or $.
  • Use it for array lookup, scalar lookup, and property transition-block lookup.
  • Keep the existing balanced-brace parser and pass it the already validated marker offset, avoiding changes to motion semantics.
  • Add ordering, independent transition metadata, and longer-key regression cases while retaining the existing single-property and real Figma conversion fixture coverage.

No easing, duration, keyframe timing, repeat, loop-wrap, or property mapping behavior was changed.

Test plan

RED on untouched parser source:

  • bun run --cwd packages/core test src/figma/motionContextToDocs.test.ts
  • 3 failed / 8 passed: opacity-before-y values, suffix-property transition metadata, and longer nested array/scalar keys

GREEN:

  • same targeted command: 11 passed

  • focused coverage: 89.09% statements, 80.24% branches, 100% functions, 96.55% lines for motionContextToDocs.ts

  • full core suite: 258 files / 5,603 tests passed

  • core typecheck passed

  • post-change core build passed

  • repository-wide lint passed (0 warnings/errors across 4,795 files)

  • repository-wide format check passed (6,842 files)

  • pre-commit fallow audit passed with no issues in the two changed files

  • exact issue fixture rerun through built dist: corrected y values/times matched the expected output

  • Unit tests added/updated

  • Manual testing performed

  • Documentation updated (not applicable; parser behavior now matches the existing contract)

  • Comments follow CONTRIBUTING.md "Comments"

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at c6182e4bdb5a589c94be319d2d2eafa816c4eff5.

I checked all three key extractors. The shared keyPattern prevents y from matching opacity and keeps property timing separate without replacing the parser.

vitest run motionContextToDocs.test.ts --configLoader runner: 11 passed. Borrowed existing Vitest dependencies. No live Figma import. Prefer this implementation over overlapping #6810.

Need: yes · Size: ok · Reuse: existing implementation seam · Simpler: already minimal · Structure: fine
Risk: low - property-key parsing.

Verdict: APPROVE
Reasoning: I checked all three key extractors. The shared keyPattern prevents y from matching opacity and keeps property timing separate without replacing the parser.

Reasoning: I checked all three key extractors. The shared keyPattern prevents y from matching opacity and keeps property timing separate without replacing the parser.

@jrusso1020
jrusso1020 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into heygen-com:main with commit 64d190e Oct 30, 2026
94 checks passed
SanHsien added a commit to SanHsien/hyperframes that referenced this pull request Nov 2, 2026
…com#6605 heygen-com#6611 heygen-com#6831 heygen-com#6800

Windows debug.log lock, PowerShell UTF-16 batch JSON, long backup names,
--variables-file readFile override, Figma motion key collisions. Rest deferred
with per-commit evidence; 72 PRs pinned in monitored.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: SanHsien <[email protected]>
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.

motionContextToDocs: y track copies opacity when a node animates both (key lookup has no word boundary)

2 participants