Repository navigation
Conversation
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.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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. |
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:
not_connected(403)monitor_inactive(409)uptime_unavailable(502)?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-dashboardandmonitormodules active), then go to Jetpack › Protect.protect-dashboard/uptimein the network tab.wp jetpack module deactivate monitorand 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.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.Not yet checked in a browser; covered so far by the Jest and PHPUnit tests in this PR.