Skip to content

Fix Sentry 3GCQ/3GDH: keep Gson-deserialized models from R8 full mode#22954

Open
nbradbury wants to merge 3 commits into
release/26.8from
fix/sentry-3gcq-3gdh-r8-26.8
Open

Fix Sentry 3GCQ/3GDH: keep Gson-deserialized models from R8 full mode#22954
nbradbury wants to merge 3 commits into
release/26.8from
fix/sentry-3gcq-3gdh-r8-26.8

Conversation

@nbradbury

@nbradbury nbradbury commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR targets release/26.8 to fix two crashes (WORDPRESS-ANDROID-3GCQ, WORDPRESS-ANDROID-3GDH) that appeared only in 26.8-rc-5 — both at the same line of RecommendApiCallsProvider.getTemplateFromJson where Gson deserializes a Kotlin data 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), so RecommendTemplateData ended up effectively abstract at runtime → InstantiationException (3GCQ) and ClassCastException (3GDH). Existing -dontoptimize does not prevent class merging — the header comment in proguard.cfg already 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.InviteLinksItem
  • ReaderReadingPreferences (+ nested Theme, FontFamily, FontSize enums)
  • SubfilterListItemMapper.MappedSubfilterListItem
  • StatsCardsConfiguration + StatsCardType
  • SubscribersCardsConfiguration + SubscribersCardType
  • InsightsCardsConfigurationRepository.PersistedConfig + InsightsCardType

Skipped: 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

  • Local minified release build still launches and reaches the home screen
  • Me → About → Share loads without the bad-format error message
  • Reader detail opens with saved reading preferences (theme/font) restored
  • New Stats screen opens with previously-configured card visibility
  • Subscribers card on New Stats opens with previous visibility
  • Users → Invite People → Get invite link returns a working link (requires site.hasCapabilityListUsers)

nbradbury and others added 2 commits June 8, 2026 11:04
…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>
@dangermattic

dangermattic commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22954-877621f
Build Number1493
Application IDorg.wordpress.android.prealpha
Commit877621f
Installation URL2dmepofuot1f8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22954-877621f
Build Number1493
Application IDcom.jetpack.android.prealpha
Commit877621f
Installation URL7b714nj3qm9fg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

@nbradbury nbradbury marked this pull request as ready for review June 8, 2026 18:11
@nbradbury nbradbury enabled auto-merge (squash) June 9, 2026 17:56
@nbradbury nbradbury requested a review from adalpari June 9, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants