fix(metro): separate server control from Expo app launch

Merged
ME
4d ago
+707-293

Summary

On iOS simulators, open an Expo development build against the Metro server you choose with --metro-host, --metro-port, or --bundle-url. Previously, the app could ignore these hints and keep using its own server.

Start Metro first. With Agent Device Tester installed and Metro on port 8085:

agent-device open com.callstack.agentdevicelab --platform ios --session lab --metro-host 127.0.0.1 --metro-port 8085
agent-device metro reload --session lab

Automatic connection requires a unique installed exp+ scheme. If detection is inconclusive, the app opens normally; --launch-url supplies its development-client URL.

After metro prepare, reload uses the local server while the app can use a public or proxy URL. A fresh open preserves that prepared binding only when its runtime matches the prepared device address; otherwise it replaces a stale binding. Reused sessions retain their binding. Explicit runtime hints replace it, and close clears it. Reload flags override the saved address.

23 files; expands the Expo launch fix to cover reload addresses. Closes #1245.

Validation

At fb368ecf80, AGENT_DEVICE_VITEST_MAX_WORKERS=2 pnpm check:affected --run passed all runnable checks, including 3,779 related tests. Stale-binding and malformed-proxy regressions failed before their fixes and passed afterward.

Real Expo prepare → reload at 10a68a94bd reached the local message socket with a public mounted runtime URL. The author's SDK 54 simulator run rendered the app at 22d9e8deac; no new device run at this head.

Android app-log waits timed out under four workers; the focused run passed. Cause unconfirmed. GitHub checks pending; native CI lanes unverified.