Skip to content

Activity Log abilities: register events reads via Registrar#48760

Draft
enejb wants to merge 4 commits into
trunkfrom
add/ship-activity-log-abilities
Draft

Activity Log abilities: register events reads via Registrar#48760
enejb wants to merge 4 commits into
trunkfrom
add/ship-activity-log-abilities

Conversation

@enejb
Copy link
Copy Markdown
Member

@enejb enejb commented May 13, 2026

Summary

Registers the jetpack-activity-log/list-events ability via the WordPress Abilities API so AI agents can answer "what happened on my site?" through the standard wp-abilities/v1 REST surface. Single consolidated read — passing event_id returns a 0- or 1-element array, so the same ability covers both list and detail views (per plan §4.2's "consolidated-read" guidance).

  • New Activity_Log_Abilities Registrar subclass under Automattic\Jetpack\Activity_Log\Abilities, namespaced category slug jetpack-activity-log.
  • Delegates to REST_Controller::get_activity_log() so the ability rides on the existing permission check, free-tier clamp, and WPCOM proxy path — no duplicate auth surface.
  • Wired via the canonical guarded actions.php pattern (autoload-files); gated behind the default-off jetpack_wp_abilities_enabled filter inside Registrar::init(), so it stays opt-in per-site until the flag is flipped.
  • Filters supported: group, action, date_from / date_to (ISO8601), page, per_page (max 100), event_id. action and event_id are applied client-side after the proxy returns (they're not part of the upstream /jetpack/v4/activity-log query surface).

Test plan

  • Unit tests pass: composer phpunit -- --filter Activity_Log_Abilities_Test (25 tests / 72 assertions, no notices).
  • PHPCS clean across src/abilities/, tests/php/, and actions.php.
  • Permission gate denies subscribers, anonymous, and admins without a user-level Jetpack connection (mirrors REST_Controller::permissions_callback()).
  • Consolidated-read contract: unknown event_id returns [] (not WP_Error); known event_id returns a 1-element projected array.
  • Input mapping: date_fromafter, date_tobefore, per_pagenumber (clamped to 100), group → single-element array. Verified via captured WP_REST_Request.
  • Upstream WP_Error propagates unchanged.

@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), and enable the add/ship-activity-log-abilities branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/ship-activity-log-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

github-actions Bot commented May 13, 2026

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!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: June 2, 2026
    • Code freeze: June 1, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@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
@github-actions github-actions Bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label May 15, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 15, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/class.jetpack.php 748/2277 (32.85%) -0.01% 1 ❤️‍🩹

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

[Package] Activity Log [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [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