Skip to content

fix: avoid incorrect-usage notice for missing processed-items ability #3376

Description

@chubes4

Bug

The missing-ability fallback in DataMachine\Api\ProcessedItems::handle_clear() calls wp_get_ability() directly. WordPress core emits an incorrect-usage notice when the ability is not registered before returning null, so the endpoint cannot cleanly return its intended safe ability_not_found error.

Reproduction

On PR #3361 head 1c5d76757, MySQL shard 2 fails:

DataMachine\Tests\Unit\Api\ProcessedItemsEndpointTest::test_handle_clear_returns_safe_error_when_ability_is_missing
Unexpected incorrect usage notice for WP_Abilities_Registry::get_registered.

GitHub job: https://github.com/Extra-Chill/data-machine/actions/runs/32732417352/job/97452519639

The other three shards and all quality gates pass.

Expected

The endpoint should check registration through WP_Abilities_Registry::is_registered() before resolving the ability, then return the existing ability_not_found / HTTP 500 WP_Error without an incorrect-usage notice. Preserve the route, permission, input, ability execution, and response contracts.

Constraints

  • Fix the missing-ability path at the owning REST adapter.
  • Do not suppress _doing_it_wrong or weaken the test.
  • Retain executable coverage for the clean missing-ability response.

Found during final #2424 package certification on #3361.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions