Skip to content

fix: load Android e2e bundle via adb reverse instead of 10.0.2.2 - #1524

Closed
MrMuzyk wants to merge 1 commit into
callstack:mainfrom
MrMuzyk:fix/flaky-android-ci-run
Closed

MrMuzyk wants to merge 1 commit into
callstack:mainfrom
MrMuzyk:fix/flaky-android-ci-run

Conversation

@MrMuzyk

@MrMuzyk MrMuzyk commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Android e2e lane fails at random with "Unable to load script" on the first test (example run). A rerun passes.

Root cause: on a stock emulator, React Native connects to the dev server at 10.0.2.2:8081, which needs the emulator network. Right after boot, that network can be down for a short time. In the failed run, Wi-Fi came up, failed its check, and was turned off. Cellular came up about 30 s later. The app started inside that gap, could not reach the dev server, and fell back to an embedded bundle, which this app does not have. React Native checks for the dev server only once per start, so a longer test timeout does not help.

Fix: set the metro.host system property to localhost before the tests run. React Native reads it before falling back to 10.0.2.2 (AndroidInfoHelpers.kt). The app then reaches 8081 through the adb reverse tunnel the lane already sets up, and that tunnel does not use the emulator network. Port 8082 (the MF remote) already works this way.

  • adb root runs first, because setting the property may need root. It runs before the adb reverse lines, because restarting adbd can remove reverse rules.
  • The property is read back, and the job stops with a clear error if it was not set.

The other option was a wait loop that probes 10.0.2.2:8081 from inside the emulator before the tests. A wait loop only makes the race less likely, while metro.host removes it.

Test plan

CI: the Android e2e job passes the metro.host not set check.

@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

@MrMuzyk is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 29ffb04

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@MrMuzyk
MrMuzyk marked this pull request as ready for review November 9, 2026 15:12
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel

Verdict: approve

No findings.

Reviewed with this repository's own Sentinel configuration (a09c6307c057).

Feedback goes in the review comment threads, as a reply under the inline comment of a finding:

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

Comment @apex-sentinel-staging review on this conversation to run a full review.

@MrMuzyk

MrMuzyk commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

As it still seems to be flaky I'll fix the problem at the root - move to testing release builds on CI

@MrMuzyk MrMuzyk closed this Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant