fix(daemon): apply stored runtime hints only to the app they were set for

Merged
IM
5d ago
+340-82

Summary

Stored runtime hints are now bound to the app an open applied them to. A later open without runtime flags re-applies them only to that app. Before, every later open in the session re-applied them to whatever it opened. On Android, opening a non-debuggable app (Photos, Files, the launcher) failed at the run-as write. On an iOS simulator, RCT_jsLocation was written into the other app's defaults, and the first app's launch URL was re-opened. Hints stored before any open bind to the first app; runtime set keeps the binding. close, runtime clear, and expiry clear them from the app they're bound to.

Before / after

Pixel 9 AVD (Android 16), with a debuggable React Native app (<rn-app>):

$ open <rn-app> --relaunch --metro-port 8081      # base and head: Opened
$ open com.google.android.apps.photos
base a4f2dcad0: COMMAND_FAILED: Failed to access Android app sandbox for com.google.android.apps.photos: run-as: package not debuggable
head 91761f668: Opened: com.google.android.apps.photos
$ close      # head: the hints are cleared from <rn-app> (debug_http_host gone), although the session ended on Photos

Validation

  • Head 91761f668, check:affected --run --head, exactCommit: true. Format, lint, typecheck, layering, fallow, build and vitest-related pass. unit fails only on upload-http-deadline and committed-source-tree, which fail the same way on clean main on this macOS host. command-docs, doc-links and doc-prose pass when run directly.
  • The new tests in session-open-runtime.test.ts fail without the fix (apply and clear paths).
  • The iOS defaults write is covered by tests only.

Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.