Skip to content

Podcast: dedicated jetpack/v4 settings endpoint#49567

Open
arcangelini wants to merge 1 commit into
trunkfrom
update/podcast-settings-jetpack-v4-endpoint
Open

Podcast: dedicated jetpack/v4 settings endpoint#49567
arcangelini wants to merge 1 commit into
trunkfrom
update/podcast-settings-jetpack-v4-endpoint

Conversation

@arcangelini

Copy link
Copy Markdown
Member

Proposed changes

Move podcast site settings off core /wp/v2/settings (and, on Simple, off the legacy WPCOM v1.x site-settings filters) onto a dedicated, package-owned REST endpoint. This unifies the schema/sanitizers in one place and makes the feature work unchanged on self-hosted Jetpack — it's pure wp_options read/write with no wpcom backend.

  • New endpoint Podcast_Settings_Endpointjetpack/v4/podcast/settings, manage_options gated.
    • GET returns the full, stable-shape record via Settings::get_all() (every option present; the two podcatcher maps padded to all directories).
    • PUT/POST/PATCH applies a partial patch: only keys present in the request are written, so absent keys can never clobber stored values. Array options merge on sanitize. Fires jetpack_podcast_settings_saved when an option is touched, then returns the full merged record.
  • Settings — dropped show_in_rest from every register_setting() (defaults + sanitize_callbacks stay, so update_option() still merges/validates). Added get_all(), rest_schema_properties(), and empty_podcatcher_map() helpers. The podcasting_* keys no longer appear in core /wp/v2/settings.
  • Tracks — the aggregate wpcom_podcasting_settings_saved event now fires off the new jetpack_podcast_settings_saved action instead of hooking the /wp/v2/settings REST response. The per-option update_option_* Tracks hooks are transport-independent and unchanged.
  • Dashboard hook (use-podcast-settings.ts) — reads/writes the new endpoint via apiFetch with a shared module-level cache. The exported contract ({ data, isLoading } / { mutate, mutateAsync, isPending }) is unchanged, so all callers are untouched.
  • Podcast Episode block — the show-cover read moves from /wp/v2/settings to the shared hook; for non-admin editors the fetch 403s and the cover resolves empty, identical to the prior behavior.

A follow-up in the wpcom repo (separate PR, to land after this deploys) removes the now-duplicate v1.x mu-plugin and the podcasting assertions in the core settings-controller test.

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

No new tracking. The existing wpcom_podcasting_settings_saved event is unchanged (same properties, same PII redaction of podcasting_email / podcasting_talent_name); only its trigger moved to a package action.

Testing instructions

  • In the wp-admin Podcast dashboard, open Settings: confirm the form loads (a GET jetpack/v4/podcast/settings request returns the full padded record).
  • Change one field and save: confirm the success snackbar, and that the saved value round-trips. Saving a partial change must not blank out other fields.
  • Toggle a distribution URL and confirm podcasting_show_urls / podcasting_show_states persist and pad to all directories on reload.
  • Confirm GET /wp/v2/settings no longer lists any podcasting_* keys.
  • On a plain self-hosted Jetpack site, confirm the route registers and round-trips options with no WordPress.com connection.
  • Package PHP tests: from projects/packages/podcast, run composer test-php (139 tests pass, incl. the new Podcast_Settings_Endpoint_Test).

Verified locally: composer test-php (139 tests / 339 assertions, green), php -l, and phpcs on all changed files (clean). JS lint/type-check were not run locally (Node/pnpm toolchain mismatch in my env) and will be validated by CI.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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 (WordPress.com Site Helper), and enable the update/podcast-settings-jetpack-v4-endpoint branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/podcast-settings-jetpack-v4-endpoint

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

Copy link
Copy Markdown
Contributor

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!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 11, 2026
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/podcast/src/class-settings.php 160/182 (87.91%) -8.86% 16 💔
projects/packages/podcast/src/class-podcast.php 9/24 (37.50%) -1.63% 1 ❤️‍🩹
projects/packages/podcast/src/class-tracks.php 114/147 (77.55%) -0.30% -2 💚

1 file is newly checked for coverage.

File Coverage
projects/packages/podcast/src/endpoints/class-podcast-settings-endpoint.php 38/43 (88.37%) 💚

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@arcangelini arcangelini self-assigned this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Podcast [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant