Repository navigation
mu-wpcom: Add a Protect page offering Scan on WordPress.com sites - #53245
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 5 files.
16 files are newly checked for coverage. Only the first 5 are listed here.
Full summary · PHP report · JS report Coverage check overridden by
I don't care about code coverage for this PR
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d pages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Adding the "dont care" label for code coverage. One of the js files is an encoded svg and has nothing to test. Unit tests on the JS wouldn't add much value. |
Checkout's "Empty cart" reads only `checkoutBackUrlDomains`, so without it backing out that way dropped the reader on /plans. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review and suggestions @kraftbj! Added all 3 in the latest commit 👍 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rcrdortiz
left a comment
There was a problem hiding this comment.
Tests well for me and works as expected, I am seeing a JS error on that page that might be worth fixing before we move forward.
# Conflicts: # projects/packages/jetpack-mu-wpcom/src/features/wpcom-backup/wpcom-backup.php # projects/packages/jetpack-mu-wpcom/src/features/wpcom-hosting-feature-page/js/screens.tsx # projects/packages/jetpack-mu-wpcom/tests/php/features/wpcom-hosting-feature-page/WPCOM_Hosting_Feature_Page_Test.php
Stubbing wpcom_site_has_feature() with Brain Monkey defines it for the rest of the run, which breaks the Marketplace tab tests that check function_exists().
kraftbj
left a comment
There was a problem hiding this comment.
Approving. One optional bit inline.
| // Some earlier suites never tear Brain Monkey down, and a leftover stub would block this one. | ||
| \Brain\Monkey\tearDown(); | ||
| \Brain\Monkey\setUp(); | ||
| $this->grant_feature( '' ); |
There was a problem hiding this comment.
Optional polish: since set_up() always stubs wpcom_site_has_feature(), nothing covers the fallback when it's missing (has_feature() returns false, so the page offers the upgrade). Now that the class runs in separate processes, one test that skips the stub would cover it.
# Conflicts: # projects/packages/jetpack-mu-wpcom/src/features/wpcom-backup/js/types.ts # projects/packages/jetpack-mu-wpcom/src/features/wpcom-backup/wpcom-backup.php # projects/packages/jetpack-mu-wpcom/src/features/wpcom-hosting-feature-page/js/screens.tsx # projects/packages/jetpack-mu-wpcom/src/features/wpcom-hosting-feature-page/js/style.scss # projects/packages/jetpack-mu-wpcom/tests/lib/class-wpcom-features.php # projects/packages/jetpack-mu-wpcom/tests/php/features/wpcom-backup/WPCOM_Backup_Test.php
Jetpack's admin menu test referenced REGISTER_PRIORITY through the hosting feature subclass, which Phan could not resolve since the constant lives on WPCOM_WP_Build_Page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches trunk: the legacy Backup entry stays visible to admins without a linked WordPress.com account, who never load the menu that links Calypso in its place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Proposed changes
This PR adds a Protect page to wp-admin on Simple and WoA sites, for sites that don't have the Scan feature yet. It works the same way as the Backup page from #52358: it offers a plan upgrade, or, for a Simple site that has the plan, initiates the transfer to WoA.
admin.php?page=jetpack-protect, labeled "Protect". It's registered but hidden from the Calypso nav. It's hidden only when this package serves the slug, so the standalone Protect plugin keeps its own menu entry.jetpack-protecton WoA yet; that's expected for now.WPCOM_Hosting_Feature_Pagebase class plus shared JS components.Related product discussion/links
Does this pull request change what data or activity we track or use?
The page fires the same view and click events as the Backup page, with
site-scanas the feature ID, matching the dashboard's Scan upsell.Testing instructions
Simple
s0.wp.comto load the built assets./wp-admin/admin.php?page=jetpack-protectand confirm you see the "Protect against security threats" upgrade prompt.jetpack-protectwith the Activate Protect prompt.Plan does not support Scan

Plan supports scan - initiate transfer

WoA
/wp-admin/admin.php?page=jetpack-protectand confirm you see the upgrade prompt.Regression
admin.php?page=jetpack-backup; nothing should have changed.🤖 Generated with Claude Code