Add multiple architectures Android insight#474
Conversation
| path_parts = Path(file_info.path).parts | ||
| if len(path_parts) >= 3 and path_parts[0] == "lib": | ||
| arch = path_parts[1] | ||
| if arch in self.ARCHITECTURE_MAPPING: | ||
| arch_to_files[arch].append((file_info.path, file_info.size)) |
There was a problem hiding this comment.
Bug: On Windows, Path().parts fails to parse POSIX paths, causing the insight to be non-functional.
Severity: CRITICAL | Confidence: 0.95
🔍 Detailed Analysis
On Windows systems, Path(file_info.path).parts incorrectly parses POSIX-formatted paths (using forward slashes) because Path creates a WindowsPath object expecting backslashes. This causes the path_parts condition if len(path_parts) >= 3 and path_parts[0] == "lib" to fail, leading the insight to always return None and rendering the feature non-functional on Windows.
💡 Suggested Fix
Replace Path(file_info.path).parts with PurePosixPath(file_info.path).parts after importing PurePosixPath from pathlib.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/launchpad/size/insights/android/multiple_native_library_arch.py#L42-L46
Potential issue: On Windows systems, `Path(file_info.path).parts` incorrectly parses
POSIX-formatted paths (using forward slashes) because `Path` creates a `WindowsPath`
object expecting backslashes. This causes the `path_parts` condition `if len(path_parts)
>= 3 and path_parts[0] == "lib"` to fail, leading the insight to always return `None`
and rendering the feature non-functional on Windows.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2694231
There was a problem hiding this comment.
Well we're not running this on windows so....
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #474 +/- ##
==========================================
+ Coverage 80.35% 80.53% +0.17%
==========================================
Files 159 161 +2
Lines 13465 13601 +136
Branches 1424 1435 +11
==========================================
+ Hits 10820 10953 +133
- Misses 2109 2110 +1
- Partials 536 538 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| """ | ||
|
|
||
| # Architectures that can most likely be removed (keeping only arm64-v8a) | ||
| REMOVABLE_ARCHITECTURES = {"x86", "x86_64", "armeabi-v7a"} |
There was a problem hiding this comment.
Is it more that only one architecture should be shipped in an APK to the app store, rather than non-arm64-v8a archs? Just wondering if generalizing this makes sense, like perhaps a different region like Asia is still on some older architectures.
There was a problem hiding this comment.
I have only ever seen arm64-v8a in the wild. x86_* are for emulators, and armeabi-v7a is the only remaining. A quick search indicates that this arch is quite outdated at this point, so I think it's a pretty safe bet to keep this as-is
c59828e to
3d7e128
Compare

Adds multiple native library insight as a carryover of https://docs.emergetools.com/docs/multiple-native-library-architectures-android
Will implement frontend handling for this over in sentry repo as follow up to resolve EME-582