Repository navigation
Premium Analytics: gate the video surfaces on VideoPress availability - #51243
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! |
Code Coverage SummaryCoverage changed in 4 files.
1 file is newly checked for coverage.
|
…n-videopress # Conflicts: # projects/packages/premium-analytics/tests/php/Widget_Availability_Test.php
| * never looks at the module and counts the paid storage tiers instead. | ||
| * | ||
| * `Current_Plan::supports( 'videopress' )` is avoided because off-platform it | ||
| * returns true for every plan, thanks to the VideoPress free tier. |
There was a problem hiding this comment.
Non-blocking; nothing in the logic needs to change. One ask: on the is_videopress_available() docblock.
The off-platform branch is VideoPress\Status::is_active(), the same two signals and the gate four places in the VideoPress package already use. The platform branch is the WPCOM hijack inside Current_Plan::supports(). Neither is reachable: jetpack-plans and jetpack-videopress aren't in this package's dependency graph, so local detection is the only option today.
The docblock rules out Current_Plan::supports() on semantic grounds, which is right, but doesn't mention Status::is_active(), which is semantically this branch and only out of reach. Worth naming it plus the boundary, so the next person finds the trail instead of writing a fifth detector.
Also worth stating: the platform branch never fires on Atomic, since wpcomsh grants videopress to WPCOM_BUSINESS_AND_HIGHER_PLANS and WoA only exists there. I don't think that's wrong (hosting is service-level on WPCOM, so the module is a false negative), but the effective coverage is Simple plus self-hosted, and an Atomic site with the module off and no videos keeps both empty surfaces.
There was a problem hiding this comment.
Good catch. I've named it in the docblock along with why it's out of reach.
retrofox
left a comment
There was a problem hiding this comment.
Thanks, Chi 🙇♂️
Approving. It solves the immediate problem, the tests are thorough, and it follows the gating pattern the package already established for File downloads, Shares, and the Subscribers section.
Same note I left on #50736, though. This is the third instance: structurally, I don't think this scales, and it's getting harder, not easier.
Each gate adds another foreign domain PA has to know how to detect, and the canonical answer usually already exists in the package that owns that domain, out of PA's reach.
Nothing to resolve in this PR. I'd like to follow up separately on the model I think we should move to.
| // WooCommerce stubs for the TEMPORARY interim sync module port (WOOA7S-1550). | ||
| // WooCommerce is a runtime, not composer, dependency; these let Phan resolve WC symbols. | ||
| '+stubs' => array( 'woocommerce', 'woocommerce-internal' ), | ||
| // The wpcom stubs cover the Simple-only symbols this package branches on. |
There was a problem hiding this comment.
Small thing: the symbol doesn't come from the generated wpcom stubs; it arrives because the wpcom stub set also pulls in wpcomsh's functions-wpcom-features.php (.phan/config.base.php:116).
| * Defaults to false, unlike the sibling `csv_exports_enabled` flag: showing the | ||
| * video surfaces on a site that cannot produce play data is the empty report | ||
| * this gate exists to remove. Safe to default that way because every path that | ||
| * renders the dashboard runs `Analytics::load_dashboard_surface()`, which is |
There was a problem hiding this comment.
load_dashboard_surface() calls it, but the filter is registered in load_dashboard_components(). Worth pointing to the one that does the injecting.
Thanks!
Fair concern! Opened WOOA7S-1958 to track the model. |
Fixes WOOA7S-1718
Proposed changes
is_videopress_available(): thevideopressplan feature on the WPCOM platform, Simple and Atomic alike (what Calypso reads), the Jetpack VideoPress module or the standalone VideoPress plugin everywhere else, all behind ajetpack_premium_analytics_videopress_availablefilter.premium_analytics.has_videopressscript data so the client routes can read it. The client can't usesiteHasFeature( 'videopress' )from@automattic/jetpack-script-datahere:site.plan.featuresis only populated when the Publicize package is loaded, which the standalone Premium Analytics plugin never loads.Atomic is deliberately grouped with Simple rather than with self-hosted:
wpcom_site_has_feature()is available there through wpcomsh, the VideoPress module carries noAuto Activateheader, so a plan that includes VideoPress routinely comes with the module off.Initial_State::has_videopress_access()in the VideoPress package draws the same boundary.Current_Plan::supports( 'videopress' )is not used as the single entry point. On the WPCOM platform it already delegates to the samewpcom_site_has_feature()call, but off-platform it falls back to returning true for every plan because of the VideoPress free tier.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
On a self-hosted Jetpack site with Premium Analytics, with VideoPress off
wp jetpack module deactivate videopress:Customizemode and remove it./reports/videosdirectly — it redirects to the dashboard, as an unknown report does./video/<attachment id>) — it redirects to the dashboard.Screen.Recording.2026-08-14.at.6.11.11.PM.mov
Then activate VideoPress (
wp jetpack module activate videopress, or the standalone Jetpack VideoPress plugin) and reload:/reports/videosloads, and a video row still drills into the detail page.Screen.Recording.2026-08-14.at.6.12.43.PM.mov
On WordPress.com Simple and Atomic the gate follows the
videopressplan feature instead, matching Calypso.