fix(settle): observe a settled screen through the capture the request admitted

Merged
TH
2mo ago
+919-79

Summary

--settle on the generic route (back, scroll) and on a coordinate press/fill polled the screen through the legacy interactor (XCTest runner tree), while snapshot, diff, wait stable and a selector --settle read it through the request-bound runtime (simulator AX bridge) — two projections of one tree. So settled: true, its diff, and the refs issued from it described a tree the caller's next command never resolves against: back --settle returning to an unchanged screen reported 5 additions/6 removals, and the next diff snapshot -i reported that churn as real.

Such a request now admits the same capture-only selector-capture plan once, and the runtime resolves one boundCapture at construction, so a request observes through one producer; no runtime-use declaration is widened. Settling stays best-effort: an owner whose facts refuse the plan (a provider device, whose only snapshot path is the interactor its own commands answer with) keeps its previous observation and discloses settle_observation_capture_unavailable with its typed reason; a throwing facts probe or bind degrades the same way. An optional observation builds no command-facing refusal response, so it spends none of that response's Apple-branch host probes, and a tap without --settle pays no admission. The iOS no-effect corroboration probe polled the legacy capture too — against a keyed baseline, a tap that landed read as a recorded failure. It now answers through the request's own capture AND still forwards the baseline's backend pin: which implementation answers and which backend it presents are options of the one capture ask, not alternatives.

Disclosed, not changed: an Apple session with no tracked app selects the without-active-app plan, which the Apple family refuses by declaration (its own snapshot refuses there too). 22 files, 258 net production lines. Closes #3510.

Validation

Tested at e39e068c3 (base 8255c735c): check:affected --run, typecheck, lint, format, check:layering, check:fallow --base origin/main clean, with the device numbers below. The review round on top (8fe9c58ad) changes tests and doc comments only — no production statement — so this evidence stays attributable; typecheck, lint, format, check:layering and fallow were rerun on that head, and CI is the authority for the rest.

iPhone 18 Pro, iOS 27.0, Settings restarted at the root before each side; 4 rounds of press 'label=General' → back --settle → diff snapshot -i plus press 201 130 --settle, one script at both SHAs, capture identity from per-request phase NDJSON.

observationbase 8255c735chead e39e068c3
back --settle diff, unchanged screen+5/-6 (4/4)+0/-0 (4/4)
next diff snapshot -iphantom +6/-5 (4/4)+0/-0 (4/4)
settle captures3–4× snapshot_capture {"backend":"xctest"} 734–775 ms; 0 bridge acquires0 runner captures; 3–4× ios.snapshot-source.acquire {"producer":"simulator-ax-bridge"} 210–302 ms
press 201 130 --settle4 runner captures; next diff phantom +6/-54 bridge acquires; next diff +0/-0
back --settle wall2411–2597 ms2137–2849 ms

A no---settle tap binds only ['tapPoint'], one admit-and-bind per settle request, both corroboration cells and the settled producer are asserted here; selector --settle, wait stable, snapshot and the private-ax sparse-verdict escalation ride the unchanged captureSnapshotForSession path (snapshot-diff-runtime.test.ts), which only gains a boundCapture field. Unresolved risks: the provider-refusal branch has no hardware coverage; the scroll top|bottom / scroll --until cells named in the ADR amendment are covered by the shared binding cache's own tests, not by a settle test, since these cases do not bind the action leaf; the degrade is disclosed in request diagnostics at warn (the android_ref_snapshot_refresh_failed precedent), so it is visible under --verbose/--debug but not on an ok: true payload; and a settle loop that pins private-ax mid-observation still crosses the runner/bridge boundary inside one observation — that pin belongs to the stable-capture owner, not this route.