Skip to content

macOS engine: #395's marker route may miss the web area in a Safari window with many tabs (scope search bound) #416

Open

Description

@SSFSKIM

Problem

#395's marker route needs Safari's AXWebArea before it can ask for the selection. It finds it with a breadth-first search from the primary window, under #354's walk bounds: 200 nodes, depth 12, 40 ms (TypeReadbackMarker.swift). On the hosted fixture the web area took about 28 nodes at depth 6. A window whose browser chrome before the web area is bigger than the bounds would never reach it: many tabs in the tab strip, a sidebar, a favorites bar. type_text then falls back to the walk, which on a large page answers noFocusedElement. That outcome is unconfirmed, never a wrong success, but it brings back #395's gap on exactly the real profiles cua is for.

This was not measured. The hosted fixture opens one tab and has no reliable way to create and count same-window tabs, and Safari's AppleScript didn't answer on hosted runners. See the evidence in docs/evidence/2026-11-18-safari-marker-route/README.md, "Not measured".

What to do

  1. Measure first. Run a hosted Safari window with 40 or more tabs, plus the large page in the front tab. Record whether the route finds the field, how many nodes the scope search visits, and its time. Build tab creation from the fixture's own pages (window.open from a user-gesture-free path, or open -a Safari <url> repeated), with an independent count.
  2. If the bound is hit: find the web area by a direct path instead of a search. Candidates are the window's selected tab group (AXTabGroup → its selected tab's content), or a search that skips the tab strip's subtree. Keep the same ownership and classification checks as macOS engine: background Safari on a large page can't find the focused field for type_text's read-back (text-marker route) #395.

A related test debt to fold in: ReadbackReads.live's walk and the web-area search read the wall clock (monotonicMilliseconds). The small-page stub tests assume about 13 stub nodes are read within 40 ms of real time. Injecting the clock through ReadbackAX would make them deterministic.

Check

Background Safari with 40 or more tabs, large page in the front tab: plain and secret type_text confirm 20/20, with 0 wrong successes. On the single-tab fixture, scope time doesn't regress.

Spawned by #395.

Activity

  1. added
    enhancement
    status:ready-for-implementer
    priority:P3
    on Nov 18, 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:P3status:ready-for-implementer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions