perf(app): strip webview-bundle source maps + skip bundle in store builds until WIA is on - #2232
perf(app): strip webview-bundle source maps + skip bundle in store builds until WIA is on#2232seshanthS wants to merge 2 commits into
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe change introduces conditional WebView bundle embedding. CI derives a skip flag from ChangesWebView bundle control
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
.github/workflows/mobile-deploy.ymlapp/fastlane/Fastfileapp/ios/Self.xcodeproj/project.pbxprojpackages/rn-sdk/package.jsonpackages/rn-sdk/scripts/copy-embedded-bundle.cjsspecs/projects/sdk/workstreams/webview-in-app/plans/WIA-APP-CUTOVER.md
| - 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 |
There was a problem hiding this comment.
🩺 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"; |
There was a problem hiding this comment.
🩺 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.
| 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"; |
There was a problem hiding this comment.
💡 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. |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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 👍 / 👎.
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
copy-assetsnow runspackages/rn-sdk/scripts/copy-embedded-bundle.cjs, which copieswebview-app/dist→assets/self-walletexcluding*.map(~21 MB of source maps that were shipping). Verified: 0.mapfiles,index.htmlpresent + SRI-stripped, dir ~43 MB (was 58); rn-sdk 175 tests pass.IS_WIA_ENABLEDis 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.ymlcomputesSELF_SKIP_WALLET_BUNDLEfrom 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 whenIS_WIA_ENABLEDflips true — no manual coordination.Safety
IS_WIA_ENABLED=false, so an absent bundle is inert.rn-sdk-test-app(keeps its bundle); defaultcopy-assetsbehavior unchanged apart from dropping maps.Validation
mobile-deploy.yml), Ruby (Fastfile), pbxproj (plutil -lint) and the iOS phase shell (bash -n) all valid.mobile-deploydispatch with the flag off should produce an AAB/IPA with noself-wallet/.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation