Fix Sentry 3GCQ/3GDH: keep Gson-deserialized models from R8 full mode#22954
Open
nbradbury wants to merge 3 commits into
Open
Fix Sentry 3GCQ/3GDH: keep Gson-deserialized models from R8 full mode#22954nbradbury wants to merge 3 commits into
nbradbury wants to merge 3 commits into
Conversation
…mend models from R8 AGP 9's R8 full mode (introduced in 26.8) was transforming RecommendApiCallsProvider$RecommendTemplateData, causing InstantiationException and ClassCastException when Gson tried to deserialize the /mobile/share-app-link response. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Audit of fromJson<T> call sites surfaced more Kotlin data classes that AGP 9's R8 full mode could class-merge or strip the same way it did to RecommendTemplateData. Adds -keep rules for: - InviteLinksApiCallsProvider.InviteLinksItem - ReaderReadingPreferences (incl. Theme/FontFamily/FontSize enums) - SubfilterListItemMapper.MappedSubfilterListItem - StatsCardsConfiguration + StatsCardType - SubscribersCardsConfiguration + SubscribersCardType - InsightsCardsConfigurationRepository.PersistedConfig + InsightsCardType These have not yet appeared in Sentry for 26.8-rc-5, but the rc-5 user base is small and the affected paths (Reader startup, new stats screens, invite links) are high-traffic enough that they would likely surface in Beta/GA. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Generated by 🚫 Danger |
Contributor
|
|
Contributor
|
|
Contributor
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
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
This PR targets
release/26.8to fix two crashes (WORDPRESS-ANDROID-3GCQ,WORDPRESS-ANDROID-3GDH) that appeared only in 26.8-rc-5 — both at the same line ofRecommendApiCallsProvider.getTemplateFromJsonwhere Gson deserializes a Kotlindata class.Root cause: 26.8 upgraded to AGP 9, which defaults R8 to full mode. Full mode class-merges/strips classes constructed only reflectively (via
Unsafe.allocateInstance), soRecommendTemplateDataended up effectively abstract at runtime →InstantiationException(3GCQ) andClassCastException(3GDH). Existing-dontoptimizedoes not prevent class merging — the header comment inproguard.cfgalready flags this risk.Sentry: 3GCQ · 3GDH
Changes
Commit 1 — fix for the two Sentry crashes:
-keep class org.wordpress.android.models.recommend.** { *; }Commit 2 — preemptive audit of other
fromJson<T>call sites on Kotlin data classes that have no keep rule and would hit the same bug under R8 full mode:InviteLinksApiCallsProvider.InviteLinksItemReaderReadingPreferences(+ nestedTheme,FontFamily,FontSizeenums)SubfilterListItemMapper.MappedSubfilterListItemStatsCardsConfiguration+StatsCardTypeSubscribersCardsConfiguration+SubscribersCardTypeInsightsCardsConfigurationRepository.PersistedConfig+InsightsCardTypeSkipped:
DebugCookie(debug-only menu),QueryResult<T>(generic — needs per-call-site type audit).The two crashes use
Fixes WORDPRESS-ANDROID-...in commit 1 so Sentry auto-resolves them on merge.Test plan
site.hasCapabilityListUsers)