feat(lint): flag CSS transition as seek-unsafe - #3539
rajanpanth wants to merge 2 commits into
Conversation
analyzeKeyframeIntervalsUncached returned isProblematic: false whenever a video had fewer than two keyframes. A video with exactly one keyframe is the worst case for the failure the check exists to catch: every seek past 0 lands inside a single GOP spanning the whole file, twice as bad as the 5s-interval case the compiler already warns about. The single-keyframe interval is now the video stream's own duration, not the container's, since the two can disagree, and is flagged past the same 2s threshold as the multi-keyframe path. Zero keyframes (still images, failed probes) keeps the prior not-problematic result.
The CSS adapter only discovers animation-name, so finite @Keyframes are seekable but transition is not. A GSAP class/attr swap that relies on transition looks correct in preview and --workers 1, but parallel chunk workers (and snapshot --at past the settle time) restore the class on a fresh page, so the browser restarts the transition and the export flashes. Flags transition and every transition-* longhand, with or without -webkit-, in <style> blocks and inline style="" attributes, using postcss so custom properties (--transition-speed), comments, and selector text named transition-something are never mistaken for the property. Allows transition: none / transition-property: none. Reuses the css_transition_used code name already referenced in skills/hyperframes-core/references/frame-worker-core.md. Fixes heygen-com#3493
5e89ad9 to
ff8a62d
Compare
|
Closing — stale PR. Please reopen with a rebased version if still relevant. |
|
Rebased onto current Still relevant: there is no rule flagging CSS This branch is still stacked on #3538 (the ffprobe commit is the parent), so it carries that change too. Happy to unstack it if you would rather take them independently. Verification after the rebase:
Worth flagging in case it bites someone else: the suite initially failed 69 of 85 for me with As on #3538, GitHub returns a 422 when I try to reopen, so I cannot reopen it myself. |
Fixes #3493
Problem
CSS
transitionruns on the browser clock. A GSAP class/attr swap that relies on it looks correct in preview and--workers 1, since the browser is running continuously and the transition plays out normally. Parallel chunk workers, andsnapshot --atpast the settle time, restore the class on a fresh page instead, so the transition restarts from its initial state and the export flashes or shows the wrong frame.The CSS runtime adapter only discovers
animation-name, since finite@keyframesare seekable andtransitionis not, buthyperframes checkdid not flagtransitionitself, so nothing catches the mistake before render.Fix
A new lint finding,
css_transition_used, in the same family asnon_deterministic_codeandgsap_infinite_repeat:transitionand everytransition-*longhand (-property,-duration,-delay,-timing-function,-behavior), with or without-webkit-<style>blocks and inlinestyle=""attributestransition: none/transition-property: none--transition-speed), since the property-name regex is anchored at both ends and a custom property's name starts with--, nottransitionor-webkit-Uses
postcssto parse declarations, matching howrepeated_id_descendant_selectorelsewhere incore.tsalready parses<style>blocks, rather than a hand-rolled regex over raw CSS text. That gets comment-stripping and string handling for free, and keeps a selector like.transition-cardfrom ever being mistaken for the property (postcss separates selector from declaration, so the property-name regex only ever seesdecl.prop).Reuses the
css_transition_usedcode name already referenced inskills/hyperframes-core/references/frame-worker-core.md, per the issue.Testing
Eight cases in
core.test.ts:transitionin a<style>block, selector reportedtransition-*longhands flagged as two separate findings-webkit-transitionstyle="", with the element id reportedtransition: noneandtransition-property: noneboth allowed--transition-speedcustom property not flagged.transition-cardselector name, plus a commented-outtransition:declaration, neither flaggedReverting the source while keeping the tests fails exactly the four positive cases and leaves the four negative (allow) cases passing, so the tests cover the change rather than restating current behaviour.
bunx vitest run packages/lint/srcpasses at 507 (up from 499 with the 8 added), with the same 35 pre-existing failures inproject.test.tsandsnippetFragment.test.tson a clean checkout ofmain, so they look unrelated to this change.oxlintandoxfmt --checkare clean on both files.