Skip to content

Scheduled Updates abilities: register schedule CRUD + run-now via Registrar#48738

Draft
enejb wants to merge 1 commit into
trunkfrom
add/ship-scheduled-updates-abilities
Draft

Scheduled Updates abilities: register schedule CRUD + run-now via Registrar#48738
enejb wants to merge 1 commit into
trunkfrom
add/ship-scheduled-updates-abilities

Conversation

@enejb
Copy link
Copy Markdown
Member

@enejb enejb commented May 12, 2026

Summary

Registers Jetpack Scheduled Updates abilities with the WordPress Abilities API so AI agents can manage plugin update schedules through the standard wp-abilities/v1 REST surface. Implements RSM "Abilities Everywhere" plan §4.2 for the scheduled-updates package.

Abilities

All slugs are namespaced under the new jetpack-scheduled-updates category. All five share the same permission gate (current_user_can( 'update_plugins' )), mirroring WPCOM_REST_API_V2_Endpoint_Update_Schedules.

Slug Annotations Purpose
jetpack-scheduled-updates/list-schedules readonly, idempotent List all scheduled-update jobs in the compact { id, plugins, schedule, last_run_status, last_run_timestamp, active } shape. Supports an optional id filter; unknown ids return an empty array (never a WP_Error).
jetpack-scheduled-updates/create-schedule destructive, NOT idempotent Create a new schedule. Returns { id, schedule }. Idempotent only at the id level (same plugin list collides).
jetpack-scheduled-updates/update-schedule destructive, idempotent Update plugins or schedule by id. Returns { id, changed, changed_fields }; replaying with the same values returns changed=false with an empty changed_fields.
jetpack-scheduled-updates/delete-schedule destructive, idempotent Delete by id. Returns { id, deleted, changed }; deleting an already-gone schedule returns deleted=true, changed=false.
jetpack-scheduled-updates/run-schedule-now destructive, NOT idempotent Force-run a schedule via wp_schedule_single_event() a few seconds out — the recurring cadence is unaffected. Re-running queues another run.

Cross-consumer wiring

The scheduled-updates package is consumed by jetpack-mu-wpcom and (indirectly) by the main Jetpack plugin. Wired via a new projects/packages/scheduled-updates/actions.php registered in composer's autoload.files. The file uses the canonical guarded pattern from projects/packages/publicize/actions.php so it stays safe when autoloaded before add_action() is available, and double-checks the jetpack_wp_abilities_enabled filter before touching the registrar class.

Why this shape

The abilities go through rest_do_request() for create/update/delete so they reuse the full WPCOM update-schedules controller pipeline (schema validation, is_plugin_installed checks, sync option write, fired jetpack_scheduled_update_{created,updated,deleted} actions) exactly as a public REST caller would. run-schedule-now queues a one-off cron event directly because the REST surface has no equivalent.

Test plan

  • composer phpunit -- --filter Scheduled_Updates_Abilities_Test (29 tests, 123 assertions, all passing)
  • Full package suite still green: composer phpunit (92 tests, 511 assertions, all passing)
  • PHPCS clean on the new files
  • Manual smoke from the abilities REST surface once the jetpack_wp_abilities_enabled filter is opened on a test site

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 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 (WordPress.com Site Helper), and enable the add/ship-scheduled-updates-abilities branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/ship-scheduled-updates-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
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 12, 2026
@jp-launch-control
Copy link
Copy Markdown

Code Coverage Summary

1 file is newly checked for coverage.

File Coverage
projects/packages/scheduled-updates/src/abilities/class-scheduled-updates-abilities.php 426/458 (93.01%) 💚

Full summary · PHP report

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

Labels

[Package] Scheduled Updates [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