Repository navigation
Edit search columns and sort from the results table - #3387
elizabetdev wants to merge 16 commits into
Conversation
Those clauses and the table actions belong with the results table. They stay hidden on Event Deltas and Event Patterns. Co-authored-by: Cursor <cursoragent@cursor.com>
…table SELECT and ORDER BY move into Columns and Sort buttons on the results table toolbar. Each opens a popover with a Pick tab (column list with add/remove, or field plus asc/desc) and a SQL tab; Apply writes the clause and runs the search, Cancel discards the draft. Custom ORDER BY expressions open on the SQL tab. The table controls become subtle action icons grouped on the right, with sentence-case tooltips, and the row selection menu sits next to the clause buttons. Co-authored-by: Cursor <cursoragent@cursor.com>
Show the source SELECT and ORDER BY as editor text, add a column only when Add is clicked, and let columns be reordered. Sort pick lists tuple fields, including function calls. Both popovers can reset to the source default. The search form keeps WHERE on its own line, with Update and Alerts at the end of the source row. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2ac10de The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔴 Tier 4 — CriticalTouches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI. Why this tier:
Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| @@ -2209,6 +2220,58 @@ function DBSearchPageContent() { | |||
| [setValue, setNewSourceModalClosed], | |||
There was a problem hiding this comment.
🔵 minor — applySelect re-implements toggleColumn's ORDER BY pruning
The loop of orderByAfterRemovingSelectItem(item, orderBy, defaultSearchConfig.orderBy) followed by setValue('orderBy') and onSubmit() duplicates toggleColumn (DBSearchPage.tsx ~1785-1796). Extract one helper, for example pruneOrderByForRemovedItems(removed, orderBy, default), and call it from both places so the two removal paths can't drift. There is also no test that removing an aliased column in the Columns popover resets an ORDER BY on that alias.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
7 finding(s): 🔴 0 critical · 🟠 1 major · 🔵 6 minor 6 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
[Medium impact] The reviewed changes appear safe to merge; all three numbered findings are addressed. SummaryMoves SELECT and ORDER BY editing into Columns and Sort popovers on the results table.
|
Deep Review✅ No critical issues found. The three P1 regressions raised in earlier review rounds (backtick-quoted names mangled on column removal, custom/tuple sorts overwritten, suggested names inserted unquoted) are all confirmed fixed in the current code, and an independent trace of the parsing primitives ( The notes below are test-coverage recommendations, not behavioral defects. 🟡 P2 -- recommended
🔵 P3 nitpicks (3)
Reviewers (4 of 10 reported): testing, agent-native, learnings-researcher, previous-comments. The correctness, adversarial, maintainability, project-standards, kieran-typescript, and julik-frontend-races reviewers were dispatched but had not returned when output was finalized — their findings are not reflected here. The orchestrator independently traced Testing gaps: No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 454 passed • 1 skipped • 1852s
Tests ran across 4 shards in parallel. |
Co-authored-by: Cursor <cursoragent@cursor.com>
| [setValue, setNewSourceModalClosed], | ||
| ); | ||
|
|
||
| const applySelect = useCallback( |
There was a problem hiding this comment.
🔵 minor — New applySelect ORDER BY clean-up and the toolbar wiring are untested
The popover tests mock onApply, and the DBSearchPage test mocks out both popovers. Nothing checks that removing an aliased column that ORDER BY sorts by resets ORDER BY through orderByAfterRemovingSelectItem. Nothing checks that the new controlsAboveTable toolbar in DBRowTable renders the table controls and the row-selection menu. Add a DBSearchPage or DBRowTable test that applies a SELECT without the sorted alias and asserts the resulting orderBy.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Suggested names with spaces or hyphens were inserted raw, an emptied column list snapped back to the source default, and a sort of two tuples was parsed as one broken list. Co-authored-by: Cursor <cursoragent@cursor.com>
Addressed in 87937b3:
|
The where field and the time group each claimed hundreds of pixels, so Live Tail and Run wrapped while the form was still wide. They now share a row until the form itself is under 900px, the compact layout cutoff. Co-authored-by: Cursor <cursoragent@cursor.com>
A newline inside a parenthesized sort hid the field controls, because the direction match stopped at the end of the line. Co-authored-by: Cursor <cursoragent@cursor.com>
| const knownColumns = new Set(columns.map(column => column.name)); | ||
| // Field discovery is off for some teams, and `useAllFields` then returns | ||
| // [] rather than "still loading". Scalar columns are still known. | ||
| const keys = |
There was a problem hiding this comment.
🟠 major — Pick suggestions leave out every DateTime column (Timestamp, TimestampTime), and every Map, Array and JSON column
getSqlSourceKeys/getSqlSourceColumnKeys (AdhocDashboardFilter/useAdhocFilterOptions.ts) were written for ad hoc filters. They drop anything that fails isAdhocComparableDataType, which is !/\bDateTime/ in common-utils/src/filters.ts, and they keep only scalar columns. So Timestamp, the most common sort key, is never offered in Sort or Columns. Build the options from all of columns plus the map and JSON keys, without the ad hoc comparability filter. Also add a DateTime column to the hook test so this is covered.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| }} | ||
| data={addOptions} | ||
| limit={50} | ||
| onOptionSubmit={id => { |
There was a problem hiding this comment.
🟠 major — "Add sort" only adds a suggested option, so a typed field or expression can never be added
A key is added only through onOptionSubmit, and there is no Add button or Enter handler. Typing toDateTime(Timestamp), or any field missing from fieldOptions (every DateTime column today), then pressing Enter does nothing. Add the free-typed value on Enter or through an Add button, as ColumnsPopover does.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| }; | ||
|
|
||
| return ( | ||
| <Popover |
There was a problem hiding this comment.
🟠 major — Pressing Escape to dismiss SQL autocomplete closes the popover and throws away the draft
Mantine Popover's closeOnEscape handles keydown in the capture phase, before CodeMirror sees it. An Escape meant to close the completion list closes the popover instead, and the next onOpen resets the draft. The e2e helper in SearchPage.ts works around exactly this. Pass closeOnEscape={false} (or skip closing while a CodeMirror completion is active), or keep the draft until Cancel or Apply.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| size="xs" | ||
| placeholder="Search columns" | ||
| value={search} | ||
| onChange={next => { |
There was a problem hiding this comment.
🔵 minor — The search input rewrites a typed map subscript on every keystroke, so its alias cannot be removed
withMapKeyAlias runs in onChange. As soon as the input matches Col['k'] (when ] is typed, or when the user backspaces the alias away), the value jumps to Col['k'] AS "k" and the cursor moves. Apply the alias only when an option is picked from the dropdown (onOptionSubmit), not on free typing.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| const count = storedColumns(value).length; | ||
| const items = splitAndTrimWithBracket(draft); | ||
|
|
||
| const options = useMemo( |
There was a problem hiding this comment.
🔵 minor — Duplicate and suggestion checks ignore aliases, so an added map key stays suggested and can be added twice
!items.includes(option) and !items.includes(trimmed) compare the raw subscript with the stored Col['k'] AS "k", which never matches. The option stays in the list, and adding it again appends an unaliased duplicate. Use the existing isColumnInSelect from packages/app/src/utils.ts, which matches on selectItemExpression. The useMemo here also depends on items, which is a new array every render, so it never memoizes.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| setSearch(''); | ||
| }} | ||
| resetDisabled={draft.trim() === defaultValue.trim()} | ||
| onApply={() => { |
There was a problem hiding this comment.
🔵 minor — Applying with every column removed silently restores the source default
With an empty draft, submitted is '', which the page reads as "use source default". The UI shows "No columns selected." and the code comment says an empty draft is not the default, yet the default comes back. Disable Apply while items.length === 0.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| onApply( | ||
| draft.trim() === defaultValue.trim() | ||
| ? '' | ||
| : draft === baseline |
There was a problem hiding this comment.
🔵 minor — The draft === baseline ? value : draft branch can never change the result (same in ColumnsPopover)
baseline is value || defaultValue. If value is non-empty, draft === baseline means draft === value. If value is empty, an equal draft was already caught by the default check. Simplify to draft.trim() === defaultValue.trim() ? '' : draft in both popovers.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| : getSqlSourceKeys(fields, columns); | ||
| return Array.from( | ||
| new Set( | ||
| keys.map(key => toQuotedClickHouseKeyExpression(key, knownColumns)), |
There was a problem hiding this comment.
🔵 minor — Keys are quoted twice
getSqlSourceKeys and getSqlSourceColumnKeys already pass every key through toQuotedClickHouseKeyExpression (toQuotedKeys in useAdhocFilterOptions.ts). The second pass is a no-op because the function is idempotent, and so is the extra knownColumns set. Drop both and just dedupe and sort.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| /** Restore the source default in the draft. Apply still has to confirm it. */ | ||
| onReset: () => void; | ||
| resetDisabled?: boolean; | ||
| renderPick: (apply: () => void) => ReactNode; |
There was a problem hiding this comment.
🔵 minor — The apply argument passed to renderPick is never used
Neither ColumnsPopover nor SortPopover reads the apply passed to renderPick, because only the SQL tab submits on Enter. Change it to renderPick: () => ReactNode.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <Stack gap="xs"> | ||
| <Box mah={220} style={{ overflowX: 'hidden', overflowY: 'auto' }}> | ||
| {items.length === 0 ? ( | ||
| <Text size="xs" c="dimmed"> |
There was a problem hiding this comment.
🔵 minor — Ad hoc empty state uses Text c="dimmed"
This breaks the EmptyState (REQUIRED) rule and the semantic-token rule in the repository conventions. Render <EmptyState title="No columns selected" /> from @/components/EmptyState instead of raw dimmed text.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Removing an aliased column left it in a multi-field sort, a comma inside a backtick-quoted name was split, and typing a map key rewrote the input. The time controls also wrap so Run stays visible on a narrow screen. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed in 0e8a7ae:
|
| ); | ||
| }; | ||
|
|
||
| const addKey = (id: string) => { |
There was a problem hiding this comment.
🟠 major — Adding a sort key on a custom ORDER BY silently replaces the whole clause
If the ORDER BY cannot be parsed (for example Timestamp DESC NULLS LAST), keys is null. The Pick tab then says "Custom sort. Edit it in SQL." but still shows the "Add sort" input (line 262). Picking a field there calls addKey, which runs commitKeys([...(keys ?? []), new]), so the draft becomes just Body DESC and Apply throws the custom sort away. Fix: hide or disable the Add sort input when keys == null, and add a test that covers this case.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| }; | ||
|
|
||
| return ( | ||
| <Popover |
There was a problem hiding this comment.
🟠 major — Pressing Escape to dismiss SQL autocomplete closes the popover and discards the draft
The Popover keeps Mantine's default closeOnEscape. Pressing Escape inside the SQL tab's CodeMirror editor, which is the usual way to close its autocomplete, closes the whole popover and loses the unapplied SELECT or ORDER BY edit. The PR's own page object works around this (tests/e2e/page-objects/SearchPage.ts: "Blur rather than Escape: Escape also closes the popover, dropping the draft"). Fix: pass closeOnEscape={false}, or ignore Escape while a .cm-tooltip-autocomplete is open.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
|
|
||
| const count = storedColumns(value).length; | ||
| const items = splitAndTrimWithBracket(draft); | ||
|
|
There was a problem hiding this comment.
🔵 minor — Backtick-quoted SELECT items containing a comma get split and rewritten in Columns Pick
splitAndTrimWithBracket (common-utils/src/core/utils.ts:132) does not treat backticks as quotes. SortPopover guards against this with its own local hasCommaInsideBackticks, but ColumnsPopover does not. A SELECT such as `a,b`, Body becomes the items `a and b`, and any remove or reorder writes back `a, b`, which is a different identifier. Fix: make splitAndTrimWithBracket skip commas inside backticks so every caller gets it, and drop the local guard in SortPopover.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <Box mah={220} style={{ overflowX: 'hidden', overflowY: 'auto' }}> | ||
| {items.length === 0 ? ( | ||
| <Text size="xs" c="dimmed"> | ||
| No columns selected. |
There was a problem hiding this comment.
🔵 minor — Ad-hoc inline empty state violates the REQUIRED EmptyState rule
The "No columns selected." message is a bare <Text size="xs" c="dimmed">. The conventions say to use EmptyState (@/components/EmptyState) for all empty and no-data states. Render <EmptyState title="No columns selected" /> here instead, with no trailing period in the title.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| opened={opened} | ||
| onChange={setOpened} | ||
| position="bottom-start" | ||
| width={440} |
There was a problem hiding this comment.
🔵 minor — Fixed 440px popover width overflows phone viewports
This PR removed the compact-viewport Columns toggle, so on phones the Columns and Sort editors are now only these popovers, and they always render at width={440}. On a 375px-wide phone, Mantine's shift can move the dropdown but cannot shrink it, so part of the dropdown, including Apply, sits off-screen. Fix: cap the width, for example width="min(440px, calc(100vw - 16px))", or set a maw on the Dropdown.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| const count = storedColumns(value).length; | ||
| const items = splitAndTrimWithBracket(draft); | ||
|
|
||
| const options = useMemo( |
There was a problem hiding this comment.
🔵 minor — options useMemo never memoizes because items is a new array every render
items = splitAndTrimWithBracket(draft) creates a new array on every render, so useMemo(..., [fieldOptions, items]) recomputes every time. Either memoize items on draft, or remove the useMemo and compute options inline.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| /** Restore the source default in the draft. Apply still has to confirm it. */ | ||
| onReset: () => void; | ||
| resetDisabled?: boolean; | ||
| renderPick: (apply: () => void) => ReactNode; |
There was a problem hiding this comment.
🔵 minor — renderPick's apply argument is never used
renderPick is passed apply, but neither caller (ColumnsPopover and SortPopover both use renderPick={() => ...}) reads it. Change the type to renderPick: () => ReactNode and render renderPick(), or remove the prop and pass the pick content as a ReactNode.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
…rch-table-select-order-by
A field count collapses to a number on a narrow screen so the three controls still fit. Storybook records when to use each clause. Co-authored-by: Cursor <cursoragent@cursor.com>
Splitting the remaining ORDER BY on every comma rewrote `a,b` as `a, b`. Sort parsing now lives beside the popover so the component stays under 300 lines. Co-authored-by: Cursor <cursoragent@cursor.com>
| const keys = | ||
| isFieldMetadataDisabled || fields == null | ||
| ? getSqlSourceColumnKeys(columns) | ||
| : getSqlSourceKeys(fields, columns); |
There was a problem hiding this comment.
🟠 major — Columns and Sort suggestions never include Timestamp or any other DateTime column, or whole Map/JSON columns
getSqlSourceKeys and getSqlSourceColumnKeys (AdhocDashboardFilter/useAdhocFilterOptions.ts) were written for ad-hoc filters. They drop every type that matches isAdhocComparableDataType (common-utils/src/filters.ts:963, which rejects /\bDateTime/), and they also drop whole non-scalar columns. So Timestamp/TimestampTime can't be picked in “Add sort”, which is the most common sort key, and LogAttributes can't be added as a column. Build the options from the fields/columns without the ad-hoc comparability filter. Add a hook test with a DateTime64 column. The popover tests miss this because they hand-pass 'Timestamp' in fieldOptions.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| setSearch(''); | ||
| }; | ||
|
|
||
| const removeColumn = (item: string) => { |
There was a problem hiding this comment.
🔵 minor — Removing one of two identical SELECT items removes both
removeColumn filters by value (items.filter(i => i !== item)). For a SELECT such as Timestamp, Body, Body, clicking Remove on one Body row drops every Body. The rows are keyed by index (columnId) precisely because duplicates can exist, so remove by index: items.filter((_, i) => i !== index).
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| setSearch(''); | ||
| }} | ||
| resetDisabled={draft.trim() === defaultValue.trim()} | ||
| onApply={() => { |
There was a problem hiding this comment.
🔵 minor — Applying an empty column list (or an empty sort) silently restores the source default
The comment says an empty draft is not “use the default”, and the picker shows “No columns selected.” But Apply submits '', which the search reads as the source default. The same happens in SortPopover when every key is removed. Disable Apply when the draft is empty, or show the user that empty means default.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| setSearch(''); | ||
| }} | ||
| resetDisabled={draft.trim() === defaultValue.trim()} | ||
| onApply={() => |
There was a problem hiding this comment.
🔵 minor — The draft-to-stored-value Apply logic is copied verbatim in ColumnsPopover and SortPopover
Both contain the same draft.trim() === defaultValue.trim() ? '' : draft === baseline ? value : draft rule and the same resetDisabled check, so the “empty means default” contract now lives in two places. Move it into ClausePopover (pass value, defaultValue and draft, and have it compute the stored value) so the two editors can't drift apart.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <Stack gap="xs"> | ||
| <Box mah={220} style={{ overflowX: 'hidden', overflowY: 'auto' }}> | ||
| {items.length === 0 ? ( | ||
| <Text size="xs" c="dimmed"> |
There was a problem hiding this comment.
🔵 minor — Ad-hoc inline empty state violates the EmptyState convention
<Text size="xs" c="dimmed">No columns selected.</Text> is the pattern the REQUIRED EmptyState rule forbids. Use EmptyState from @/components/EmptyState, for example title="No columns selected".
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| const shown = storedColumns(value); | ||
| const items = splitAndTrimWithBracket(draft); | ||
|
|
||
| const options = useMemo( |
There was a problem hiding this comment.
🔵 minor — useMemo for options never memoizes because items is a new array on every render
items = splitAndTrimWithBracket(draft) is recomputed on every render, so [fieldOptions, items] changes every time and the memo always reruns. Memoize items on draft, or drop the useMemo.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| '"service.name" ASC, Timestamp DESC', | ||
| 'Timestamp DESC', | ||
| ), | ||
| ).toBe('Timestamp DESC'); |
There was a problem hiding this comment.
🔵 minor — Multi-key removal test can't tell keeping the remaining key apart from falling back to the default
In the first case the kept key Timestamp DESC is also the defaultOrderBy. An implementation that still returns the default whenever any key matches, which is the old behaviour, would pass. Use a different default (for example 'TimestampTime DESC') so the assertion proves only the alias key was dropped.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
|
The column list split backtick-quoted names on commas, and Add sort replaced a clause the field list could not parse. The column row moved out so ColumnsPopover stays under 300 lines. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
|
||
| const addColumn = (column: string) => { | ||
| const trimmed = column.trim(); | ||
| if (trimmed && !items.includes(trimmed)) { |
There was a problem hiding this comment.
🟠 major — An already-aliased map column can be added a second time
Suppose the SELECT already has LogAttributes['x'] AS "x". Because options and addColumn check with items.includes(...), the bare LogAttributes['x'] is still offered. If the user adds it, withMapKeyAlias sees that the alias x is taken and returns the bare subscript, so the same column ends up in the SELECT twice. Fix: use the existing isColumnInSelect(items, option) from packages/app/src/utils.ts:1253 for both the option filter and the duplicate check. It already matches aliased items by their expression, and toggleColumn in DBSearchPage relies on the same match.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| const trimmed = orderBy.trim(); | ||
| if (!trimmed) return []; | ||
| // A comma inside a backtick-quoted name would be split into extra fields. | ||
| if (hasCommaInsideBackticks(trimmed)) return null; |
There was a problem hiding this comment.
🔵 minor — parseSortKeys adds a second backtick scanner instead of using splitClauseList
hasCommaInsideBackticks repeats work that splitClauseList (packages/app/src/utils.ts, built on replaceBacktickedIdentifiers in common-utils) already does. Because of the bail-out, a sort like (`a,b`, Timestamp) DESC opens on SQL, although the same PR's Columns popover handles that name. The scanner also does not skip string literals the way replaceBacktickedIdentifiers does. Fix: split with splitClauseList, both for the tuple body and for the top-level keys, and delete hasCommaInsideBackticks.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| onChange={setOpened} | ||
| position="bottom-start" | ||
| width={440} | ||
| shadow="md" |
There was a problem hiding this comment.
🔵 minor — Fixed 440px popover overflows on phones now that the compact column toggle is gone
This PR removes the compact-viewport handling for SELECT and ORDER BY (columnsOpen and the stacked editors). On compact viewports these popovers now open at a fixed width={440}, which is wider than a typical 375px phone screen, so the Apply and Cancel buttons can render off screen. Fix: cap the width, for example width="min(440px, calc(100vw - 16px))", or switch to width="target" with a max width when useCompactViewport() is true.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <Stack gap="xs"> | ||
| <Box mah={220} style={{ overflowX: 'hidden', overflowY: 'auto' }}> | ||
| {items.length === 0 ? ( | ||
| <Text size="xs" c="dimmed"> |
There was a problem hiding this comment.
🔵 minor — Ad-hoc empty state breaks the EmptyState convention
<Text size="xs" c="dimmed">No columns selected.</Text> is the inline empty-state pattern that the REQUIRED "EmptyState Component" rule forbids. Fix: render <EmptyState title="No columns selected" /> from @/components/EmptyState (headline style, no trailing period) and update the test that queries this text.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| const shown = storedColumns(value); | ||
| const items = splitClauseList(draft); | ||
|
|
||
| const options = useMemo( |
There was a problem hiding this comment.
🔵 minor — useMemo for options never memoizes
items is a new array from splitClauseList(draft) on every render, so the [fieldOptions, items] dependency changes every time and the memo recomputes on each render. Fix: either drop the useMemo, or memoize items on draft (useMemo(() => splitClauseList(draft), [draft])).
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| ); | ||
| }; | ||
| const applySelect = useCallback( | ||
| (select: string, removedItems: string[]) => { |
There was a problem hiding this comment.
🔵 minor — New applySelect sort pruning and popover placement have no test
applySelect now prunes ORDER BY in a loop over every removed item and submits. The popovers are also rendered in three places: the empty state, the query error, and the table toolbar. DBSearchPage.directTrace.test.tsx mocks out ColumnsPopover, SortPopover and useClauseFieldOptions, so none of this is exercised. A regression such as passing removedItems wrongly, or editors missing from the error branch, would still pass. Fix: add a DBSearchPage test that uses the real ColumnsPopover. It should remove an aliased column that ORDER BY sorts on and assert the submitted orderBy.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
## Summary Group by uses a new shared split button: a fixed name, then the current value. On a narrow screen a count such as `3 fields` shows as `3`. A single field still shows its name. Columns and Sort will use the same button in a follow-up. This PR only switches Group by, so that button can be reviewed on its own. Storybook (`Components/SplitValueButton`) says when to use it. Related: #3387. Replaces #3429, which closed when the branch moved off the `agent/` prefix. ### Screenshots or video <img width="599" height="436" alt="Screenshot 2026-10-21 at 15 10 27" src="https://github.com/user-attachments/assets/4c40486d-d015-446b-bc45-269851e0772b" /> On the search page: <img width="556" height="99" alt="Screenshot 2026-10-21 at 15 14 15" src="https://github.com/user-attachments/assets/f7f77c13-65d9-48c7-9604-540b1b535b8a" /> ### How to reproduce **Starting point:** Vercel preview, or `yarn app:dev:local` connected to the demo server. **On `main`:** 1. Open Search. 2. Open Group by and select two fields, then Apply. 3. Narrow the window below 900px. The button still reads `2 fields`. **On this branch:** 1. Open Search. 2. Open Group by and select two fields, then Apply. 3. Narrow the window below 900px. The value shows `2`. One field still shows its name, and an empty selection still shows `none`. ### How to test on Vercel preview **Preview routes:** /search **Steps:** 1. Open Group by. 2. Select two fields and click Apply. 3. Verify the button reads Group by and `2 fields` at a desktop width. 4. Narrow the viewport below 900px. 5. Verify the value shows `2`. ### References - Related PR: #3387 Made with [Cursor](https://cursor.com)
Summary
SELECT and ORDER BY now belong to the results table. They open from Columns and Sort on the table toolbar, and they stay hidden on Event Deltas and Event Patterns. The source row and the WHERE line are split again so the WHERE clause keeps the width of the row.
upper(Body) as message, is added only when Add is clicked. SQL edits the full SELECT.(toDateTime(Timestamp), Timestamp) DESC. SQL edits the raw clause. An expression that cannot be split, such asTimestamp DESC NULLS LAST, opens on SQL.I could not capture before/after screenshots from this session. The table below is left for those.
Screenshots or video
How to reproduce
Starting point: play.hyperdx.io → Search, with the Logs source selected. The same flow works on a Vercel preview (local mode, demo ClickHouse).
On
main:On this branch:
upper(Body) as message, click Add, then Apply. Confirm the table columns match that list.toDateTime(Timestamp)when that is the source default. Change a direction and click Apply.How to test on Vercel preview
Preview routes: /search
Steps:
References
Made with Cursor