Fix empty accessibility hierarchy on iOS 26+ simulators#312
Open
dpearson2699 wants to merge 1 commit intogetsentry:mainfrom
Open
Fix empty accessibility hierarchy on iOS 26+ simulators#312dpearson2699 wants to merge 1 commit intogetsentry:mainfrom
dpearson2699 wants to merge 1 commit intogetsentry:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e963be0. Configure here.
) On iOS 26+ fresh simulators, AccessibilityEnabled and ApplicationAccessibilityEnabled default to 0, which prevents accessibility hierarchy queries from returning any elements. Enable both flags via xcrun simctl spawn defaults write after boot_sim and build_run_sim boot the simulator. The check is idempotent (reads first, writes only if needed) and failures are logged but never propagated to avoid blocking boot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
On iOS 26+ fresh simulators,
AccessibilityEnabledandApplicationAccessibilityEnableddefault to0, which causessnapshot_uito return an empty accessibility hierarchy with no children.This PR proactively enables both accessibility flags at simulator boot time via
xcrun simctl spawn <udid> defaults write, sosnapshot_uiworks correctly on first use.Changes
src/utils/simulator-accessibility.ts— NewensureSimulatorAccessibility()utility that reads the currentAccessibilityEnabledvalue and writes both flags if disabled. Failures are logged but never propagated (accessibility setup should not block boot).src/mcp/tools/simulator/boot_sim.ts— CallsensureSimulatorAccessibility()after successful boot.src/mcp/tools/simulator/build_run_sim.ts— CallsensureSimulatorAccessibility()after the boot-if-needed section, covering the implicit boot path.src/utils/__tests__/simulator-accessibility.test.ts— 6 unit tests covering enable, skip-if-already-enabled, error handling, and command verification.src/mcp/tools/simulator/__tests__/boot_sim.test.ts— Updated command verification test to account for accessibility calls after boot.Design decisions
snapshot_uitime — avoids the overhead of detecting an empty hierarchy, retrying, and adding response notes.warnlevel, never thrown.Fixes #290