fix(describe-ui): Retry when the simulator UI is not ready yet - #68
fix(describe-ui): Retry when the simulator UI is not ready yet#68BariBariGood wants to merge 2 commits into
Conversation
Querying the accessibility hierarchy within a few seconds of booting a
simulator or launching an app can fail with:
No translation object returned for simulator. This means you have
likely specified a point onscreen that is invalid or invisible due
to a fullscreen dialog
even when no point was specified and the UI simply has not finished
coming up. Retrying the same command a few seconds later succeeds.
Detect this transient translation-unavailable error (including when it
is nested in an underlying error), retry with a short exponential
backoff, and if the UI still is not ready after the retries, surface an
accurate error explaining that the simulator UI is not ready for
accessibility queries yet.
WalkthroughAXe now retries accessibility queries when simulator translation data is unavailable. The retry logic checks chained error descriptions, applies increasing delays, and retries up to five times. After exhaustion, AXe throws a sanitised “UI is not ready yet” 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 12: Update the `describe-ui` changelog entry to append the originating
issue link `[`#458`](https://github.com/getsentry/XcodeBuildMCP/issues/458)` after
the existing description.
In `@Sources/AXe/Utilities/AccessibilityFetcher.swift`:
- Around line 51-56: Update retryingWhileTranslationUnavailable and the
point-query path in fetchAccessibilityInfoJSONData so a terminal translation
failure preserves or identifies the invalid/invisible point cause instead of
being replaced solely by the UI-readiness error. Keep frontmost queries’
existing behavior, and add coverage in AccessibilityFetcherTests for the
point-query terminal error path, including the relevant fixture condition.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ba5c5c2e-8bea-47ac-853e-729cf3cdf927
📒 Files selected for processing (3)
CHANGELOG.mdSources/AXe/Utilities/AccessibilityFetcher.swiftTests/AccessibilityFetcherTests.swift
… exhausted Point queries can exhaust translation retries on a permanent failure: the simulator reports an invalid or dialog-hidden point with the same translation error it uses for a UI that is not ready yet. The terminal error now keeps both causes for point queries while frontmost queries keep their existing message. Adds a test for the point-query terminal path and links the originating getsentry/XcodeBuildMCP issue in the changelog.
Summary
Validation
swift testpasses (adds unit tests for the transient-error detection, including the nested-underlying-error case, and the retry/backoff logic).describe-uiimmediately aftersimctl boot, v1.8.0 fails instantly with the misleading message; with this change the same call either succeeds after the internal retries (~7s) or, if the UI takes longer, fails with the accurate "simulator UI is not ready" error.