Skip to content

fix(cli): check's overlap audit skips scenes the runtime hid - #5758

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/check-bounded-by-screen
Oct 17, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
fix/check-bounded-by-screen

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

check's content-overlap audit no longer walks inside scenes the runtime has hidden. On a long composition, almost every element sits in a scene that is off screen at any given sample, and the audit was reading styles and geometry for all of them on every sample.

Why

The dense overlap pass seeks to up to 600 times and runs this audit at each one. The audit walked root.querySelectorAll("*"), so its cost per sample grew with the length of the film, not with what was on screen. On a 9-minute composition with about 430 scenes, 7,348 of 7,806 elements were inside runtime-hidden clips at a typical sample, and check ran past its deadline. In a CPU profile of 100 samples, the per-element visibility test in this audit was the largest single cost.

The runtime hides an inactive clip with data-hf-clip-hidden plus inline visibility: hidden. Its rule [data-hf-clip-hidden][style*="visibility: hidden"] * { visibility: hidden !important; } (core timedClipHide.ts) keeps every descendant hidden. So nothing inside such a clip can be on screen, and skipping the subtree changes no finding.

Related work

Part of making check's browser work independent of film length. Bounding the number of dense overlap samples follows in a separate PR.

How

  • elementsOnScreenScenes(root) walks with a TreeWalker that rejects runtime-hidden clips, so their subtrees are never visited. It matches the same selector as the runtime rule.
  • collectSolidTextBlocks uses it. That is the walk behind __hyperframesOverlapAudit (every dense sample) and the overlap part of the full layout audit.
  • An author-hidden ancestor without the runtime marker is still walked, so visibility_escapes_segment behaves as before (its existing test is unchanged and passes).

Test plan

  • Unit test never reads inside a scene the runtime hid: the overlap audit returns nothing and never reads styles of an element inside a runtime-hidden clip. With the walk put back to the whole page, it fails (expected [ { …(9) } ] to deeply equal []).
  • layout-audit.browser.test.ts passes 3 runs in a row. oxlint and oxfmt are clean.
  • Same findings: check on the 9-minute composition, before and after, gives identical layout findings (80 of 80, same code, selector and time). The audit's share of the overlap pass dropped 2-3x. Wall times were taken on a loaded machine and are not quoted.
  • 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.

Approving at b73c7842. Skipping runtime-hidden clips changes no finding, because nothing inside such a clip can paint.

  • Selector check. RUNTIME_HIDDEN_CLIP is the same selector as core's HIDE_HIDDEN_CLIP_CONTENTS in timedClipHide.ts: [data-hf-clip-hidden][style*="visibility: hidden"] * { visibility: hidden !important; }. That rule hides every descendant of such a clip.
  • Temporary unhide. The helper in the same file sets hidden clips to visibility: visible for a moment. The attribute then no longer matches, so the walk still visits them during that window. That's consistent with what is actually on screen.
  • Author-hidden ancestors. One without the runtime marker is still walked, so visibility_escapes_segment keeps its behaviour.
  • Traversal. FILTER_REJECT skips the whole subtree. The walker never filters the root itself, which is right for a root that's an audit scope.
  • Test. It asserts both an empty result and that getComputedStyle never sees #a, so it would catch the walk regressing to the whole page.

Non-blocking: a descendant with an inline visibility: visible !important inside a runtime-hidden clip beats the stylesheet !important, so it would paint and now go unaudited. That's an author-level edge case. The skip should still be right for every composition the runtime produces.

No live run.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit 066ca7e Oct 17, 2026
64 checks passed
@miguel-heygen
miguel-heygen deleted the fix/check-bounded-by-screen branch October 17, 2026 09:35
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