From 912c90fba462800ec484b61019b5ad711bef0035 Mon Sep 17 00:00:00 2001 From: Nik McLaughlin <72171383+nikmclaughlin@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:03:17 -0800 Subject: [PATCH 1/4] Rename experimental ability names from wp/ to core-experimental/ (#18) Every experimental-tier ability moves from the wp/ namespace to core-experimental/, so the name itself signals in-development status (WordPress/abilities#18). The manifest entries record the old name under renamed_from, which the Registrar stamps into each ability's meta; the tier/prefix rules in ManifestTest and bin/verify-manifest.php now require the core-experimental/ prefix. Tier values and promise levels are unchanged, and the core/ and wordpress/ tiers are untouched. --- bin/verify-manifest.php | 6 +- src/Categories.php | 2 +- src/Manifest.php | 104 ++++++++-------- src/Media/Abstract_Media_Write.php | 32 ++--- src/Media/Media_Delete.php | 8 +- src/Media/Media_Query.php | 14 +-- src/Media/Media_Update.php | 8 +- src/Media/Media_Upload.php | 8 +- src/Settings/Settings_Update.php | 10 +- src/Terms/Abstract_Term_Write.php | 32 ++--- src/Terms/Term_Create.php | 10 +- src/Terms/Term_Delete.php | 8 +- src/Terms/Term_Update.php | 10 +- src/Terms/Terms_Query.php | 14 +-- src/Users/Abstract_User_Write.php | 22 ++-- src/Users/User_Create.php | 6 +- src/Users/User_Delete.php | 6 +- src/Users/User_Update.php | 6 +- tests/Abilities/MediaDeleteTest.php | 12 +- tests/Abilities/MediaQueryTest.php | 14 +-- tests/Abilities/MediaUpdateTest.php | 10 +- tests/Abilities/MediaUploadTest.php | 14 +-- tests/Abilities/SettingsUpdateTest.php | 8 +- tests/Abilities/TermWritesTest.php | 158 ++++++++++++------------- tests/Abilities/TermsQueryTest.php | 20 ++-- tests/Abilities/UserWritesTest.php | 48 ++++---- tests/ManifestTest.php | 12 +- tests/RegistrarTest.php | 2 +- 28 files changed, 303 insertions(+), 301 deletions(-) diff --git a/bin/verify-manifest.php b/bin/verify-manifest.php index 7912e5a..1653aef 100644 --- a/bin/verify-manifest.php +++ b/bin/verify-manifest.php @@ -147,7 +147,7 @@ function verify_manifest_structure(): array { /** * Tier and prefix rules (mirrors ManifestTest's experimental/stable tests). * - * experimental ⇒ name starts wp/, and starts with neither core/ nor + * experimental ⇒ name starts core-experimental/, and starts with neither core/ nor * wordpress/. stable|core ⇒ name starts core/ or wordpress/. core + core/ * ⇒ core_since and proposal set. stable + core/ ⇒ proposal set. Every * entry sets a non-empty min_wp_version. Unknown tier values are flagged; @@ -178,8 +178,8 @@ function verify_manifest_tier_prefix_rules(): array { } if ( Manifest::TIER_EXPERIMENTAL === $tier ) { - if ( ! verify_manifest_starts_with( $name, 'wp/' ) ) { - $violations[] = $name . ' (tier experimental): must start with wp/.'; + if ( ! verify_manifest_starts_with( $name, 'core-experimental/' ) ) { + $violations[] = $name . ' (tier experimental): must start with core-experimental/.'; } if ( verify_manifest_starts_with( $name, 'core/' ) || verify_manifest_starts_with( $name, 'wordpress/' ) ) { $violations[] = $name . ' (tier experimental): must not start with core/ or wordpress/.'; diff --git a/src/Categories.php b/src/Categories.php index 89b79c2..33f60eb 100644 --- a/src/Categories.php +++ b/src/Categories.php @@ -53,7 +53,7 @@ final class Categories { 'description' => 'Abilities that retrieve or manage posts and other content.', ), /* - * Package-authored, for the `wp/media-query` port: core trunk registers no + * Package-authored, for the `core-experimental/media-query` port: core trunk registers no * `media` ability category (wp_register_core_ability_categories() covers * `site`, `user`, `content`, and `uncategorized`), so there is nothing to * copy verbatim. Styled like trunk's own registrations; keep it in sync diff --git a/src/Manifest.php b/src/Manifest.php index 2c263d1..ebbd618 100644 --- a/src/Manifest.php +++ b/src/Manifest.php @@ -21,7 +21,7 @@ final class Manifest { /** Package version; must match the newest git tag. */ public const VERSION = '0.1.0'; - /** Experimental tier: `wp/` prefix, no promises, iterating. */ + /** Experimental tier: `core-experimental/` prefix, no promises, iterating. */ public const TIER_EXPERIMENTAL = 'experimental'; /** Stable tier: `core/` or `wordpress/` prefix, proposed to core, schema-frozen. */ @@ -42,7 +42,7 @@ private function __construct() {} */ public static function all(): array { return array( - 'core/content-query' => array( + 'core/content-query' => array( 'name' => 'core/content-query', /* * `::class` resolves to the FQCN without loading the class, @@ -60,7 +60,7 @@ public static function all(): array { // the landed core work (wordpress-develop PR 12195) before release. 'proposal' => 'https://github.com/WordPress/wordpress-develop/pull/12195', ), - 'core/settings-get' => array( + 'core/settings-get' => array( 'name' => 'core/settings-get', 'class' => Settings\Settings_Get::class, 'category' => 'site', @@ -72,7 +72,7 @@ public static function all(): array { // Landed in trunk as b6512b1e8c (Trac #64605), developed in this PR. 'proposal' => 'https://github.com/WordPress/wordpress-develop/pull/12141', ), - 'core/users-query' => array( + 'core/users-query' => array( 'name' => 'core/users-query', 'class' => Users\Users_Query::class, 'category' => 'user', @@ -93,7 +93,7 @@ public static function all(): array { * filing). The entries flip to core with `core_since` set once * the abilities land in an actual WordPress release. */ - 'core/content-create' => array( + 'core/content-create' => array( 'name' => 'core/content-create', 'class' => Content\Content_Create::class, 'category' => 'content', @@ -104,7 +104,7 @@ public static function all(): array { 'renamed_from' => null, 'proposal' => 'https://github.com/WordPress/ai/pull/1025', ), - 'core/content-update' => array( + 'core/content-update' => array( 'name' => 'core/content-update', 'class' => Content\Content_Update::class, 'category' => 'content', @@ -115,7 +115,7 @@ public static function all(): array { 'renamed_from' => null, 'proposal' => 'https://github.com/WordPress/ai/pull/1025', ), - 'core/content-delete' => array( + 'core/content-delete' => array( 'name' => 'core/content-delete', 'class' => Content\Content_Delete::class, 'category' => 'content', @@ -130,68 +130,68 @@ public static function all(): array { * The media query below is a faithful port of WordPress/ai PR #1098 * (author @jorgefilipecosta). * - * Tier: experimental, incubating under the `wp/` prefix — the proposal + * Tier: experimental, incubating under the `core-experimental/` prefix — the proposal * below is the PR's paper trail, but the ability has NOT landed in * core (`core_since` stays null and flips when core lands it), so its * name and schema carry no promises yet (NAME-LIFECYCLE.md). It uses * the package-authored `media` ability category (core trunk has no * media category; see Categories). */ - 'wp/media-query' => array( - 'name' => 'wp/media-query', + 'core-experimental/media-query' => array( + 'name' => 'core-experimental/media-query', 'class' => Media\Media_Query::class, 'category' => 'media', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/media-query', 'proposal' => 'https://github.com/WordPress/ai/pull/1098', ), /* * The media writes below are a faithful port of WordPress/ai PR #1104 - * (author @jorgefilipecosta) on top of the `wp/media-query` field + * (author @jorgefilipecosta) on top of the `core-experimental/media-query` field * projection: the abilities write attachments and answer with them * through the query's contract, in the edit context. * - * Tier: experimental, incubating under the `wp/` prefix — the proposal + * Tier: experimental, incubating under the `core-experimental/` prefix — the proposal * below is the PR's paper trail, but the abilities have NOT landed in * core (`core_since` stays null and flips when core lands them), so * their names and schemas carry no promises yet (NAME-LIFECYCLE.md). * They use the package-authored `media` ability category (see * Categories). */ - 'wp/media-upload' => array( - 'name' => 'wp/media-upload', + 'core-experimental/media-upload' => array( + 'name' => 'core-experimental/media-upload', 'class' => Media\Media_Upload::class, 'category' => 'media', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/media-upload', 'proposal' => 'https://github.com/WordPress/ai/pull/1104', ), - 'wp/media-update' => array( - 'name' => 'wp/media-update', + 'core-experimental/media-update' => array( + 'name' => 'core-experimental/media-update', 'class' => Media\Media_Update::class, 'category' => 'media', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/media-update', 'proposal' => 'https://github.com/WordPress/ai/pull/1104', ), - 'wp/media-delete' => array( - 'name' => 'wp/media-delete', + 'core-experimental/media-delete' => array( + 'name' => 'core-experimental/media-delete', 'class' => Media\Media_Delete::class, 'category' => 'media', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/media-delete', 'proposal' => 'https://github.com/WordPress/ai/pull/1104', ), /* @@ -203,20 +203,20 @@ public static function all(): array { * names, per-setting stored-value sanitizing/omission) are already * in the PR #2 backport; nothing was ported for them. * - * Tier: experimental, incubating under the `wp/` prefix — the proposal + * Tier: experimental, incubating under the `core-experimental/` prefix — the proposal * below is the PR's paper trail, but the ability has NOT landed in * core (`core_since` stays null and flips when core lands it), so its * name and schema carry no promises yet (NAME-LIFECYCLE.md). */ - 'wp/settings-update' => array( - 'name' => 'wp/settings-update', + 'core-experimental/settings-update' => array( + 'name' => 'core-experimental/settings-update', 'class' => Settings\Settings_Update::class, 'category' => 'site', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/settings-update', 'proposal' => 'https://github.com/WordPress/ai/pull/764', ), /* @@ -228,49 +228,49 @@ public static function all(): array { * Users_Query backport byte-exact), with `format_user()` gaining the * write-side `$edit_context` parameter the PR's write path adds. * - * Tier: experimental, incubating under the `wp/` prefix — the proposal + * Tier: experimental, incubating under the `core-experimental/` prefix — the proposal * below is the PR's paper trail, but the abilities have NOT landed in * core (`core_since` stays null and flips when core lands them), so * their names and schemas carry no promises yet (NAME-LIFECYCLE.md). */ - 'wp/user-create' => array( - 'name' => 'wp/user-create', + 'core-experimental/user-create' => array( + 'name' => 'core-experimental/user-create', 'class' => Users\User_Create::class, 'category' => 'user', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/user-create', 'proposal' => 'https://github.com/WordPress/ai/pull/1105', ), - 'wp/user-update' => array( - 'name' => 'wp/user-update', + 'core-experimental/user-update' => array( + 'name' => 'core-experimental/user-update', 'class' => Users\User_Update::class, 'category' => 'user', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/user-update', 'proposal' => 'https://github.com/WordPress/ai/pull/1105', ), - 'wp/user-delete' => array( - 'name' => 'wp/user-delete', + 'core-experimental/user-delete' => array( + 'name' => 'core-experimental/user-delete', 'class' => Users\User_Delete::class, 'category' => 'user', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array(), - 'renamed_from' => null, + 'renamed_from' => 'wp/user-delete', 'proposal' => 'https://github.com/WordPress/ai/pull/1105', ), /* * The terms query below is a faithful port of WordPress/ai PR #1099 * (author @jorgefilipecosta). * - * Tier: experimental, incubating under the `wp/` prefix — the proposal + * Tier: experimental, incubating under the `core-experimental/` prefix — the proposal * below is the PR's paper trail, but the ability has NOT landed in * core (`core_since` stays null and flips when core lands it), so its * name and schema carry no promises yet (NAME-LIFECYCLE.md). Its @@ -278,20 +278,20 @@ public static function all(): array { * pre-7.2 hosts), and the taxonomy opt-in `show_in_abilities` is * native on 7.2+ and polyfilled on 6.9-7.1. */ - 'wp/terms-query' => array( - 'name' => 'wp/terms-query', + 'core-experimental/terms-query' => array( + 'name' => 'core-experimental/terms-query', 'class' => Terms\Terms_Query::class, 'category' => 'content', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array( 'taxonomy_show_in_abilities' ), - 'renamed_from' => null, + 'renamed_from' => 'wp/terms-query', 'proposal' => 'https://github.com/WordPress/ai/pull/1099', ), /* * The term writes below are a faithful port of WordPress/ai PR #1103 - * (author @jorgefilipecosta) on top of the `wp/terms-query` field + * (author @jorgefilipecosta) on top of the `core-experimental/terms-query` field * projection (PR #10): the abilities write terms of the same exposed * taxonomies and answer with them through the same contract, limited * by `fields`; a delete returns the deleted term under `previous`, @@ -301,10 +301,10 @@ public static function all(): array { * capability mapping denies `delete_term` against the term named by * the `default_{$taxonomy}` option, and `wp_delete_term()` refuses it. * The write helpers share the projection by verbatim copy (the - * media-write sharing pattern, as Terms_Query is a hand-authored wp/* + * media-write sharing pattern, as Terms_Query is a hand-authored core-experimental/* * class), with `private` relaxed to `protected` at the copy site. * - * Tier: experimental, incubating under the `wp/` prefix — the proposal + * Tier: experimental, incubating under the `core-experimental/` prefix — the proposal * below is the PR's paper trail, but the abilities have NOT landed in * core (`core_since` stays null and flips when core lands them), so * their names and schemas carry no promises yet (NAME-LIFECYCLE.md). @@ -312,37 +312,37 @@ public static function all(): array { * it on pre-7.2 hosts), and the taxonomy opt-in they ride is the * `taxonomy_show_in_abilities` support feature, as for the query. */ - 'wp/term-create' => array( - 'name' => 'wp/term-create', + 'core-experimental/term-create' => array( + 'name' => 'core-experimental/term-create', 'class' => Terms\Term_Create::class, 'category' => 'content', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array( 'taxonomy_show_in_abilities' ), - 'renamed_from' => null, + 'renamed_from' => 'wp/term-create', 'proposal' => 'https://github.com/WordPress/ai/pull/1103', ), - 'wp/term-update' => array( - 'name' => 'wp/term-update', + 'core-experimental/term-update' => array( + 'name' => 'core-experimental/term-update', 'class' => Terms\Term_Update::class, 'category' => 'content', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array( 'taxonomy_show_in_abilities' ), - 'renamed_from' => null, + 'renamed_from' => 'wp/term-update', 'proposal' => 'https://github.com/WordPress/ai/pull/1103', ), - 'wp/term-delete' => array( - 'name' => 'wp/term-delete', + 'core-experimental/term-delete' => array( + 'name' => 'core-experimental/term-delete', 'class' => Terms\Term_Delete::class, 'category' => 'content', 'tier' => self::TIER_EXPERIMENTAL, 'min_wp_version' => '6.9', 'core_since' => null, 'requires' => array( 'taxonomy_show_in_abilities' ), - 'renamed_from' => null, + 'renamed_from' => 'wp/term-delete', 'proposal' => 'https://github.com/WordPress/ai/pull/1103', ), ); diff --git a/src/Media/Abstract_Media_Write.php b/src/Media/Abstract_Media_Write.php index 01d5486..2693623 100644 --- a/src/Media/Abstract_Media_Write.php +++ b/src/Media/Abstract_Media_Write.php @@ -4,14 +4,14 @@ * * Ported from WordPress/ai PR #1104 (https://github.com/WordPress/ai/pull/1104) by @jorgefilipecosta. * - * The helpers shared with this package's `wp/media-query` port (attachment lookup, + * The helpers shared with this package's `core-experimental/media-query` port (attachment lookup, * permission checks, field projection, the response date formatting, and the file-size / * file-name accessors) are extracted verbatim from Media_Query.php with `private` * relaxed to `protected` so the write ability subclasses reuse them; the global-post * restoration the upstream PR refactored into a helper is ported as written. The write * logic itself (upload from base64 data or a URL sideload, update, delete) is a faithful * port of the PR: upstream names the abilities `core/media-*`; this package ships them - * under the experimental tier's `wp/` prefix (see NAME-LIFECYCLE.md), with the `default` + * under the experimental tier's `core-experimental/` prefix (see NAME-LIFECYCLE.md), with the `default` * text domain and registration owned by the package's Registrar. * * @package WordPress\Abilities @@ -28,9 +28,9 @@ use WordPress\Abilities\Abstract_Core_Ability; /** - * Shared base for the `wp/media-upload`, `wp/media-update`, and `wp/media-delete` abilities. + * Shared base for the `core-experimental/media-upload`, `core-experimental/media-update`, and `core-experimental/media-delete` abilities. * - * A written attachment is answered through the same field projection as `wp/media-query`, in + * A written attachment is answered through the same field projection as `core-experimental/media-query`, in * the edit context: the returned item's raw fields do not depend on edit access, because the * abilities' permission callbacks already require it. * @@ -99,7 +99,7 @@ protected function restore_request_state( $previous_post ): void { // -- The helpers below are extracted verbatim from this package's Media_Query // -- port of WordPress/ai PR #1098, with `private` relaxed to `protected` so // -- the write abilities reuse them. They are the field projection that lets - // -- a written attachment be read back unchanged through `wp/media-query`'s + // -- a written attachment be read back unchanged through `core-experimental/media-query`'s // -- contract. /** @@ -273,7 +273,7 @@ public function protected_title_format(): string { } /** - * The attachment item field schema, shared by `wp/media-query` and the write + * The attachment item field schema, shared by `core-experimental/media-query` and the write * abilities (the write output uses it with edit-context descriptions). * * @return array> Field definitions keyed by field name. @@ -566,7 +566,7 @@ protected function prepare_item_for_response( $item, array $request ): array { } /** - * Permission callback for the `wp/media-upload` ability. + * Permission callback for the `core-experimental/media-upload` ability. * * Requires an authenticated user who can create attachments and upload files. The author * and the parent post are checked during execution, where the error can name the refused @@ -586,7 +586,7 @@ public function create_item_permissions_check(): bool { } /** - * Executes the `wp/media-upload` ability. + * Executes the `core-experimental/media-upload` ability. * * {@see WP_Ability::execute()} always runs {@see self::create_item_permissions_check()} * first. The global post, which preparing the response replaces, is restored afterwards. @@ -607,7 +607,7 @@ public function execute_media_upload( $input = array() ) { } /** - * Permission callback for the `wp/media-update` ability. + * Permission callback for the `core-experimental/media-update` ability. * * Requires an authenticated user who can edit the attachment; a missing attachment is * denied like one the user cannot edit. The rest of the input is checked during @@ -627,7 +627,7 @@ public function update_item_permissions_check( $input = array() ): bool { } /** - * Executes the `wp/media-update` ability. + * Executes the `core-experimental/media-update` ability. * * {@see WP_Ability::execute()} always runs {@see self::update_item_permissions_check()} * first. The global post, which preparing the response replaces, is restored afterwards. @@ -648,7 +648,7 @@ public function execute_media_update( $input = array() ) { } /** - * Permission callback for the `wp/media-delete` ability. + * Permission callback for the `core-experimental/media-delete` ability. * * Requires an authenticated user who can delete the attachment; a missing attachment is * denied like one the user cannot delete. @@ -667,7 +667,7 @@ public function delete_item_permissions_check( $input = array() ): bool { } /** - * Executes the `wp/media-delete` ability. + * Executes the `core-experimental/media-delete` ability. * * {@see WP_Ability::execute()} always runs {@see self::delete_item_permissions_check()} * first. The global post, which preparing the response replaces, is restored afterwards. @@ -1575,7 +1575,7 @@ protected function get_write_properties(): array { } /** - * Builds the input schema for the `wp/media-upload` ability. + * Builds the input schema for the `core-experimental/media-upload` ability. * * The file comes either as base64 data with a file name, or as a URL to download an * image from. The two modes are modeled as a `oneOf`, and neither accepts the other's @@ -1630,7 +1630,7 @@ protected function get_upload_input_schema(): array { } /** - * Builds the input schema for the `wp/media-update` ability. + * Builds the input schema for the `core-experimental/media-update` ability. * * The status is not restricted by an enum: an attachment may keep its current status, * such as `inherit`, so the status is validated against the attachment during execution. @@ -1707,7 +1707,7 @@ protected function get_write_output_schema(): array { } /** - * Builds the input schema for the `wp/media-delete` ability. + * Builds the input schema for the `core-experimental/media-delete` ability. * * @return array The input JSON Schema. */ @@ -1732,7 +1732,7 @@ protected function get_delete_input_schema(): array { } /** - * Builds the output schema for the `wp/media-delete` ability. + * Builds the output schema for the `core-experimental/media-delete` ability. * * Trashing returns the trashed attachment directly; a forced deletion returns a `deleted` * flag with the deleted attachment under `previous`. diff --git a/src/Media/Media_Delete.php b/src/Media/Media_Delete.php index c146ed9..2a9d52c 100644 --- a/src/Media/Media_Delete.php +++ b/src/Media/Media_Delete.php @@ -1,6 +1,6 @@ $create_schema The input schema of the `wp/term-create` ability. + * @param array $create_schema The input schema of the `core-experimental/term-create` ability. * @return array The input JSON Schema. */ protected function get_term_update_input_schema( array $create_schema ): array { @@ -512,7 +512,7 @@ protected function get_term_update_input_schema( array $create_schema ): array { } /** - * Builds the input schema for the `wp/term-delete` ability. + * Builds the input schema for the `core-experimental/term-delete` ability. * * @param list $taxonomies Exposed taxonomy names. * @return array The input JSON Schema. @@ -576,7 +576,7 @@ protected function get_term_output_schema(): array { } /** - * Builds the output schema for the `wp/term-delete` ability. + * Builds the output schema for the `core-experimental/term-delete` ability. * * @return array The output JSON Schema. */ @@ -598,7 +598,7 @@ protected function get_term_delete_output_schema(): array { // -- The helpers below are extracted verbatim from this package's Terms_Query // -- port of WordPress/ai PR #1099, with `private` relaxed to `protected` so // -- the write abilities reuse them. They are the field projection that lets - // -- a written term be read back unchanged through `wp/terms-query`'s + // -- a written term be read back unchanged through `core-experimental/terms-query`'s // -- contract. Only `get_term_for_write()` above adds write-specific logic on // -- top of them. diff --git a/src/Terms/Term_Create.php b/src/Terms/Term_Create.php index e784f5f..dda153e 100644 --- a/src/Terms/Term_Create.php +++ b/src/Terms/Term_Create.php @@ -1,6 +1,6 @@ The output JSON Schema. */ diff --git a/src/Terms/Term_Delete.php b/src/Terms/Term_Delete.php index e19bc66..5a85982 100644 --- a/src/Terms/Term_Delete.php +++ b/src/Terms/Term_Delete.php @@ -1,6 +1,6 @@ The output JSON Schema. */ diff --git a/src/Terms/Terms_Query.php b/src/Terms/Terms_Query.php index 283a20d..681bd1d 100644 --- a/src/Terms/Terms_Query.php +++ b/src/Terms/Terms_Query.php @@ -5,7 +5,7 @@ * Ported from WordPress/ai PR #1099 (https://github.com/WordPress/ai/pull/1099) * by @jorgefilipecosta, on this package's Abstract_Core_Ability authoring * surface. The PR's `core/terms-query` name is not copied: the ability ships - * under the experimental tier name `wp/terms-query` (see NAME-LIFECYCLE.md; + * under the experimental tier name `core-experimental/terms-query` (see NAME-LIFECYCLE.md; * the D7 name-lifecycle rule carries no aliases), and its category stays the * core-registered `content` category — everything else mirrors the PR as * written: labels, description, schemas, annotations, error codes, and the @@ -33,7 +33,7 @@ use WordPress\Abilities\Abstract_Core_Ability; /** - * Registers the read-only `wp/terms-query` ability, which retrieves terms of a taxonomy + * Registers the read-only `core-experimental/terms-query` ability, which retrieves terms of a taxonomy * exposed to abilities via `show_in_abilities`. Supports fetching a single term by ID or by * taxonomy and slug, or querying the terms of one taxonomy filtered by search, parent, post, * emptiness, or included and excluded IDs. @@ -90,7 +90,7 @@ final class Terms_Query extends Abstract_Core_Ability { * @return string */ protected function ability_name(): string { - return 'wp/terms-query'; + return 'core-experimental/terms-query'; } /** @@ -218,7 +218,7 @@ protected function required_capabilities(): array { } /** - * Permission callback for the `wp/terms-query` ability. + * Permission callback for the `core-experimental/terms-query` ability. * * Requires a logged-in user. A single-term request is denied unless the term exists in a * taxonomy exposed to abilities, and in the requested taxonomy when one is given. A @@ -244,7 +244,7 @@ private function check_permission( $input = array() ): bool { } /** - * Executes the `wp/terms-query` ability. + * Executes the `core-experimental/terms-query` ability. * * {@see WP_Ability::execute()} always runs {@see self::check_permission()} first, so * single-term requests are only resolved again here when reached through the unvalidated @@ -748,7 +748,7 @@ private function check_is_taxonomy_allowed( string $taxonomy ): bool { } /** - * Builds the input schema for the `wp/terms-query` ability. + * Builds the input schema for the `core-experimental/terms-query` ability. * * The ability has three mutually exclusive modes, modeled as a `oneOf` so invalid * combinations are rejected rather than silently ignored: @@ -833,7 +833,7 @@ private function get_terms_query_input_schema( array $taxonomies ): array { } /** - * Builds the output schema for the `wp/terms-query` ability. + * Builds the output schema for the `core-experimental/terms-query` ability. * * Single-term mode returns the term object directly, while collection mode returns a * paginated wrapper. Both shapes reject unknown properties, which keeps a term from diff --git a/src/Users/Abstract_User_Write.php b/src/Users/Abstract_User_Write.php index 9d5ccaa..dd1d184 100644 --- a/src/Users/Abstract_User_Write.php +++ b/src/Users/Abstract_User_Write.php @@ -13,7 +13,7 @@ * `$edit_context` parameter the write path needs, ported verbatim from the PR's * write-side edition. The write logic itself (create, update, delete, the * roles/reassign rules) is a faithful port of the PR: upstream names the abilities - * `core/user-*`; this package ships them under the experimental tier's `wp/` + * `core/user-*`; this package ships them under the experimental tier's `core-experimental/` * prefix (see NAME-LIFECYCLE.md), with the `default` text domain and registration * owned by the package's Registrar. * @@ -30,7 +30,7 @@ use WordPress\Abilities\Abstract_Core_Ability; /** - * Shared base for the `wp/user-create`, `wp/user-update`, and `wp/user-delete` + * Shared base for the `core-experimental/user-create`, `core-experimental/user-update`, and `core-experimental/user-delete` * abilities. * * A written user is answered through the same field projection as @@ -658,7 +658,7 @@ protected function check_role_update( ?int $user_id, array $roles ) { } /** - * Permission callback for the `wp/user-create` ability. + * Permission callback for the `core-experimental/user-create` ability. * * The rest of the input is checked during execution. * @@ -669,7 +669,7 @@ public function check_create_permission(): bool { } /** - * Permission callback for the `wp/user-update` ability. + * Permission callback for the `core-experimental/user-update` ability. * * The current user must be able to edit the user, or to promote the user when only the * roles are given, an empty list included. A roles change still needs the promote @@ -708,7 +708,7 @@ public function check_update_permission( $input = array() ): bool { } /** - * Permission callback for the `wp/user-delete` ability. + * Permission callback for the `core-experimental/user-delete` ability. * * @param mixed $input Optional. The ability input. Default empty array. * @return bool True if the request may proceed, false otherwise. @@ -729,7 +729,7 @@ public function check_delete_permission( $input = array() ): bool { } /** - * Executes the `wp/user-create` ability. + * Executes the `core-experimental/user-create` ability. * * @param mixed $input Optional. The ability input. Default empty array. * @return array|\WP_Error The created user, or a WP_Error. @@ -846,7 +846,7 @@ public function execute_user_create( $input = array() ) { } /** - * Executes the `wp/user-update` ability. + * Executes the `core-experimental/user-update` ability. * * @param mixed $input Optional. The ability input. Default empty array. * @return array|\WP_Error The updated user, or a WP_Error. @@ -930,7 +930,7 @@ public function execute_user_update( $input = array() ) { } /** - * Executes the `wp/user-delete` ability. + * Executes the `core-experimental/user-delete` ability. * * Users cannot be trashed, so the user is deleted permanently and returned as it was just * before the deletion. @@ -1072,7 +1072,7 @@ protected function get_user_write_properties(): array { } /** - * Builds the input schema for the `wp/user-create` ability. + * Builds the input schema for the `core-experimental/user-create` ability. * * @return array The input JSON Schema. */ @@ -1095,7 +1095,7 @@ protected function get_user_create_input_schema(): array { } /** - * Builds the input schema for the `wp/user-update` ability. + * Builds the input schema for the `core-experimental/user-update` ability. * * @return array The input JSON Schema. */ @@ -1119,7 +1119,7 @@ protected function get_user_update_input_schema(): array { } /** - * Builds the input schema for the `wp/user-delete` ability. + * Builds the input schema for the `core-experimental/user-delete` ability. * * `reassign` also takes a string so the query-string forms of an ID and of false are read * like the ID and false themselves. diff --git a/src/Users/User_Create.php b/src/Users/User_Create.php index 0e9d9bc..c01722c 100644 --- a/src/Users/User_Create.php +++ b/src/Users/User_Create.php @@ -1,6 +1,6 @@ get_registered( 'wp/media-delete' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-delete' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability; @@ -126,7 +126,7 @@ private function get_registered(): WP_Ability { * @return mixed The ability result. */ private function delete( array $input = array() ) { - $ability = WP_Abilities_Registry::get_instance()->get_registered( 'wp/media-delete' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-delete' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability->execute( $input ); @@ -259,7 +259,7 @@ public function test_registers_the_delete_ability(): void { $schema = $ability->get_input_schema(); $output = $ability->get_output_schema(); - $query_types = wp_list_pluck( WP_Abilities_Registry::get_instance()->get_registered( 'wp/media-query' )->get_output_schema()['oneOf'][0]['properties'], 'type' ); + $query_types = wp_list_pluck( WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-query' )->get_output_schema()['oneOf'][0]['properties'], 'type' ); self::assertSame( array( 'id' ), $schema['required'], 'Only the ID should be required.' ); self::assertArrayHasKey( 'force', $schema['properties'], 'The delete input should take the force key.' ); diff --git a/tests/Abilities/MediaQueryTest.php b/tests/Abilities/MediaQueryTest.php index 655b47f..8b3fd6e 100644 --- a/tests/Abilities/MediaQueryTest.php +++ b/tests/Abilities/MediaQueryTest.php @@ -1,10 +1,10 @@ get_registered( 'wp/media-query' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-query' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability; @@ -129,7 +129,7 @@ private function get_registered(): WP_Ability { * @return mixed The ability result. */ private function execute( array $input = array() ) { - return wp_get_ability( 'wp/media-query' )->execute( $input ); + return wp_get_ability( 'core-experimental/media-query' )->execute( $input ); } /** @@ -308,7 +308,7 @@ private function check_post_data( WP_Post $attachment, array $data ): void { /** * Registered exactly once, with the PR's annotations and the experimental provenance. * - * The `wp/` name is never core-provided, so the package copy registers on both + * The `core-experimental/` name is never core-provided, so the package copy registers on both * environments and the provenance does not branch. */ public function test_registered_once_with_annotations_and_provenance(): void { diff --git a/tests/Abilities/MediaUpdateTest.php b/tests/Abilities/MediaUpdateTest.php index 4b70249..897a151 100644 --- a/tests/Abilities/MediaUpdateTest.php +++ b/tests/Abilities/MediaUpdateTest.php @@ -1,6 +1,6 @@ get_registered( 'wp/media-update' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-update' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability; @@ -125,7 +125,7 @@ private function get_registered(): WP_Ability { * @return mixed The ability result. */ private function update( array $input = array() ) { - $ability = WP_Abilities_Registry::get_instance()->get_registered( 'wp/media-update' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-update' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability->execute( $input ); diff --git a/tests/Abilities/MediaUploadTest.php b/tests/Abilities/MediaUploadTest.php index ffbc2d9..8a8efa5 100644 --- a/tests/Abilities/MediaUploadTest.php +++ b/tests/Abilities/MediaUploadTest.php @@ -1,10 +1,10 @@ get_registered( 'wp/media-upload' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-upload' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability; @@ -147,7 +147,7 @@ private function get_registered(): WP_Ability { * @return mixed The ability result. */ private function upload( array $input = array() ) { - $ability = WP_Abilities_Registry::get_instance()->get_registered( 'wp/media-upload' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/media-upload' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability->execute( $input ); @@ -895,7 +895,7 @@ public function test_upload_matches_the_media_endpoint(): void { ); $fields = array( 'date', 'date_gmt', 'status', 'title_raw', 'title_rendered', 'author', 'description_raw', 'caption_raw', 'caption_rendered', 'alt_text', 'media_type', 'mime_type', 'post' ); - $request = new WP_REST_Request( 'POST', '/wp/v2/media' ); + $request = new WP_REST_Request( 'POST', '/core-experimental/v2/media' ); $request->set_header( 'Content-Type', 'image/jpeg' ); $request->set_header( 'Content-Disposition', 'attachment; filename=canola.jpg' ); $request->set_body( (string) file_get_contents( (string) constant( 'DIR_TESTDATA' ) . '/images/canola.jpg' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Reads a local test file. diff --git a/tests/Abilities/SettingsUpdateTest.php b/tests/Abilities/SettingsUpdateTest.php index cf60ec8..b815deb 100644 --- a/tests/Abilities/SettingsUpdateTest.php +++ b/tests/Abilities/SettingsUpdateTest.php @@ -1,6 +1,6 @@ get_registered( 'wp/settings-update' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/settings-update' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability; diff --git a/tests/Abilities/TermWritesTest.php b/tests/Abilities/TermWritesTest.php index 024e4e9..381473a 100644 --- a/tests/Abilities/TermWritesTest.php +++ b/tests/Abilities/TermWritesTest.php @@ -1,11 +1,11 @@ Term_Create::class, - 'wp/term-update' => Term_Update::class, - 'wp/term-delete' => Term_Delete::class, + 'core-experimental/term-create' => Term_Create::class, + 'core-experimental/term-update' => Term_Update::class, + 'core-experimental/term-delete' => Term_Delete::class, ); global $wp_current_filter; @@ -244,9 +244,9 @@ private function execute_raw( string $ability_name, array $input = array() ) { */ private function execute_method_for( string $ability_name ): string { $methods = array( - 'wp/term-create' => 'execute_term_create', - 'wp/term-update' => 'execute_term_update', - 'wp/term-delete' => 'execute_term_delete', + 'core-experimental/term-create' => 'execute_term_create', + 'core-experimental/term-update' => 'execute_term_update', + 'core-experimental/term-delete' => 'execute_term_delete', ); return $methods[ $ability_name ]; @@ -392,9 +392,9 @@ private function assert_error( $actual, string $code, ?int $status = null, strin * schemas, and the answer shape of the query the writes answer through. */ public function test_registered_once_with_the_pr_contract(): void { - $create = $this->get_registered( 'wp/term-create' ); - $update = $this->get_registered( 'wp/term-update' ); - $delete = $this->get_registered( 'wp/term-delete' ); + $create = $this->get_registered( 'core-experimental/term-create' ); + $update = $this->get_registered( 'core-experimental/term-update' ); + $delete = $this->get_registered( 'core-experimental/term-delete' ); self::assertSame( 'Term Create', $create->get_label() ); self::assertSame( 'Term Update', $update->get_label() ); @@ -443,7 +443,7 @@ public function test_registered_once_with_the_pr_contract(): void { self::assertSame( 'boolean', $delete_schema['properties']['force']['type'], 'The force flag should be a boolean.' ); self::assertSame( 'Optional. Delete the term only if it belongs to this taxonomy.', $delete_schema['properties']['taxonomy']['description'], 'The taxonomy should be an optional guard on delete.' ); - $term_shape = $this->get_registered( 'wp/terms-query' )->get_output_schema()['oneOf'][0]; + $term_shape = $this->get_registered( 'core-experimental/terms-query' )->get_output_schema()['oneOf'][0]; self::assertSame( $term_shape, $create->get_output_schema(), 'The created term should have the shape of a queried term.' ); self::assertSame( $term_shape, $update->get_output_schema(), 'The updated term should have the shape of a queried term.' ); @@ -486,7 +486,7 @@ public function test_create_item(): void { $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => $taxonomy, 'name' => 'My Awesome Term', @@ -517,7 +517,7 @@ public function test_created_term_defaults(): void { $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => $taxonomy, 'name' => 'Default fields ' . $taxonomy, @@ -538,13 +538,13 @@ public function test_created_term_defaults(): void { /** * The ID is always included, even under a field selection asking for one - * detail, and the stored term reads back the same through `wp/terms-query`. + * detail, and the stored term reads back the same through `core-experimental/terms-query`. */ public function test_created_term_reads_back_the_same_through_the_query(): void { $this->log_in_as( 'administrator' ); $created = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'Backreading', @@ -556,7 +556,7 @@ public function test_created_term_reads_back_the_same_through_the_query(): void self::assertSame( array( 'id', 'description' ), array_keys( $created ), 'The ID should always be included.' ); $read = $this->execute( - 'wp/terms-query', + 'core-experimental/terms-query', array( 'id' => $created['id'], 'fields' => array( 'name', 'description', 'taxonomy' ), @@ -577,7 +577,7 @@ public function test_create_item_term_already_exists(): void { $existing_id = $this->create_test_term( 'category', 'Existing' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'Existing', @@ -595,7 +595,7 @@ public function test_create_item_invalid_taxonomy(): void { $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'invalid-taxonomy', 'name' => 'Invalid Taxonomy', @@ -613,7 +613,7 @@ public function test_create_item_missing_name(): void { foreach ( $this->core_taxonomies() as $taxonomy ) { $this->log_in_as( 'administrator' ); - $result = $this->execute( 'wp/term-create', array( 'taxonomy' => $taxonomy ) ); + $result = $this->execute( 'core-experimental/term-create', array( 'taxonomy' => $taxonomy ) ); $this->assert_error( $result, 'ability_invalid_input', null, 'A term without a name should fail validation.' ); } @@ -627,7 +627,7 @@ public function test_create_item_unknown_input_rejected(): void { $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'post_tag', 'name' => 'Blue', @@ -648,7 +648,7 @@ public function test_create_item_incorrect_permissions(): void { $this->log_in_as( 'subscriber' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => $taxonomy, 'name' => 'Incorrect permissions', @@ -668,7 +668,7 @@ public function test_create_item_incorrect_permissions_contributor(): void { $this->log_in_as( 'contributor' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'Incorrect permissions', @@ -685,7 +685,7 @@ public function test_create_item_contributor(): void { $this->log_in_as( 'contributor' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'post_tag', 'name' => 'My Awesome Term', @@ -727,7 +727,7 @@ public function test_roles_creating_terms(): void { foreach ( $allowed_by_taxonomy as $taxonomy => $allowed ) { $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => $taxonomy, 'name' => $name, @@ -758,7 +758,7 @@ public function test_create_item_with_parent(): void { $parent = $this->create_test_term( 'category', 'test-category' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'My Awesome Term', @@ -779,7 +779,7 @@ public function test_create_item_invalid_parent(): void { $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'My Awesome Term', @@ -798,7 +798,7 @@ public function test_create_item_with_no_parent(): void { $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'My Awesome Term', @@ -819,7 +819,7 @@ public function test_create_item_parent_non_hierarchical_taxonomy(): void { $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'post_tag', 'name' => 'My Awesome Term', @@ -851,7 +851,7 @@ public function test_create_term_name_is_unique_under_its_parent(): void { $fields = array( 'name', 'slug', 'parent' ); $taken = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'Apple', @@ -869,7 +869,7 @@ public function test_create_term_name_is_unique_under_its_parent(): void { ); $under_veg = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'Apple', @@ -882,7 +882,7 @@ public function test_create_term_name_is_unique_under_its_parent(): void { self::assertSame( $veg, $under_veg['parent'], 'The term should be created under the other parent.' ); $top_level = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'Apple', @@ -894,7 +894,7 @@ public function test_create_term_name_is_unique_under_its_parent(): void { self::assertSame( 0, $top_level['parent'], 'The term should be created at the top level.' ); $own_slug = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'category', 'name' => 'Apple', @@ -918,7 +918,7 @@ public function test_create_tag_with_a_taken_name_is_reported(): void { $red = $this->create_test_term( 'post_tag', 'Red' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'post_tag', 'name' => 'Red', @@ -938,7 +938,7 @@ public function test_create_item_with_an_empty_name(): void { foreach ( array( '', '' ) as $name ) { $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'post_tag', 'name' => $name, @@ -957,7 +957,7 @@ public function test_create_item_outside_the_exposure_is_denied_like_a_missing_c $this->log_in_as( 'administrator' ); $result = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'wpai_secret', 'name' => 'Secret term', @@ -967,7 +967,7 @@ public function test_create_item_outside_the_exposure_is_denied_like_a_missing_c $this->assert_error( $result, 'ability_invalid_input', null, 'The schema should refuse an unexposed taxonomy.' ); $direct = $this->execute_raw( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'wpai_secret', 'name' => 'Secret term', @@ -995,7 +995,7 @@ public function test_update_item(): void { ); $result = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $term_id, 'name' => 'Renamed', @@ -1023,7 +1023,7 @@ public function test_renaming_keeps_the_slug_until_it_is_cleared(): void { $tag_id = $this->create_test_term( 'post_tag', 'Green', array( 'slug' => 'green' ) ); $renamed = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $tag_id, 'name' => 'Lime green', @@ -1034,7 +1034,7 @@ public function test_renaming_keeps_the_slug_until_it_is_cleared(): void { self::assertSame( 'green', $renamed['slug'], 'Renaming should keep the slug.' ); $cleared = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $tag_id, 'slug' => 'lime-green', @@ -1056,7 +1056,7 @@ public function test_update_item_parent_and_removal(): void { $apple = $this->create_test_term( 'category', 'Apple', array( 'parent' => $fruit ) ); $moved = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $apple, 'parent' => $veg, @@ -1067,7 +1067,7 @@ public function test_update_item_parent_and_removal(): void { self::assertSame( $veg, $moved['parent'], 'The term should move under the new parent.' ); $top = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $apple, 'parent' => 0, @@ -1087,7 +1087,7 @@ public function test_update_saves_the_term_even_without_changes(): void { $tag_id = $this->create_test_term( 'post_tag', 'No change', array( 'slug' => 'no-change' ) ); $result = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $tag_id, 'fields' => array( 'name', 'slug', 'count' ), @@ -1109,7 +1109,7 @@ public function test_update_item_parent_invalid_and_non_hierarchical(): void { $tag_id = $this->create_test_term( 'post_tag', 'Parentless tag' ); $invalid = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $category_id, 'parent' => self::IMPOSSIBLY_HIGH_NUMBER, @@ -1118,7 +1118,7 @@ public function test_update_item_parent_invalid_and_non_hierarchical(): void { $this->assert_error( $invalid, 'terms_term_invalid', 400, 'A missing parent should be reported.' ); $flat = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $tag_id, 'parent' => $category_id, @@ -1138,7 +1138,7 @@ public function test_update_taxonomy_guard_mismatch_denies_like_a_missing_term() $category_id = $this->create_test_term( 'category', 'The category' ); $result = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $category_id, 'taxonomy' => 'post_tag', @@ -1149,7 +1149,7 @@ public function test_update_taxonomy_guard_mismatch_denies_like_a_missing_term() $this->assert_denied( $result, 'A guard mismatch should deny the update.' ); $direct = $this->execute_raw( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $category_id, 'taxonomy' => 'post_tag', @@ -1171,14 +1171,14 @@ public function test_hidden_and_missing_terms_are_denied_alike(): void { $hidden_id = $this->create_test_term( 'wpai_secret', 'Hidden genre', array( 'slug' => 'hidden-genre' ) ); $hidden = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $hidden_id, 'name' => 'Renamed', ) ); $missing = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => self::IMPOSSIBLY_HIGH_NUMBER, 'name' => 'Renamed', @@ -1201,7 +1201,7 @@ public function test_direct_update_with_a_malformed_lookup_fails_closed(): void foreach ( array( 'Not a number', 1.5 ) as $malformed_id ) { $direct = $this->execute_raw( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $malformed_id, 'name' => 'Hijacked', @@ -1229,7 +1229,7 @@ public function test_update_item_capability_floors(): void { $this->log_in_as( 'subscriber' ); $subscriber = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $term_id, 'name' => 'Renamed by a subscriber', @@ -1239,7 +1239,7 @@ public function test_update_item_capability_floors(): void { $this->log_in_as( 'contributor' ); $contributor = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $term_id, 'name' => 'Renamed by a contributor', @@ -1249,7 +1249,7 @@ public function test_update_item_capability_floors(): void { $this->log_in_as( 'editor' ); $editor = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $term_id, 'name' => 'Renamed by an editor', @@ -1276,7 +1276,7 @@ public function test_update_item_logged_out_denied(): void { wp_set_current_user( 0 ); $result = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $term_id, 'name' => 'Renamed by nobody', @@ -1299,7 +1299,7 @@ public function test_update_item_with_edit_term_cap_granted(): void { $this->log_in_as( 'subscriber' ); $subscriber = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $tag_id, 'name' => 'Renamed by a subscriber', @@ -1319,7 +1319,7 @@ public function test_update_item_with_edit_term_cap_granted(): void { try { $result = $this->execute( - 'wp/term-update', + 'core-experimental/term-update', array( 'id' => $tag_id, 'name' => 'Renamed under a granted cap', @@ -1356,7 +1356,7 @@ public function test_delete_item(): void { ); $result = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $term_id, 'force' => true, @@ -1383,7 +1383,7 @@ public function test_deleted_term_matches_its_last_read(): void { $fields = array( 'name', 'slug', 'count' ); $read = $this->execute( - 'wp/terms-query', + 'core-experimental/terms-query', array( 'id' => $tag_id, 'fields' => $fields, @@ -1392,7 +1392,7 @@ public function test_deleted_term_matches_its_last_read(): void { self::assertIsArray( $read, 'The term should be readable before its deletion.' ); $deleted = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $tag_id, 'force' => true, @@ -1413,7 +1413,7 @@ public function test_deleted_term_is_no_longer_readable(): void { $tag_id = $this->create_test_term( 'post_tag', 'Unreadable after delete' ); $deleted = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $tag_id, 'force' => true, @@ -1421,7 +1421,7 @@ public function test_deleted_term_is_no_longer_readable(): void { ); self::assertIsArray( $deleted, 'The tag should be deleted.' ); - $read = $this->execute( 'wp/terms-query', array( 'id' => $tag_id ) ); + $read = $this->execute( 'core-experimental/terms-query', array( 'id' => $tag_id ) ); $this->assert_denied( $read, 'A deleted term should be unreadable.' ); } @@ -1436,11 +1436,11 @@ public function test_delete_item_no_trash(): void { $term_id = $this->create_test_term( $taxonomy, 'Not doomed ' . $taxonomy ); - $without_force = $this->execute( 'wp/term-delete', array( 'id' => $term_id ) ); + $without_force = $this->execute( 'core-experimental/term-delete', array( 'id' => $term_id ) ); $this->assert_error( $without_force, 'terms_trash_not_supported', 501, 'A delete without force should be refused.' ); $false_force = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $term_id, 'force' => false, @@ -1462,7 +1462,7 @@ public function test_delete_item_guard_and_missing_denied_alike(): void { $tag_id = $this->create_test_term( 'post_tag', 'Guarded tag' ); $missing = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => self::IMPOSSIBLY_HIGH_NUMBER, 'force' => true, @@ -1471,7 +1471,7 @@ public function test_delete_item_guard_and_missing_denied_alike(): void { $this->assert_denied( $missing, 'A missing term should be denied.' ); $guarded = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $tag_id, 'taxonomy' => 'category', @@ -1481,7 +1481,7 @@ public function test_delete_item_guard_and_missing_denied_alike(): void { $this->assert_denied( $guarded, 'A guard mismatch should deny the delete.' ); $direct = $this->execute_raw( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => self::IMPOSSIBLY_HIGH_NUMBER, 'force' => true, @@ -1501,7 +1501,7 @@ public function test_direct_delete_with_a_malformed_lookup_fails_closed(): void foreach ( array( 'Not a number', 0, 1.5 ) as $malformed_id ) { $direct = $this->execute_raw( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $malformed_id, 'force' => true, @@ -1522,11 +1522,11 @@ public function test_direct_delete_rechecks_the_force_gate(): void { $tag_id = $this->create_test_term( 'post_tag', 'Unforced tag' ); - $direct = $this->execute_raw( 'wp/term-delete', array( 'id' => $tag_id ) ); + $direct = $this->execute_raw( 'core-experimental/term-delete', array( 'id' => $tag_id ) ); $this->assert_error( $direct, 'terms_trash_not_supported', 501, 'A direct call should refuse a delete without force.' ); $coerced = $this->execute_raw( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $tag_id, 'force' => 'false', @@ -1552,7 +1552,7 @@ public function test_delete_item_incorrect_permissions(): void { $this->log_in_as( 'subscriber' ); $result = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $term_id, 'force' => true, @@ -1564,7 +1564,7 @@ public function test_delete_item_incorrect_permissions(): void { wp_set_current_user( 0 ); $logged_out = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $term_id, 'force' => true, @@ -1606,7 +1606,7 @@ public function test_roles_deleting_terms(): void { foreach ( $term_ids as $taxonomy => $term_id ) { $result = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $term_id, 'force' => true, @@ -1637,7 +1637,7 @@ public function test_contributor_can_create_but_not_delete_tags(): void { $this->log_in_as( 'contributor' ); $created = $this->execute( - 'wp/term-create', + 'core-experimental/term-create', array( 'taxonomy' => 'post_tag', 'name' => 'Contributor tag', @@ -1647,7 +1647,7 @@ public function test_contributor_can_create_but_not_delete_tags(): void { $this->track_term( (int) $created['id'], 'post_tag' ); $deleted = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $tag_id, 'force' => true, @@ -1675,9 +1675,9 @@ public function test_default_category_cannot_be_deleted(): void { 'force' => true, ); - $this->assert_denied( $this->execute( 'wp/term-delete', $input ), 'The default category should not be deleted.' ); + $this->assert_denied( $this->execute( 'core-experimental/term-delete', $input ), 'The default category should not be deleted.' ); - $direct = $this->execute_raw( 'wp/term-delete', $input ); + $direct = $this->execute_raw( 'core-experimental/term-delete', $input ); $this->assert_error( $direct, 'terms_cannot_delete', 403, 'A direct call should not delete the default category either.' ); $granted = static function ( $caps, $cap ) { @@ -1690,7 +1690,7 @@ public function test_default_category_cannot_be_deleted(): void { add_filter( 'map_meta_cap', $granted, 10, 2 ); try { - $forced = $this->execute_raw( 'wp/term-delete', $input ); + $forced = $this->execute_raw( 'core-experimental/term-delete', $input ); $this->assert_error( $forced, 'terms_cannot_delete', 500, 'A granted capability should still not delete the default category.' ); } finally { remove_filter( 'map_meta_cap', $granted, 10 ); @@ -1711,7 +1711,7 @@ public function test_deleting_a_parent_moves_its_children_up(): void { $child = $this->create_test_term( 'category', 'Child', array( 'parent' => $parent ) ); $deleted = $this->execute( - 'wp/term-delete', + 'core-experimental/term-delete', array( 'id' => $parent, 'force' => true, diff --git a/tests/Abilities/TermsQueryTest.php b/tests/Abilities/TermsQueryTest.php index b4ce16e..20d4434 100644 --- a/tests/Abilities/TermsQueryTest.php +++ b/tests/Abilities/TermsQueryTest.php @@ -1,10 +1,10 @@ get_registered( 'wp/terms-query' ); + $ability = WP_Abilities_Registry::get_instance()->get_registered( 'core-experimental/terms-query' ); self::assertNotNull( $ability, 'The ability should be registered through the Registrar.' ); return $ability; @@ -160,7 +160,7 @@ private function get_registered(): WP_Ability { * @return mixed The ability result. */ private function query_terms( array $input = array() ) { - return wp_get_ability( 'wp/terms-query' )->execute( $input ); + return wp_get_ability( 'core-experimental/terms-query' )->execute( $input ); } /** @@ -362,7 +362,7 @@ private function exposed_taxonomies(): array { /** * Registered exactly once, with the PR's annotations and the experimental provenance. * - * The `wp/` name is never core-provided, so the package copy registers on both + * The `core-experimental/` name is never core-provided, so the package copy registers on both * environments and the provenance does not branch. */ public function test_registered_once_with_annotations_and_provenance(): void { @@ -391,7 +391,7 @@ public function test_registered_once_with_annotations_and_provenance(): void { self::assertSame( 'experimental', $meta['stability'] ?? null ); self::assertSame( 'wordpress/abilities', $meta['source'] ?? null ); self::assertSame( Manifest::VERSION, $meta['package_version'] ?? null ); - self::assertArrayNotHasKey( 'renamed_from', $meta, 'The port carries no renamed_from lineage.' ); + self::assertSame( 'wp/terms-query', $meta['renamed_from'] ?? null, 'The port carries the core-experimental rename lineage.' ); Registrar::register_all(); Registrar::register_all(); @@ -1622,7 +1622,7 @@ public function test_run_endpoint_takes_query_string_input(): void { $this->log_in_as( 'subscriber' ); - $route = '/wp-abilities/v1/abilities/wp/terms-query/run'; + $route = '/wp-abilities/v1/abilities/core-experimental/terms-query/run'; $request = new \WP_REST_Request( 'GET', $route ); $request->set_query_params( array( diff --git a/tests/Abilities/UserWritesTest.php b/tests/Abilities/UserWritesTest.php index a375c0c..0b4646c 100644 --- a/tests/Abilities/UserWritesTest.php +++ b/tests/Abilities/UserWritesTest.php @@ -1,9 +1,9 @@ get_registered( 'wp/user-create' ); - $update = $this->get_registered( 'wp/user-update' ); - $delete = $this->get_registered( 'wp/user-delete' ); + $create = $this->get_registered( 'core-experimental/user-create' ); + $update = $this->get_registered( 'core-experimental/user-update' ); + $delete = $this->get_registered( 'core-experimental/user-delete' ); self::assertSame( 'Create User', $create->get_label() ); self::assertSame( 'Update User', $update->get_label() ); @@ -221,7 +221,7 @@ public function test_registered_once_with_the_pr_contract(): void { public function test_create_with_password_answers_the_projected_user(): void { $this->log_in_as( 'administrator' ); - $result = $this->get_registered( 'wp/user-create' )->execute( + $result = $this->get_registered( 'core-experimental/user-create' )->execute( array( 'username' => 'uw_created_user', 'email' => 'created@example.com', @@ -250,7 +250,7 @@ public function test_create_with_password_answers_the_projected_user(): void { public function test_create_without_password_generates_one(): void { $this->log_in_as( 'administrator' ); - $result = $this->get_registered( 'wp/user-create' )->execute( + $result = $this->get_registered( 'core-experimental/user-create' )->execute( array( 'username' => 'uw_generated_user', 'email' => 'generated@example.com', @@ -279,7 +279,7 @@ public function test_create_capability_gates(): void { $this->log_in_as( 'editor' ); $this->assert_error_response( 'ability_invalid_permissions', - $this->get_registered( 'wp/user-create' )->execute( + $this->get_registered( 'core-experimental/user-create' )->execute( array( 'username' => 'uw_editor_create', 'email' => 'editor-create@example.com', @@ -294,7 +294,7 @@ public function test_create_capability_gates(): void { $this->log_in_as( 'subscriber' ); $this->assert_error_response( 'ability_invalid_permissions', - $this->get_registered( 'wp/user-create' )->execute( + $this->get_registered( 'core-experimental/user-create' )->execute( array( 'username' => 'uw_subscriber_create', 'email' => 'subscriber-create@example.com', @@ -314,7 +314,7 @@ public function test_create_bad_input(): void { // An invalid username is refused with its own error. $this->assert_error_response( 'users_invalid_param', - $this->get_registered( 'wp/user-create' )->execute( + $this->get_registered( 'core-experimental/user-create' )->execute( array( 'username' => 'not valid!', 'email' => 'bad-user@example.com', @@ -327,7 +327,7 @@ public function test_create_bad_input(): void { // An empty password is refused. $this->assert_error_response( 'users_invalid_param', - $this->get_registered( 'wp/user-create' )->execute( + $this->get_registered( 'core-experimental/user-create' )->execute( array( 'username' => 'uw_empty_password', 'email' => 'empty-pass@example.com', @@ -347,7 +347,7 @@ public function test_update_fields_and_password_never_returned(): void { $this->log_in_as( 'administrator' ); $target_id = $this->create_user( 'uw_update_target', 'subscriber' ); - $result = $this->get_registered( 'wp/user-update' )->execute( + $result = $this->get_registered( 'core-experimental/user-update' )->execute( array( 'id' => $target_id, 'name' => 'Validated Updated Name', @@ -381,7 +381,7 @@ public function test_update_roles_rules(): void { $this->log_in_as( 'editor' ); $this->assert_error_response( 'ability_invalid_permissions', - $this->get_registered( 'wp/user-update' )->execute( + $this->get_registered( 'core-experimental/user-update' )->execute( array( 'id' => $target_id, 'name' => 'Denied', @@ -395,7 +395,7 @@ public function test_update_roles_rules(): void { $this->log_in_as( 'administrator' ); $this->assert_error_response( 'users_user_invalid_role', - $this->get_registered( 'wp/user-update' )->execute( + $this->get_registered( 'core-experimental/user-update' )->execute( array( 'id' => $this->user_ids['role_administrator'], 'roles' => array(), @@ -408,7 +408,7 @@ public function test_update_roles_rules(): void { // An unknown role is refused. $this->assert_error_response( 'ability_invalid_input', - $this->get_registered( 'wp/user-update' )->execute( + $this->get_registered( 'core-experimental/user-update' )->execute( array( 'id' => $target_id, 'roles' => array( 'not-a-role' ), @@ -439,7 +439,7 @@ public function test_delete_semantics(): void { // An admin cannot delete their own account. $this->assert_error_response( 'users_cannot_delete', - $this->get_registered( 'wp/user-delete' )->execute( + $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => $this->user_ids['role_administrator'], 'reassign' => false, @@ -450,7 +450,7 @@ public function test_delete_semantics(): void { ); // Reassign false: the posts go to the trash; the answer is the user as it was. - $result = $this->get_registered( 'wp/user-delete' )->execute( + $result = $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => $target_id, 'reassign' => false, @@ -463,7 +463,7 @@ public function test_delete_semantics(): void { self::assertFalse( get_userdata( $target_id ), 'The user should be permanently deleted (users cannot be trashed).' ); $this->assert_error_response( 'ability_invalid_permissions', - $this->get_registered( 'wp/user-delete' )->execute( + $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => $target_id, 'reassign' => false, @@ -477,7 +477,7 @@ public function test_delete_semantics(): void { $second_id = $this->create_user( 'uw_delete_second', 'subscriber' ); $this->assert_error_response( 'users_user_invalid_reassign', - $this->get_registered( 'wp/user-delete' )->execute( + $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => $second_id, 'reassign' => 4294967296, @@ -490,7 +490,7 @@ public function test_delete_semantics(): void { // A valid reassign moves the posts. $third_id = $this->create_user( 'uw_delete_third', 'subscriber' ); $post_id = $this->create_post( $third_id ); - $result = $this->get_registered( 'wp/user-delete' )->execute( + $result = $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => $third_id, 'reassign' => $reassign_id, @@ -512,7 +512,7 @@ public function test_delete_capability_gate(): void { $this->log_in_as( 'editor' ); $this->assert_error_response( 'ability_invalid_permissions', - $this->get_registered( 'wp/user-delete' )->execute( + $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => $target_id, 'reassign' => false, @@ -525,7 +525,7 @@ public function test_delete_capability_gate(): void { $this->log_in_as( 'subscriber' ); $this->assert_error_response( 'ability_invalid_permissions', - $this->get_registered( 'wp/user-delete' )->execute( + $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => $target_id, 'reassign' => false, @@ -547,7 +547,7 @@ public function test_delete_capability_gate(): void { public function test_delete_missing_user_is_denied(): void { $this->log_in_as( 'administrator' ); - $result = $this->get_registered( 'wp/user-delete' )->execute( + $result = $this->get_registered( 'core-experimental/user-delete' )->execute( array( 'id' => 4294967296, 'reassign' => false, diff --git a/tests/ManifestTest.php b/tests/ManifestTest.php index f9d2f93..93f4940 100644 --- a/tests/ManifestTest.php +++ b/tests/ManifestTest.php @@ -30,16 +30,18 @@ public function test_names_unique_and_match_manifest(): void { } /** - * Experimental tier ⇒ wp/ prefix, and neither core/ nor wordpress/. + * Experimental tier ⇒ core-experimental/ prefix, and neither core/ nor + * wordpress/ (a literal `wp/` name is likewise barred: the pre-issue-18 + * experiment namespace migrated to core-experimental/). */ - public function test_experimental_names_use_wp_prefix(): void { + public function test_experimental_names_use_core_experimental_prefix(): void { $experimental = array(); foreach ( Manifest::all() as $name => $entry ) { if ( Manifest::TIER_EXPERIMENTAL !== $entry['tier'] ) { continue; } $experimental[] = $name; - self::assertTrue( str_starts_with( $name, 'wp/' ), sprintf( 'Experimental %s must start with wp/.', $name ) ); + self::assertTrue( str_starts_with( $name, 'core-experimental/' ), sprintf( 'Experimental %s must start with core-experimental/.', $name ) ); self::assertFalse( str_starts_with( $name, 'core/' ) || str_starts_with( $name, 'wordpress/' ), sprintf( 'Experimental %s must not start with core/ or wordpress/.', $name ) ); } @@ -56,11 +58,11 @@ public function test_experimental_names_use_wp_prefix(): void { array_filter( $experimental, static function ( string $name ): bool { - return ! str_starts_with( $name, 'wp/' ); + return ! str_starts_with( $name, 'core-experimental/' ); } ) ), - 'Every experimental name must carry the wp/ prefix.' + 'Every experimental name must carry the core-experimental/ prefix.' ); } diff --git a/tests/RegistrarTest.php b/tests/RegistrarTest.php index 8119c72..e89e0ba 100644 --- a/tests/RegistrarTest.php +++ b/tests/RegistrarTest.php @@ -9,7 +9,7 @@ * that need a package-owned, non-public vehicle — the version floor and * `public_only` selection — drive the synthetic `test/registrar-synthetic` * entry through the engine's own registration funnel. Its `test/` prefix - * can never collide with real manifest growth (`core/` or `wp/` entries). + * can never collide with real manifest growth (`core/` or `core-experimental/` entries). * * P8 adds category ownership to the same sequencing: the Registrar must * declare the manifest-declared categories itself, at priority 20 on From 7b83568dd3da319868eb075ca299d643801ff25b Mon Sep 17 00:00:00 2001 From: Nik McLaughlin <72171383+nikmclaughlin@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:03:18 -0800 Subject: [PATCH 2/4] Document the core-experimental/ tier namespace (#18) Tier tables and the promotion-path worked example in NAME-LIFECYCLE.md and README.md switch to the core-experimental/ prefix, alongside the KNOWN-ISSUES.md and CONTRIBUTING.md references; the enforcement section describes the new rule. The [Unreleased] changelog gains a breaking entry mapping wp/ to core-experimental/; historical 0.1.0 entries are left as shipped. --- CHANGELOG.md | 17 ++++++++++++++++- CONTRIBUTING.md | 2 +- KNOWN-ISSUES.md | 12 ++++++------ NAME-LIFECYCLE.md | 12 ++++++------ README.md | 20 ++++++++++---------- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55a034d..92c7f62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,22 @@ the initial snapshot of the prototype. ## [Unreleased] -### Added +### Changed + +- **Breaking (experimental):** Renamed every experimental-tier ability from the + `wp/` namespace to `core-experimental/` so the name itself tells consumers + the ability is still in development + ([issue #18](https://github.com/WordPress/abilities/issues/18)). Every + `wp/` became `core-experimental/` — the twelve experimental + abilities: `media-query`, `media-upload`, `media-update`, `media-delete`, + `settings-update`, `user-create`, `user-update`, `user-delete`, + `terms-query`, `term-create`, `term-update`, `term-delete`. Per the rename + protocol (NAME-LIFECYCLE.md) the manifest entries record the old name under + `renamed_from` (stamped into each ability's `meta.renamed_from`), the old + names stop working with the release carrying this change, and no alias + period is offered. Tier values and promise levels are unchanged: + `core-experimental/` abilities keep the no-promises experimental tier; + `core/` and `wordpress/` semantics are untouched. ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17ce92e..07921a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ canonical ability. Ability names are adopted with a paper trail: a `core/`-prefix or `core`-tier ability must link a core trac/GitHub ticket, recorded in its manifest entry's -`proposal` field. Experimental (`wp/`) abilities don't need one yet; filing +`proposal` field. Experimental (`core-experimental/`) abilities don't need one yet; filing it is part of promotion. Promotions and renames follow the promotion path and rename protocol in [NAME-LIFECYCLE.md](NAME-LIFECYCLE.md). diff --git a/KNOWN-ISSUES.md b/KNOWN-ISSUES.md index cd23182..b4f50d0 100644 --- a/KNOWN-ISSUES.md +++ b/KNOWN-ISSUES.md @@ -32,7 +32,7 @@ until core decides otherwise: - Deletion formats the post before deleting it. - `get_post_by_slug` is unreachable via the write schemas — a dead path kept for parity with core. -- `wp/media-query` (WordPress/ai PR #1098): +- `core-experimental/media-query` (WordPress/ai PR #1098): - A status the caller may not query reports `media_invalid_param` (with a 400 status), not the ability framework's `ability_invalid_permissions` — the PR wraps its internal status error in the execute callback. @@ -48,7 +48,7 @@ until core decides otherwise: - With raw fields requested, a collection is answered in the edit context: items the caller cannot edit are withheld from the list but still counted in the totals. -- `wp/settings-update` (WordPress/ai PR #764): +- `core-experimental/settings-update` (WordPress/ai PR #764): - All-or-nothing by design (`settings_invalid_param` 400 → `settings_cannot_manage_privacy_options` 403 → `settings_invalid_stored_value` 500 → writes): an error leaves every @@ -70,7 +70,7 @@ until core decides otherwise: settings endpoint skips the setting without an error. - `settings-update` is not registered when every exposed setting is read-only (multisite), where the endpoint always exists. -- `wp/terms-query` (WordPress/ai PR #1099): +- `core-experimental/terms-query` (WordPress/ai PR #1099): - A missing, hidden, or taxonomy-mismatched term is denied like an unreadable one — a generic permission denial (no 404 vs 403 distinction), so terms cannot be probed through the ability. A direct (unvalidated) call reports @@ -95,7 +95,7 @@ until core decides otherwise: branches of the matrix; a custom taxonomy's non-bool opt-in value (e.g. `'yes'`) is not normalized to a bool, which the loose object-list match and the ability's truthiness check read exactly like 7.2's bool cast. -- `wp/media-upload` / `wp/media-update` / `wp/media-delete` (WordPress/ai PR #1104): +- `core-experimental/media-upload` / `core-experimental/media-update` / `core-experimental/media-delete` (WordPress/ai PR #1104): - Trashing an attachment requires the site to enable the media trash (`MEDIA_TRASH`): without it, a non-forced delete answers `media_trash_not_supported` (501), and `force` string values coerce like @@ -117,8 +117,8 @@ until core decides otherwise: - The delete capability is re-checked right before anything is removed, so a hook refusal surfaces as `media_cannot_delete` (500) on the `pre_delete_attachment` veto. -- `wp/term-create` / `wp/term-update` / `wp/term-delete` (WordPress/ai PR #1103): - - Terms cannot be trashed, so `wp/term-delete` only deletes with `force` +- `core-experimental/term-create` / `core-experimental/term-update` / `core-experimental/term-delete` (WordPress/ai PR #1103): + - Terms cannot be trashed, so `core-experimental/term-delete` only deletes with `force` set to true: a missing or false `force` answers `terms_trash_not_supported` (501), and string values coerce like booleans through the delete route's query-string input (`"false"` does not delete, `"true"` does). diff --git a/NAME-LIFECYCLE.md b/NAME-LIFECYCLE.md index 3356d94..b38abbf 100644 --- a/NAME-LIFECYCLE.md +++ b/NAME-LIFECYCLE.md @@ -8,18 +8,18 @@ integrations — for good. | Prefix | Tier | Meaning | Promises | |---|---|---|---| -| `wp/` | experimental | Incubation. Where **all** new abilities — including every write ability — start. | **None.** Name AND schema may change or vanish in any release. | +| `core-experimental/` | experimental | Incubation. Where **all** new abilities — including every write ability — start. | **None.** Name AND schema may change or vanish in any release. | | `core/` | stable | Core-destined. Adopted **at proposal filing**, after iteration is done. From then on it is frozen: schema backwards compatibility applies immediately. | Semver applies. | | `wordpress/` | stable | Package-owned, not core-destined. Rare. | Semver applies. | | *(tier flips to)* — | core | Landed in actual core. The package copy is a **backport only**, mechanically generated, and never diverges from core's implementation. | Identical to core's. | ### Promotion path -Iteration happens under `wp/`; landing in core is a mechanical pipeline, not a -rewrite. Worked example, `wp/post-update` (a planned write ability, not yet +Iteration happens under `core-experimental/`; landing in core is a mechanical pipeline, not a +rewrite. Worked example, `core-experimental/post-update` (a planned write ability, not yet shipped): -1. **Incubate:** `wp/post-update` iterates and gets tested through the MCP +1. **Incubate:** `core-experimental/post-update` iterates and gets tested through the MCP adapter against real tasks. Names and schema may still change freely. 2. **Ready:** file the core proposal (a trac ticket or GitHub issue). 3. **Same release:** rename to `core/post-update` — tier becomes `stable`, @@ -49,7 +49,7 @@ Reviewers **reject alias PRs** — see [CONTRIBUTING.md](CONTRIBUTING.md). Backwards-compatibility promises are **per-ability-tier, not per-package-version**: -- Removing or changing an experimental (`wp/`) ability or its schema is fine +- Removing or changing an experimental (`core-experimental/`) ability or its schema is fine in any release; it is documented as a CHANGELOG breaking-for-experimental entry. - Breaking changes to `stable` (`core/`, `wordpress/`) or `core` tier @@ -61,7 +61,7 @@ per-package-version**: Tier/prefix rules are machine-checked, not aspirational: `ManifestTest` and `composer run verify:manifest` enforce that experimental names start with -`wp/` (and neither `core/` nor `wordpress/`), stable names start with `core/` +`core-experimental/` (and neither `core/` nor `wordpress/`), stable names start with `core/` or `wordpress/`, `core`-tier entries have `core_since` and a `proposal` set, `core/`-prefix stable entries have a `proposal`, names are unique, `renamed_from` never collides with a live name, and every `class` exists and diff --git a/README.md b/README.md index f0a0a80..573a98e 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ Full rules, the promotion path, and the rename protocol are in | Prefix | Tier | Promises | |---|---|---| -| `wp/` | experimental | **None.** Name AND schema may change or vanish in any release. | +| `core-experimental/` | experimental | **None.** Name AND schema may change or vanish in any release. | | `core/` | stable (core-destined) | Semver applies; schema frozen at core-proposal filing. | | `wordpress/` | stable (package-owned) | Semver applies. | | *(tier flips to)* — | core | Package copy is a mechanically generated backport; never diverges from core's. | @@ -141,15 +141,15 @@ Full rules, the promotion path, and the rename protocol are in | `core/content-create` | stable | content | Port of the content create ability from [WordPress/ai PR #1025](https://github.com/WordPress/ai/pull/1025) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Creates posts of types exposed to abilities under the field names `core/content-query` returns. | | `core/content-update` | stable | content | Port of the content update ability from [WordPress/ai PR #1025](https://github.com/WordPress/ai/pull/1025) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Updates a post by ID; fields left out keep their current values. | | `core/content-delete` | stable | content | Port of the content delete ability from [WordPress/ai PR #1025](https://github.com/WordPress/ai/pull/1025) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Trashes a post by ID, or deletes it permanently with `force`. | -| `wp/media-query` | experimental | media | Port of the read-only media query ability from [WordPress/ai PR #1098](https://github.com/WordPress/ai/pull/1098) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Reads media library items — a single item by ID, or a paginated filtered collection (`media`/`total`/`total_pages`) with totals; `fields` picks a subset, and raw fields require edit access. Uses the package-authored `media` category (core has no equivalent to copy). | -| `wp/media-upload` | experimental | media | Port of the media upload ability from [WordPress/ai PR #1104](https://github.com/WordPress/ai/pull/1104) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Uploads a file from base64 `data` + `filename` (with attachment fields), or downloads an image from a `url` (parent post only). Returns the new item in the edit context; `fields` picks a subset. Requires `upload_files`; the parent and author are named-field checks. A URL upload downloads from another site (`open_world: true`), capped at the site's upload size. Uses the package-authored `media` category. | -| `wp/media-update` | experimental | media | Port of the media update ability from [WordPress/ai PR #1104](https://github.com/WordPress/ai/pull/1104) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Updates a media item by ID with the same attachment fields (the status is validated against the attachment, so `inherit` can be kept); fields left out keep their values. Returns the updated item in the edit context. Requires edit access to the item (`edit_post` for attachments, via the same projection `wp/media-query` reads with). | -| `wp/media-delete` | experimental | media | Port of the media delete ability from [WordPress/ai PR #1104](https://github.com/WordPress/ai/pull/1104) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Trashes a media item by ID (an error unless the site enables media trash), or deletes it and its files permanently with `force`, returning the item under `previous`. Requires `delete_post` for attachments; the capability is re-checked just before removal. | -| `wp/settings-update` | experimental | site | Port of the settings update ability from [WordPress/ai PR #764](https://github.com/WordPress/ai/pull/764) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Updates only the settings `core/settings-get` reads — every setting except `url` and `email` (read-only, and unregistered by the ability when all of them are read-only) — via a map of setting name to new value; `null` resets a setting with a registered default to it (a setting without one refuses `null`); every check (sanitize, privacy policy, stored value) runs before any write, so an error leaves every setting unchanged; the answer holds only the updated settings. Requires `manage_options`; the privacy policy page additionally requires `manage_privacy_options`. | -| `wp/terms-query` | experimental | content | Port of the read-only terms query ability from [WordPress/ai PR #1099](https://github.com/WordPress/ai/pull/1099) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Reads terms of the taxonomies exposed to abilities via `show_in_abilities` (polyfilled: no currently supported core declares the taxonomy flag yet) — a single term by ID (optionally guarded by `taxonomy`) or by `taxonomy` + `slug`, or a paginated filtered collection (`terms`/`total`/`total_pages`) covering search, include, exclude, hierarchical `parent`, `post`, and `hide_empty`; `fields` picks a subset (the ID always included, `parent` for hierarchical taxonomies only). Requires an authenticated user; a missing or hidden term is denied like an unreadable one. Served through the GET run route, like the other read abilities. | -| `wp/term-create` | experimental | content | Port of the term create ability from [WordPress/ai PR #1103](https://github.com/WordPress/ai/pull/1103) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Creates a term in a taxonomy exposed to abilities via `show_in_abilities` (the same taxonomies `wp/terms-query` reads — taxonomy opt-in governs the writes too): takes a `taxonomy` and a `name`, plus optional `slug`, `description`, and `parent` (hierarchical taxonomies only). Returns the created term in the `wp/terms-query` shape; `fields` picks the subset. `edit_terms` is the floor in a hierarchical taxonomy, `assign_terms` in a flat one, so a contributor can create tags without touching categories. | -| `wp/term-update` | experimental | content | Port of the term update ability from [WordPress/ai PR #1103](https://github.com/WordPress/ai/pull/1103) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Updates a term by `id` with the same fields, which keep their values when left out; `taxonomy` is an optional guard, and a term outside it is denied like a missing one. Returns the updated term in the `wp/terms-query` shape; `fields` picks the subset. Requires `edit_term` for the term. | -| `wp/term-delete` | experimental | content | Port of the term delete ability from [WordPress/ai PR #1103](https://github.com/WordPress/ai/pull/1103) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Deletes a term by `id`; terms cannot be trashed, so **`force` must be true** — a non-forced call answers `terms_trash_not_supported` (501). Returns `{ deleted, previous }`, the deleted term in the `wp/terms-query` shape; `fields` picks the subset. Requires `delete_term` for the term; the default category is not deleted (core's capability mapping denies it, and `wp_delete_term()` refuses it), and the `taxonomy` input is an optional guard like on update. | +| `core-experimental/media-query` | experimental | media | Port of the read-only media query ability from [WordPress/ai PR #1098](https://github.com/WordPress/ai/pull/1098) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Reads media library items — a single item by ID, or a paginated filtered collection (`media`/`total`/`total_pages`) with totals; `fields` picks a subset, and raw fields require edit access. Uses the package-authored `media` category (core has no equivalent to copy). | +| `core-experimental/media-upload` | experimental | media | Port of the media upload ability from [WordPress/ai PR #1104](https://github.com/WordPress/ai/pull/1104) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Uploads a file from base64 `data` + `filename` (with attachment fields), or downloads an image from a `url` (parent post only). Returns the new item in the edit context; `fields` picks a subset. Requires `upload_files`; the parent and author are named-field checks. A URL upload downloads from another site (`open_world: true`), capped at the site's upload size. Uses the package-authored `media` category. | +| `core-experimental/media-update` | experimental | media | Port of the media update ability from [WordPress/ai PR #1104](https://github.com/WordPress/ai/pull/1104) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Updates a media item by ID with the same attachment fields (the status is validated against the attachment, so `inherit` can be kept); fields left out keep their values. Returns the updated item in the edit context. Requires edit access to the item (`edit_post` for attachments, via the same projection `core-experimental/media-query` reads with). | +| `core-experimental/media-delete` | experimental | media | Port of the media delete ability from [WordPress/ai PR #1104](https://github.com/WordPress/ai/pull/1104) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Trashes a media item by ID (an error unless the site enables media trash), or deletes it and its files permanently with `force`, returning the item under `previous`. Requires `delete_post` for attachments; the capability is re-checked just before removal. | +| `core-experimental/settings-update` | experimental | site | Port of the settings update ability from [WordPress/ai PR #764](https://github.com/WordPress/ai/pull/764) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Updates only the settings `core/settings-get` reads — every setting except `url` and `email` (read-only, and unregistered by the ability when all of them are read-only) — via a map of setting name to new value; `null` resets a setting with a registered default to it (a setting without one refuses `null`); every check (sanitize, privacy policy, stored value) runs before any write, so an error leaves every setting unchanged; the answer holds only the updated settings. Requires `manage_options`; the privacy policy page additionally requires `manage_privacy_options`. | +| `core-experimental/terms-query` | experimental | content | Port of the read-only terms query ability from [WordPress/ai PR #1099](https://github.com/WordPress/ai/pull/1099) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Reads terms of the taxonomies exposed to abilities via `show_in_abilities` (polyfilled: no currently supported core declares the taxonomy flag yet) — a single term by ID (optionally guarded by `taxonomy`) or by `taxonomy` + `slug`, or a paginated filtered collection (`terms`/`total`/`total_pages`) covering search, include, exclude, hierarchical `parent`, `post`, and `hide_empty`; `fields` picks a subset (the ID always included, `parent` for hierarchical taxonomies only). Requires an authenticated user; a missing or hidden term is denied like an unreadable one. Served through the GET run route, like the other read abilities. | +| `core-experimental/term-create` | experimental | content | Port of the term create ability from [WordPress/ai PR #1103](https://github.com/WordPress/ai/pull/1103) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Creates a term in a taxonomy exposed to abilities via `show_in_abilities` (the same taxonomies `core-experimental/terms-query` reads — taxonomy opt-in governs the writes too): takes a `taxonomy` and a `name`, plus optional `slug`, `description`, and `parent` (hierarchical taxonomies only). Returns the created term in the `core-experimental/terms-query` shape; `fields` picks the subset. `edit_terms` is the floor in a hierarchical taxonomy, `assign_terms` in a flat one, so a contributor can create tags without touching categories. | +| `core-experimental/term-update` | experimental | content | Port of the term update ability from [WordPress/ai PR #1103](https://github.com/WordPress/ai/pull/1103) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Updates a term by `id` with the same fields, which keep their values when left out; `taxonomy` is an optional guard, and a term outside it is denied like a missing one. Returns the updated term in the `core-experimental/terms-query` shape; `fields` picks the subset. Requires `edit_term` for the term. | +| `core-experimental/term-delete` | experimental | content | Port of the term delete ability from [WordPress/ai PR #1103](https://github.com/WordPress/ai/pull/1103) (`core_since: null` — flips to tier `core` when it lands in WordPress core). Deletes a term by `id`; terms cannot be trashed, so **`force` must be true** — a non-forced call answers `terms_trash_not_supported` (501). Returns `{ deleted, previous }`, the deleted term in the `core-experimental/terms-query` shape; `fields` picks the subset. Requires `delete_term` for the term; the default category is not deleted (core's capability mapping denies it, and `wp_delete_term()` refuses it), and the `taxonomy` input is an optional guard like on update. | ## Development From 62f2a55c2028b482fb82bc22226f748f590fe61e Mon Sep 17 00:00:00 2001 From: Nik McLaughlin <72171383+nikmclaughlin@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:11:06 -0800 Subject: [PATCH 3/4] restore REST endpoint in media test --- tests/Abilities/MediaUploadTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Abilities/MediaUploadTest.php b/tests/Abilities/MediaUploadTest.php index 8a8efa5..653aa3d 100644 --- a/tests/Abilities/MediaUploadTest.php +++ b/tests/Abilities/MediaUploadTest.php @@ -895,7 +895,7 @@ public function test_upload_matches_the_media_endpoint(): void { ); $fields = array( 'date', 'date_gmt', 'status', 'title_raw', 'title_rendered', 'author', 'description_raw', 'caption_raw', 'caption_rendered', 'alt_text', 'media_type', 'mime_type', 'post' ); - $request = new WP_REST_Request( 'POST', '/core-experimental/v2/media' ); + $request = new WP_REST_Request( 'POST', '/wp/v2/media' ); $request->set_header( 'Content-Type', 'image/jpeg' ); $request->set_header( 'Content-Disposition', 'attachment; filename=canola.jpg' ); $request->set_body( (string) file_get_contents( (string) constant( 'DIR_TESTDATA' ) . '/images/canola.jpg' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Reads a local test file. From 38cf0894e3b45fad587ce2bb9c0e707f79b8ec07 Mon Sep 17 00:00:00 2001 From: Nik McLaughlin <72171383+nikmclaughlin@users.noreply.github.com> Date: Fri, 27 Nov 2026 14:20:40 -0800 Subject: [PATCH 4/4] fix test failure: ensure tz is reset --- tests/Abilities/MediaUploadTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Abilities/MediaUploadTest.php b/tests/Abilities/MediaUploadTest.php index 653aa3d..aa5ef6e 100644 --- a/tests/Abilities/MediaUploadTest.php +++ b/tests/Abilities/MediaUploadTest.php @@ -126,6 +126,11 @@ public function tear_down(): void { $this->user_ids = array(); wp_set_current_user( 0 ); + // The site timezone is not this class's business; a test that set it + // must not leak that setting into later tests, even when it fails + // mid-method. + update_option( 'timezone_string', '' ); + parent::tear_down(); }