Stats v2: rename Premium Analytics menu and stop replacing legacy Stats - #50915
Stats v2: rename Premium Analytics menu and stop replacing legacy Stats#50915kangzj wants to merge 5 commits into
Conversation
Renames the bundled dashboard's admin menu label from "Premium Analytics" (WPCOM Simple) / "Analytics" (default, used by Atomic and other flag-enabled sites) to "Stats v2", and removes the code that suppressed the legacy Stats menu, admin-bar entries, post-list column, and dashboard widget whenever the flag was on. Stats v2 now adds its own menu alongside the existing Stats UI instead of replacing it, matching how WPCOM Simple already behaved.
|
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. |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryCoverage changed in 2 files.
|
Narrows scope back to the label rename. The legacy Stats menu, admin-bar entries, post-list column, and dashboard widget keep being suppressed by the existing jetpack_premium_analytics_enabled gate exactly as before — that gate and the "replace" behavior it drives are untouched. Stats v2 already registers its own separate top-level menu unconditionally when enabled; nothing about that needed to change.
Scopes the existing jetpack_premium_analytics_enabled replace behavior to exclude Atomic sites (Automattic\Jetpack\Status\Host::is_woa_site()). On Atomic the legacy Stats menu, admin-bar entries, post-list column, and dashboard widget now stay in place alongside the new Stats v2 menu instead of being suppressed. Self-hosted and other WPCOM flag-enabled sites keep the existing replace behavior unchanged.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Broadens the previous Atomic-only exception to every site: Stats v2 always adds its own admin menu alongside the existing Stats menu, admin-bar entries, post-list column, and dashboard widget instead of replacing them, regardless of host. Drops the now-unused Host::is_woa_site() check from modules/stats.php and class-jetpack-stats-dashboard-widget.php.
Retype the plugins/jetpack changelog entry as enhancement instead of bugfix — this is an intentional rollout behavior change, not a defect fix. Document why test_stats_admin_menu_kept_when_enabled() only tears down the one action it asserts on.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🤖 Review-cycle summary —
|
| Source | Comment | Resolution |
|---|---|---|
| claude[bot] | (#5126405852) 3 non-blocking notes: duplicated replace-predicate across files, stats_load() test hygiene, changelog type bugfix vs enhancement |
Predicate concern resolved outright by f5223dec56 (the replace logic was deleted entirely, not centralized); added a hygiene doc-comment to the test and retyped the changelog to enhancement in b17bf0b4a3 |
| claude[bot] | (#5126523064) re-review — verified all three items, no blocking issues, one non-blocking observation (the per-request cache on is_premium_analytics_enabled() is now less load-bearing with fewer callers) |
No action needed — reviewer explicitly noted nothing to change |
Unaddressed (flagged for owner):
None.
CI: all required checks passing (36 pass, 8 skipping as expected for unaffected file types).
Why this matters
The bundled analytics dashboard currently shows as "Premium Analytics" (WPCOM Simple) or the generic "Analytics" (Atomic and other flag-enabled sites), and it swaps out the existing Stats menu entirely the moment it's enabled — no way back to the surface people are used to mid-rollout. This renames the dashboard to "Stats v2" and adds it as a second menu alongside the existing Stats menu, on every site, instead of replacing it.
Fixes #
Proposed changes
Related product discussion/links
jetpack_premium_analytics_replaces_statsflag, so there's currently no way to restore replacement behavior without a follow-up code change if that's ever neededDoes this pull request change what data or activity we track or use?
Testing instructions
jetpack_premium_analytics_enabledflag on (or the WPCOM Simple / Atomic rollout gates), confirm both "Stats" and "Stats v2" appear as separate top-level admin menu items, and that the Stats admin-bar entry, post-list column, and WP dashboard widget are still present.jp docker phpunit jetpack --php 8.3 -- --filter "Jetpack_Premium_Analytics_Test|Stats_Admin_Bar_Test"— 15/15 pass.jp test php packages/jetpack-mu-wpcomand theAnalytics_Testlabel assertions inpackages/premium-analytics— pass.