Skip to content

Conversation

@justlevine
Copy link
Contributor

@justlevine justlevine commented Sep 13, 2025

What

This PR exposes the register_ability_args filter as a way to centrally extend and change the behavior of registered abilities.

Why

How

  • wp_ability_args is used before the merge to core, but it should be changed to abilities_api as part of 6.9 IMO. changed to register_ability_args

@justlevine justlevine requested a review from Copilot September 13, 2025 17:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the wp_ability_args filter to the Abilities API, allowing developers to modify ability arguments before validation and instantiation. This provides a centralized mechanism for extending and customizing ability behavior.

  • Adds a filter hook in the registry's register method to modify ability arguments
  • Includes comprehensive documentation with usage examples
  • Uses wp_ prefix to avoid naming collisions before core integration

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
includes/abilities-api/class-wp-abilities-registry.php Adds the wp_ability_args filter in the register method before validation
docs/5.hooks.md Documents the new filter with detailed usage examples and parameters

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Sep 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.64%. Comparing base (4beab25) to head (36c0e99).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk      #74      +/-   ##
============================================
+ Coverage     84.84%   85.64%   +0.79%     
  Complexity      102      102              
============================================
  Files            16       16              
  Lines           772      773       +1     
  Branches         86       86              
============================================
+ Hits            655      662       +7     
+ Misses          117      111       -6     
Flag Coverage Δ
javascript 92.66% <ø> (ø)
unit 82.88% <100.00%> (+1.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@justlevine justlevine requested a review from gziolo September 13, 2025 17:16
@justlevine justlevine marked this pull request as ready for review September 13, 2025 17:17
@github-actions
Copy link

github-actions bot commented Sep 13, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: justlevine <[email protected]>
Co-authored-by: gziolo <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some minor feedback. Overall, I'm very much in favor of the proposed extensibility option.

@gziolo gziolo added the [Type] Enhancement New feature or request label Sep 15, 2025
@gziolo
Copy link
Member

gziolo commented Sep 17, 2025

We will also need some basic unit test coverage to illustrate the expected behavior better and prevent future regressions.

I plan to add some tests today to:

We can coordinate how to ensure we avoid more complex merge conflicts.

@gziolo
Copy link
Member

gziolo commented Sep 23, 2025

@gziolo gziolo changed the title dev: add wp_ability_args filter [Proposal] dev: add register_ability_args filter [Proposal] Sep 23, 2025
@gziolo
Copy link
Member

gziolo commented Sep 23, 2025

@galatanovidiu, this proposed filter register_ability_args that allows changing $args during registration should be essential for extenders that want to annotate existing abilities for usage with the MCP adapter when such information is missing.

@justlevine
Copy link
Contributor Author

@gziolo feedback addressed, tests added, and merged the action/filter docs (structure too, not just pasting the two together). PTAL and let me know what you think 🙏

@justlevine justlevine requested a review from gziolo September 27, 2025 20:55
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition to the documentation and test coverage. Thank you for addressing my feedback.

I left some small notes to address before merging changes 🚀

Co-authored-by: Greg Ziółkowski <[email protected]>
@justlevine justlevine requested a review from gziolo September 29, 2025 11:17
@gziolo gziolo merged commit 309f5a0 into WordPress:trunk Sep 29, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants