Jetpack Connection Heath tests: Migrate from Jetpack plugin to Connection package#47837
Jetpack Connection Heath tests: Migrate from Jetpack plugin to Connection package#47837
Conversation
|
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. |
Code Coverage SummaryCoverage changed in 6 files. Only the first 5 are listed here.
3 files are newly checked for coverage.
Full summary · PHP report · JS report Coverage check overridden by
I don't care about code coverage for this PR
|
There was a problem hiding this comment.
Pull request overview
Migrates Jetpack connection health / Site Health tests out of the Jetpack plugin into the automattic/jetpack-connection package, while keeping Jetpack-specific tests (e.g., Sync health) extensible via hooks.
Changes:
- Introduces a connection-package health testing framework (
Connection_Health_Test_Base,Connection_Health_Tests) and Site Health integration (Site_Health), and wires it intoManager::configure(). - Updates Jetpack plugin surfaces (CLI, legacy debugger page, REST endpoints) to use
Automattic\Jetpack\Connection\Connection_Health_Tests, and registers Jetpack-specific tests viajetpack_connection_tests_loaded. - Adds package PHPUnit coverage and documentation for the new framework; deprecates the legacy Jetpack Site Health integration functions.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/plugins/jetpack/class.jetpack-cli.php | Switches CLI connection status output to the connection package test suite. |
| projects/plugins/jetpack/changelog/update-migrate-cnx-health-tests-to-package | Adds Jetpack plugin changelog fragment for the migration. |
| projects/plugins/jetpack/.phan/baseline.php | Updates Phan baseline counts and removes suppressions tied to removed legacy test classes. |
| projects/plugins/jetpack/_inc/lib/debugger/debug-functions.php | Deprecates legacy Site Health functions and routes them to the package test suite. |
| projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-debugger.php | Updates legacy debugger UI to use the package test suite for pass/fail display. |
| projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php | Updates debug info gathering to instantiate the package test suite. |
| projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-tests.php | Refactors Jetpack-specific tests to extend the package base and register onto a target suite. |
| projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-test-base.php | Converts legacy base class into a thin deprecated alias of the package base. |
| projects/plugins/jetpack/_inc/lib/debugger.php | Removes legacy Site Health registrations; adds filters/actions to integrate with the package. |
| projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php | Updates REST endpoints to use the package test suite. |
| projects/packages/connection/tests/php/Site_Health_Test.php | Adds tests for the new Site_Health integration behavior and legacy Jetpack deferral. |
| projects/packages/connection/tests/php/Connection_Health_Tests_Test.php | Adds tests covering discovery and behavior of built-in connection tests. |
| projects/packages/connection/tests/php/Connection_Health_Test_Base_Test.php | Adds tests for base framework helpers, output methods, filters, and extension patterns. |
| projects/packages/connection/src/health/class-connection-health-tests.php | Introduces the package’s built-in connection health tests and extension hook. |
| projects/packages/connection/src/health/class-connection-health-test-base.php | Introduces the reusable framework for registering/running tests and formatting outputs. |
| projects/packages/connection/src/class-site-health.php | Implements package Site Health integration and defers when legacy Jetpack integration is detected. |
| projects/packages/connection/src/class-manager.php | Initializes Site Health integration during connection Manager::configure(). |
| projects/packages/connection/README.md | Links to the new connection health tests documentation. |
| projects/packages/connection/docs/connection-health-tests.md | Documents architecture, extension points, and how to run tests. |
| projects/packages/connection/changelog/update-migrate-cnx-health-tests-to-package | Adds connection package changelog fragment for the migration. |
darssen
left a comment
There was a problem hiding this comment.
Hi @fgiannar many thanks for moving the tests to the Connection Package and for the added docs 👍
From a pure testing perspective, everything looked fine in my tests.
I tested all of the environments you described, but only tested connection failing with a couple of scenarios.
coder-karen
left a comment
There was a problem hiding this comment.
Thanks for working on this!
Also tested, though not much of connection failing scenarios.
Looks good, just left a question above, not a blocker.
Closes CONNECT-219
Related to CONNECT-210
DO NOT MERGE till we have a final confirmation on the updated copies.
Proposed changes
Migrates Jetpack connection health / Site Health tests out of the Jetpack plugin into the automattic/jetpack-connection package, while keeping Jetpack-specific tests (e.g., Sync health) extensible via hooks.
Changes:
Connection_Health_Test_Base,Connection_Health_Tests) and Site Health integration (Site_Health), and wires it intoManager::configure().Automattic\Jetpack\Connection\Connection_Health_Tests, and registers Jetpack-specific tests viajetpack_connection_tests_loaded.Other information
Related product discussion/links
Does this pull request change what data or activity we track or use?
No
Testing instructions
Confirm no errors/Warnings and ensure the following results match on trunk vs current branch (make sure to test with both failing and successful tests too):
wp-admin/admin.php?page=jetpack-debugger) and confirm the samewp jetpack statusand confirm results match on trunk vs current branchGET wp-json/jetpack/v4/connection/test?_wpnonce=REPLACE_MEREPLACE_ME = wpApiSettings.nonce (in your browser console when logged-in)
Important: Test the above once more, but this time with Jetpack on latest stable and one Jetpack plugin active on this branch. Alternatively test on a WoA site by having only wpcomsh plugin on the current branch.
Test without the Jetpack plugin: Test with Jetpack Social or Jetpack Boost only active and confirm the Jetpack tests are visible in Site Heath Status. Note that in these cases reconnecting Jetpack via an action is not possible.
Example with Jetpack plugin active:

Example with Jetpack plugin not active:
