Skip to content

Surface errors when post publish silently fails#22652

Open
jkmassel wants to merge 1 commit intotrunkfrom
jkmassel/publish-silent-fail-fix
Open

Surface errors when post publish silently fails#22652
jkmassel wants to merge 1 commit intotrunkfrom
jkmassel/publish-silent-fail-fix

Conversation

@jkmassel
Copy link
Contributor

@jkmassel jkmassel commented Mar 3, 2026

Summary

Investigating CMM-1297: posts intermittently stay in draft after tapping Publish with no error shown.

Two small changes to surface errors that are currently silently swallowed:

  • UploadUtils.publishPost(): Added an else branch to the existing network availability check. Previously, if the network was unavailable at the moment of publish, the upload was silently skipped with no user feedback. Now shows a "no network" toast.
  • PostUploadHandler.onPostUploaded(): Added warning log when an OnPostUploaded event is received for a post that is no longer tracked as the currently uploading post. Logs the post IDs involved and any error details that would otherwise be silently dropped. This will help diagnose cases where the upload response arrives but the handler state has been cleared (e.g. service killed by OS on low-memory devices).

These are additive-only changes — no existing control flow is altered.

Test plan

  • Verify publish still works normally with network available
  • Enable airplane mode, attempt to publish a post, confirm toast is shown
  • Check that diagnostic logs capture the new warning messages

🤖 Generated with Claude Code

Add a toast when publishPost() is called without network connectivity,
so the user sees feedback instead of the publish silently doing nothing.

Add warning log when PostUploadHandler receives an OnPostUploaded event
for a post that is no longer tracked as uploading, including any error
details that would otherwise be silently dropped.

Ref: CMM-1297

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jkmassel jkmassel requested review from adalpari and nbradbury March 3, 2026 21:53
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2026

@jkmassel jkmassel self-assigned this Mar 3, 2026
@jkmassel jkmassel added this to the 26.7 milestone Mar 3, 2026
@wpmobilebot
Copy link
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
FlavorJalapeno
Build TypeDebug
Versionpr22652-2e7e439
Build Number1485
Application IDcom.jetpack.android.prealpha
Commit2e7e439
Installation URL7tv1ktjjgrtfg
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
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
FlavorJalapeno
Build TypeDebug
Versionpr22652-2e7e439
Build Number1485
Application IDorg.wordpress.android.prealpha
Commit2e7e439
Installation URL11l17dbpb4o58
Note: Google Login is not supported on these builds.

@jkmassel jkmassel marked this pull request as ready for review March 5, 2026 03:46
@jkmassel
Copy link
Contributor Author

jkmassel commented Mar 5, 2026

Turns out this work might overlap with #22656 – if so, it can be closed @nbradbury.

@adalpari
Copy link
Contributor

adalpari commented Mar 5, 2026

This is odd. Publish action is not working for me at all. And if I go offline, I'm not seeing the toast or the log...

Screen_recording_20260305_105846.mp4

Only POST log line

2026-03-05 10:58:55.363 16654-16823 WordPress-POSTS com.jetpack.android.beta D PageStore: getPagesWithLocalChanges

@nbradbury
Copy link
Contributor

Enable airplane mode, attempt to publish a post, confirm toast is shown

In this situation I don't see the "no network" toast - instead I'm returned to the post list, with a snackbar saying the post will be published when the device is online.

Screen_recording_20260305_111233.mp4

@nbradbury
Copy link
Contributor

nbradbury commented Mar 5, 2026

Turns out this work might overlap with #22656 – if so, it can be closed @nbradbury

Sorry, I missed that! @adalpari and I chatted about the overlap this morning and I ended up closing my PR in lieu of this one.

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