Skip to content

Protect Dashboard: Tell the Monitor card's failures apart - #53382

Draft
kraftbj wants to merge 1 commit into
add/protect-dashboard-monitorfrom
update/protect-monitor-card-failure-states-JETPACK-2963
Draft

kraftbj wants to merge 1 commit into
add/protect-dashboard-monitorfrom
update/protect-monitor-card-failure-states-JETPACK-2963

Conversation

@kraftbj

@kraftbj kraftbj commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Fixes JETPACK-2963

Stacked on PR 53194 (add/protect-dashboard-monitor), which adds the Monitor section. This targets that branch and should be retargeted to trunk once it merges.

Proposed changes

The uptime route returns three errors, and the Overview card showed "Uptime history is unavailable right now." and a "Status unknown" badge for all of them. Each now gets its own treatment:

Route error Before After
not_connected (403) "Unavailable right now", "Status unknown" "Your site is being monitored. Connect your WordPress.com account to see its uptime history." with a "Connect your account" link to My Jetpack's connection screen. The badge says "On".
monitor_inactive (409) "Unavailable right now", "Status unknown" The card re-reads the Monitor setting and shows the Off state. The Settings toggle picks up the same value.
uptime_unavailable (502) "Unavailable right now", "Status unknown" Same text and badge, plus a "Try again" button.
  • An admin PHP already knows is not connected no longer triggers the uptime request at all.
  • "Try again" sends ?retry=1, which skips the failure the route caches for a minute (otherwise the button would do nothing for up to 60 seconds). It doesn't skip a cached success. The trade-off is that an admin clicking it repeatedly during an outage sends a WordPress.com request per click.

The copy and the "On" badge for the not-connected case are my proposal for the product call the issue leaves open, so push back on wording.

Related product discussion/links

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

No.

Testing instructions

Set up the Protect dashboard as described in PR 53194 (flag on, protect-dashboard and monitor modules active), then go to Jetpack › Protect.

  • Not connected: log in as an admin with no WordPress.com connection. The Monitor card shows the "On" badge, the "Your site is being monitored…" text and a "Connect your account" link that opens My Jetpack's connection screen. There's no request to protect-dashboard/uptime in the network tab.
  • Turned off elsewhere: as a connected admin, load the page, then run wp jetpack module deactivate monitor and switch to the Settings tab and back to Overview without reloading the page. The card shows "Off" and "Turn on in Settings", and the Monitor toggle on Settings is off.
  • WordPress.com failure: force a failure, for example with
    add_filter( 'pre_http_request', fn( $pre, $args, $url ) => str_contains( $url, 'jetpack-monitor-uptime' ) ? new WP_Error( 'x', 'x' ) : $pre, 10, 3 );
    and wp transient delete jetpack_protect_dashboard_uptime. The card shows "Uptime history is unavailable right now." with a "Try again" button. Remove the filter and click the button: the bars load right away, without waiting out the one-minute failure cache.
  • With Monitor on and working, the card looks the same as before.

Not yet checked in a browser; covered so far by the Jest and PHPUnit tests in this PR.

The uptime route returns three errors and the Overview card showed the
same text for all of them. A user without a WordPress.com connection now
gets a link to connect, Monitor being turned off elsewhere shows the Off
state, and a WordPress.com failure gets a Try again button that skips
the failure cached for a minute.
@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 update/protect-monitor-card-failure-states-JETPACK-2963 branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/protect-monitor-card-failure-states-JETPACK-2963

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

@github-actions github-actions Bot added [Package] Protect [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels 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!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

No summary data is available for parent commit e0ea5f5, 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 e0ea5f5 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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant