Skip to content

Abilities API: Add an open world annotation - #16201

Open
avinash-addweb wants to merge 4 commits into
WordPress:trunkfrom
avinash-addweb:feature/66799-open-world-annotation
Open

avinash-addweb wants to merge 4 commits into
WordPress:trunkfrom
avinash-addweb:feature/66799-open-world-annotation

Conversation

@avinash-addweb

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/66799

What

Adds open_world as an optional bool|null annotation under meta.annotations, next to readonly, destructive and idempotent.

  • true: at least one supported execution path can interact with public or open-ended entities.
  • false: all supported execution paths stay within a bounded environment.
  • null or omitted: not declared. Core does not infer a value.

Like the other annotations it is a hint. It does not change permissions, execution or exposure.

Changes

  • WP_Ability::$default_annotations gets open_world => null.
  • The annotations docblocks in abilities-api.php, WP_Abilities_Registry and WP_Ability document the new key.
  • WP_REST_Abilities_V1_List_Controller declares open_world in the response schema and in the annotations collection filter, as it already does for the other three.

Core's own abilities are not changed. They can opt in separately.

Testing

  • New test_open_world_annotation covers explicit true, false and null, and omission.
  • Existing tests that hard-code the default annotations array now include the new key.
  • npm run test:php -- --group abilities-api passes on single site (940 tests) and multisite (945).
  • PHPCS reports no errors on the changed files.

Adds `open_world` as an optional `bool|null` ability annotation, defaulting to `null`, and documents it in the REST schema and the registration docblocks.

Props avinashzala01.
See #66799.
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props avinashzala01, gziolo.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@gziolo

gziolo commented Nov 25, 2026

Copy link
Copy Markdown
Member

Thanks for working on this, @avinash-addweb! The change looks good and is almost ready. I have some feedback to share.

In the places where the new annotation is documented, please add a @since entry. We did the same when meta.public was added, for example @since 7.1.0 Added the public meta argument.

I think we can spend some time trying to iron out the description. The phrase "public or open-ended entities" is hard to follow. The word "public" is also used by the public meta key, which has a different meaning. Would you like to try a different wording? One idea is to say that when the value is true, the ability may interact with systems outside of the site, such as remote HTTP services or email recipients. When the value is false, the ability only interacts with the site itself. Feel free to propose something else. It would be good to use the same wording in all places.

Could you also add a test for the REST API? Query parameters arrive as strings, so it would be good to check that meta[annotations][open_world]=true is treated as a boolean. The existing test_filter_by_annotation test does this for readonly, so you can follow its structure.

Describes the annotation in terms of systems outside of the site, so it is not confused with the `public` meta key, and uses the same wording everywhere. Adds `@since 7.3.0` entries and a REST test that the `open_world` filter value is coerced from a string.

See #66799.

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for addressing the feedback. The changes look good to me, and the new REST test covers both true and false values.

Approving this now. I plan to leave some time for others to review and share feedback before committing it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants