Skip to content

feat(mobile): one build-time switch picks native or OTA, default native (OTA phase E1) - #22193

Merged
Jinwoo-H merged 7 commits into
mainfrom
ota-e1-shell-build-switch
Sep 22, 2026
Merged

Jinwoo-H merged 7 commits into
mainfrom
ota-e1-shell-build-switch

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​531 $\color{#cf222e}{\Huge{\mathbf{−}}}$​305 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​226
Prod 32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​439 $\color{#cf222e}{\Huge{\mathbf{−}}}$​614 $\color{#cf222e}{\Huge{\mathbf{−}}}$​175

One build-time constant decides whether a mobile binary mounts the native screens or the web page delivered over the air, and every default build is native. This is the switch the OTA programme (phases A–D, all landed inert) was waiting on; nothing ships differently until a release is dispatched with shell=ota.

Phone. mobileShellBuildKind() in mobile/src/storage/preferences.ts is the only place process.env.EXPO_PUBLIC_MOBILE_SHELL is spelled. babel-preset-expo inlines a literal EXPO_PUBLIC_* member expression at bundle time, so a release bundle carries the value, not the variable (proved on four production Metro exports: the function body reads 'ota' or 'native', and process.env.EXPO_PUBLIC_MOBILE_SHELL occurs zero times in either bundle or its Hermes bytecode). Anything but the exact string ota is native. mobileWebShellFlagCanBeOn() becomes __DEV__ || kind === 'ota'; an unset stored key reads ON only in an OTA build, a stored 'false' still wins, and the ability never comes from storage. Troubleshoot mounts the shell row wherever the flag can be on (in an OTA build it is the only way back to the native screens), labelled by build kind; the bundle probe row stays development-only. The flag census gains two rules: process.env.EXPO_PUBLIC_ resolves to exactly the one file, and mobileShellBuildKind to its two callers.

Release workflows. mobile-android-release.yml and mobile-ios-release.yml gain a workflow_dispatch input shell (native default, ota), and pass EXPO_PUBLIC_MOBILE_SHELL: ${{ inputs.shell || 'native' }} to the step that bundles the JavaScript, printing it first. Tag pushes and schedules carry no inputs and read native. A contract test evaluates the expression rather than matching its text: absent, empty and native resolve to native; ota to ota; an unparseable shape fails (mutated the fallback to 'ota' and watched it go red).

Desktop. build:mobile-web now builds and verifies the real page into the packaged bundle dir, whose one definition is MOBILE_WEB_BUNDLE_DIR in the packaging guard. The Phase A placeholder (src/mobile-web/, its builder, verifier, tsconfig, knip and electron-builder entries) is retired; its manifest writer, entry detection and line-ending check are split into named modules the app builder already used. Packaged reading: 110 assets, 8 routes, 8,055,568 B of the 9,437,184 B budget, reproducible buildId. The desktop reads out/mobile-web beside the app exactly as before, so a paired phone in an OTA build fetches the real page from any desktop carrying this change, and a native phone never asks.

Inert by default. No release is affected until someone runs a release workflow with shell=ota. Native screens stay until after the first OTA release.

…native

EXPO_PUBLIC_MOBILE_SHELL is read in exactly one place, mobileShellBuildKind in
preferences.ts. Expo's babel preset inlines a literal process.env member
expression at build time, so a release bundle carries the answer as a constant
and anything but the exact string 'ota' — unset, empty, a typo — is native.
Every default build is therefore the native app, unchanged.

mobileWebShellFlagCanBeOn now answers __DEV__ or an OTA build, so the ability to
mount the page comes from the build and never from storage: a native binary
installed over an OTA one, same bundle id and same data container, still refuses
a stored 'true' without reading the key. An unset key reads on only in an OTA
build; a development build keeps its opt-in, and a stored 'false' wins
everywhere so the Troubleshoot toggle can switch an OTA build back to native.

That toggle now mounts wherever the flag can be on, which is the only way back
to the native screens in an OTA build, and its label names the build kind rather
than saying "(dev)". The bundle probe row beside it stays development-only: it
fetches.

The flag census gains two rules — one module reads the switch, in the member
form Expo inlines and not the bracket form, and one named function answers the
build kind — and the build-kind fence now lists the Troubleshoot route that asks
it. Docblocks that said a store build can never mount the shell now say it
mounts only when built for OTA.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…tive

Both release workflows gain a `shell` workflow_dispatch choice, options native
and ota, default native, and hand it to the step that bundles the JavaScript as
EXPO_PUBLIC_MOBILE_SHELL. That is the Gradle assembleRelease step on Android and
the fastlane build_and_upload step on iOS; nothing else in either file sets it.

A tag push and a schedule carry no inputs at all, so `inputs.shell || 'native'`
yields native for them — the first OTA release is a dispatch with one field
changed, and every other run is the app we ship today.

Each build step prints the value it is about to build with, read back from the
same variable rather than from a second copy of the expression, so a run's log
cannot claim a shell the build did not use.

The new contract test evaluates that expression rather than matching its text:
absent, empty and 'native' all resolve to native, 'ota' to ota, and any
expression shape it cannot evaluate is a failure rather than a pass.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ired

build:mobile-web now runs the app builder and app verifier, and both take their
output root from MOBILE_WEB_BUNDLE_DIR in the packaging guard rather than each
carrying a constant of their own — one definition of where the bundle lives, so
a drift cannot leave electron-builder's beforePack looking at an empty directory
while the builder reports a tree it wrote elsewhere. build:mobile-web:app is
gone; it was the same two commands.

src/mobile-web/ and its two scripts go with it. What the app builder shared with
them is split into three modules named for what they hold rather than for the
bundle that used to own them: mobile-web-bundle-manifest.mjs (content types, the
canonical asset serialization, buildId, hashed assets, the protocol window and
the manifest write), script-entry-detection.mjs (isDirectInvocation, whose two
failure modes are Windows paths and symlinked entries), and
mobile-web-source-line-endings.mjs (the CRLF guard, now with a required
directory rather than a default pointing at the deleted tree).

The two suites that only needed *a* valid tree on disk — the beforePack guard
and the packaged-bundle guard — build one from mobile-web-bundle-fixture-tree
instead of bundling the whole mobile graph. It goes through the same manifest
writer the page does, so a manifest shape change still reaches them.

Also retired: the placeholder's tsconfig project and its typecheck lane, its
knip entry, its electron-builder exclusion and .gitattributes pins, and the
app-bundle test that asserted the shims stayed out of a builder that no longer
exists. pr.yml's page job builds the same bundle the package job ships.

Inert for native phones: they never fetch it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…suite

The changed-code quality gate's focused plugins read the two as a duplicate
import; the readFile line was left over from the split.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The web entry said it was built by `build:mobile-web:app` into out/mobile-web-app
and shipped by nothing. That script, that directory and that fact are all gone:
it is built by `build:mobile-web` into the packaged bundle dir, and a phone
mounts it only when the binary was built with EXPO_PUBLIC_MOBILE_SHELL=ota.

Two Windows cache keys explained themselves by naming src/mobile-web and "the
two bundle builders"; config/** now covers the builder, the verifier and the
manifest writer, and the spike's key no longer waits on a Phase C flip that has
happened. The keys themselves are unchanged.

Three scratch directories in the app-bundle suites and one in the verifier still
spelled the retired output root. Renamed to mobile-web, which is what the build
writes; they are temp subdirectory names and nothing reads them.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…itch

# Conflicts:
#	config/scripts/build-mobile-web-app-bundle.test.mjs
@pullfrog

pullfrog Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor
  • Read PR summary snapshot and complete diff
  • Triage: identify subsystems, seams, contracts
  • Inspect related files/callers/tests
  • Dispatch reviewfrog specialists for unresolved questions
  • Aggregate findings, draft review
  • Update summary snapshot and submit review

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 149ec4d0-ed39-48b0-8624-7684449a4d9e

📥 Commits

Reviewing files that changed from the base of the PR and between 6ae5ef2 and fef3d34.

⛔ Files ignored due to path filters (1)
  • src/mobile-web/src/orca-mark.png is excluded by !**/*.png
📒 Files selected for processing (45)
  • .gitattributes
  • .github/workflows/daemon-relocation-spike.yml
  • .github/workflows/mobile-android-release.yml
  • .github/workflows/mobile-ios-release.yml
  • .github/workflows/pr.yml
  • .github/workflows/win-crash-survival-e2e.yml
  • config/electron-builder.config.cjs
  • config/knip.json
  • config/scripts/build-mobile-web-app-bundle.mjs
  • config/scripts/build-mobile-web-app-bundle.test.mjs
  • config/scripts/build-mobile-web-bundle.mjs
  • config/scripts/build-mobile-web-bundle.test.mjs
  • config/scripts/electron-builder-config.test.mjs
  • config/scripts/mobile-release-shell-switch-workflow.test.mjs
  • config/scripts/mobile-web-bundle-fixture-tree.mjs
  • config/scripts/mobile-web-bundle-manifest.mjs
  • config/scripts/mobile-web-bundle-manifest.test.mjs
  • config/scripts/mobile-web-bundle-serializer-parity.test.mjs
  • config/scripts/mobile-web-page-routes.test.mjs
  • config/scripts/mobile-web-source-line-endings.mjs
  • config/scripts/mobile-web-source-line-endings.test.mjs
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-code-change-scope.test.mjs
  • config/scripts/run-typecheck-projects-in-parallel.mjs
  • config/scripts/script-entry-detection.mjs
  • config/scripts/script-entry-detection.test.mjs
  • config/scripts/verify-mobile-web-app-bundle.mjs
  • config/scripts/verify-mobile-web-bundle.mjs
  • config/scripts/verify-packaged-mobile-web-bundle.cjs
  • config/scripts/verify-packaged-mobile-web-bundle.test.mjs
  • config/tsconfig.mobile-web.json
  • mobile/app/h/[hostId]/web.tsx
  • mobile/app/troubleshoot.tsx
  • mobile/src/diagnostics/mobile-web-shell-dev-row.test.tsx
  • mobile/src/diagnostics/mobile-web-shell-dev-row.tsx
  • mobile/src/diagnostics/troubleshoot-view.tsx
  • mobile/src/mobile-web-shell/mobile-web-shell-flag-census.test.ts
  • mobile/src/mobile-web-shell/use-mobile-web-shell-enabled.ts
  • mobile/src/storage/preferences.test.ts
  • mobile/src/storage/preferences.ts
  • mobile/web-entry/index.tsx
  • package.json
  • src/mobile-web/index.html
  • src/mobile-web/src/bootstrap.css
  • src/mobile-web/src/bootstrap.ts
💤 Files with no reviewable changes (9)
  • config/electron-builder.config.cjs
  • src/mobile-web/src/bootstrap.css
  • config/scripts/build-mobile-web-bundle.mjs
  • config/scripts/verify-mobile-web-bundle.mjs
  • config/tsconfig.mobile-web.json
  • src/mobile-web/src/bootstrap.ts
  • config/knip.json
  • src/mobile-web/index.html
  • config/scripts/build-mobile-web-bundle.test.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The mobile web build now produces the packaged page bundle through a shared manifest writer and verifier. The previous bootstrap page, builder, verifier, and mobile-web TypeScript project were removed. Source line endings and direct script invocation use dedicated helpers. Android and iOS release workflows now select native or ota through EXPO_PUBLIC_MOBILE_SHELL. Mobile preferences and diagnostics use this build classification to control the hybrid shell. CI and packaging commands now use the unified bundle build.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to fef3d

Release builds remain native by default, while explicitly selected OTA builds use the packaged mobile page; the current change has no evidenced merge-blocking risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation and intended behavior, but it does not follow the required template. It omits the required Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Agent… Add all required template sections. Include the linked issue number, visual proof or an explicit N/A with a reason, testing steps and platform coverage, AI disclosure, review details, the agent skill boundary checkbox, notes on compatibilit…
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 29 files. (7 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: a build-time mobile shell switch that defaults to native and can select OTA delivery.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the implementation and intended behavior, but it does not follow the required template. It omits the required Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.

Resolution

Add all required template sections. Include the linked issue number, visual proof or an explicit N/A with a reason, testing steps and platform coverage, AI disclosure, review details, the agent skill boundary checkbox, notes on compatibility and security, and the checklist responses.

Full details: Docstring Coverage

Explanation

Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 29 files. (7 skipped: 7 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

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