Skip to content

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

Merged
nbradbury merged 4 commits into
release/26.8from
fix/sentry-3gcq-3gdh-r8-26.8
Jun 11, 2026
Merged

Fix Sentry 3GCQ/3GDH: keep Gson-deserialized models from R8 full mode#22954
nbradbury merged 4 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-1950dcb
Build Number1493
Application IDorg.wordpress.android.prealpha
Commit1950dcb
Installation URL2um2hff5gefrg
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-1950dcb
Build Number1493
Application IDcom.jetpack.android.prealpha
Commit1950dcb
Installation URL7vdfdg45g5c5g
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

@adalpari adalpari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nbradbury
nbradbury merged commit 00eb108 into release/26.8 Jun 11, 2026
28 of 29 checks passed
@nbradbury
nbradbury deleted the fix/sentry-3gcq-3gdh-r8-26.8 branch June 11, 2026 07:46
crazytonyli pushed a commit that referenced this pull request Jun 12, 2026
…#22954)

* Fix Sentry WORDPRESS-ANDROID-3GCQ, WORDPRESS-ANDROID-3GDH: keep recommend 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>

* Keep additional Gson-deserialized models from R8

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>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
crazytonyli added a commit that referenced this pull request Jun 15, 2026
* Fix NPE in Site Settings when refreshing GBKit toggle with null site (#22953)

The refresh runs from an async onSettingsUpdated callback that only guards
with isAdded(), so mSite can be null when isBlockEditorDefault — a non-null
Kotlin param — is invoked, crashing on the generated null check.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

* Fix Sentry WORDPRESS-ANDROID-3GCQ, WORDPRESS-ANDROID-3GDH: keep recommend 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>

* Keep additional Gson-deserialized models from R8

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>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix NPE when application password response is missing password or UUID (#22952)

The Gson-deserialized ApplicationPasswordCreationResponse declared its
fields as non-null, but Gson populates objects via reflection and bypasses
Kotlin's null checks. When the API returns a 200 response missing the
`password` or `uuid` field, those nulls flowed into the non-null
ApplicationPasswordCreationPayload constructor, crashing the app (in the
minified release build the parameter null-check compiles to a bare
getClass() call, producing the reported NPE).

Make the response fields nullable and validate them, returning the existing
error payload instead of crashing. Applied to both the Jetpack and WP-API
clients, which share the response type.

Crash report: https://a8c.sentry.io/issues/7522022287/

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update translations

* Update WordPress metadata translations for 26.8

* Update Jetpack metadata translations for 26.8

* Bump version number

* Update translations

* Bump version number

---------

Co-authored-by: Adalberto Plaza <adalpari@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Nick Bradbury <nbradbury@users.noreply.github.com>
Co-authored-by: Automattic Release Bot <mobile+wpmobilebot@automattic.com>
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.

4 participants