Skip to content

feat(mobile): skip dev-client rebuilds when the Expo native fingerprint is unchanged - #33410

Merged
nwparker merged 1 commit into
mainfrom
nwparker/mobile-native-fingerprint-cache
Oct 25, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/mobile-native-fingerprint-cache

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​86 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​86
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​637 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​635

Summary

Dev-client rebuilds are skipped when the Expo fingerprint of the native inputs hasn't changed.

  • pnpm native ensure <ios|android> [--device <name|udid|serial>] [--rebuild] (mobile/scripts/native-client.mjs) computes the platform fingerprint and looks up a build cached under that fingerprint.
    • HIT: installs the cached .app with xcrun simctl install (the simulator boots headless if needed) or the .apk with adb install -r -d, and prints HIT <platform> fingerprint <hash>. If that install fails, it falls back to a build.
    • MISS: regenerates ios/ or android/ whenever its stamp doesn't match the fingerprint, runs expo run:<platform> --no-bundler, and stores the artifact.
  • Shared cache: the cache lives in the user cache dir (~/Library/Caches/orca-mobile/native-builds, $XDG_CACHE_HOME/..., %LOCALAPPDATA%\..., or ORCA_MOBILE_NATIVE_BUILD_CACHE_DIR), so every worktree shares it. Writes go through a staging dir and a rename, so a concurrent reader never sees a partial build. The newest 3 entries per platform are kept.
  • Expo buildCacheProvider: mobile/scripts/native-build-cache.cjs is registered as the provider in app.config.js, so a plain pnpm ios / pnpm android also installs a cached build on a hit. Only ensure writes to the cache. expo run reuses an existing ios//android/ directory even when it was generated from older inputs, so letting it store could cache a stale build under the new fingerprint.
  • mobile/fingerprint.config.js:
    • Hashes packages/expo-two-way-audio. pnpm installs it under node_modules/.pnpm, which the fingerprint skips as a nested node_modules.
    • Skips package.json scripts, .gitignore, and version/build numbers, which never change native code.
  • @expo/fingerprint is loaded through expo's own dependency, so it is the exact version Expo CLI uses. There are no lockfile changes.
  • CI: a new report-only Mobile native fingerprint job in mobile.yml (2 vCPU, mobile-only install with --ignore-scripts, continue-on-error) fingerprints the head and HEAD^1. It writes base/head hashes and the changed sources to the step summary, and adds a warning annotation when they differ.

Why the provider is a complement, not a replacement

Expo 55 ships a local provider, but its default cache lives per worktree in .expo/build-cache. Passing a shared absolute cacheDir through the Expo config would put a per-user path into the hashed config, so the fingerprint would differ between machines and CI. The custom provider resolves the shared dir at runtime, which keeps the config constant. The EAS provider needs credentials, so it doesn't fit.

Notes

  • Orca doesn't use expo-updates, so runtimeVersion: { policy: "fingerprint" } doesn't apply and is unchanged. If OTA is adopted later, the same fingerprint (and this CI job) is the natural runtime-version gate.
  • This PR itself changes the fingerprint once, because it adds buildCacheProvider and the source skips.

Validation

  • node scripts/typecheck-mobile.mjs, check:tests-typecheck, pnpm lint, pnpm format:check, check:code-quality:changed, and the mobile scripts/ tests pass. The new test covers the provider's store gating, variant keys, and LRU pruning.
  • Expo CLI's own resolveBuildCacheProvider/resolveBuildCache/uploadBuildCache against the real config: a miss, then a store in store mode, then a hit. The CLI hash matches pnpm native fingerprint.
  • ensure android against a stubbed adb prints HIT and installs the cached artifact. The miss path ran expo prebuild, wrote the stamp, and invoked expo run:android; that machine has no Android SDK, so the build itself failed.
  • The fingerprint is stable across prebuild. An edit under packages/expo-two-way-audio/ios changes it.
  • compare was checked locally against base and head fingerprints.
  • Not validated: a real simulator or emulator install, because no simulator or SDK was available in the validation environment.

…nt is unchanged

Add `pnpm native ensure <ios|android>`, which installs a cached dev-client
build keyed by the Expo fingerprint and only runs `expo run` on a miss.
The cache lives in the user cache dir so every worktree shares it, and
app.config.js registers it as Expo's buildCacheProvider so plain
`expo run` reuses hits too. A report-only PR job flags fingerprint
changes against the base in the step summary.
@nwparker
nwparker marked this pull request as ready for review October 25, 2026 05:53
@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e55cdc69-ece5-4c5e-a23a-87feb9e940ce
Commits

Reviewing files that changed from the base of the PR and between 62d9706 and dfb6e4a.

Files selected for processing: 8
  • .github/workflows/mobile.yml
  • mobile/README.md
  • mobile/app.config.js
  • mobile/fingerprint.config.js
  • mobile/package.json
  • mobile/scripts/native-build-cache.cjs
  • mobile/scripts/native-build-cache.test.ts
  • mobile/scripts/native-client.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 4b34768 into main Oct 25, 2026
51 checks passed
@nwparker
nwparker deleted the nwparker/mobile-native-fingerprint-cache branch October 25, 2026 06:08
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