Skip to content

feat: suggest combining repeated query filters into In / Not In - #1994

Merged
paustint merged 1 commit into
mainfrom
feat/1987-suggest-in-clause
Aug 23, 2026
Merged

feat: suggest combining repeated query filters into In / Not In#1994
paustint merged 1 commit into
mainfrom
feat/1987-suggest-in-clause

Conversation

@paustint

Copy link
Copy Markdown
Contributor

The query builder now detects 2+ conditions on the same field that can be collapsed — OR + Equals into In, AND + Does Not Equal into Not In — and offers a one-click conversion in a dismissible inline hint above the filter rows. Rows using a date picker or a field function are skipped, since neither survives the rewrite unchanged.

Closes #1987

@paustint
paustint force-pushed the feat/1987-suggest-in-clause branch from bc0f869 to 5ebf892 Compare August 23, 2026 00:45
The query builder now detects 2+ conditions on the same field that can be
collapsed — OR + Equals into In, AND + Does Not Equal into Not In — and offers
a one-click conversion in a dismissible inline hint above the filter rows.
Rows using a date picker or a field function are skipped, since neither
survives the rewrite unchanged.

Closes #1987
@paustint
paustint force-pushed the feat/1987-suggest-in-clause branch from 5ebf892 to 9ee3db9 Compare August 23, 2026 01:40
@paustint

Copy link
Copy Markdown
Contributor Author

Code review summary

Automated review (Claude Code). Fixes below are pushed as an amend to the PR head.

Verdict: the SOQL rewrite is semantically correct and unusually well tested. Remaining items are UX polish.

Verified against a live org: NOT IN is equivalent to chained != (952 vs 952 records — SOQL's null handling differs from ANSI SQL here, and the implementation gets it right), and date literals and booleans are legal inside IN.

Fixed and pushed

  • ExpressionListOperatorSuggestions.tsx — two identical suggestions were indistinguishable. When the same field is collapsible both at root and inside a group, two suggestions rendered with identical copy and identical accessible names. Now scoped by the group's display number ("…in condition group 3"), matching the "Condition Group N" label ExpressionGroup already renders. Note this uses the display number rather than the internal groupKey, which matches nothing the user sees. Root-level copy is byte-identical to before, so existing unit and E2E locators still match.
  • ExpressionContainer.tsx — junk picklist entry. updateResourcesOnRow ran before normalization, adding a newline-joined "a\nb" item to the select. Row metadata is now derived from suggestion.values with normalization applied after. Still entirely within the CONVERT_ROWS_TO_LIST_OPERATOR reducer — no atom write introduced.

Verified as a genuine regression guard: with the fix reverted, the new assertion fails with exactly the reported artifact (["Prospecting","Qualification","Closed Won","Prospecting\nQualification"]).

⚠️ Worth knowing: the query specs in this PR were not being executed

vitest --project query matches no project — the real name is features-query. Run alone it errors; combined with a valid project name it is silently ignored. Any "521 tests passing" figure was ui only. With correct filters: ui = 54 files/522, features-query = 7 files/63. Full run now green at 61 files / 585 tests, typecheck clean.

Needs a decision

  • Dismissed suggestions come back on tab switch (ExpressionContainer.tsx:461). Tabs unmounts inactive content, so dismissal state is lost and the hint re-nags. Fix means lifting dismissed ids to QueryFilter/an atom, or passing renderAllContent — a component-ownership call.

Note

The drive-by usePortal: true on the operator combobox is correct and test-covered, but unmentioned in the commit message.

@paustint
paustint merged commit 1dd3a89 into main Aug 23, 2026
14 checks passed
@paustint
paustint deleted the feat/1987-suggest-in-clause branch August 23, 2026 12:13
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.

Query Builder: suggest converting repeated OR conditions into an IN clause

1 participant