Skip to content

test(android): pin that a child vanishing mid-read reads as gone - #3905

Merged
thymikee merged 1 commit into
mainfrom
fix/android-helper-gone-child-seam
Oct 22, 2026
Merged

thymikee merged 1 commit into
mainfrom
fix/android-helper-gone-child-seam

Conversation

@thymikee

@thymikee thymikee commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #3901, applying the review's non-blocking notes. 2 files changed.

  • AccessibilityNodeReads.child now reads through nullIfGone, a small generic seam that treats a throwing read as a gone node. The JVM suite can reach it, and a new AccessibilityReadBatchTest case fails if the catch is removed. A non-vanishing failure (IllegalStateException) still propagates.
  • A doc comment says a null node is a programmer error that the catch would also hide.
  • child.getChildCount and the bounds reads in appendNode need no guard. In the framework sources (API 35), getChildCount() returns mChildNodeIds.size() and getBoundsInScreen(Rect) copies mBoundsInScreen. Both are field reads on a sealed node with no interaction-client call. Only getChild goes through AccessibilityInteractionClient, and fix(android): read a child that vanished mid-read as gone #3901 already covers it.

Validation

  • Head a09cc7d: pnpm check:affected --run --head a09cc7df06 passed (exactCommit). The snapshot helper build runs SnapshotHelperTestSuite, which includes the new case.
  • With the catch changed to a different exception type, the same build fails with NullPointerException: window closed from the new case.
  • GitHub owns the Android lanes. No device run: the change is a refactor of the already-verified catch.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Route AccessibilityNodeReads.child through a generic nullIfGone seam so
the JVM suite can reach the catch, and document that a null node is a
programmer error the catch would also hide.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.54 MB 5.53 MB -6.9 kB
Package (unpacked) 5.54 MB 5.53 MB -6.9 kB
Package (download) 1.68 MB 1.68 MB -1.5 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 31.4 ms 32.9 ms +1.5 ms
CLI --help 64.8 ms 65.9 ms +1.1 ms

@thymikee

Copy link
Copy Markdown
Member Author

The code at a09cc7d is ready, and the new test correctly pins that a child vanishing mid-read reads as gone. I read the FutureTask and await path to confirm the test would fail without the fix, but I did not run the JVM suite or mutate the catch. I could not check the API 35 framework sources, so the note that getChildCount and getBoundsInScreen are plain field reads is not verified here. There are no conflicts. Smoke Tests is still running, and it covers this change through the Android snapshot helper build and SnapshotHelperTestSuite, which now includes the new case. The other 15 checks are green, so this PR can merge once Smoke Tests finishes green.

Not blocking, and you can take or leave these: readsAChildThatVanishedMidReadAsGone calls nullIfGone directly, so the JVM suite would stay green if child went back to a bare node.getChild(...); a package-private child overload that takes the framework read as a lambda would pin that wiring, or the emulator lanes can cover it. A null node also throws inside the lambda and reads as a gone child, which Objects.requireNonNull(node) in child would avoid and let you delete the doc paragraph at line 42. The nullIfGone javadoc could also name the result-integrity NPE it handles instead of the general "vanished node" wording.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 22, 2026
@thymikee
thymikee merged commit 72c051d into main Oct 22, 2026
16 checks passed
@thymikee
thymikee deleted the fix/android-helper-gone-child-seam branch October 22, 2026 11:11
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-22 11:14 UTC

thymikee added a commit that referenced this pull request Oct 22, 2026
* origin/main:
  perf(ios): confirm fill focus from the tapped input before the keyboard (#3906)
  feat(perf): time every iOS command against the fixture app (#3885)
  fix(ios): stop the XCTest-channel penalty from re-arming itself (#3896)
  test(android): pin that a child vanishing mid-read reads as gone (#3905)
  ci: skip device smoke lanes when a PR changes no lane input (#3904)
  fix(ios): verify deep-tree back on the sole screen (#3894)
  fix(ios): synthesize long presses and the gesture viewport on deep trees (#3893)
  perf(ios): read each resolved text input through one snapshot (#3882)
  fix(gate): take the host validation lock for heavy gates (#3900)
  fix(logs): keep an early iOS simulator logs stop from hanging the session (#3892)
  fix(apple): clean the runner derived path the runner uses (#3897)
  test(provider-scenarios): open deadline scenarios without the test IME (#3903)
  test(host-kit): stub os.homedir for the exec-trace late-close test (#3898)
  feat(test-app): add a Bluesky-depth heavy feed screen (#3884)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant