Repository navigation
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: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Backup 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. |
dhasilva
left a comment
There was a problem hiding this comment.
[blocker] Static analysis (current) fails on a stale Phan baseline entry: the removed callbacks were the code that PhanTypeMismatchReturn covered. jp phan --update-baseline packages/backup fixes it.
[suggestion] The reason given for the namespace bump is backwards. The Jetpack autoloader keeps the highest version of each class across all active plugins, so under one V0005 namespace an older copy can't win. The bump creates that case instead:
initialize()returns ondid_action( 'jetpack_backup_initialized' ), an action shared by every namespace version.- The standalone plugin calls
initialize()when its main file loads, before the Jetpack plugin does. - So with a new Jetpack plugin and an outdated standalone Backup plugin, the old copy serves the page and still registers the four routes, and Jetpack's
V0006call is a no-op.
The bump is still worth keeping: it follows the file-header convention, and it keeps any out-of-repo caller of the removed public methods from hitting a fatal. Suggest the description give that reason and note the trade-off.
[suggestion] The package changelog entry is patch for removing four routes and three public methods. If this ships with #53857, one of the two package entries should be minor or major.
[suggestion] Jetpack_Backup_Test.php L227 and L299 both hard-code "six", and this PR had to edit both. Suggest dropping the number; the list right below is the count.
On the outside-callers question, searching default branches:
- None of the four routes has a caller in
wp-calypso, WordPress-Android, WordPress-iOS, or the WordPress.com, dash and VaultPress codebases. The WooCommerce apps have none forhas-backup-planorbackup-capabilities, the two I checked there. A control search forrewind/capabilitiesmatched in Calypso and both WordPress apps, so those repos were searchable; the apps read WordPress.com's v2 capabilities endpoint directly. The only WordPress.com hits are its deployed copy of the Jetpack plugin itself. Backup\V0005on WordPress.com appears only in that same deployed copy, so nothing there needs updating.
The rename is complete (no Backup\V0005 left, Transport_Helper\V0005 untouched), and the new /backup-promoted-product-info marker is valid since only initialize() registers it. PHPUnit passes locally: backup 431 tests, backup-helper-script-manager 59, transport-helper 10.
Generated by Claude.
2dffa56 to
401b90b
Compare
|
Changes since the review, in 401b90b:
Checks: PHPUnit for |
c4a8529 to
242e30a
Compare
401b90b to
34fa295
Compare
Remove backup-capabilities, has-backup-plan, site/current-purchases and site/dismissed-review-request. Bump the Backup namespace V0005 to V0006 so a stale copy loaded by another autoloader cannot register the old set. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
242e30a to
d46fdb8
Compare
34fa295 to
56ee276
Compare
Fixes JETPACK-2314
Do not merge until
trunk.Proposed changes
Part 3 of 3 for JETPACK-2314.
Routes removed
All four are registered in
Jetpack_Backup::register_rest_routes()inprojects/packages/backup/src/class-jetpack-backup.php.GET /jetpack/v4/backup-capabilitiesand its callbackget_backup_capabilities(). The redesigned dashboard uses the liveGET /jetpack/v4/site/capabilitiesbridge route instead.GET /jetpack/v4/has-backup-plan. The route is removed.get_backup_plan_state()andhas_backup_plan()stay, becausejetpack_check_user_licenses()uses them.GET /jetpack/v4/site/current-purchasesand its callbackget_site_current_purchases(). This is not the My Jetpackmy-jetpack/v1/site/purchasesroute, which stays.POST/PUT/PATCH /jetpack/v4/site/dismissed-review-requestand its callbackmanage_dismissed_backup_review_request(). The redesigned dashboard has no review prompt. Thedismissed_backup_review_*Jetpack options stay, so stored values are not lost.Evidence that nothing in the repo calls them
git grepoverprojects/(excludingCHANGELOG.md) for each route path and each callback name finds:src/dashboard,routes/,packages/init, other packages, the Jetpack plugin,wpcomsh,jetpack-mu-wpcomor e2e specs.class-capabilities-bridge.phpthat named/backup-capabilities.Jetpack_Eager_Load_Packages_TestandJetpack_Backup_Init_Options_Testused/jetpack/v4/has-backup-planas the marker thatJetpack_Backup::initialize()ran. Both now use/jetpack/v4/backup-promoted-product-info, which only the Backup package registers and the redesigned dashboard still calls.The legacy JS that called the routes was removed in #53857.
Why the namespace bump
The file header of
class-jetpack-backup.phpasks for a version bump whenever the file changes. The bump also means any out-of-repo caller of the removed public methods gets a clear fatal, not a silent call into code that no longer registers the route.The bump has a trade-off.
initialize()returns early whendid_action( 'jetpack_backup_initialized' )is set, and that action is shared by every namespace version. The standalone plugin callsinitialize()when its main file loads, before the Jetpack plugin. So with a new Jetpack plugin and an outdated standalone Backup plugin, the old copy serves the page and still registers the four routes. Jetpack'sV0006call is then a no-op. Under one sharedV0005namespace the Jetpack autoloader keeps the highest version of each class, so an old copy could not win. The routes are unused, so a stale copy that still registers them is harmless.Automattic\Jetpack\Backup\V0005becomesV0006in every file that uses it (43 files, one mechanical replacement):projects/packages/backup(source,actions.php, tests).projects/packages/backup-helper-script-manager, which shares the namespace.projects/packages/transport-helper,projects/plugins/backup, and the Jetpack plugin (class.jetpack.php, the two helper-script JSON endpoints,uninstall.php, and the Admin menu and Eager Load tests).Transport_Helper\V0005is a different namespace and is unchanged.No match for the old name remains in
wpcomsh,jetpack-mu-wpcom,.phanor any composer/autoload map. The autoload maps are classmaps generated at build time. I did not touch thejetpack-mu-wpcomrollback code.Related product discussion/links
Open questions
wp-calypso, WordPress-Android, WordPress-iOS, or the WordPress.com, dash and VaultPress codebases. The WooCommerce apps were checked only forhas-backup-planandbackup-capabilities, with no caller. The mobile apps read the WordPress.com v2 capabilities endpoint directly.Backup\V0005appears on WordPress.com only in its deployed copy of the Jetpack plugin.site/dismissed-review-request) accepted as a product call? The redesigned dashboard has no equivalent.Does this pull request change what data or activity we track or use?
No. It removes endpoints. It adds no tracking.
Testing instructions
Automated checks I ran on this branch. The backup PHP, Jest and typecheck runs are from after the 2026-11-18 rebase; the others are from the 2026-11-10 rebase:
jetpack test php packages/backup -v: OK (497 tests, 1280 assertions).jetpack test php packages/backup-helper-script-manager(59 tests) andjetpack test php packages/transport-helper(10 tests): pass.pnpm run testinprojects/packages/backup: 82 suites, 977 tests pass.pnpm run typecheckinprojects/packages/backup: no errors.jetpack phan packages/backup: 0 issues before the rebase. Phan crashes in my local environment now (while parsing the WordPress stubs), so CI covers it after the rebase.vendor/bin/phpcsonprojects/packages/backup/src,projects/packages/backup/tests/phpandprojects/packages/backup/actions.php: no errors (existing warnings only). The pre-commit hook also passed.Jetpack_Eager_Load_Packages_Test(21 tests) andJetpack_Admin_Menu_Test(3 tests) pass. Not re-run after the rebase; CI covers them.I did not run a manual check on a connected site. After merge, a reviewer can request
/wp-json/jetpack/v4/backup-capabilitiesas an admin and expectrest_no_route, and confirm Jetpack > Backup still loads.🤖 Generated with Claude Code