Skip to content

Image CDN abilities: register status reads via Registrar#48758

Draft
enejb wants to merge 1 commit into
trunkfrom
add/ship-image-cdn-abilities
Draft

Image CDN abilities: register status reads via Registrar#48758
enejb wants to merge 1 commit into
trunkfrom
add/ship-image-cdn-abilities

Conversation

@enejb
Copy link
Copy Markdown
Member

@enejb enejb commented May 13, 2026

Summary

Adds a minimal Abilities API surface to the jetpack-image-cdn package via the shared Registrar base class. Exposes a single read-only ability — jetpack-image-cdn/get-status — that returns the current Image CDN (Photon) activation state, effective CDN domain, srcset wiring flag, and the deduplicated list of supported MIME types.

Per RSM "Abilities Everywhere" plan §4.2, this package is consumed by both Jetpack's Photon module and Boost, so wiring lives in the package's actions.php (canonical guarded pattern from projects/packages/publicize/actions.php). Registration is gated behind the jetpack_wp_abilities_enabled filter (default false) inside Registrar::init() — no behavior change until the filter is opted in.

get-statistics from the original plan was dropped because the package tracks no local statistics — the audit found no bytes-saved, request-count, or last-request timestamp surface. update-settings and clear-cache writes are intentionally deferred; this PR is reads-only.

Surface

  • jetpack-image-cdn/get-status{ active, settings: { quality, formats, srcset_enabled, cdn_domain }, supported_mime_types: [string] }. quality and formats are null because the consumer plugin (not this package) owns those toggles.

Permissions

current_user_can( 'manage_options' ) — the package has no domain-specific capability of its own; reuse the site-admin cap.

Test plan

  • composer phpunit -- --filter Image_CDN_Abilities_Test (21 tests, 62 assertions, all green)
  • Set add_filter( 'jetpack_wp_abilities_enabled', '__return_true' ) on a site running this branch with the Image CDN module active; confirm wp_get_abilities() includes jetpack-image-cdn/get-status and that /wp-json/wp-abilities/v1/abilities exposes it.
  • Confirm the rollout filter default-off path: with the filter omitted, the ability does not appear in wp_get_abilities().
  • Override jetpack_photon_domain with a custom host; confirm the returned settings.cdn_domain reflects it.
  • CI: PHPCS, parallel-lint, and the full package suite remain green (one pre-existing test failure in Image_CDN_Core_Test::test_photon_url_filter_url_encodes_path_parts is unrelated to this change).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

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 (Jetpack or WordPress.com Site Helper), and enable the add/ship-image-cdn-abilities branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/ship-image-cdn-abilities
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/ship-image-cdn-abilities

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 github-actions Bot added [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Package] Image CDN [Status] In Progress [Tests] Includes Tests labels May 13, 2026
@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 🤖


🔴 Action required: Please include detailed testing steps, explaining how to test your change, like so:

## Testing instructions:

* Go to '..'
*

🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so:

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

My PR adds *x* and *y*.

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 May 13, 2026
@jp-launch-control
Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/image-cdn/src/class-image-cdn.php 379/510 (74.31%) 0.20% -1 💚

1 file is newly checked for coverage.

File Coverage
projects/packages/image-cdn/src/abilities/class-image-cdn-abilities.php 71/71 (100.00%) 💚

Full summary · PHP report · JS report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Package] Image CDN [Status] In Progress [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