Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 5e43cd6 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 |
|
@vinzee is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
97076ea to
fa84b72
Compare
[Medium impact] The PR appears safe to merge. SummaryThe PR adds URL-persisted faceted filters to the sessions page and applies them to trace-backed session aggregation.
|
Deep ReviewFaceted filters for ✅ No critical issues found. 🟡 P2 — recommended
🔵 P3 nitpicks (6)
Reviewers (9): correctness, testing, maintainability, kieran-typescript, performance, adversarial, julik-frontend-races, project-standards, previous-comments. 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 |
fa84b72 to
d81257b
Compare
2b5bdd1 to
1901232
Compare
1901232 to
2f51ae2
Compare
| style={{ flex: 1, minWidth: 0, minHeight: 0 }} | ||
| > | ||
| <Group gap={4} align="center" wrap="nowrap"> | ||
| {isFilterSidebarCollapsed && ( |
There was a problem hiding this comment.
🔵 minor — Show-filters button duplicates DBSearchPage's ExpandFiltersButton
The Tooltip + subtle ActionIcon + IconArrowBarToRight + aria-label="Show filters" block is a copy of ExpandFiltersButton in DBSearchPage.tsx:312 (differing only in icon/ActionIcon size). Export that component (or move it next to DBSearchPageFilters) and use it here so the two collapse affordances can't drift.
There was a problem hiding this comment.
ExpandFiltersButton lives in DBSearchPage.tsx, which this PR doesn't change; happy to share it in a follow-up.
PR Review
4 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 4 minor 3 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. |
2f51ae2 to
a1e6e23
Compare
| @@ -97,6 +108,21 @@ export function useSessions( | |||
| 'rum.sessionId', | |||
| ); | |||
|
|
|||
| const searchFilters: Filter[] = [ | |||
There was a problem hiding this comment.
🔵 minor — New session query logic (filters merged into the aggregation, HAVING dropped whenever any filter exists) has no test
sessions.test.ts only covers the URL parser, and SessionFilters.test.tsx only checks that props are forwarded. Nothing tests that filters reach the trace aggregation's filters, that sidebar-only filters (with no where) remove the HAVING interactionCount > 0 clause and switch to the joined finalQuery, or that the source-change filter reconciliation works. Add a useSessions test that captures the rendered SQL for where-only, filters-only and neither.
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
There was a problem hiding this comment.
Partly addressed in 6e7833167: added tests for buildSessionsSearchCondition and for hasSessionsSearch, the shared predicate that drives the HAVING/finalQuery switch. A full useSessions SQL snapshot test would need a mocked ClickHouse client and metadata; happy to add one if you want it in this PR.
| filters: appliedConfig.filters, | ||
| }, | ||
| resetOptions: { | ||
| keepDirtyValues: true, |
There was a problem hiding this comment.
🔵 minor — keepDirtyValues stops the form from following URL changes for fields the user has edited
With resetOptions.keepDirtyValues, a later change to values keeps any field the user has touched. Example: pick source B in the dropdown (it is now dirty), then press browser Back so the URL returns to ?sessionSource=A&where=.... The form keeps source B and the old typed where, so the header and the source used by useSource(sourceId) no longer match the URL. Before this PR the form reset to match the URL. Fix: scope the protection to the case that motivated it. For example, don't route sidebar filters through values, or call reset on URL navigation with only filters taken from the URL, instead of keeping every dirty field globally.
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
| @@ -1092,29 +1092,35 @@ const DBSearchPageFiltersComponent = ({ | |||
| setFilterValue: _setFilterValue, | |||
| isLive, | |||
| chartConfig, | |||
| analysisMode, | |||
| setAnalysisMode, | |||
| analysisMode = 'results', | |||
There was a problem hiding this comment.
🔵 minor — Analysis-mode props made optional for every caller, so the visible tabs can be inert
Making analysisMode/setAnalysisMode/showDelta/denoiseResults/setDenoiseResults optional with voidFunc defaults means a caller that leaves hideAnalysisMode false and forgets setAnalysisMode still compiles, and the tabs and denoise checkbox it renders do nothing when clicked. Model the props as a union instead: { hideAnalysisMode: true } or { hideAnalysisMode?: false; analysisMode; setAnalysisMode; showDelta; denoiseResults; setDenoiseResults }. That keeps them required for DBSearchPage, and SessionFilters can opt out.
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
There was a problem hiding this comment.
Intentional: the defaults keep the search page's behavior unchanged, and SessionFilters is the only caller that omits them. Leaving the type as is unless a maintainer prefers a union.
4ac8fe0 to
e9e13ba
Compare
commented
Oct 12, 2026
|
@pulpdrew ready for another look. Your comments are addressed; the ServiceName scope optimization moved to #3358. The branch is rebased on main and squashed to one commit. Still open for your call:
I'll hold off on further bot rounds until you've had a look. |
| onSubmit(); | ||
| } | ||
| }); | ||
| useEffect(() => { | ||
| submitOnSourceChange(); | ||
| }, [sourceId]); | ||
|
|
||
| const retainCompatibleFilters = useEffectEvent(() => { |
There was a problem hiding this comment.
🔵 minor — Source-change filter reconcile copies DBSearchPage's logic instead of sharing it
pendingFilterReconcileRef, retainFiltersByColumns, and the yellow formatDroppedFiltersMessage notification now exist in two places: here and in retainCompatibleFilters in packages/app/src/DBSearchPage.tsx (~line 1487). Only the message helper was moved into @/searchFilters. Move the whole step into one hook next to useSearchPageFilterState, e.g. useReconcileFiltersOnSourceChange(searchFilters, columns), so both pages use the same code.
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 submitOnSourceChange = useEffectEvent(() => { | ||
| if (sourceId !== (paramSource?.id ?? null)) { | ||
| if (paramSource != null) { |
There was a problem hiding this comment.
🔵 minor — Filters from the URL are never checked against the trace columns when no source was resolved
The reconcile only gets armed when paramSource != null. Two ways around it: a link with ?filters=… and no sessionSource (the first source gets auto-selected), or a sessionSource name that doesn't exist here (the user then picks a source). In both cases onSubmit() runs and the stale filters go straight into useSessions and the facet query, so filters on columns the trace table lacks are never dropped. Arm pendingFilterReconcileRef whenever sourceId is non-null, not only when paramSource is set.
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
| @@ -1092,29 +1092,35 @@ const DBSearchPageFiltersComponent = ({ | |||
| setFilterValue: _setFilterValue, | |||
| isLive, | |||
| chartConfig, | |||
| analysisMode, | |||
| setAnalysisMode, | |||
| analysisMode = 'results', | |||
There was a problem hiding this comment.
🔵 minor — Required analysis-mode props made optional for every caller just to serve one wrapper
analysisMode, setAnalysisMode, showDelta, denoiseResults, and setDenoiseResults now get defaults for all callers, but SessionFilters is the only caller that omits them, and it already hardcodes isLive and hideAnalysisMode. DBSearchPage could now drop one of them by accident and the compiler wouldn't catch it. Keep them required and have SessionFilters pass analysisMode="results", showDelta={false}, etc. explicitly.
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
Bring the search page's faceted filter sidebar to /sessions and wire the selected filters into the session aggregation query. - Add a SessionFilters wrapper around DBSearchPageFilters that hides the analysis-mode tabs, denoise, and root-spans-only toggles that don't apply to sessions. - Persist sidebar filters in the URL and thread them through useSessions. Validate the ?filters= param against FilterSchema with a [] default so a stale/hand-edited param resolves to the default instead of white-screening. - Combine the RUM session scope and the user's query into one where via a shared buildSessionsSearchCondition, used by the facet sidebar and useSessions, so facet "load more" keeps both. SQL queries get a SQL scope built with useFieldExpressionGenerator; Map and JSON ResourceAttributes both work. - Force exact facet mode and hide the "Show all values" setting; keep the scope in the in-pill value picker (new pickerFilters prop). - Keep a typed-but-unsubmitted query when a facet is clicked, and drop filters that don't exist on the new trace source on source change. - Show a "No matching sessions" EmptyState with a clear-filters action. - Portal the source-select dropdown above the filter sidebar. - Add unit tests: SessionFilters prop forwarding, pill picker scope, the ?filters= parser, and the sessions search-condition helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
e9e13ba to
5e43cd6
Compare
| ...overrides, | ||
| }; | ||
| } | ||
| const config = buildSearchChartConfig(traceTrace, { |
There was a problem hiding this comment.
🔵 minor — Facet sidebar and pill picker queries skip the RUM service scope that the sessions aggregation relies on
filtersChartConfig and rumScopeFilters only carry rum.sessionId:*, while useSessions also adds fetchServiceScopeFilters (sessions.ts:227, added in #3358 to bound the trace scan). The facet getKeyValues queries therefore scan the whole trace table. They can also list services that never appear in the session table. Pass the same service-scope filters into the sidebar/picker config. You could expose them from a shared hook so the page and useSessions don't each compute them.
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
| submitOnSourceChange(); | ||
| }, [sourceId]); | ||
|
|
||
| const retainCompatibleFilters = useEffectEvent(() => { |
There was a problem hiding this comment.
🔵 minor — Source-change filter reconciliation copies DBSearchPage's logic
pendingFilterReconcileRef + retainFiltersByColumns + the formatDroppedFiltersMessage notification repeat DBSearchPage.tsx:1487-1509 almost line for line. Only the helper string was moved into searchFilters.tsx. Move the whole reconcile, i.e. mark pending → wait for columns → retain → notify, into a hook next to useSearchPageFilterState so both pages share it.
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
| beforeEach(() => { | ||
| dbSearchPageFilters.mockClear(); | ||
| }); | ||
|
|
There was a problem hiding this comment.
🔵 minor — Tests mock out the component whose behaviour the new flags change
The tests mock DBSearchPageFilters and only check that forceExactFacetMode/hideAnalysisMode are forwarded as true. They would still pass if the mode: forceExactFacetMode || !showAllValues ? 'exact' : 'all' change in DBSearchPageFilters.tsx were reverted, or if the tabs, denoise, root-spans and 'Show All Values' controls were still rendered. Add a DBSearchPageFilters test that renders with these flags and asserts useFetchFacets gets mode: 'exact' and the hidden controls are absent.
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
Bring the search page's faceted filter sidebar to /sessions and wire the selected filters into the session aggregation query.
Screenshots or video
The Sessions Tab now has a sidebar with filters:

How to test on Vercel preview
Preview routes: /sessions
Steps (/sessions):
References