fix Android StackOverflowError in MainApplication.getPackages - #2195
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📝 WalkthroughWalkthroughFixes ChangesMainApplication fix and test coverage
Country document type mappings
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StackOverflowErrorcrash on Android: inside the anonymousDefaultReactNativeHostinMainApplication.kt, the unqualifiedpackagesreference resolved to the host's own Kotlin-syntheticgetPackages()property instead ofMainApplication's lazypackagesproperty, sogetPackages()called itself until the stack was exhausted.reactNativeHostcode paths — never on New Architecture startup — which is why it escaped manual testing. Confirmed triggers in our dependency tree: Segment'strackDeepLinks(app opened via deep link with the analytics module live), RN coreBlobProvider(external blobcontent://resolution), and react-native-screens' debug-only overflow menu.getPackages(); it reproduces the exact crash signature on the old code and passes with the fix.Changes
React Native app (Android native)
MainApplication.kt: qualify the reference asthis@MainApplication.packagessogetPackages()returns the app's package list instead of recursing.app/build.gradle: addtestOptions.unitTests.includeAndroidResourcesand JUnit/Robolectric/androidx-test dependencies.SDK core
country-document-types.json: refresh bundled country/document data to match the live API (ID-card support now reported for most countries; Germany keyed asD<<). Fixes the failingcountry-data-sync.integration.test.tsin theworkspace-testCI job. Same data as PR add doc-aware embed routing + sticky verification request #2194.Tests
MainApplicationTest.kt: Robolectric regression test assertinggetPackages()returns (with the custom packages present) instead of overflowing the stack. Verified red on the buggy code, green on the fix.src/test/AndroidManifest.xml: mirrors the main manifest's merge overrides (ML KitDEPENDENCIES, Firebase notification meta-data, application attributes) because the unit-test manifest merge does not inherit them.Test Plan
pnpm lint && pnpm typespassescd app/android && ./gradlew :app:testDebugUnitTest --tests "com.proofofpassportapp.MainApplicationTest"passesself:/// https deep link (cold and warm) — no crashNative Consolidation Checklist
cd app && pnpm jest:run/pnpm --filter @selfxyz/rn-sdk-test-app test)🤖 Generated with Claude Code
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests
Chores