Skip to content

Fix Sentry WORDPRESS-ANDROID-3F1P: emit isPage in prepublishing event#22839

Draft
nbradbury wants to merge 5 commits intotrunkfrom
fix/sentry-3f1p-editpostrepo-ispage
Draft

Fix Sentry WORDPRESS-ANDROID-3F1P: emit isPage in prepublishing event#22839
nbradbury wants to merge 5 commits intotrunkfrom
fix/sentry-3f1p-editpostrepo-ispage

Conversation

@nbradbury
Copy link
Copy Markdown
Contributor

@nbradbury nbradbury commented May 6, 2026

Fixes WORDPRESS-ANDROID-3F1P

Summary

Fix for Sentry WORDPRESS-ANDROID-3F1P — 40 users / 43 events. The openPrepublishingBottomSheet observer in PostsListActivity was reaching back into a shared EditPostRepository to read isPage, which dereferences post!!. After activity recreation the event can be redelivered before the repo's loadPostByLocalPostId(...) has run on the recreated instance, so editPostRepository.isPage throws an NPE.

Fix: carry isPage through the event payload itself. The ViewModel already has the PostModel in scope at emit time, so it just emits Event(post.isPage) and the activity uses the unwrapped value — no dependency on shared repository state. This matches the codebase's idiomatic pattern for ViewModel→Activity events (e.g. PostListAction sealed class).

Test plan

  • Enable "Don't keep activities" in Developer Options, open the post list, tap the publish quick action on a post, confirm the prepublishing bottom sheet appears with no crash.

…tory.isPage

Fixes WORDPRESS-ANDROID-3F1P

EditPostRepository.isPage dereferenced post!! and crashed when called
before any post was loaded. The reported caller is the
openPrepublishingBottomSheet observer in PostsListActivity, which can
fire after the activity is recreated but before the editor data
binds.

Return false (the safe default for the prepublishing flow) and emit an
AppLog warning so we still see the case if it persists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dangermattic
Copy link
Copy Markdown
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented May 6, 2026

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
Versionpr22839-d658c68
Build Number1488
Application IDorg.wordpress.android.prealpha
Commitd658c68
Installation URL7kig55rgrdrl0
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

wpmobilebot commented May 6, 2026

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
Versionpr22839-d658c68
Build Number1488
Application IDcom.jetpack.android.prealpha
Commitd658c68
Installation URL4n2c95t9k6af0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 37.20%. Comparing base (6bef09a) to head (d658c68).

Files with missing lines Patch % Lines
...ordpress/android/ui/posts/PostListMainViewModel.kt 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #22839   +/-   ##
=======================================
  Coverage   37.20%   37.20%           
=======================================
  Files        2317     2317           
  Lines      124522   124522           
  Branches    16909    16909           
=======================================
  Hits        46333    46333           
  Misses      74441    74441           
  Partials     3748     3748           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

nbradbury and others added 2 commits May 6, 2026 14:36
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Carry isPage through the openPrepublishingBottomSheet event so the
activity observer no longer reaches into a possibly-empty EditPostRepository
after activity recreation. Reverts the repo-level guard from this PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nbradbury nbradbury changed the title Fix Sentry WORDPRESS-ANDROID-3F1P: avoid post!! NPE in EditPostRepository.isPage Fix Sentry WORDPRESS-ANDROID-3F1P: emit isPage in prepublishing event May 6, 2026
nbradbury and others added 2 commits May 7, 2026 09:58
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