Fix #292: poll preview_elements for render-readiness instead of a fixed sleep - #295
Merged
Conversation
…ed sleep The fullIOSWorkflow test queried preview_elements after a fixed 3s sleep, which raced the agent's accessibility render. The lightweight PreviewBanner registers in the a11y tree before the wrapped ToDoView content, so under load the tree was banner-only and the "My Items"/items assertions flaked. Replace the fixed sleep with awaitElementsText, a MCPTestServer poll helper that mirrors awaitStderrContains/awaitSnapshotChange (ContinuousClock deadline, Issue.record + throw on timeout) and retries preview_elements until the content appears. It fails fast via a new MCPTestError.toolError when the tool genuinely errors, rather than polling a real failure into an opaque timeout. The snapshot step needs no sleep: #269 made preview_start gate on the first frame. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018StzgGyDWR45JsR94FUBmy
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
IOSMCPTests.fullIOSWorkflowflaked: it queriedpreview_elementsafter a fixedTask.sleep(3), which raced the agent's accessibility render. The lightweightPreviewBannerregisters in the a11y tree before the wrappedToDoViewcontent, so under load the tree was banner-only and theMy Items/item assertions failed (#292).Changes
MCPTestServer.awaitElementsText(sessionID:contains:timeout:), a poll helper that mirrors the existingawaitStderrContains/awaitSnapshotChangepattern (ContinuousClock deadline,Issue.record+ throw on timeout). It retriespreview_elementsuntil the content appears.MCPTestError.toolErrorwhen the tool genuinely errors, instead of polling a real failure into an opaque 30s timeout.fullIOSWorkflowwith the helper; drop the now-redundantelementsError/!isEmpty/duplicateMy Itemsasserts.preview_startgate on the first frame.Verification
IOSMCPTestsgreen across 4 clean isolated runs (~22-26s each).bazel test //previewsmcp/...(serialized test jobs): 9/9 targets pass; the affectedMCPIntegrationTeststarget passed fresh in 75s./simplify+/code-review(high) run; confirmed findings fixed.Closes #292.
🤖 Generated with Claude Code