Skip to content

Protect Dashboard: Surface WordPress.com error detail on uptime failures - #53383

Open
kraftbj wants to merge 3 commits into
add/protect-dashboard-monitorfrom
add/protect-uptime-error-detail-JETPACK-2964
Open

kraftbj wants to merge 3 commits into
add/protect-dashboard-monitorfrom
add/protect-uptime-error-detail-JETPACK-2964

Conversation

@kraftbj

@kraftbj kraftbj commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Fixes JETPACK-2964

Proposed changes

Follow-up to the Monitor section added in #53194 — this PR is stacked on that branch and targets it, so it should merge after #53194.

When either WordPress.com call behind GET jetpack/v4/protect-dashboard/uptime failed, the route returned a generic uptime_unavailable 502 and discarded the reason: the upstream status code and any WP_Error never reached the response, so a site reporting "uptime history is unavailable" left nothing to look at.

  • The request helper now also returns an error string for a transport failure (the WP_Error code and message), instead of collapsing every failure to code 0.
  • The 502's error data now carries upstreamStatus (the upstream HTTP status, 0 for a transport failure) and, for a transport failure, upstreamError. That is enough to tell a timeout from a 401 from a 500.

No UI change — the dashboard still shows the same generic message; the detail is for logs and support.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • This targets the add/protect-dashboard-monitor branch; review it on top of Protect Dashboard: Add the Monitor section #53194.
  • Run the package tests: jetpack test php packages/protect -- --filter Monitor_Test — the provide_unusable_histories cases now assert the upstream detail on the 502 (a timed-out request, a 500, a 401, a 403, and an empty body each leave distinct data behind).
  • On a connected site with Monitor on, hit GET /wp-json/jetpack/v4/protect-dashboard/uptime while WordPress.com is unreachable (e.g. short-circuit the request to a WP_Error or a 500). The 502 response body's data now includes upstreamStatus and, for a transport failure, upstreamError.

When a WordPress.com call behind the uptime route fails, the 502 now
carries the upstream HTTP status (0 for a transport failure) and, for a
transport failure, the WP_Error code and message. This lets a timeout, a
401, and a 500 be told apart when a site reports its uptime history is
unavailable, instead of discarding the reason entirely.
@kraftbj kraftbj added the [Status] Needs Review This PR is ready for review. label Oct 8, 2026
@kraftbj kraftbj self-assigned this Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/protect-uptime-error-detail-JETPACK-2964 branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/protect-uptime-error-detail-JETPACK-2964

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@jp-launch-control

jp-launch-control Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

No summary data is available for parent commit 54c66c7, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for 54c66c7 is available.

Full summary · PHP report · JS report

This branch has not been deployed

No deployments
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.

1 participant