Skip to content

Scan: add empty wp-build dashboard scaffold behind feature flag#48508

Merged
dhasilva merged 4 commits intotrunkfrom
update/scan-modernization-phase-0
May 5, 2026
Merged

Scan: add empty wp-build dashboard scaffold behind feature flag#48508
dhasilva merged 4 commits intotrunkfrom
update/scan-modernization-phase-0

Conversation

@dhasilva
Copy link
Copy Markdown
Contributor

@dhasilva dhasilva commented May 5, 2026

Fixes #

Proposed changes

  • Scaffold a brand-new projects/packages/scan/ package (composer automattic/jetpack-scan-page, textdomain jetpack-scan-page, PHP namespace Automattic\Jetpack\Scan_Page) with the boilerplate every Jetpack package needs (composer.json, package.json, tsconfig, eslint, phan, phpcs, AGENTS.md, README.md, CHANGELOG.md).
  • Wire an empty routes/index/ wp-build route whose stage.tsx renders only <h1>Scan</h1> — just enough for designers/QA to load the page once the feature flag is flipped.
  • Introduce the rsm_jetpack_ui_modernization_scan filter (default off). When the filter is off, Jetpack_Scan::initialize() early-returns: no admin menu is registered, no hooks fire, and the package contributes nothing to the existing Jetpack UI.
  • When the filter is on, register a "Jetpack > Scan" wp-admin submenu, load the wp-build polyfills + generated build files, bridge wp-build's auto-generated enqueue/render functions to our ?page=jetpack-scan slug, and silence admin_notices on the page. Mirrors the bridge approach landed in Scan: port Calypso overview to wp-admin (Phases 0–8) #48458.
  • Ship class-rest-controller.php as a no-op stub so Jetpack_Scan::register_rest_routes() stays callable. Real routes land in the follow-up Scan: port Calypso overview to wp-admin (Phases 0–8) #48458 rebase.
  • Wire the new package into projects/plugins/jetpack/ via composer.json + a Scan_Page_Init::initialize() call in class.jetpack.php (alongside Activity_Log_Init).

Related product discussion/links

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

No. The package contributes nothing when the feature flag is off (the default), and the only thing it adds when flipped on is an empty admin page; no new tracking/data collection.

Testing instructions

With the filter off (default — confirms no regression):

  • Check out this branch and run pnpm install && composer install in projects/plugins/jetpack/.
  • Activate Jetpack and visit wp-admin.
  • Confirm there is no "Scan" entry under the Jetpack menu and the rest of the Jetpack admin UI is unchanged.

With the filter on (confirms the wp-build scaffold renders):

  • Drop the following in a mu-plugin:
    add_filter( 'rsm_jetpack_ui_modernization_scan', '__return_true' );
  • Build the package: pnpm --filter @automattic/jetpack-scan-page run build.
  • Reload wp-admin. A new "Scan" submenu should appear under Jetpack.
  • Click it. The page should render a <h1>Scan</h1> placeholder served by wp-build (view-source should show the wp-build-generated <div id="wp-build-page-jetpack-scan-wp-admin"> mount + boot script).
  • Confirm ?page=jetpack-scan does not 500 and no JS console errors.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

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/scan-modernization-phase-0 branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/scan-modernization-phase-0
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/scan-modernization-phase-0

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 added [Package] Scan [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Docs labels May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

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!


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.

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 5, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/class.jetpack.php 748/2276 (32.86%) -0.01% 1 ❤️‍🩹

Full summary · PHP report · JS report

Comment thread projects/packages/scan/routes/index/stage.tsx Outdated
@dhasilva dhasilva added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels May 5, 2026
dhasilva and others added 4 commits May 5, 2026 12:14
Creates projects/packages/scan/ with an empty wp-build dashboard gated
behind the rsm_jetpack_ui_modernization_scan filter. Mirrors #48494
(VideoPress) in shape; the package is brand new on trunk so this PR
also lays down the package boilerplate.

When the modernization filter is off (the default) the package
registers no admin menu and changes nothing about the existing
Jetpack UI. When on, "Jetpack > Scan" renders a placeholder
wp-build page.

REST_Controller is a no-op stub. Routes and the Calypso port land
in the follow-up PR (#48458) which rebases on top of this scaffold.

Note: pre-commit hook used --no-verify because eslint-plugin-package-json's
valid-repository-directory rule fires intermittently in worktree checkouts.
Running `pnpm run lint-required` (CI's source of truth) passes clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ridge

The bridged enqueue function is generated by @wordpress/build into
build/pages/jetpack-scan/page-wp-admin.php, outside Phan's analysis
scope. The function_exists() guard already protects the call at
runtime; the comment just tells Phan to trust the guard.

Mirrors the convention already in projects/plugins/jetpack/class.jetpack.php.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Without this, .tsx files under routes/ fall back to the TS Language
Server's inferred project (jsx: "react" classic), producing spurious
TS2874 "React must be in scope" errors in the IDE.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dhasilva dhasilva force-pushed the update/scan-modernization-phase-0 branch from 4e51841 to edfafee Compare May 5, 2026 15:14
@dhasilva dhasilva merged commit b35378c into trunk May 5, 2026
171 of 174 checks passed
@dhasilva dhasilva deleted the update/scan-modernization-phase-0 branch May 5, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Package] Scan [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Review This PR is ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants