Podcast: add product-access gate and grandfather sticker constant#48702
Podcast: add product-access gate and grandfather sticker constant#48702robertbpugh wants to merge 6 commits into
Conversation
Adds `Podcast_Gate::has_product_access()` as the single entry point downstream gates (dashboard tab, stats endpoint, episode block, AI shownotes) will call. Two ways to pass: the `podcasting-grandfathered` blog sticker, or `Current_Plan::supports( 'podcasting' )` — which short-circuits to `wpcom_site_has_feature` on Simple/Atomic and falls through to cached plan data on self-hosted Jetpack, so the same helper is correct on every host.
| Are you an Automattician? The PR will need to be tested on WordPress.com. This comment will be updated with testing instructions as soon the build is complete. |
|
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: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Mu Wpcom 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 SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
* Drop @phan-suppress-next-line PhanUndeclaredClassMethod on the two Atomic-only branches in class-tracks (Current_Plan::get, Tracking::tracks_record_event). Adding automattic/jetpack-plans to the package require pulls in the connection package transitively, so phan now resolves both classes and the suppressions are unused. * Regenerate the three plugin composer.locks (jetpack, mu-wpcom-plugin, wpcomsh) that reference automattic/jetpack-podcast, picking up the new jetpack-plans dep.
Matches sibling changelog entries in projects/packages/podcast/changelog (add-podcast-tracks, add-podcast-settings, add-podcast-package) which all use `minor` for new added surface area.
Required by the pre-push changelog check now that the previous commit touched jetpack/mu-wpcom-plugin/wpcomsh composer.lock files.
There was a problem hiding this comment.
Pull request overview
This PR introduces a reusable product-access gate for the Jetpack Podcast package, allowing premium podcast features to be conditionally enabled based on either a “grandfathered” blog sticker or plan feature support via Current_Plan::supports(). It also wires in the jetpack-plans dependency needed for that plan check and updates relevant lockfiles and changelog entries.
Changes:
- Add
Podcast_Gate::has_product_access()with constants for the podcasting feature slug and the grandfathering sticker. - Add PHPUnit coverage for sticker-based allow, plan-feature allow, and deny cases (including a test stub for
wpcom_has_blog_sticker). - Add
automattic/jetpack-planstojetpack-podcastdependencies and update plugincomposer.lockfiles accordingly.
Reviewed changes
Copilot reviewed 9 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| projects/plugins/wpcomsh/composer.lock | Updates the jetpack-podcast path package metadata to include the new jetpack-plans dependency. |
| projects/plugins/wpcomsh/changelog/pods-141-add-gate | Records the lockfile update for wpcomsh. |
| projects/plugins/mu-wpcom-plugin/composer.lock | Updates the jetpack-podcast path package metadata to include the new jetpack-plans dependency. |
| projects/plugins/mu-wpcom-plugin/changelog/pods-141-add-gate | Records the lockfile update for mu-wpcom-plugin. |
| projects/plugins/jetpack/composer.lock | Updates the jetpack-podcast path package metadata to include the new jetpack-plans dependency. |
| projects/plugins/jetpack/changelog/pods-141-add-gate | Adds a Jetpack plugin changelog entry related to the lockfile update. |
| projects/packages/podcast/composer.json | Adds automattic/jetpack-plans so Current_Plan is consistently available. |
| projects/packages/podcast/src/class-podcast-gate.php | Introduces the new Podcast_Gate access-check helper and related constants. |
| projects/packages/podcast/tests/php/Podcast_Gate_Test.php | Adds tests validating sticker allow, plan-feature allow, and deny behavior. |
| projects/packages/podcast/tests/php/bootstrap.php | Adds a lightweight wpcom_has_blog_sticker stub for the test environment. |
| projects/packages/podcast/src/class-tracks.php | Removes no-longer-needed Phan suppression comments. |
| projects/packages/podcast/changelog/pods-141-add-gate | Adds the package-level changelog entry for the new gate/helper. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fixes PODS-141
Proposed changes
Podcast_Gate::has_product_access()returns true when the current blog either carries thepodcasting-grandfatheredsticker or the active plan supportspodcasting.Current_Plan::supports, which short-circuits towpcom_site_has_featureon Simple/Atomic and falls through to cached plan data on self-hosted Jetpack — one helper, correct on every host.jetpack-plansadded torequiresoCurrent_Planis always autoloaded.wpcom_has_blog_stickerstub that reads from$GLOBALS['jetpack_podcast_test_stickers'].Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
cd projects/packages/podcast && composer phpunit— 59 tests, 145 assertions pass.Open follow-ups (separate work)
const PODCASTING = 'podcasting'toWPCOM_Featuresin wpcom and wpcomsh so the wpcom-platform short-circuit activates.podcasting-grandfatheredsticker on the existing audio-upload cohort.