Port Scan overview to Jetpack wp-admin as a native page
Maintainers usually reply within 1 day
@ilonagl is already working on this.
Since May 2, 2026.
Assessment
This issue has not been assessed yet.
Description
Replace the standalone Scan UI inside the Jetpack Protect plugin with the MSD-aligned overview ported from Calypso's Dashboard. Architecture follows projects/packages/activity-log/ (per #48244) and projects/packages/backup/ (per #48236 / #48297) — a new bundled projects/packages/scan/ package with a wp-admin shell, TanStack Query data layer, and @wordpress/dataviews UI.
Status (2026-05-02)
Implementation lives on #48458 (try/jetpack-scan-new-ui). Progress vs. the 8-phase plan:
- ✅ Phases 0, 1, 2, 3, 4, 5, 6, 7 — fully shipped.
- 🟡 Phase 8 — bridge permission tests (9/9 phpunit) +
isFixComplete(5/5 jest) shipped; broader bridge × happy/error coverage and Playwright e2e deferred.
Build pipeline: migrated from webpack + @automattic/jetpack-webpack-config to @wordpress/build (mirrors Newsletter #48420 and Forms). Routes now live under routes/index/ (route.tsx, stage.tsx, route.scss, package.json); the page chrome moved to _inc/components/scan-page.{tsx,scss}. Routing switched from react-router's useSearchParams to @wordpress/route's useSearch / useNavigate. PHP-side, Jetpack_Scan loads build/build.php, registers polyfills via WP_Build_Polyfills, and bridges the user-facing ?page=jetpack-scan slug onto wp-build's auto-generated jetpack-scan-wp-admin enqueue.
Source
- Calypso shell:
client/dashboard/sites/scan/(wp-calypso) - Calypso DataViews tables:
client/dashboard/sites/scan-active/andclient/dashboard/sites/scan-history/ - Calypso REST surface:
wpcom/v2 /sites/:siteId/scan*and…/alerts/*(seepackages/api-queries/src/site-scan.ts) - Existing component library:
projects/js-packages/scan/(ThreatsDataViews,ThreatSeverityBadge,Threattypes) — reused as building blocks - Pin: Calypso source SHA at port start, recorded in the package's
AGENTS.md
Note: Calypso's Scan dashboard is single-pane tabbed (Active / History) with threat details in a Modal via DataViews
RenderModal— not dual-pane like Backup. The port preserves this layout. See decision #1 below if we want to deliberately diverge.
Architectural rules
-
Package location: new
projects/packages/scan/(sibling toactivity-log,backup). Existingprojects/plugins/protect/is left untouched in this PR; future deprecation tracked separately. -
Package name:
@automattic/jetpack-scan-page(avoids clash with existing@automattic/jetpack-scanjs-package). -
Build:
@wordpress/build(wp-build) — Newsletter / Forms pattern. Drops webpack +@automattic/jetpack-webpack-configfor this package; the plugin's webpack chain still consumes the wp-buildbuild/output via the auto-generatedbuild/build.php. -
Shell pattern (post wp-build migration):
src/class-jetpack-scan.php— wp-admin submenu (?page=jetpack-scan),WP_Build_Polyfills::register,require build/build.php,bridge_wp_build_enqueue,fix_boot_import_map_ordering(work-around forWordPress/gutenberg#76870)src/class-initial-state.php,src/class-rest-controller.phproutes/index/{route.tsx,stage.tsx,route.scss,package.json}— the wp-build entry. Stage mountsQueryClientProvider+HeaderActionsProviderand renders<ScanPage>withTabs.Panelchildren._inc/components/scan-page.{tsx,scss}— page chrome (@wordpress/admin-uiPage+Tabs.Root+ sticky tab row anchored to--jetpack-scan-page-header-height)
-
Data layer: TanStack Query factories matching Calypso names (
siteScanQuery,siteScanHistoryQuery,siteScanCountsQuery,siteScanEnqueueMutation,fixThreatMutation,ignoreThreatMutation,unignoreThreatMutation,fixThreatsMutation,fixThreatsStatusQuery). -
REST bridges (admin-only) under
jetpack/v4/site/scan/*:GET /site/scan←/sites/:siteId/scan(blog auth — matches Protect'sThreats::fetch_status())GET /site/scan/history←/sites/:siteId/scan/history(blog auth)GET /site/scan/counts←/sites/:siteId/scan/counts(blog auth)POST /site/scan/enqueue←/sites/:siteId/scan/enqueue(blog auth — matches Protect'sThreats::scan())POST /site/scan/threat/{id}/fix(and/ignore,/unignore) ←/sites/:siteId/alerts/:threatId?...(user auth)POST /site/scan/threats/fix←/sites/:siteId/alerts/fix(user auth)GET /site/scan/threats/fix-status←/sites/:siteId/alerts/fix?threat_ids[]=…(user auth)
Implementation: each route proxies to WPCOM via
Automattic\Jetpack\Connection\Client::wpcom_json_api_request_as_blog()for site-level reads / scan enqueue and…_as_user()for alert mutations. Permission callback admin-only, validated by phpunit. -
Routing:
@wordpress/route(useNavigate/useSearch). Single overview route at/;?tab=active|historyswitches panels,?jps-mock=1for mock mode. (Was originally planned ascreateHashRouterfromreact-router@7; switched as part of the wp-build migration to match Newsletter / Forms.) -
Mock mode:
?jps-mock=1short-circuits all gates so design iteration works without a Scan plan or WPCOM connection. Mock fixtures live insrc/js/data/mock/. -
Components:
@wordpress/dataviews@14,@wordpress/components,@wordpress/ui,Pagefrom@wordpress/admin-ui, WPDS tokens (--wpds-*). -
i18n: textdomain
jetpack-scan-page.__,_n,_x,sprintffrom@wordpress/i18n. -
Suppress
admin_notices/all_admin_noticeson the Scan page (Forms-style). -
Drop Calypso-only concerns:
HostingFeatureGatedWithCallout,JETPACK_CONTACT_SUPPORTlink, multi-site routing (siteRoute.useParams,useRouter().navigate('/sites/...')),TimeMismatchNotice,isEnabled('dashboard/omnibar'),PerformanceTrackerStop,calypso_dashboard_*event names. -
Reuse
@automattic/jetpack-scan(existing js-package) forThreatSeverityBadge+Threattypes. Calypso's modals are richer than what that package ships — Scan's row-action modals (fix-threat-modal.tsx,ignore-threat-modal.tsx,unignore-threat-modal.tsx) are ported into the new package and wired via the upstream'sRenderFixModal/RenderIgnoreModal/RenderUnignoreModalprops (added in #48458).
Plan
Phase 0: Shell + data layer skeleton
- Scaffold
projects/packages/scan/(package.json,composer.json,AGENTS.md) - PHP shell:
class-jetpack-scan.php,class-initial-state.php(JPSCAN_INITIAL_STATE),class-rest-controller.php(empty handlers) - JS shell:
— replaced by wp-build entry:index.js,admin.tsx(hash router),shell.tsx(AdminPage+HeaderActionsProvider),providers.tsx(QueryClient+ThemeProvider),gates.tsx,routes.tsroutes/index/{route,stage,route.scss,package.json}.tsx+_inc/components/scan-page.{tsx,scss}+src/js/header-actions-context.tsx+gates.tsx(now a pass-through) - Data skeleton:
data/{fetchers,query-options,types,use-site-data,use-track-event}.ts - Mock mode:
?jps-mock=1flag,data/mock/fixtures.ts,mock-banner.tsx(5 active + 4 history fixtures) - wp-admin menu entry registered, blank "Hello Scan" page renders
Phase 1: Active threats
- Port
client/dashboard/sites/scan-active/index.tsx→screens/overview/active-threats.tsx - Port
dataviews/{fields,actions}.tsxfor active list (lives in upstream@automattic/jetpack-scan'sThreatsDataViews) - Port
severity-badge.tsx,utils.ts(getThreatType/getThreatIcon) — reused from@automattic/jetpack-scan - Port
use-scan-state.tsstate machine (idle|enqueued|running|success|error) - Wire
useSiteScanQueryoverjetpack/v4/site/scanREST bridge - Tabbed shell rendering Active tab; History tab wired
- Header actions:
ScanNowButton+ conditionalAuto-fix N threatsbutton (modal wired in Phase 4) -
usePersistentViewfor view persistence — implemented aspersistKeyprop on upstreamThreatsDataViews. Both panels pass stable namespaced keys (jetpack-scan:active-threats:view,jetpack-scan:scan-history:view); filters / sort / search / page / layout round-trip across reloads
Phase 2: Scan history
- Port
client/dashboard/sites/scan-history/index.tsx - Port history
dataviews/{fields,actions}.tsx - Wire
useSiteScanHistoryQueryoverjetpack/v4/site/scan/history - History tab rendering
Phase 3: Single-threat modals
- Port
fix-threat-modal.tsx,fix-threat-confirmation.tsx - Port
ignore-threat-modal.tsx,unignore-threat-modal.tsx - Wire
fixThreatMutation,ignoreThreatMutation,unignoreThreatMutationover threat-id REST bridges - Port
useFixThreatsorchestration hook (2s polling for fixer status) - Wire row actions in
dataviews/actions.tsx(via newRender*Modalprops on upstreamThreatsDataViews) - Handle
useFixThreatsStatusQueryisErrorstate in fix / bulk-fix modals (P2 review) - Don't render
donestep on initial bulk-fix POST failure (P2 review)
Phase 4: Bulk fix + view-details
- Port
bulk-fix-threats-modal.tsx - Port
view-details-modal.tsx(lean version — title + severity + signature + description + file path / context block / extension version / first-detected / fixed-on metadata + fix-description summary) - Wire
view-details-modalas DataViewsRenderModalaction — addedRenderViewModalprop on upstreamThreatsDataViews(always-eligible,largemodal size). Wired on both panels. - Wire
fixThreatsMutation+fixThreatsStatusQuerypolling - "Auto-fix N threats" header CTA opens bulk-fix modal
Phase 5: Notices, scan-now, in-progress UI
- Port
scan-notices.tsx,scan-now-button.tsx,scan-status.tsx - Active tab toggles between
<ScanStatus>(running) and<ActiveThreatsDataViews> - Wire
siteScanEnqueueMutationoverjetpack/v4/site/scan/enqueue - Snackbar notices via
@wordpress/notices - Copy in
scan-callout-illustration.svg,scan-scanning-illustration.svg— blocked on decision #7 (asset clearance)
Phase 6: Polish
- Drop
HostingFeatureGated,TimeMismatchNotice,PerformanceTrackerStop,isEnabled('dashboard/omnibar') - Replace
JETPACK_CONTACT_SUPPORTwith Jetpack-equivalent support URL - Decide on Codeable upsell (see decision #4)
- Suppress
admin_notices/all_admin_noticeson the page - WPDS tokens applied; full-width layout (BoundedLayout 1344px cap deferred)
- DataViews empty body anchored to
calc(100vh - 320px); page chain anchored to viewport so the footer pins to the bottom even on tall screens - In-table active/historic status toggle hidden via new
showStatusFilterprop onThreatsDataViews(page-level tabs already cover that dimension) - Mobile responsiveness verification
- Accessibility pass on modals (DataViews-managed; uses native
Modalfrom@wordpress/components) - Empty / loading / error state copy
Phase 7: Analytics
-
data/use-track-event.tswraps@automattic/jetpack-analytics'stracks.recordEvent(same client Forms / Backup / Activity Log use) - Rename Calypso events:
calypso_dashboard_scan_*→jetpack_scan_*-
jetpack_scan_scan_now -
jetpack_scan_fix_threats_cta_click({ threat_count }) -
jetpack_scan_bulk_fix_threats_modal_open/_click/_success/_failed -
jetpack_scan_{fix,ignore,unignore}_threat_modal_open/_click/_success/_failed(Phase 3) -
jetpack_scan_view_details_modal_open(Phase 4) -
jetpack_scan_codeable_estimate_click— pending decision #4 - DataViews canonical:
_view_change,_filter_change,_search({ has_query: boolean }),_page_change,_layout_changed— addedonTrackEventcallback prop on the upstreamThreatsDataViews(Protect can adopt the same hook with its own prefix)._reset_view_clicknot yet — DataViews doesn't expose a distinct hook for "reset view" beyond the diffs the canonical events already cover.
-
Phase 8: Tests
- phpunit
tests/php/Jetpack_Scan_Bridges_Test.php— admin permission callback + route registration (9/9) - Jest unit tests:
isFixCompletepolling-terminator fromuseFixThreatsStatusQuery(5/5) - Broader Jest coverage: bulk-fix orchestration, fix-status
isErrorpaths, modal render tests - E2E (Playwright) happy paths: scan-now, single-threat fix, bulk-fix
- Bridge × happy/error path coverage in a follow-up PR
Decisions to make
- #1 Faithful tabbed-with-modal port vs deliberately add a Backup-style side-pane?
- #2 DataViews configs: thin wrapper around existing
ThreatsDataViewsfromjs-packages/scan(decided — addedRenderFixModal/RenderIgnoreModal/RenderUnignoreModal/showStatusFilter/emptyprops upstream) - #3 Surface as a separate wp-admin entry (
?page=jetpack-scan) — decided. - #4 Keep or drop the Codeable freelancer upsell from
threat-description.tsx? - #5 Deprecate
jetpack-protect/v1/*REST surface or keep it side-by-side withjetpack/v4/site/scan/*? - #6 Confirm package name
@automattic/jetpack-scan-page— confirmed. - #7 Confirm asset clearance for the two Calypso SVG illustrations.
- #8 What happens to WAF + Account Protection in
plugins/protectpost-port (status quo, also port, or deprecate the plugin)?
Open follow-ups (from #48458 review)
- Mirror repo: empty
github.com/Automattic/jetpack-scan-pageneeds to be created (org-admin task) so the Mirror repo check passes. Same gating Activity Log had. - Phase 8 broader tests: Jest render tests for the four modals, bulk-fix orchestration, and fix-status
isErrorpaths; Playwright e2e for scan-now / single-fix / bulk-fix.
Risks
- API contract drift between WPCOM
wpcom/v2 /sites/:siteId/scan*and our bridges — pin the Calypso commit we ported from inAGENTS.md. - Scan plan gating — Calypso uses
HostingFeatureGated; wp-admin needs an equivalent viaPlanfromprotect-status. - Modal stacking — bulk-fix during in-progress fixer poll could collide with view-details; verify under wp-admin.
- Polling collisions —
useScanStatusQuerypolling vs user view changes; reset page=1 on dataset changes (Activity Log pattern). - Asset clearance — confirm the SVG illustrations can ship under Jetpack's license/branding.
@wordpress/dataviewsversion skew — confirm parity with Activity Log + Backup; investigate@automattic/dataviews(#40612 closing comment) if versions diverge.
References
- #48458 — implementation PR (this issue)
- #48420 — Newsletter unified page (canonical wp-build pattern)
- #48244 — Activity Log wp-admin port
- #48236 — Backup wp-admin port
- #48297 — Backup port tracking issue
- #48160 — Jetpack UI Modernization umbrella
- #48156 —
ThreatSeverityBadgealready migrated to@wordpress/ui - #48154 — Shared
BoundedLayout+ stickyJetpackFooter - Calypso source:
client/dashboard/sites/scan/,scan-active/,scan-history/ - Companion plan docs:
protect-scan-port-plan.md,protect-dataviews-plan.md
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 913
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 809
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/jetpack
-
Bug Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Automattic/jetpack#55870 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/jetpack#55385 · 1 comment ·
Maintainers usually reply within 1 day
-
WAF: jetpack_waf_blocklog is created without the site's charset and collationPossibly taken @jwebbdev claimed this 3 days ago. Open[Plugin] Protect Bug Customer Report
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Automattic/jetpack#55365 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Package] Stats Admin [Type] Bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Automattic/jetpack#54188 ·
Maintainers usually reply within 1 day
-
Bug Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/jetpack#53467 ·
Maintainers usually reply within 1 day
All issues in Automattic/jetpack
Similar issues
-
follow-up
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Invoice reminders more than a month after the due date, and bill reminders more than a month before it, are not sentPossibly taken @officialasishkumar claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/blocks-engine#7881 ·
Maintainers usually reply within 1 day
-
[FrameworkBundle] MicroKernelTrait lists BundleAdapter instead of the bundle class in kernel.bundlesPossibly taken A pull request linked to this issue is open or already merged. OpenBug FrameworkBundle Status: Needs Review
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Flaky Test] testMonitorCallbackReturnExitsPossibly taken @uintaam claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
valkey-io/valkey-glide-php#515 ·
Maintainers usually reply within 4 days