Repository navigation
test(thread): read fresh accessibility bounds in the newer-pagination emulator test - #3613
Merged
Merged
Conversation
… emulator test RaftThreadNewerAutoPaginationConnectedTest read message markers through UiAutomation's accessibility cache. Compose only invalidates that cache through throttled content-change events, so right after the first toward-newer swipe cached rows can still report their pre-swipe bounds: a local run read AUTO-MSG-0011..0013 at their old positions (y=1629/2021/2413) while a fresh read had them at y=341/554/946. The test then picked a stale row as the "retained" anchor. On CI that was AUTO-MSG-0008, the focused row that the swipe had already scrolled away. Once the append refreshed the cache, the row was gone for good, and the test timed out with "Timed out waiting for stable retained message AUTO-MSG-0008". The product kept its anchor; the harness was measuring the old frame. - Markers are collected in one walk of the window that calls AccessibilityNodeInfo.refresh() on every node and drops nodes that no longer exist. - The retained anchor is the topmost marker fully inside the list viewport. A clipped marker has its top pinned to the viewport edge, which hides displacement. - The Retry and Back-to-bottom nodes are refreshed before their bounds are used. - The stable-anchor waits report the latest sample, the visible markers and the accessibility tree when they time out. Signed-off-by: Lagoon <raft+lagoon@agents.stamp.build> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Verification results for head 2aaccf0, rebased onto main with #3605 and #3602. CI, full
Local, API 35 emulator on 2 pinned cores:
|
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.
The emulator test
thread-newer-auto-paginationfailed at random in the "Android first-character baseline (emulator)" job withTimed out waiting for stable retained message AUTO-MSG-0008. This happened three times today: runs 39939224593 and 39951797674, plus one earlier run. A rerun always passed. This PR fixes the test harness. The product code is not changed.Root cause
The test reads message positions through UiAutomation, which answers from its accessibility cache. Compose clears that cache only through throttled content-change events. Right after the first toward-newer swipe, cached rows can still report where they were before the swipe. On a local emulator, a fresh read put AUTO-MSG-0011..0013 at y=341/554/946, while the cache still had them at y=1629/2021/2413, overlapping the rows that had scrolled in.
The test picks its "retained anchor" from those reads. In local runs of the unchanged test, the anchor it picked jumped between AUTO-MSG-0008, 0009, 0010 and 0014 for the same scroll. It picked 0008 once locally, the same row as in the CI failures. 0008 is the focused row that the swipe had already scrolled away. The test then compared stale bounds with stale bounds. It passed while the cache stayed stale, and timed out when the page append refreshed the cache and 0008 was no longer in the window. The product kept its anchor: the restore logs show the newer-page settlement restoring the pointer-settled anchor every time.
This is not a scroll/settle race and not a timing wait that depends on emulator speed. It also does not come from #3578 or #3555. The fixture's realtime catch-up is a no-op, and the failure is in the harness's reads. The CI history I could pull (test.yml runs from 10-22 18:00 through today) shows this test passing in all but two of the roughly 27 full runs that included it. #3192 already reported it as flaky on 10-20, before either PR.
Fix
AccessibilityNodeInfo.refresh()on every node and drops nodes that no longer exist, so bounds are never served from the stale cache.The waits stay bounded monotonic polls. No timeout was raised and no retry was added. There is no deterministic hook here because the property under test is the on-screen position, and only the accessibility tree reports it to the test process.
Verification
Local runs, on an API 35 emulator limited to 2 host cores with one busy loop on those cores:
Full CI (
test.yml, scope=full) on head 2aaccf0 has been dispatched three times: on this branch and on two extra refs with the same commit, because the workflow cancels earlier runs on the same ref. Results will follow in a comment.No changeset, because this change only touches a test.
🤖 Generated with Claude Code