Skip to content

Connection: Consume the health check endpoint and show results via the existing error UI - Activity Log initially#50169

Open
coder-karen wants to merge 4 commits into
trunkfrom
update/connection-errors-consume-health-check
Open

Connection: Consume the health check endpoint and show results via the existing error UI - Activity Log initially#50169
coder-karen wants to merge 4 commits into
trunkfrom
update/connection-errors-consume-health-check

Conversation

@coder-karen

@coder-karen coder-karen commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fixes CONNECT-327

Proposed changes

  • This PR adds a runConnectionHealthCheck() thunk + connectionHealthErrors store slot to the connection package. It maps failed health checks into the shared ConnectionErrorMap. We include a context param now, so each consumer can share context as to why the banner shows (if using the shared banner).
  • As a single usage point (for this PR only), Activity Log now renders the shared <ConnectionError> component showing the descriptive error message, along with context relevant to the Activity Log.
  • Note - this PR does not modify the style, or update the <ConnectionError> component, in any way other than is needed in order to display health related information. Further improvements will come in following PRs.

Activity Log:

  • If a connection error is discovered (related to the user connection), then the WPcom <ConnectionError> banner will show as explained above.
  • The generic AL error banner should only show if the connection test is true, but a failure is recorded when trying to retrieve the list itself.
  • We suppress the generic notice until the WPcom probe is done, just incase. Don't want two different notices.

Related product discussion/links

  • See linked Linear issue.

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

No.

Testing instructions

Aside from code review;
To test the new health check information, test the Activity Log as this is the only feature that this PR hooks up to use the new error messages. To test, on a Jetpack-connected site, apply this PR locally, or using the Jetpack Beta test plugin. If testing locally, make sure to build jetpack build selecting packages and activity-log, and build all dependencies.

  • Visit the AL page at /wp-admin/admin.php?page=jetpack-activity-log.
  • In the browser console, apply the following snippet: 3bcfd-pb/
  • As the console log says, try modifying an AL setting - with a free plan modify the sort order and that will be enough.
  • Wait for a moment, and then you should see a WPcom error notice with descriptive message.
  • To mimic just the generic message showing, and not the WPcom error notice, use this snippet: 3bcfe-pb/ -- and then change something such as the sort order.
    Additional testing:
  • Set an invalid user token with the Jetpack Debug plugin (if you have the Jetpack Beta plugin active, you can activate the Debug plugin from here). Under Jetpack Debug, select 'Broken token utilities' and save. Then on the new Broken token utilities dashboard page select 'set invalid user token (current user)'.
  • On trunk you'll see a notice saying only the administrator can query information on the current site.
  • With the Branch you'll see a WPcom notice saying that there is an invalid user token.

Example notice:

Screenshot 2026-07-02 at 11 14 12

@github-actions

github-actions Bot commented Jul 2, 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 or WordPress.com Site Helper), and enable the update/connection-errors-consume-health-check branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/connection-errors-consume-health-check
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/connection-errors-consume-health-check

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 commented Jul 2, 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!

@jp-launch-control

jp-launch-control Bot commented Jul 2, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 4 files.

File Coverage Δ% Δ Uncovered
projects/js-packages/connection/state/reducers.jsx 34/46 (73.91%) 0.10% 1 ❤️‍🩹
projects/js-packages/connection/hooks/use-connection-error-notice/index.tsx 16/16 (100.00%) 0.00% 0 💚
projects/js-packages/connection/state/actions.jsx 61/74 (82.43%) 3.40% 0 💚
projects/js-packages/connection/state/selectors.jsx 10/17 (58.82%) 2.57% 0 💚

1 file is newly checked for coverage.

File Coverage
projects/js-packages/connection/helpers/map-health-check-errors.ts 27/28 (96.43%) 💚

Full summary · PHP report · JS report

@coder-karen coder-karen marked this pull request as ready for review July 2, 2026 16:08
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