Skip to content

fix(api): place AND operator before connector filter in device list#6131

Merged
gustavosbarreto merged 1 commit intomasterfrom
fix/device-filter-operator-ordering
Apr 7, 2026
Merged

fix(api): place AND operator before connector filter in device list#6131
gustavosbarreto merged 1 commit intomasterfrom
fix/device-filter-operator-ordering

Conversation

@gustavosbarreto
Copy link
Copy Markdown
Member

Summary

  • The connector/platform filter in the device list handler placed the AND operator after the property instead of before
  • Since Match processes operators as prefix (applies to the next condition), the platform filter was OR'd with user filters
  • This caused WHERE (name ILIKE '%foo%') OR (platform <> 'connector') instead of AND, returning all non-connector devices regardless of the user's search
  • Added test that verifies operator ordering and fails without the fix

@gustavosbarreto gustavosbarreto requested a review from a team as a code owner April 7, 2026 18:29
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Claude finished @gustavosbarreto's task in 2m 29s —— View job


Code Review Complete

Reviewed 2 files across code quality, security, testing, Go patterns, and architecture — no issues found. The code looks good as-is.

The fix correctly moves the AND operator before the property filter in both branches of the connector/platform filter logic, ensuring the platform condition is properly AND'd with user filters instead of OR'd. The test effectively validates the ordering invariant by capturing the request and asserting the last two filter elements are [operator(and), property].


To request another review round, comment /review.

…andler

The connector/platform filter appended the AND operator
after the property, so it was OR'd with user filters
instead of AND'd, effectively returning all devices
regardless of the user's search filter.
@gustavosbarreto gustavosbarreto force-pushed the fix/device-filter-operator-ordering branch from e36630a to 704627a Compare April 7, 2026 18:30
@gustavosbarreto gustavosbarreto enabled auto-merge (rebase) April 7, 2026 18:33
@gustavosbarreto gustavosbarreto merged commit 50df770 into master Apr 7, 2026
12 checks passed
@gustavosbarreto gustavosbarreto deleted the fix/device-filter-operator-ordering branch April 7, 2026 18:37
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.

1 participant