Skip to content

Conversation

@JUVOJustin
Copy link

@JUVOJustin JUVOJustin commented Dec 1, 2025

partial_args_matching (json and like modes) fails to find actions when arguments exceed 191 characters because it only queries the args column, which contains an MD5 hash for long args while the actual JSON is in extended_args.

Changes

  • json mode: Use COALESCE(a.extended_args, a.args) so JSON_EXTRACT operates on actual JSON data
  • like mode: Check both columns following the existing search query pattern: ((a.extended_args IS NULL AND a.args LIKE %s) OR a.extended_args LIKE %s)

Example

// Before: only checks args column (contains MD5 hash for long args)
$sql .= ' AND JSON_EXTRACT(a.args, %s)=' . $placeholder;

// After: checks extended_args first if present
$sql .= ' AND JSON_EXTRACT(COALESCE(a.extended_args, a.args), %s)=' . $placeholder;

Tests

Added test coverage for both like and json modes with:

  • Short args (≤191 chars, stored in args)
  • Long args (>191 chars, stored in extended_args)

Fix #1299

Copilot AI and others added 4 commits November 30, 2025 20:26
- Update 'json' mode to use COALESCE(a.extended_args, a.args) for JSON_EXTRACT
- Update 'like' mode to check both args and extended_args columns
- Add tests for partial_args_matching with short args (≤191 chars)
- Add tests for partial_args_matching with long args (>191 chars)

Co-authored-by: JUVOJustin <30726576+JUVOJustin@users.noreply.github.com>
Move duplicate JSON support check logic into a private helper method
to reduce code duplication in the test file.

Co-authored-by: JUVOJustin <30726576+JUVOJustin@users.noreply.github.com>
Ensure global $wpdb is only accessed after the JSON support check
to avoid unnecessary global access when test is skipped.

Co-authored-by: JUVOJustin <30726576+JUVOJustin@users.noreply.github.com>
@JUVOJustin
Copy link
Author

JUVOJustin commented Dec 1, 2025

To be clear: This PR is done by github copilot. I reviewed and tested locally again.
Fixes #1299

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.

Partial Match checks "args" instead of "extended_args"

1 participant