Skip to content

perf(app): strip webview-bundle source maps + skip bundle in store builds until WIA is on - #2232

Open
seshanthS wants to merge 2 commits into
devfrom
feat/wia-skip-webview-bundle-prod
Open

perf(app): strip webview-bundle source maps + skip bundle in store builds until WIA is on#2232
seshanthS wants to merge 2 commits into
devfrom
feat/wia-skip-webview-bundle-prod

Conversation

@seshanthS

@seshanthS seshanthS commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Trims the embedded webview bundle (self-wallet, 58 MB) out of the app until the WebView path is live. Independent of the B2 PR (#2230) — build-config + rn-sdk copy-script only.

Two changes

  1. Always exclude source maps. copy-assets now runs packages/rn-sdk/scripts/copy-embedded-bundle.cjs, which copies webview-app/distassets/self-wallet excluding *.map (~21 MB of source maps that were shipping). Verified: 0 .map files, index.html present + SRI-stripped, dir ~43 MB (was 58); rn-sdk 175 tests pass.
  2. Skip the bundle on store builds while IS_WIA_ENABLED is off. The bundle ships even though the WebView path is gated off (assets merge at build time), so it's dead weight today. mobile-deploy.yml computes SELF_SKIP_WALLET_BUNDLE from the source flag → the copy script no-ops (no bundle produced), Android release passes -PSelfRnSdk_selfWalletBundleOptional=true (fastlane) so rn-sdk's release guard tolerates the absence, and the iOS "Copy self-wallet assets" phase early-exits. Auto-returns when IS_WIA_ENABLED flips true — no manual coordination.

Safety

  • No runtime regression: the WebView path is unreachable while IS_WIA_ENABLED=false, so an absent bundle is inert.
  • Does not touch rn-sdk-test-app (keeps its bundle); default copy-assets behavior unchanged apart from dropping maps.

Validation

  • rn-sdk: map-exclude + skip verified locally; 175 tests pass.
  • YAML (mobile-deploy.yml), Ruby (Fastfile), pbxproj (plutil -lint) and the iOS phase shell (bash -n) all valid.
  • End-to-end check (post-merge): a prod mobile-deploy dispatch with the flag off should produce an AAB/IPA with no self-wallet/.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added conditional WebView bundle inclusion for Android and iOS builds.
    • Builds now automatically omit the embedded wallet bundle when the in-app WebView feature is disabled.
    • Source maps are excluded from embedded WebView assets to reduce bundle size.
    • Embedded assets are restored automatically when the feature is re-enabled.
  • Documentation

    • Updated build and release documentation with bundle size details and inclusion behavior.

seshanthS and others added 2 commits July 24, 2026 16:03
…view bundle

copy-assets now runs a node script that (1) always excludes *.map from the
copied self-wallet bundle (~21MB of dead-weight source maps never shipped),
and (2) skips the copy entirely when SELF_SKIP_WALLET_BUNDLE=1. Reuses the
existing SRI strip. No consumer regresses (default behavior unchanged bar the
map exclusion).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… off

mobile-deploy computes SELF_SKIP_WALLET_BUNDLE from IS_WIA_ENABLED (skip when
the WebView path is off), so build:deps produces no self-wallet bundle. Android
release passes -PSelfRnSdk_selfWalletBundleOptional=true (fastlane) so the
rn-sdk release guard tolerates the absent bundle; the iOS Copy self-wallet
assets phase early-exits when skipped/absent. The bundle auto-returns when
IS_WIA_ENABLED flips true. Trims dead weight from prod/internal APK/AAB/IPA
(WebView path is gated off, so an absent bundle is inert).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
self-webview-app Building Building Preview, Comment Jul 24, 2026 10:34am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change introduces conditional WebView bundle embedding. CI derives a skip flag from IS_WIA_ENABLED; Android, iOS, and RN SDK packaging then omit or include the bundle accordingly, excluding source maps during copying.

Changes

WebView bundle control

Layer / File(s) Summary
Bundle copy and cleanup
packages/rn-sdk/package.json, packages/rn-sdk/scripts/copy-embedded-bundle.cjs
copy-assets now uses a dedicated script that validates sources, removes stale bundles, excludes source maps, copies assets, and strips embedded SRI when enabled.
Platform build flag integration
.github/workflows/mobile-deploy.yml, app/fastlane/Fastfile, app/ios/Self.xcodeproj/project.pbxproj, specs/projects/sdk/workstreams/webview-in-app/plans/WIA-APP-CUTOVER.md
iOS and Android workflows set SELF_SKIP_WALLET_BUNDLE from IS_WIA_ENABLED; Android and iOS build steps use it to conditionally omit the embedded bundle, with the deployment behavior documented.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: stripping source maps and conditionally skipping the webview bundle in store builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wia-skip-webview-bundle-prod

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c6021d3-8ddc-416a-b6b1-166db2adddac

📥 Commits

Reviewing files that changed from the base of the PR and between 2a44f5a and 8df0a38.

📒 Files selected for processing (6)
  • .github/workflows/mobile-deploy.yml
  • app/fastlane/Fastfile
  • app/ios/Self.xcodeproj/project.pbxproj
  • packages/rn-sdk/package.json
  • packages/rn-sdk/scripts/copy-embedded-bundle.cjs
  • specs/projects/sdk/workstreams/webview-in-app/plans/WIA-APP-CUTOVER.md

Comment on lines +635 to +647
- name: Determine webview-bundle inclusion (WIA flag)
if: inputs.platform != 'android'
run: |
# Ship the embedded webview bundle only when the WebView path is on
# (IS_WIA_ENABLED). While it's off the bundle is dead weight, so skip it
# to trim app size. Tracks the source flag so it auto-returns when flipped.
if grep -qE 'IS_WIA_ENABLED[[:space:]]*=[[:space:]]*true' app/src/utils/devUtils.ts; then
echo "SELF_SKIP_WALLET_BUNDLE=0" >> "$GITHUB_ENV"
echo "WIA enabled → embedding webview bundle"
else
echo "SELF_SKIP_WALLET_BUNDLE=1" >> "$GITHUB_ENV"
echo "WIA disabled → skipping webview bundle (size trim)"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Gate every WebView entry before deriving bundle omission from IS_WIA_ENABLED.

The supplied cutover plan documents ungated QR-scan and sessionId/mock_passport entry points. Those paths can still reach WebView after the workflow removes self-wallet, causing runtime failures due to the missing local bundle.

  • .github/workflows/mobile-deploy.yml#L635-L647: Gate all iOS WebView entry points or retain the bundle until they share this flag.
  • .github/workflows/mobile-deploy.yml#L1119-L1131: Apply the same protection to Android.
📍 Affects 1 file
  • .github/workflows/mobile-deploy.yml#L635-L647 (this comment)
  • .github/workflows/mobile-deploy.yml#L1119-L1131

runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nSRC=\"${PROJECT_DIR}/../node_modules/@selfxyz/rn-sdk/assets/self-wallet\"\nDST=\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/self-wallet\"\nrm -rf \"$DST\"\nmkdir -p \"$DST\"\ncp -R \"$SRC\"/. \"$DST\"\n";
shellScript = "set -e\nSRC=\"${PROJECT_DIR}/../node_modules/@selfxyz/rn-sdk/assets/self-wallet\"\nDST=\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/self-wallet\"\n# Skip when the webview bundle is intentionally not produced (WIA off) or absent,\n# so the archive doesn't hard-fail on a missing source (set -e + cp).\nif [ \"${SELF_SKIP_WALLET_BUNDLE:-0}\" = \"1\" ] || [ ! -d \"$SRC\" ]; then\n echo \"Copy self-wallet assets: skipped (SELF_SKIP_WALLET_BUNDLE=${SELF_SKIP_WALLET_BUNDLE:-0})\"\n exit 0\nfi\nrm -rf \"$DST\"\nmkdir -p \"$DST\"\ncp -R \"$SRC\"/. \"$DST\"\n";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fail the iOS build when the bundle is unexpectedly missing.

The condition treats a missing source directory as a valid skip even when SELF_SKIP_WALLET_BUNDLE is 0 or unset. A failed copy can therefore produce a successful archive with no self-wallet/index.html, breaking WebView startup at runtime. Only skip on the explicit flag; otherwise error when $SRC is absent.

Proposed fix
-if [ "${SELF_SKIP_WALLET_BUNDLE:-0}" = "1" ] || [ ! -d "$SRC" ]; then
+if [ "${SELF_SKIP_WALLET_BUNDLE:-0}" = "1" ]; then
   echo "Copy self-wallet assets: skipped (SELF_SKIP_WALLET_BUNDLE=${SELF_SKIP_WALLET_BUNDLE:-0})"
   exit 0
 fi
+if [ ! -d "$SRC" ]; then
+  echo "error: Copy self-wallet assets: source directory not found: $SRC" >&2
+  exit 1
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
shellScript = "set -e\nSRC=\"${PROJECT_DIR}/../node_modules/@selfxyz/rn-sdk/assets/self-wallet\"\nDST=\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/self-wallet\"\n# Skip when the webview bundle is intentionally not produced (WIA off) or absent,\n# so the archive doesn't hard-fail on a missing source (set -e + cp).\nif [ \"${SELF_SKIP_WALLET_BUNDLE:-0}\" = \"1\" ] || [ ! -d \"$SRC\" ]; then\n echo \"Copy self-wallet assets: skipped (SELF_SKIP_WALLET_BUNDLE=${SELF_SKIP_WALLET_BUNDLE:-0})\"\n exit 0\nfi\nrm -rf \"$DST\"\nmkdir -p \"$DST\"\ncp -R \"$SRC\"/. \"$DST\"\n";
shellScript = "set -e\nSRC=\"${PROJECT_DIR}/../node_modules/@selfxyz/rn-sdk/assets/self-wallet\"\nDST=\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/self-wallet\"\n# Skip when the webview bundle is intentionally not produced (WIA off) or absent,\n# so the archive doesn't hard-fail on a missing source (set -e + cp).\nif [ \"${SELF_SKIP_WALLET_BUNDLE:-0}\" = \"1\" ]; then\n echo \"Copy self-wallet assets: skipped (SELF_SKIP_WALLET_BUNDLE=${SELF_SKIP_WALLET_BUNDLE:-0})\"\n exit 0\nfi\nif [ ! -d \"$SRC\" ]; then\n echo \"error: Copy self-wallet assets: source directory not found: $SRC\" >&2\n exit 1\nfi\nrm -rf \"$DST\"\nmkdir -p \"$DST\"\ncp -R \"$SRC\"/. \"$DST\"\n";

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8df0a38a2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const dst = path.join(__dirname, '../assets/self-wallet');

if (process.env.SELF_SKIP_WALLET_BUNDLE === '1') {
// Remove any bundle left over from a prior build; do NOT copy or strip SRI.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate the production WebView shortcut when omitting its bundle

In store builds with the current false WIA flag, the workflow sets SELF_SKIP_WALLET_BUNDLE=1 and this removes the bundle on both platforms, but the production app still registers the dev screens (app/src/navigation/index.tsx:45), lets users enable the Debug menu with five version taps (SettingsScreen.tsx:158-162), and unconditionally exposes the WebView Host shortcut (DebugShortcutsSection.tsx:126-129). Selecting it then loads the deleted self-wallet/index.html and only shows the load-error overlay; gate that shortcut when the bundle is omitted or retain the bundle in builds intended for this production QA path.

AGENTS.md reference: AGENTS.md:L37-L37

Useful? React with 👍 / 👎.

runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nSRC=\"${PROJECT_DIR}/../node_modules/@selfxyz/rn-sdk/assets/self-wallet\"\nDST=\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/self-wallet\"\nrm -rf \"$DST\"\nmkdir -p \"$DST\"\ncp -R \"$SRC\"/. \"$DST\"\n";
shellScript = "set -e\nSRC=\"${PROJECT_DIR}/../node_modules/@selfxyz/rn-sdk/assets/self-wallet\"\nDST=\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/self-wallet\"\n# Skip when the webview bundle is intentionally not produced (WIA off) or absent,\n# so the archive doesn't hard-fail on a missing source (set -e + cp).\nif [ \"${SELF_SKIP_WALLET_BUNDLE:-0}\" = \"1\" ] || [ ! -d \"$SRC\" ]; then\n echo \"Copy self-wallet assets: skipped (SELF_SKIP_WALLET_BUNDLE=${SELF_SKIP_WALLET_BUNDLE:-0})\"\n exit 0\nfi\nrm -rf \"$DST\"\nmkdir -p \"$DST\"\ncp -R \"$SRC\"/. \"$DST\"\n";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail iOS builds when an enabled WIA bundle is missing

When IS_WIA_ENABLED has been flipped true but $SRC is absent—for example, an archive launched directly from Xcode without first running build:deps—this condition exits successfully instead of failing as the previous cp did. SplashScreen then routes every normal startup to WebViewHost (app/src/screens/app/SplashScreen.tsx:157-160), whose iOS URI points at the missing self-wallet/index.html, so the resulting signed archive installs but is unusable; only SELF_SKIP_WALLET_BUNDLE=1 should permit a missing source.

Useful? React with 👍 / 👎.

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