Repository navigation
Add the trio core backports' show_in_rest REST-visibility flag - #15
Merged
Merged
Conversation
PLAN-mcp-adapter-poc.md step 1.5 (sec. 1 resolution, sec. 4.0): the 8 media/terms abilities — wp/media-query, wp/media-upload, wp/media-update, wp/media-delete, wp/terms-query, wp/term-create, wp/term-update, wp/term-delete — did not carry the public meta, so the MCP adapter's McpAbilityExposure falls back to meta.public and excludes them from the MCP surface. This adds the MCP-specific flag mcp => array( public => true ) to their ability_meta(), which McpAbilityExposure checks first, without changing their high-level publicness (no public key added) — the team decides between the mcp flag and full meta.public before this lands on the package's main. annotations/show_in_rest and every other meta key are untouched; no other ability changes. The Registrar's Gate-6 public_only probe reads the ability's own public meta only — the flag is additive there. Tests: the registered-once tests of the 8 abilities (media-query/upload/ update/delete, terms-query, and the term-writes contract test) each now also assert the exact mcp meta shape ( array( public => true ) ) and that the high-level public meta is unchanged (get_meta_item( 'public', false ) === false). No assertions were deleted.
PLAN-ai-plugin-poc.md sec. 7.0 (sec. 10.2 resolution, Option A): core/content-query, core/settings-get and core/users-query gain 'show_in_rest' => true in ability_meta() under a // Package: marker, so the abilities stay exposed over core's REST abilities routes on every supported WordPress (6.9+) — core's own registration omits the flag and relies on meta.public seeding it, which WordPress 7.1+ only does. On 7.1+ the seeding makes the flag redundant but harmless. The same accommodation the AI plugin's synced copies carry with their // Plugin: marker, made once in the package. tools/coreify.php tolerates exactly this marked line and nothing more, symmetrically: a narrow PKG_META_ACCOMMODATIONS map (meta key => marker-comment lines) makes --reverse re-inject the flag (plus markers) into regenerated backports when the fixture's meta lacks it, and forward drop it behind marker-verbatim checks when unwrapping ability_meta() into core-shaped registration args — both semantic-diff invariants of the check gate stay green, and a mapped key without the const's exact markers fails the forward path loudly. The trio tests now pin meta.show_in_rest === true with the high-level public meta unchanged (PR #12's pattern). Stacked on #12 (add/mcp-public-meta) so the ai PoC pins one integration ref.
8 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds
'show_in_rest' => trueto theability_meta()of the three tier-core backports —core/content-query(src/Content/Content_Query.php),core/settings-get(src/Settings/Settings_Get.php),core/users-query(src/Users/Users_Query.php) — each under a// Package:marker comment.Why?
Core's
WP_Abilityonly seedsmeta.show_in_restfrommeta.publicsince WordPress 7.1, and core's REST abilities routes (abilities/v1list + run) hard-require the flag. The backports serve WordPress 6.9+, where no seeding happens, so the core-verbatim trio would silently vanish from REST on 6.9–7.0.x hosts. The AI plugin's own synced copies carry the same accommodation with a// Plugin:marker; this makes it once, in the package (§10.2, resolved Option A, decided 2026-11-06 — not to be relitigated). Full rationale + spec:PLAN-ai-plugin-poc.md§7.0, §10.2, §10.7, §11 step 1. On 7.1+ thepublic-seeding makes the explicit flag redundant but harmless — and both wp-env suites prove the registered meta isshow_in_rest === trueeither way (seeded on trunk, explicit on stable).How?
publicstaystrue; no other ability touched — the other 15 setshow_in_restalready).tools/coreify.php: one narrowly-scoped const,PKG_META_ACCOMMODATIONS(map of meta key → marker-comment lines, global across profiles — every tier-core backport has the same 6.9+ floor), teaches the round-trip tolerance exactly this one marked divergence, symmetrically:--reverseinjects the key + marker lines when emitting the package shape'sability_meta(), only when the fixture's meta lacks the key (a fixture that already carries it is carried through verbatim, never duplicated), so regenerated backports keep the flag and stay semantically identical to the shipped files (the mB side of the gate).ability_meta()into core-shaped registration args, so the regenerated core text stays semantically identical to the fixture (the mA side). No wildcard dropping of anything else.coreify: pkg-meta drop: ability_meta() carries the accommodated key 'show_in_rest' without PKG_META_ACCOMMODATIONS's exact marker comment lines ...), so the shipped files and the const change together. (The mB semdiff still skips comments by design, unchanged.)meta.mcp.publicto the media and terms abilities for MCP exposure #12's pattern mirrored for the trio — an exact-shape assertion pinningmeta.show_in_rest === true(fails on absent/type changes) pluspublic-stays-truevia the accessor, intests/Abilities/ContentQueryTest.php,tests/Abilities/SettingsGetTest.php,tests/Abilities/UsersQueryTest.php(expansion only — zero assertion deletions).CHANGELOG.mdUnreleased entry (house style).Preflight findings (§10.7 trio sync-parity gate)
The three
WordPress/aidevelopcopies (synced at core r65075 / r65002 / r64346) were diffed against this package's trunk fixtures (plugin copy vs fixture, not vs the package shape). Confirmed within the brief's accepted-delta set:'ai'vsdefault— all three copies.wp_has_ability( ... ) → return, with a// Plugin:marker: "so core's version and its security fixes stay in effect"); nowp_unregister_ability()anywhere in the trio. (The known override delta has already converged plugin-side.)wp_abilities_api_categories_initat priority 11 from its own class; ours: Registrar priority 20) and the explicitshow_in_restflag (both sides now,// Plugin:vs// Package:markers — this PR extends the package's marker to the trio metas).init()hooks + namespacedABSPATHguard vs theAbstract_Core_Abilityauthoring surface; the plugin'sarray_all()/array_any()loop replacements andphpcs:ignore/@phpstan-ignoreannotations are plugin-stubs artifacts, non-behavioral.Known intentional divergence, confirmed: the plugin's
Settings(r64346 sync) deliberately omits core r64500'srequired_capabilities => manage_optionsfor pre-7.2 safety and keeps its permission callback; ours carries r64500 core-verbatim withAbstract_Core_Abilitycapability-floor handling for pre-7.2 hosts — ours being more faithful, not drift. Our settings fixture is additionally byte-identical to today's trunk (the plugin copy is intentionally behind).PLAN-ai-plugin-poc.md§7.0b (a separate stacked trunk-sync PR, to resolve before the ai PoC pins its ref): the plugin copies are synced to trunk revisions newer than our fixtures (fixtures refreshed 2026-10-20, re-verified 2026-10-23), verified by diffing today'swordpress-developtrunk against both sides (trunk matches the plugin copies; our fixtures differ):core/content-query— trunk (r65075-era) reworked author visibility:get_visible_author()memoized per query via a new$visible_authorsproperty, anedit_userpermission branch, andcount_user_posts()restricted to post types filtered byshow_in_abilities+ viewability. Our fixture andsrc/Content/Content_Query.phpstill carry the olderget_author_by_slug()gating (is_user_member_of_blog+edit_others_posts, count over all viewable post types).core/users-query— trunk (r65002-era) turned theregisteredoutput field into a dottedregistered.site/registered.gmtobject and added the dotted-field projection machinery (get_field_paths(),is_field_requested()viarest_is_field_included(), and thefieldsinputenumof those paths); our fixture andsrc/Users/Users_Query.phpstill have the flatregistered_datefield. (core/settings-getis current — no staleness.)These are real user-visible behaviors missing from the package's content/users backports. They are not a regression caused by this PR (which only adds one meta key), and bundling a core re-sync here would break the one-PR-one-purpose line, so they are flagged for the follow-up instead. The preflight enumeration in the plan (§10.7 cites the content sync as r64907) predates the plugin's current r65075 sync.
Housekeeping note (resolved 2026-11-06): PR #12's description originally cited a
CHANGELOG.mdentry its branch lacked; the claim was dropped from that description — the entry will land on the branch together with the flag-level resolution.add/mcp-public-meta) — merge order belongs to the teamThis PR is stacked on #12 (
00d65cf) and is not to be merged until the team resolves #12's open question; merging is a human/team call. The stack keeps the package's head carrying all 18 abilities plus both meta accommodations. #12's own SHA is immutable, so the MCP adapter PoC's pin (WordPress/mcp-adapter #430 →00d65cf) is unaffected either way.Open question (non-blocking, same class as #12's)
PKG_META_ACCOMMODATIONSis global across profiles, and forward drops the mapped keys from any profiled meta even if a future fixture itself starts carryingshow_in_rest(at which point mA fails loudly — a conscious fix: move the key out of the const for that profile, or special-case). Acceptable for the three tier-core profiles per §10.2; the team may prefer a per-profile accommodation map later.Use of AI tools
Tool(s): goose (agent) via the Solo orchestration harness. Model(s): glm-5.3-flash:cloud. Used for: implementation, tests, gate runs, and this description's drafting basis (plan-driven per
PLAN-ai-plugin-poc.md§7.0; worker brieftools/out/worker-a-brief.md). Reviewed and edited by the committer.Testing Instructions
composer run lint:phpcs && composer run lint:phpstan && composer run verify:manifest && composer run verify:coreify— all clean (verify:coreifyPASS on all three pairs; round-trip invariant holds).npx @wordpress/env start --config=.wp-env.stable.json --update && npx @wordpress/env run tests-cli --config=.wp-env.stable.json bash -c "cd wp-content/plugins/wordpress-abilities && vendor/bin/phpunit"npx @wordpress/env start --config=.wp-env.trunk.json --update && npx @wordpress/env run tests-cli --config=.wp-env.trunk.json bash -c "cd wp-content/plugins/wordpress-abilities && vendor/bin/phpunit"public-seeding on trunk). One pre-existing upstream-faithful cast warning, unchanged by this diff.Changelog entries
Added (CHANGELOG.md): the
show_in_restexposure flag on the three tier-core backports — REST exposure on every supported WordPress via an explicit, marker-verified meta accommodation, tolerated exactly by the coreify round-trip gate.