Repository navigation
Conversation
The /elements walker returned only top-level `_UIHostingView` /
`HostingView` shells on SwiftUI screens — three entries for a full
Dashboard, all with empty identifier/label and a 0,0,390,844 frame.
SwiftUI vends its AX leaves through the indexed accessor
(`accessibilityElementCount` + `accessibilityElement(at:)`) on the
hosting container, not through `accessibilityElements` (which returns
nil OR an empty array). The previous walker only fell through to the
indexed path on nil, not on empty — so SwiftUI leaves were silently
dropped.
Fix is three coordinated changes to ElementsBridgeImpl plus an opt-in
escape hatch:
1. Force materialization via `UIAccessibility.post(.layoutChanged, …)`
before the walk. Public API, no-op when VoiceOver already populated
the tree, doesn't speak.
2. Always run the indexed accessor when `accessibilityElements` is nil
OR empty. This is the actual SwiftUI path.
3. Read identifier/label/value/traits/frame from synthetic AX elements
via KVC over the documented `UIAccessibility` informal protocol
property names — safe and version-independent across the private
element classes (`_AXSnapshotElement`, `_UIAccessibilityElementMockView`, …).
4. New `.gstackProbe("identifier")` SwiftUI ViewModifier + thread-safe
`GstackProbeRegistry` for views the AX tree refuses to surface
(intentionally hidden, custom Canvas, decorative Shape stacks). Probe
sets `.accessibilityIdentifier(_:)` AND registers (id, frame) in the
registry; the walker merges these in as synthetic entries tagged
`"source":"gstack-probe"`.
Also filters empty container synthetic nodes (no label/id/value/traits)
that were clogging the output before.
Docs in `ios-qa/docs/swiftui-accessibility.md` cover the root cause,
what the fix does/doesn't address, and when to reach for `.gstackProbe`
vs vision-based coordinate tapping.
Typechecks clean against iOS 16 + iOS 17 SDKs, Swift 6 strict
concurrency. Live-device validation pending — PR author will port to
downstream app + report new element count.
Downstream validation — iPhone 12 Pro on iOS 26.3.1Ported this PR's Result: still 3 elements, identical to the pre-PR behavior. Tried with a screenshot-warmup pass before the elements query (in case The walker emits these three only because they hit the Diagnosis: on iOS 26.x SDK, Recommendation:
Tested against: iPhone 12 Pro, iOS 26.3.1, Xcode 26.0.1, Swift 6.2, app target uses iOS 26 deployment min, daemon at |
|
Thanks for this. The supplied iOS 26 validation contradicts claims still present in the documentation, while the new probe and template changes lack matching fixture and release-build coverage. Split documentation from behavior changes, remove disproved claims, mirror fixtures, and provide live-version plus release-absence validation. |
|
Thank you for the iOS 26 device data. The synthetic accessibility walker is already on main, and as you found it doesn't help |
…hes the app, loud boot-token write (#3076) * fix(ios-qa): allow physical iPad devices in tunnel bootstrap (#2743) (cherry picked from commit d6d4393) * fix(ios-qa): iPhone + iPad on USB names each UDID instead of picking one With GSTACK_IOS_TARGET_UDID unset, tied default ranks used to pick the first device devicectl listed, so a QA session could drive the wrong device. Tied candidates now fail with multiple_devices, list each device and UDID, and print a ready export line. Device selection moves into selectDevice() so the route-drop recovery can re-resolve with the same rules. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(ios-qa): a dropped CoreDevice route no longer relaunches the app (#1975) Rotation deletes the app's one-shot boot-token file, so the daemon's old 503/504 path (invalidate + full bootstrap) could only get a new token by running devicectl launch --terminate-existing, wiping the in-app QA state at every route blip. A route failure now goes through recoverTunnel(): re-select the device with the bootstrap rules, re-resolve the tunnel address for the pinned UDID, check the unauthenticated /healthz owner, then probe /state/snapshot with the cached bearer. Outcomes: - bearer accepted: keep the session (new address if it moved) - 401: full bootstrap from the fresh boot token (app was relaunched) - app confirmed absent: bootstrap, which launches it normally once - different device or an address devicectl cannot tie to the UDID: bootstrap; the old bearer is never sent there - route still down with the app running: surface the error, keep the session Concurrent failures on one tunnel share a single refresh. Mutations whose response was lost are still never replayed. The CLI wiring moves into deviceTunnelSource() so tests drive it against a simulated device. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(ios-qa): a failed boot-token write is loud instead of silent (#1837) StateServer.start() wrote the boot-token file with try?, so a failed write left nothing on disk and no trace anywhere, and the daemon then relaunched the app trying to mint a token that could never be written. The write is now a do/catch that logs the path and error (never the token), logs a NOT READY bootstrap line, and reports boot_token_error on /healthz. bootstrapTunnel reads that field and returns boot_token_unavailable naming the device-side cause instead of running --terminate-existing. Also drops the stale comments claiming the token was written to os_log. Template and fixture stay byte-identical. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(ios-qa): type the iPad acceptance test's mDNS stub ResolveImpl returns Promise<string[]>; resolving null tripped the test-code typecheck ratchet. A rejected lookup exercises the same resolve_failed path. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(ios-qa): iPad support, GSTACK_IOS_TARGET_UDID, route-drop recovery, known limits - iPhone-only description, triggers, and prerequisites now cover iPads, and say how to pick one device with GSTACK_IOS_TARGET_UDID. - Phase 2 no longer tells you to capture a boot token from os_log (it has not been logged for many releases); it describes the 0600 tmp/ file and the NOT READY signal (#1837, #1735). - Source-control guidance for the generated DebugBridge/ package (#1735). - Failure table: route drops keep the session, multiple_devices, unwritable token file, and the one relaunch a daemon restart still costs. - Known limits: SwiftUI DragGesture and /swipe on iOS 26 (#1975), the iOS 26.3.1 /elements data from PR #1755, unverified iPad Stage Manager. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: iOS QA how-to and skill index cover iPads and route-drop recovery The how-to still said the boot token was readable from os_log and that a route drop re-bootstraps; both are now accurate, with iPad selection, GSTACK_IOS_TARGET_UDID, and three new failure rows. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * v1.91.37.0 fix(ios-qa): iPads work, a route drop no longer relaunches the app, loud boot-token write Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(ios-qa): keep issue numbers out of model-read skill text The archaeology lint rejects issue references in generated SKILL.md text; the Known limits entry keeps the iOS version and drops the number. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * chore: re-slot to v1.91.38.0 (v1.91.37.0 claimed by #3075) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(ios-qa): device-change recovery test without an IPv4-mapped address The Windows lane could not reach a fake StateServer through ::ffff:127.0.0.1, so the iPad half of the device-change test timed out. The fake device now swaps identity on its one ::1 listener, which is also closer to production: every StateServer answers on the same port. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: loulanyue <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…hes the app, loud boot-token write (garrytan#3076) * fix(ios-qa): allow physical iPad devices in tunnel bootstrap (garrytan#2743) (cherry picked from commit d6d4393) * fix(ios-qa): iPhone + iPad on USB names each UDID instead of picking one With GSTACK_IOS_TARGET_UDID unset, tied default ranks used to pick the first device devicectl listed, so a QA session could drive the wrong device. Tied candidates now fail with multiple_devices, list each device and UDID, and print a ready export line. Device selection moves into selectDevice() so the route-drop recovery can re-resolve with the same rules. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(ios-qa): a dropped CoreDevice route no longer relaunches the app (garrytan#1975) Rotation deletes the app's one-shot boot-token file, so the daemon's old 503/504 path (invalidate + full bootstrap) could only get a new token by running devicectl launch --terminate-existing, wiping the in-app QA state at every route blip. A route failure now goes through recoverTunnel(): re-select the device with the bootstrap rules, re-resolve the tunnel address for the pinned UDID, check the unauthenticated /healthz owner, then probe /state/snapshot with the cached bearer. Outcomes: - bearer accepted: keep the session (new address if it moved) - 401: full bootstrap from the fresh boot token (app was relaunched) - app confirmed absent: bootstrap, which launches it normally once - different device or an address devicectl cannot tie to the UDID: bootstrap; the old bearer is never sent there - route still down with the app running: surface the error, keep the session Concurrent failures on one tunnel share a single refresh. Mutations whose response was lost are still never replayed. The CLI wiring moves into deviceTunnelSource() so tests drive it against a simulated device. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(ios-qa): a failed boot-token write is loud instead of silent (garrytan#1837) StateServer.start() wrote the boot-token file with try?, so a failed write left nothing on disk and no trace anywhere, and the daemon then relaunched the app trying to mint a token that could never be written. The write is now a do/catch that logs the path and error (never the token), logs a NOT READY bootstrap line, and reports boot_token_error on /healthz. bootstrapTunnel reads that field and returns boot_token_unavailable naming the device-side cause instead of running --terminate-existing. Also drops the stale comments claiming the token was written to os_log. Template and fixture stay byte-identical. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(ios-qa): type the iPad acceptance test's mDNS stub ResolveImpl returns Promise<string[]>; resolving null tripped the test-code typecheck ratchet. A rejected lookup exercises the same resolve_failed path. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(ios-qa): iPad support, GSTACK_IOS_TARGET_UDID, route-drop recovery, known limits - iPhone-only description, triggers, and prerequisites now cover iPads, and say how to pick one device with GSTACK_IOS_TARGET_UDID. - Phase 2 no longer tells you to capture a boot token from os_log (it has not been logged for many releases); it describes the 0600 tmp/ file and the NOT READY signal (garrytan#1837, garrytan#1735). - Source-control guidance for the generated DebugBridge/ package (garrytan#1735). - Failure table: route drops keep the session, multiple_devices, unwritable token file, and the one relaunch a daemon restart still costs. - Known limits: SwiftUI DragGesture and /swipe on iOS 26 (garrytan#1975), the iOS 26.3.1 /elements data from PR garrytan#1755, unverified iPad Stage Manager. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: iOS QA how-to and skill index cover iPads and route-drop recovery The how-to still said the boot token was readable from os_log and that a route drop re-bootstraps; both are now accurate, with iPad selection, GSTACK_IOS_TARGET_UDID, and three new failure rows. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * v1.91.37.0 fix(ios-qa): iPads work, a route drop no longer relaunches the app, loud boot-token write Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(ios-qa): keep issue numbers out of model-read skill text The archaeology lint rejects issue references in generated SKILL.md text; the Known limits entry keeps the iOS version and drops the number. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * chore: re-slot to v1.91.38.0 (v1.91.37.0 claimed by garrytan#3075) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(ios-qa): device-change recovery test without an IPv4-mapped address The Windows lane could not reach a fake StateServer through ::ffff:127.0.0.1, so the iPad half of the device-change test timed out. The fake device now swaps identity on its one ::1 listener, which is also closer to production: every StateServer answers on the same port. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: loulanyue <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
What this PR is now
Three low-risk, additive changes plus an honest docs page:
Walker cleanup in
ios-qa/templates/Bridges.swift.template— refactor that should be net-positive on every iOS version, no behavior regression observed:emitAXChild()helper (removes duplicated synthetic-element extraction).accessibilityElementsreturns nil OR empty array (the existing template only fell through on nil — SwiftUI hosting views can return empty array with a non-zeroaccessibilityElementCount(), which was getting silently dropped)."source": "ax-synthetic"for downstream agent disambiguation.UIAccessibility.post(notification: .layoutChanged, argument: nil)before walking. Documented public API. Note: likely a working trick on iOS 17-18 per related Swift-Forums + swift-agentation prior art, but does NOT trigger SwiftUI AX tree materialization on iOS 26.3.1 per device validation below..gstackProbe(_:)SwiftUI ViewModifier (new public API in template) — opt-in escape hatch. Apps that need agent visibility on views the AX tree refuses to surface call.gstackProbe("dashboard.captureButton")and the walker merges (id, frame, label) into the/elementssnapshot fromGstackProbeRegistry. UsesGeometryReader { .global }+PreferenceKeyto keep frames current without polling. Pure public API — no private selectors. Not validated on device in this PR — requires explicit per-view instrumentation that wasn't part of the validation app.New docs page
ios-qa/docs/swiftui-accessibility.md— explains the underlying constraint (SwiftUI doesn't always create backing UIViews; AX tree is lazy + VoiceOver-gated), what this PR fixes, what it does NOT fix on iOS 26, and when to reach for.gstackProbe(_:)vs vision-based coordinate tapping.What this PR is NOT
A general fix for the SwiftUI accessibility-walker problem on iOS 26. That problem appears to require either private XCTest APIs (
XCAXClient_iOS, not available in an in-process DEBUG bridge), an actual VoiceOver-running session, or vision-based positioning. The docs page now says this plainly.Validation
Apps/iOS/DebugBridge/Bridges.swift), hitGET /elementsagainst a Dashboard view with declared.accessibilityIdentifier(...)modifiers. Returns 3 elements (same as pre-PR). The walker cleanup is a no-op regression-wise; the SwiftUI tree-walking claim doesn't hold on this iOS version. Full data in comment thread.Package.swift.templatedeployment floor) and Swift 6 strict concurrency..gstackProbe(_:)modifier: untested on device — requires app developer to instrument views with it before there's anything to validate.Sources consulted
GstackProbe.Suggested merge disposition
Three reasonable paths, in increasing order of conservatism:
.gstackProbe(_:)modifier + docs are all useful additions; the docs page is explicit about iOS 26 limitations..gstackProbe(_:)until someone validates it on device.swiftui-accessibility.md+ filters the noise-element cleanup, no API surface changes.Author's recommendation: B — gets the cleanup + the honest docs in front of users, defers the new API until it has device evidence.
Tested against: iPhone 12 Pro, iOS 26.3.1, Xcode 26.0.1, Swift 6.2.