Utilize the new client-side Abilities API#364
Utilize the new client-side Abilities API#364dkotter wants to merge 22 commits intoWordPress:developfrom
Conversation
…put schema and ensure we have our own sanitization
… schema and ensure we have our own sanitization
…input schema and ensure we have our own sanitization
… input schema and ensure we have our own sanitization
…tion input schema and ensure we have our own sanitization
…put schema and ensure we have our own sanitization
…schema and ensure we have our own sanitization
…nstead of a string. Add a console error message when making a request using the client-side Abilities API for easier debugging
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #364 +/- ##
=============================================
- Coverage 65.75% 65.59% -0.16%
- Complexity 763 771 +8
=============================================
Files 53 53
Lines 3863 3851 -12
=============================================
- Hits 2540 2526 -14
- Misses 1323 1325 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Holding on merge here as its unclear from #346 (comment) whether we should proceed with this PR or await a change in Gutenberg/core that we may then need to adjust for in the AI plugin. |
…ication. Fix an issue where max suggestions was being treated as a string
What?
Closes #346
Ensure we properly use the new client-side Abilities API and ensure we fix all errors with existing Abilities
Why?
We currently have a helper method that attempted to use the client-side Abilities API, falling back to making direct API requests if it wasn't available. This was based on the older client-side API and so needed updating with the new version that is shipping with WordPress 7.0 (see post).
In doing this, ran into a number of issues that prevented things from working properly. These issues were silently ignored when using direct API requests but the validation the client-side API uses is more strict and thus surfaced these errors. All of those have been fixed up here.
How?
runAbilityhelper function to use the new client-side Abilities APIsanitize_callbackfrom all of our Ability schemas as this isn't supported by the Abilities API, just the REST API@wordpress/core-abilitiesscript module is loaded anytime an Ability needs itUse of AI Tools
Used Cursor running GPT-5.3 Codex to figure out how to properly load the
@wordpress/core-abilitiesscript module based on our current setup. Also used it to investigate what schema options are supported and verifysanitize_callbackwas not. All other work done by meTesting Instructions
npm i && npm run build[AI] Client ability execution unavailable. Falling back to REST.