Utils: Preserve omitted ability input#775
Conversation
|
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. |
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #775 +/- ##
==========================================
Coverage 76.48% 76.48%
Complexity 1869 1869
==========================================
Files 89 89
Lines 7990 7990
==========================================
Hits 6111 6111
Misses 1879 1879
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gziolo
left a comment
There was a problem hiding this comment.
Approved. Verified locally: install, build, tests, lint, and typecheck all pass. Nice, focused fix.
One small follow-up (not blocking): the GET/DELETE path has no test yet, and an explicit null is treated differently there (no input) than in POST (input: null). Worth a quick test and a decision on that case later.
|
Would be great if we can ensure the PR template is followed here. Noticing the |
afb164a to
ddfc25b
Compare
ddfc25b to
3bd37af
Compare
3bd37af to
8d34d98
Compare
The description was updated 👍 |
What?
runAbility()input asundefinedinstead of normalizing it tonull.Why?
Some abilities use an object schema with a default empty object for empty collection/query mode. Passing
nullprevents the abilities client from applying that schema default and can makerunAbility( 'core/users' )fail whereexecuteAbility( 'core/users' )succeeds.Core users is at #774.
How?
runAbility()input argument through to the client abilities API without coercing omitted input tonull.data.inputpayload when input is omitted.{}, when building REST fallback requests.Use of AI Tools
AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5
Used for: Implementation assistance, manual test planning, and PR description updates. Final changes were reviewed and verified locally.
Testing Instructions
Manual testing:
core/usersability from Add core/read-users ability #774 available.const { ready } = await import( '@wordpress/core-abilities' ); await ready; const { executeAbility } = await import( '@wordpress/abilities' ); await executeAbility( 'core/users' );.await wp.apiFetch( { path: '/wp-abilities/v1/abilities/core/users/run', method: 'POST' } );.data.inputalso succeeds.await wp.apiFetch( { path: '/wp-abilities/v1/abilities/core/users/run', method: 'POST', data: { input: {} } } );.{}remain distinct.Automated testing:
npm run lint:js -- src/utils/run-ability.tsnpm run typecheckScreenshots or screencast
Not applicable; this is a utility behavior change without UI changes.
Changelog Entry