Skip to content

Engine: when the node budget cuts, keep what the screenshot shows (visible-first walk) #301

Closed

Description

@SSFSKIM

Problem

When a window's tree exceeds the engine's node budget (maxObservedNodes = 4,000, cua's own; Walk.swift), the walk spends the budget depth-first from the top of the document. On long pages scrolled 25% or more, the viewport lies past the cut:

Spike #299 measured this: #299 (comment).

Build (design session ruling aed3f041)

  1. When the budget fires, spend it visible first.
    • On WebKit and native apps, prioritize by frame.
    • On Chromium, frames are clamped to 1-pt strips offscreen, so seed the kept set with the hit-test ancestor chains of a grid of points (80 pt) over the window. Seeding runs only when the budget fires, on Chromium only, under a hard cap of about 500 ms counted inside the observation's existing deadline. Past the cap, keep what is seeded and fill the rest in document order.
  2. The printed tree stays in document order.
  3. When the budget cuts, the tree says so, with counts of what was dropped above and below the viewport, so the model knows to scroll or re-observe.
  4. The width rule's omitted branch (more than 499 children with no visible subset): the guard's record keeps the children whose frames meet the window. The tree keeps the vendor's width rule.

Conditions

  • Element ids stay stable for a node present in consecutive observations.
  • The repl-parity and docs-oracle suites pass. Any change to an observation's wording goes in the first-call docs.
  • The hosted A/B, before and after on Spike: how often real pages truncate the observation, leaving clicks the stale-point guard can't check #299's pages: the guard's checked share at 0 / 25 / 50 / 90%, plus the walk time and the seeding cost (p50 and p95, reported in the PR).
  • The limit to state: Chromium coverage depends on the seed grid, so a control smaller than the grid that falls between seeds can be missed.

Activity

  1. added
    enhancement
    status:ready-for-implementer
    priority:P2
    status:in-progress
    and removed
    status:ready-for-implementer
    on Nov 6, 2026
  2. SSFSKIM commented on Nov 6, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-progress: Taken by cursor235 per ruling aed3f041

  3. 5 remaining items

  4. added
    status:in-review
    and removed
    status:in-progress
    on Nov 6, 2026
  5. added 2 commits that reference this issue on Nov 6, 2026
  6. removed
    status:in-review
    on Nov 6, 2026
  7. SSFSKIM commented on Nov 6, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: Landed via PR #306 (0.27.0)

  8. added 3 commits that reference this issue on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions