Skip to content

Utils: Preserve omitted ability input#775

Open
jorgefilipecosta wants to merge 1 commit into
developfrom
codex/run-ability-omitted-input
Open

Utils: Preserve omitted ability input#775
jorgefilipecosta wants to merge 1 commit into
developfrom
codex/run-ability-omitted-input

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Jun 25, 2026

Copy link
Copy Markdown
Member

What?

  • Preserves omitted runAbility() input as undefined instead of normalizing it to null.
  • Omits REST fallback input payloads when the caller does not provide input.
  • Keeps explicitly provided empty-object input as request input.

Why?

Some abilities use an object schema with a default empty object for empty collection/query mode. Passing null prevents the abilities client from applying that schema default and can make runAbility( 'core/users' ) fail where executeAbility( 'core/users' ) succeeds.

Core users is at #774.

Testing

  • npx wp-scripts test-unit-js tests/unit/run-ability.test.ts
  • npm run lint:js -- src/utils/run-ability.ts tests/unit/run-ability.test.ts
  • All other tests and checks are green.
Open WordPress Playground Preview

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>

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

@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.71%. Comparing base (dd7d364) to head (afb164a).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #775   +/-   ##
==========================================
  Coverage      76.71%   76.71%           
  Complexity      1828     1828           
==========================================
  Files             87       87           
  Lines           7764     7764           
==========================================
  Hits            5956     5956           
  Misses          1808     1808           
Flag Coverage Δ
unit 76.71% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't currently have any unit tests for our TS files. While I'm not opposed to getting that added, that will require more than just a single test file, we'll need all the underlying code to run those tests as well (and get those set up in CI). May be worth doing that in a separate PR instead of rolling into this one

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@dkotter

dkotter commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Would be great if we can ensure the PR template is followed here. Noticing the Use of AI Tools and Changelog Entry sections aren't provided right now and the Testing Instructions section just includes automated test steps whereas we want manual test steps there

@dkotter dkotter added this to the 1.1.0 milestone Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants