feat(app): filters sidebar for multi-source search - #2865
Conversation
The filters sidebar now works across a multi-source selection. Each selected source runs its own facet pipeline (fields + values); the sidebar merges them by field path with values unioned, reusing the single-source FilterGroup rendering. Checking a value filters every source that has the field. A source whose table lacks a filtered column is excluded from the search with a visible reason on its status chip, rather than silently returning rows that ignore the filter. Filter pills and add-to-filter from the row side panel are re-enabled in multi mode, with filter-key escaping and date-column detection driven by the union of the selected sources' schemas.
🦋 Changeset detectedLatest commit: 667dfb1 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR restores the filters sidebar for multi-source search by merging per-source facets and excluding sources that cannot satisfy an active filter.
Confidence Score: 4/5The facet pipeline should be fixed before merging because it still queries sources explicitly excluded for missing active-filter columns. Row and histogram queries honor each source's disabled reason, but the new facet slot only checks whether a spec exists, allowing an excluded source's active filter key to reach its facet request and invalidate that source's facet batch. Files Needing Attention: packages/app/src/components/MultiSourceSearchFilters.tsx
|
| Filename | Overview |
|---|---|
| packages/app/src/DBSearchPage.tsx | Coordinates multi-source schema metadata, filter resolution, query specs, filter pills, and sidebar rendering; excluded sources remain represented in facet specs. |
| packages/app/src/components/MultiSourceSearchFilters.tsx | Adds merged facet rendering, but its query slot ignores source exclusion and the new component exceeds the repository's file-size limit. |
| packages/app/src/components/MultiSourceRowTable.tsx | Correctly suppresses excluded source queries and presents their filter-related status. |
| packages/app/src/components/MultiSourceTimeChart.tsx | Correctly suppresses histogram queries for excluded sources. |
| packages/app/src/hooks/useMultiSourceSearch.ts | Adds date-column unions and root-column resolution with focused unit tests. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Filters[Active filters] --> Resolve[Resolve filter columns per source]
Resolve -->|Column present| Specs[Build row and histogram specs]
Resolve -->|Column absent| Disabled[Attach disabled reason]
Specs --> Rows[Run row query]
Specs --> Histogram[Run histogram query]
Specs --> Facets[Run facet pipeline]
Disabled -. correctly blocks .-> Rows
Disabled -. correctly blocks .-> Histogram
Disabled -. currently does not block .-> Facets
Facets --> Sidebar[Merge facets into sidebar]
Reviews (1): Last reviewed commit: "feat(app): filters sidebar for multi-sou..." | Re-trigger Greptile
| // Value lists show everything in range (not narrowed by the current | ||
| // query), matching the sidebar's default "show all values" behavior. | ||
| mode: 'all', | ||
| filterState, |
There was a problem hiding this comment.
Excluded sources still fetch facets
When an active filter references a column absent from one selected source, the row and histogram pipelines disable that source but useSourceFacetsSlot still fetches its active filter key. The resulting missing-column request invalidates that source's facet batch, leaving the merged sidebar incomplete, empty, or displaying stale loading activity.
Knowledge Base Used: App Components and Charts
| </ScrollArea> | ||
| </Box> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Sidebar exceeds component size limit
The new component is 315 lines, exceeding the repository's 300-line limit and coupling facet queries, facet merging, resizing, and rendering in one file. Extracting part of this logic would reduce the maintenance cost of subsequent filter changes.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Stacked on #2862 — review that first; this PR's diff is relative to
tom/multi-source-search.Multi-source search shipped without the filters sidebar, because everything about it was single-source: facets come from one table's field list and value queries, and applied filters are SQL predicates naming one table's columns. This PR brings the sidebar back for multi-source searches with cross-source semantics.
Each selected source runs its own facet pipeline (the existing
useFetchFacets, one hook slot per source), and a new leanMultiSourceSearchFilterssidebar merges the results by field path with values unioned, reusing the single-sourceFilterGroup/NestedFilterGrouprendering. Checking a value applies the filter to every source that has the field. The key semantic decision: a source whose table lacks a filtered column is excluded from the search with a visible reason on its status chip (a quiet filter-off icon plus tooltip), rather than silently returning rows that ignore the filter or erroring the whole search. Filter pills and add-to-filter from the row side panel are re-enabled in multi mode; filter-key escaping and date-column detection now run against the union of the selected sources' schemas.Single-source-only affordances (pins, shared filters, value counts, load-more, analysis-mode tabs, denoising) are intentionally absent from the multi sidebar for now. Single-source behavior is unchanged.
Screenshots or video
Verified live against the demo stack: a two-source (logs + traces) search shows merged facet groups (
LogAttributes,SpanAttributes,SeverityText,StatusCode, ...); filteringServiceName = cartnarrows both sources; filtering trace-onlyStatusCode = Unsetexcludes the log source with the chip reason. Screenshots can be dragged in from the local capture set.How to test on Vercel preview
Preview routes: /search
Steps: