Skip to content

fix: preserve single CSS translateX animation snapshots - #661

Draft
bubkoo wants to merge 2 commits into
codex/document-property-lifetimefrom
codex/snapshot-source-css-animations
Draft

bubkoo wants to merge 2 commits into
codex/document-property-lifetimefrom
codex/snapshot-source-css-animations

Conversation

@bubkoo

@bubkoo bubkoo commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

A paused CSS animation can restart when the captured subtree includes its keyframes. For example, a 1s translateX animation paused at 500ms renders its initial pose after export. This snapshots one supported CSSAnimation's primitive timing and explicit keyframes, then restores that pose after clone callbacks. Native effect.updateTiming() and effect.setKeyframes() overrides are included.

Current head b4d8e74568791e76045f9f0542d3abd0bd2444c9 adds the 12 contract cases without changing the production source tree. Its latest CI run46725877838 fails: coverage1394 passed/6 skipped; source1273 passed/2 failed/6 skipped. Both Firefox CSS-animation lifetime controls report nativeCollected=true/capturedCollected=false after the original three GC requests, including the held disposed capture. Built-package tests and coverage uploads were skipped. Older bef750d CI success does not clear this head.

The December4 local Node24.11 run preserves a separate WebKit SVG-fragment GC failure (coverage1393 passed/1 failed/6 skipped) and a Firefox runner-iframe selection timeout in an explicit source run (1274 passed/1 failed/6 skipped). Targeted Firefox6 and a separate four-case diagnostic pass do not explain or replace these failures. The PR stays draft; no lifetime fix is claimed.

Stacked on #650, targeting codex/document-property-lifetime at exact base 877c476888bbc2146a15d3c673f7a3385f3b9ddb.

The implementation records clone baselines before callbacks and installs private cascade mirrors after their changes. Source STYLE text and LINK URLs remain literal. Callback timing retains its priority and source order. Installation writes only to an unexposed, freshly constructed inert SVG copy, preserving the public clone's MutationObservers. Unknown plans use the original serialization path without a new API error or partial installation. No active frame/script, raster prediction, extra animation-frame wait or additional stabilization draw is introduced.

The supported domain is deliberately bounded: one CSSAnimation on an ordinary HTML element or its before/after pseudo, numeric interior time, one normal iteration, linear replace composition and explicit translateX(px) frames with strictly increasing offsets. Default style copying, flat known selectors and readable literal/data CSS are required. Multiple/additive/implicit or percentage-time effects, complex selectors/layers/imports, dynamic style-attribute dependencies and uncertain declaration ownership retain the existing path. Hidden customized-built-in is values are conservatively detected through native HTML serialization; Firefox's XML serialization can synthesize them after the visible attribute is removed.

Validation, with unchanged deadlines, browser settings and original GC assertions:

  • Exact 877 source plus the same 48 new source/lifetime tests: 27 failed / 19 passed / 2 skipped → candidate 46 passed / 2 skipped. A separate real-build matrix preserves the original 33 cases (12 → 33 exact native-pixel matches) and 9 timing/important controls (3 → 9 exact matches). All 42 candidate outputs enter the private path; source state and LINK identity remain unchanged.
  • Observer/form/rel-token/uppercase-selector controls: 12 passed. The initial observer test had 2 failures because it incorrectly required zero total style notifications. Exact 877 already emits background rewrite notifications. First failures remain retained; the corrected test strictly checks private payloads in current/old attribute values, the real private path, native pixels and zero Image/Canvas creation during capture. Its same-file baseline was 6 failed / 6 passed, then 12 passed.
  • Chromium and Firefox paired native/source-iframe controls pass the original three collections before lazy rendering and after disposal. Two new WebKit lifetime skips inherit the existing native removed-frame collection boundary; this is not three-engine GC acceptance. Total unit skips are 4 existing + 2 new.
  • Frozen install, full lint, build, browser types and installed-package/TypeScript consumer checks pass. Full default coverage: 1358 passed / 6 skipped. Full source: 1239 passed / 6 skipped.
  • Full built-package run remains red: 166 passed / 2 failed out of 168. Both failures are the unchanged 90000ms full mobile-smoke test, in Firefox and WebKit. Firefox had entered the external SVG stylesheet capture/resource path; WebKit progressed through external SVG data imports. The traces do not isolate a cause. No retry, timeout increase or flaky classification was applied. All six new ESM/UMD animation groups, each covering 14 modes, pass in that complete run and in the earlier targeted run.

Historical bef750d validation used macOS, Node 22.17.0 and Playwright 1.64.1 (Chromium 156, Firefox 157, WebKit 27.2); repository CI uses Node 24. The 294 measured inputs match the committed Git blobs, and all 135 compiled files remain unchanged through normal commit hooks. Exact-head CI run46264098844 succeeds with 1358 coverage /1239 source (6 skips each) /168 built-package tests. Tested merge c709595 has parents [877c476,bef750d] and the exact head tree. The separate Codecov checks fail: patch75.55% (target88.59%), project86.30% (-2.29%). The PR remains a draft; no current-head CodeQL run is scheduled for this stacked base. No device or npm-release acceptance is claimed.

Independent paired smoke diagnostics ran the original877 and candidate bef once each in Firefox/WebKit: four passed without reproducing the two original full-run timeouts. Baseline ESM was reconstructed; its UMD matches the frozen original. Added Promise observation and resource routing change scheduling. These diagnostic passes neither replace 166/2 nor establish a cause.

Immutable evidence at documentation commit 7e4b44a286a487af875f864faf4e337d1bb969a0:

First failures and scope limits remain preserved. The offline iPhone material has static checks only; no physical-device acceptance is claimed.

Additional regression coverage

Added 12 CSS animation contract cases covering native pose matching and preservation of author changes. Browser-test types and all 12 Chromium cases passed locally.

Current-head recovery records and unchanged-input local diagnostics: December4 evidence. The local four-case probe changes diagnostic topology and does not disprove the Linux failures.

@codecov

codecov Bot commented Nov 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.55066% with 111 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.30%. Comparing base (877c476) to head (bef750d).

Files with missing lines Patch % Lines
src/css-animation-snapshots.ts 74.47% 31 Missing and 79 partials ⚠️
src/clone-node.ts 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##           codex/document-property-lifetime     #661      +/-   ##
====================================================================
- Coverage                             88.59%   86.30%   -2.29%     
====================================================================
  Files                                    19       20       +1     
  Lines                                  2166     2615     +449     
  Branches                                617      764     +147     
====================================================================
+ Hits                                   1919     2257     +338     
- Misses                                  114      145      +31     
- Partials                                133      213      +80     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant