feat(app): add faceted filters to the sessions page #2992
🦋 Changeset detected
Latest commit: 5e43cd6bfd7d47e17d64b38277affb1f0a31a314
The changes in this PR will be included in the next version bump.
<details><summary>This PR includes changesets to release 3 packages</summary>
| Name | Type |
| ----------------------- | ----- |
| @hyperdx/app | Patch |
| @hyperdx/api | Patch |
| @hyperdx/otel-collector | Patch |
</details>
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%3A%20add%20faceted%20filters%20to%20the%20sessions%20page%0A)
@vinzee is attempting to deploy a commit to the HyperDX Team on Vercel.
A member of the Team first needs to authorize it.
<!-- greptile_summary -->
<h2><a href="https://app.greptile.com/api/retrigger?id=56482116"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/hyperdx/github/hyperdxio/hyperdx/-/pull/2992"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2>
[Medium impact] The PR appears safe to merge.
<h3>Summary</h3>
The PR adds URL-persisted faceted filters to the sessions page and applies them to trace-backed session aggregation.
<details open><summary><h3>Diagram</h3></summary>
%%{init: {'theme': 'neutral'}}%%
flowchart LR
U[Session query and facet selections] --> URL[URL-backed search state]
URL --> S[Sessions page]
S --> F[Session filter sidebar]
S --> C[Combined RUM scope and query]
F --> SF[Structured filters]
C --> Q[Trace-backed session aggregation]
SF --> Q
Q --> L[Filtered session cards]
</details>
<!-- greptile_confidence_score:5 -->
<sub>Reviews (10) · Last reviewed commit: "feat(app): add faceted filters to the se..." · Reviewed by Greptile</sub>
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Service scope drops valid sessions
If the session table lacks rows for a service that has qualifying RUM trace spans in the selected range, this nonempty IN scope excludes that service from the trace aggregation, causing its sessions to disappear from the list.
Knowledge Base Used: Session replay and exploration
<a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20174-184%0A%0AComment%3A%0AService%20scope%20drops%20valid%20sessions%0A%0AIf%20the%20session%20table%20lacks%20rows%20for%20a%20service%20that%20has%20qualifying%20RUM%20trace%20spans%20in%20the%20selected%20range%2C%20this%20nonempty%20%60IN%60%20scope%20excludes%20that%20service%20from%20the%20trace%20aggregation%2C%20causing%20its%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=6"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/conductor?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20174-184%0A%0AComment%3A%0AService%20scope%20drops%20valid%20sessions%0A%0AIf%20the%20session%20table%20lacks%20rows%20for%20a%20service%20that%20has%20qualifying%20RUM%20trace%20spans%20in%20the%20selected%20range%2C%20this%20nonempty%20%60IN%60%20scope%20excludes%20that%20service%20from%20the%20trace%20aggregation%2C%20causing%20its%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductorDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=6"><img alt="Fix in Conductor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/cursor?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20174-184%0A%0AComment%3A%0AService%20scope%20drops%20valid%20sessions%0A%0AIf%20the%20session%20table%20lacks%20rows%20for%20a%20service%20that%20has%20qualifying%20RUM%20trace%20spans%20in%20the%20selected%20range%2C%20this%20nonempty%20%60IN%60%20scope%20excludes%20that%20service%20from%20the%20trace%20aggregation%2C%20causing%20its%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursorDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=6"><img alt="Fix in Cursor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20174-184%0A%0AComment%3A%0AService%20scope%20drops%20valid%20sessions%0A%0AIf%20the%20session%20table%20lacks%20rows%20for%20a%20service%20that%20has%20qualifying%20RUM%20trace%20spans%20in%20the%20selected%20range%2C%20this%20nonempty%20%60IN%60%20scope%20excludes%20that%20service%20from%20the%20trace%20aggregation%2C%20causing%20its%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodexDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=6"><img alt="Fix in Codex" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=6"></picture></a>
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Source changes retain stale filters
When a user applies a facet and then selects a session source whose trace source lacks that field or assigns it different semantics, the URL-persisted filter is sent directly to the new source, causing the sessions query to fail or return incorrect results.
Knowledge Base Used:
<a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20481-484%0A%0AComment%3A%0ASource%20changes%20retain%20stale%20filters%0A%0AWhen%20a%20user%20applies%20a%20facet%20and%20then%20selects%20a%20session%20source%20whose%20trace%20source%20lacks%20that%20field%20or%20assigns%20it%20different%20semantics%2C%20the%20URL-persisted%20filter%20is%20sent%20directly%20to%20the%20new%20source%2C%20causing%20the%20sessions%20query%20to%20fail%20or%20return%20incorrect%20results.%0A%0AKnowledge%20Base%20Used%3A%0A-%20%5BSearch%20and%20log%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsearch-and-log-exploration.md%29%0A-%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=6"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/conductor?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20481-484%0A%0AComment%3A%0ASource%20changes%20retain%20stale%20filters%0A%0AWhen%20a%20user%20applies%20a%20facet%20and%20then%20selects%20a%20session%20source%20whose%20trace%20source%20lacks%20that%20field%20or%20assigns%20it%20different%20semantics%2C%20the%20URL-persisted%20filter%20is%20sent%20directly%20to%20the%20new%20source%2C%20causing%20the%20sessions%20query%20to%20fail%20or%20return%20incorrect%20results.%0A%0AKnowledge%20Base%20Used%3A%0A-%20%5BSearch%20and%20log%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsearch-and-log-exploration.md%29%0A-%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductorDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=6"><img alt="Fix in Conductor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/cursor?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20481-484%0A%0AComment%3A%0ASource%20changes%20retain%20stale%20filters%0A%0AWhen%20a%20user%20applies%20a%20facet%20and%20then%20selects%20a%20session%20source%20whose%20trace%20source%20lacks%20that%20field%20or%20assigns%20it%20different%20semantics%2C%20the%20URL-persisted%20filter%20is%20sent%20directly%20to%20the%20new%20source%2C%20causing%20the%20sessions%20query%20to%20fail%20or%20return%20incorrect%20results.%0A%0AKnowledge%20Base%20Used%3A%0A-%20%5BSearch%20and%20log%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsearch-and-log-exploration.md%29%0A-%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursorDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=6"><img alt="Fix in Cursor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20481-484%0A%0AComment%3A%0ASource%20changes%20retain%20stale%20filters%0A%0AWhen%20a%20user%20applies%20a%20facet%20and%20then%20selects%20a%20session%20source%20whose%20trace%20source%20lacks%20that%20field%20or%20assigns%20it%20different%20semantics%2C%20the%20URL-persisted%20filter%20is%20sent%20directly%20to%20the%20new%20source%2C%20causing%20the%20sessions%20query%20to%20fail%20or%20return%20incorrect%20results.%0A%0AKnowledge%20Base%20Used%3A%0A-%20%5BSearch%20and%20log%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsearch-and-log-exploration.md%29%0A-%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodexDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=6"><img alt="Fix in Codex" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=6"></picture></a>
<!-- deep-review-state: diff=f6c89d9eecac76e1cf12c01775aba341e756091456352a17c2885bc9cb123c9a; plugin=compound-engineering-v3.6.1 -->
<!-- deep-review -->
Deep Review
Faceted filters for /sessions: URL-persisted filters threaded into the RUM-scoped trace aggregation, with DBSearchPageFilters refactored behind a SessionFilters wrapper. The core logic is sound — the SQL/lucene scope builder, the zod-validated ?filters= parser, the whitespace handling, and the forceExactFacetMode facet scoping all check out, and every prior reviewer concern was verified as genuinely addressed. The open items cluster around how source changes and deep-linked URLs reconcile incompatible filters.
✅ No critical issues found.
🟡 P2 — recommended
packages/app/src/SessionsPage.tsx:462 — URL-seeded and cross-source filters bypass retainCompatibleFilters because the reconcile only runs when pendingFilterReconcileRef is set, which happens solely on an interactive source change with paramSource != null; a shared or hand-edited URL whose ?filters= reference columns absent from the (auto-selected or param) source execute against the trace query with no dropped-filter notice, surfacing a column-not-found error as a bare "No matching sessions".- Fix: Run the reconcile once after the first
traceColumns load whenever appliedConfig.filters is non-empty, not only on interactive source switches.- <sub>adversarial, correctness, julik-frontend-races, kieran-typescript</sub>
packages/app/src/sessions.ts:241 — sessionFiltersParser accepts the full FilterSchema union, so non-canonical frames (type: 'lucene', type: 'sql_ast', or a non-IN sql condition) in ?filters= are executed verbatim via traceQueryFilters yet render no pill or facet state, so displayed and executed filter sets silently diverge with no removal path except the blanket "Clear filters" button.- Fix: Validate persisted session filters against the renderable-filter predicate and drop or flag frames that will not round-trip to a visible facet.
- <sub>adversarial</sub>
packages/app/src/SessionsPage.tsx:462 — The new pendingFilterReconcileRef/retainCompatibleFilters handshake and the filters threading in useSessions (the PR's core behavior, including the hasSearchQuery HAVING/CTE branch) have no test; the multi-condition guard and cross-effect ordering are the most breakage-prone new logic and are only exercised indirectly through the unit-tested retainFiltersByColumns primitive.- Fix: Add a page/hook-level test for a source switch that drops filters referencing columns absent on the new source, and a
useSessions test asserting filters reach the aggregation query and flip the hasSearchQuery branch.- <sub>testing, correctness, maintainability, julik-frontend-races, kieran-typescript</sub>
<details>
<summary>🔵 P3 nitpicks (6)</summary>
packages/app/src/sessions.ts:157 — The SQL branch's AND (${query}\n) newline only neutralizes a trailing -- line comment; an unterminated block comment (/) in the query still swallows the injected ), and the inline comment overstates the invariant.- Fix: Scope the comment to line comments and normalize or reject a trailing unterminated block comment before wrapping.
- <sub>correctness, adversarial</sub>
packages/app/src/SessionsPage.tsx:533 — appliedConfig.whereLanguage is 'sql' | 'lucene' | null, but the as SearchConditionLanguage cast forces null into a type that forbids it (and the adjacent as SearchCondition is a redundant string→string cast), disabling the checker for this flow.- Fix: Use
appliedConfig.whereLanguage ?? undefined and drop the redundant where cast.- <sub>kieran-typescript</sub>
packages/app/src/sessions.ts:137 — The fallback string 'ResourceAttributes' is duplicated across buildSessionsScope, useSessions, and SessionsPage.tsx:385.- Fix: Hoist it to one shared named constant.
- <sub>maintainability</sub>
packages/app/src/SessionsPage.tsx:684 — ActiveFilterPills renders unconditionally (not gated by canShowFilterSidebar), so with a non-empty URL filter set and traceTrace still null, its in-pill value picker can issue key-value queries against the empty fallback chartConfig (connection: '', from: {'',''}).- Fix: Gate the pills on
canShowFilterSidebar, or pass a disabled flag when the empty fallback config is in use.- <sub>correctness, kieran-typescript</sub>
packages/app/src/SessionsPage.tsx:453 — pendingFilterReconcileRef can remain set forever when switching to a source whose trace columns never load (no traceSourceId or unreachable columns), so a later unrelated traceColumns arrival could fire a reconcile the user never triggered.- Fix: Reset the ref on every terminal branch, or key it to a specific
(sourceId, traceSourceId) pair.- <sub>julik-frontend-races</sub>
packages/app/src/components/DBSearchPageFilters.tsx:1121 — hideAnalysisMode now gates five distinct UI regions (header justify, header text, tabs, denoise checkbox, root-spans checkbox), and its name implies it only hides the tabs, so future UI additions must remember to gate on it.- Fix: Extract the analysis-mode header/tabs/denoise block into a sub-component rendered only when enabled.
- <sub>maintainability*</sub>
</details>
---
Reviewers (9): correctness, testing, maintainability, kieran-typescript, performance, adversarial, julik-frontend-races, project-standards, previous-comments.
Testing gaps:
?filters= referencing columns absent from the auto-selected source (the reconcile-never-fires path).forceExactFacetMode → mode: 'exact' branch at the facet query (only prop forwarding at the wrapper boundary is covered).filtersChartConfig empty-config fallback or that notifications.show fires exactly once per reconcile.<sub>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</sub>
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Finite service scope drops sessions
If trace retention exceeds session retention, or a trace-derived session has no recording row in this 30-day window, the nonempty service list becomes a hard ServiceName IN filter that excludes the session's service, causing valid sessions to disappear from the list.
Knowledge Base Used: Session replay and exploration
<a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20142-146%0A%0AComment%3A%0AFinite%20service%20scope%20drops%20sessions%0A%0AIf%20trace%20retention%20exceeds%20session%20retention%2C%20or%20a%20trace-derived%20session%20has%20no%20recording%20row%20in%20this%2030-day%20window%2C%20the%20nonempty%20service%20list%20becomes%20a%20hard%20%60ServiceName%20IN%60%20filter%20that%20excludes%20the%20session's%20service%2C%20causing%20valid%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=6"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/conductor?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20142-146%0A%0AComment%3A%0AFinite%20service%20scope%20drops%20sessions%0A%0AIf%20trace%20retention%20exceeds%20session%20retention%2C%20or%20a%20trace-derived%20session%20has%20no%20recording%20row%20in%20this%2030-day%20window%2C%20the%20nonempty%20service%20list%20becomes%20a%20hard%20%60ServiceName%20IN%60%20filter%20that%20excludes%20the%20session's%20service%2C%20causing%20valid%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductorDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=6"><img alt="Fix in Conductor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/cursor?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20142-146%0A%0AComment%3A%0AFinite%20service%20scope%20drops%20sessions%0A%0AIf%20trace%20retention%20exceeds%20session%20retention%2C%20or%20a%20trace-derived%20session%20has%20no%20recording%20row%20in%20this%2030-day%20window%2C%20the%20nonempty%20service%20list%20becomes%20a%20hard%20%60ServiceName%20IN%60%20filter%20that%20excludes%20the%20session's%20service%2C%20causing%20valid%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursorDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=6"><img alt="Fix in Cursor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=6"></picture></a> <a href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2Fsessions.ts%0ALine%3A%20142-146%0A%0AComment%3A%0AFinite%20service%20scope%20drops%20sessions%0A%0AIf%20trace%20retention%20exceeds%20session%20retention%2C%20or%20a%20trace-derived%20session%20has%20no%20recording%20row%20in%20this%2030-day%20window%2C%20the%20nonempty%20service%20list%20becomes%20a%20hard%20%60ServiceName%20IN%60%20filter%20that%20excludes%20the%20session's%20service%2C%20causing%20valid%20sessions%20to%20disappear%20from%20the%20list.%0A%0AKnowledge%20Base%20Used%3A%20%5BSession%20replay%20and%20exploration%5D%28https%3A%2F%2Fapp.greptile.com%2Fhyperdx%2F-%2Fcustom-context%2Fknowledge-base%2Fhyperdxio%2Fhyperdx%2F-%2Fdocs%2Fsession-replay-and-exploration.md%29%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodexDark.svg?v=6"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=6"><img alt="Fix in Codex" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=6"></picture></a>
I think we could use some bottom margin here, and maybe some alignment of the left margin between these pills and the session card list
<img width="1944" height="152" alt="Image" src="https://github.com/user-attachments/assets/7192d0d6-538a-4bcc-8f42-9f3389129048" />
If we're forcing exact mode, we should avoid showing the option to toggle between exact and all mode
<img width="342" height="241" alt="Image" src="https://github.com/user-attachments/assets/ebe74fa0-9d40-4e81-b7d8-f2b668eaed84" />
🟠 major — Clicking a sidebar facet resets the form and discards a typed-but-unsubmitted query
useForm({ values: {...} }) at SessionsPage.tsx:272 has no resetOptions, so RHF does a full reset whenever the values object changes. handleSetFilters calls setAppliedConfig({ filters }), which changes appliedConfig → changes values → resets where back to appliedConfig.where. Concretely: type error in the search box (don't press Run), click a ServiceName checkbox — the search box visibly reverts to empty and the query never runs. The comment claims this mirrors the search page, but DBSearchPage.tsx:1122 sets resetOptions: { keepDirtyValues: true } and its handleSetFilters (DBSearchPage.tsx:1296) calls debouncedSubmit() so the whole form is applied. Do the same here: add resetOptions: { keepDirtyValues: true } to the useForm call and make handleSetFilters call onSubmit() instead of writing only filters.
<!-- hdxr:020520d46aaf9c3d -->
🟠 major — ServiceName scope derived from the session source can silently drop whole services' sessions
The scope list is built from a DISTINCT ServiceName scan of sessionSource.from (the rrweb table), then applied as a hard ServiceName IN (...) predicate on the trace aggregation. A service that emits RUM spans (rum.sessionId, component:"user-interaction") but writes no rrweb rows — session recording disabled in the browser SDK, recording not yet started, or a shorter TTL on the sessions table — contributes zero rows to that DISTINCT, so its sessions disappear from /sessions entirely, with no error and no UI signal. The try/catch only covers query failure, not a successfully-returned-but-incomplete list. Either derive the scope from the trace source itself (a cheap DISTINCT serviceNameExpression with the rum.sessionId predicate over the same range), or gate the whole optimization behind an explicit source/feature flag so correctness isn't traded away by default.
<!-- hdxr:93022b65e8d09d1f -->
🟠 major — rumScopeFilter hardcodes Map access and mapContains, breaking JSON-typed ResourceAttributes
${traceTrace.resourceAttributesExpression}['rum.sessionId'] and mapContains(...) assume the column is a Map. The repo already has useFieldExpressionGenerator (packages/app/src/hooks/useFieldExpressionGenerator.tsx) for exactly this — sessions.ts:132 uses it to build traceSessionIdExpression for the same key, emitting toString(col.key) for JSON columns. On a JSON-typed ResourceAttributes the sidebar's facet query is invalid SQL, so every facet fetch fails and the user gets a red notification plus an empty sidebar. resourceAttributesExpression is also z.string().optional() (common-utils/src/types.ts:2279), so it can render as the literal undefined. Build the expression with useFieldExpressionGenerator(traceTrace) and apply the ?? 'ResourceAttributes' fallback used elsewhere in sessions.ts.
<!-- hdxr:1d0b318fd4e0a50f -->
🟠 major — In-pill value picker strips the RUM scope that forceExactFacetMode exists to preserve
ActiveFilterPills is handed filtersChartConfig, and FilterPill builds its value-picker config as { ...chartConfig, where: '', filters: [] } (packages/app/src/components/ActiveFilterPills.tsx:160). That clears rumScopeFilter, so clicking a pill on /sessions runs groupUniqArray over the entire trace table for the selected range — the exact unscoped query the PR added forceExactFacetMode to avoid. Carry the always-on scope outside filters (e.g. fold it into the config's where, or add a prop for a non-strippable base filter honoured by both useFacets' mode === 'all' branch and valueChartConfig) so the pill picker stays scoped.
<!-- hdxr:f55e684ab9897cb1 -->
🔵 minor — "Show all values" setting is inert on /sessions but still writes the shared localStorage key
With forceExactFacetMode, mode is always 'exact', yet FilterSettingsPanel (line 1661) still renders the showAllValues switch, wired to the shared hdx-show-all-filter-values key. On /sessions the toggle does nothing locally while silently changing the search page's facet behaviour. Add a prop to hide (or disable with an explanatory tooltip) the "Show all values" control when forceExactFacetMode is set.
<!-- hdxr:4d0810a21bf76ed1 -->
🔵 minor — Sidebar toolbar icons jump to the left edge when hideAnalysisMode is set
The header <Flex align="center" justify="space-between"> relies on the "Analysis Mode" Text as its first item. With hideAnalysisMode the Group holding the settings gear and the "Hide filters" collapse button is the only flex child, so space-between places it at flex-start — the controls render at the top-left of the sessions sidebar instead of the top-right where they sit on the search page. Use justify={hideAnalysisMode ? 'flex-end' : 'space-between'}.
<!-- hdxr:01662b3f88855d9b -->
🔵 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.
<!-- hdxr:46b64c1ce8af4f7c -->
🔵 minor — Service-name enumeration re-runs serially inside every sessions fetch
The DISTINCT ServiceName query is issued inside queryFn and awaited before the main Promise.all, so every time range change, facet toggle, or manual refresh pays an extra serialized round trip for a 30-day scan whose answer changes very rarely. Lift it into its own useQuery (keyed on sessionSource.id + a coarse window) with a long staleTime, and pass the resolved names into useSessions; the fallback-to-unscoped behaviour on error is unchanged.
<!-- hdxr:cc7f4bdcfa13bbf9 -->
<!-- claude-code-review -->
<!-- claude-review-state: diff=f6c89d9eecac76e1cf12c01775aba341e756091456352a17c2885bc9cb123c9a; prompt=0fd42800a420202202b28cbb41d72978f50f644052efb6c80366db4b53bf1936 -->
PR Review
If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:
- 🔴 critical or 🟠 major in code this PR adds or changes: fix before asking for review.
- 🔵 minor in code this PR changes: your call. Fix if small, otherwise reply.
- Anything about surrounding code, or asking you to widen the change (hoist a helper,
dedupe with another file, fix other call sites): never fix here, whatever the
severity. Reply with one sentence; if it is critical, say so plainly so a human sees it.
> One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.
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 lines
<details><summary>1 minor</summary>
packages/app/src/__tests__/sessions.test.ts:502 — No test covers how useSessions now uses the new filters → The buildSessionsQueryFilters tests were deleted, and nothing replaces them for the new useSessions paths: sidebar filters are appended after the service scope (traceQueryFilters), searchCondition is spread into the trace config, and HAVING interactionCount > 0 ... is dropped when only filters are set. Add a useSessions test with a mocked renderChartConfig/client that asserts the trace config's where/filters and the HAVING clause with filters-only input.</details>
---
<sub>Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.</sub>
tcFromSource(traceTrace)
I believe this will probably break when the trace source is the JSON schema (where resource attributes is not a map but rather a JSON column) due to the mapContains.
Same thing above for the rumSessionIdKey using bracket syntax
connectionId: sessionSource.connection,
format: 'JSON',
Two other reachable paths wipe chartConfig.filters too: DBSearchPageFilters/hooks.ts:225 (loadMoreFacetsForKey) and ActiveFilterPills.tsx:161 (in-pill value picker). "Show more values" and pill-editing therefore scan the whole trace table unscoped
This optimization seems like a separate change, with separate risks - could we split it out into it's own PR for discussion?
I'm curious why this would be such a long lookback - it seems excessive to scan 30 days back before each sessions query. And since this is tied to the selected date range, if won't necessarily be cached when changing date ranges.
Requested changes.
🟠 major — Facet "Load more" drops the user's search-bar query, so it lists values outside the current results
The RUM scope now sits in where and the user's free-text query was moved into filters. But in exact mode, loadMoreFacetsForKey (packages/app/src/components/DBSearchPageFilters/hooks.ts:219-230) replaces chartConfig.filters with a list rebuilt from filterState alone, so the appliedConfig.where filter gets thrown away. The search page doesn't have this problem because its query stays in where. To fix it, either put the user query in where (AND-ed with the RUM scope), or have load-more keep any chartConfig.filters entries that don't come from filterState.
<sub>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</sub>
<!-- hdxr:0d55a0887bd2a538 -->
🔵 minor — Stale "Load more" facet values persist when only the search query changes
useFetchFacets only clears extraFacets when chartConfig.where, chartConfig.whereLanguage or filterState change (packages/app/src/components/DBSearchPageFilters/hooks.ts:405-421). On this page where is always the fixed RUM scope and the user's query lives in chartConfig.filters, so loaded-more values from an earlier query stay merged into the facet list after a new search. Keep the user query in where (same fix as the load-more finding), or add the query to the reset dependencies.
<sub>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</sub>
<!-- hdxr:9cb82281f1332ceb -->
🔵 minor — Session search scope (RUM condition + where→Filter conversion) is built twice, with a cast, and the two copies already differ
rumScopeCondition and the {type, condition: appliedConfig.where} as Filter construction here repeat sessions.ts:111-124 and sessions.ts:183. useSessions maps promql to lucene but this copy doesn't, and this copy adds a 'ResourceAttributes' fallback that useSessions doesn't have. Export one helper from sessions.ts that returns { where, filters } for a trace source plus a query, and use it in both places. Build the filter with satisfies Filter rather than as Filter, per the TypeScript convention.
<sub>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</sub>
<!-- hdxr:072c6eca31bbf9e8 -->
🔵 minor — A query with no matches now shows a legacy ad-hoc empty state with a forbidden button variant and an install-integration CTA
When there are no results and hasActiveSearch is true, the page now renders SessionCardList. Its empty branch (SessionsPage.tsx:157-177) is a raw <div> with a variant="outline-success" Button telling the user to install the browser integration, even though the real cause is just that nothing matched. Render EmptyState here instead, with no-match copy (e.g. title "No matching sessions") and a secondary action to clear filters. This follows the REQUIRED EmptyState and Button-variant rules.
<sub>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</sub>
<!-- hdxr:160af050315d1c4f -->
🔵 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.
<sub>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</sub>
<!-- hdxr:ac11124cdf4e43a7 -->
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Facet search drops the query
On the sessions page, searching a facet's values or clicking “Load more” drops the free-text query. filtersChartConfig stores that query in filters, but loadMoreFacetsForKey replaces them with sidebar selections alone. The sidebar then offers values outside the search, unlike its initial list. Selecting one can produce no results.
Preserve the free-text query when removing the selected field's filter.
<a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20396-405%0A%0AComment%3A%0AFacet%20search%20drops%20the%20query%0A%0AOn%20the%20sessions%20page%2C%20searching%20a%20facet's%20values%20or%20clicking%20%E2%80%9CLoad%20more%E2%80%9D%20drops%20the%20free-text%20query.%20%60filtersChartConfig%60%20stores%20that%20query%20in%20%60filters%60%2C%20but%20%60loadMoreFacetsForKey%60%20replaces%20them%20with%20sidebar%20selections%20alone.%20The%20sidebar%20then%20offers%20values%20outside%20the%20search%2C%20unlike%20its%20initial%20list.%20Selecting%20one%20can%20produce%20no%20results.%0A%0APreserve%20the%20free-text%20query%20when%20removing%20the%20selected%20field's%20filter.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"></picture></a> <a href="https://app.greptile.com/api/ide/conductor?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20396-405%0A%0AComment%3A%0AFacet%20search%20drops%20the%20query%0A%0AOn%20the%20sessions%20page%2C%20searching%20a%20facet's%20values%20or%20clicking%20%E2%80%9CLoad%20more%E2%80%9D%20drops%20the%20free-text%20query.%20%60filtersChartConfig%60%20stores%20that%20query%20in%20%60filters%60%2C%20but%20%60loadMoreFacetsForKey%60%20replaces%20them%20with%20sidebar%20selections%20alone.%20The%20sidebar%20then%20offers%20values%20outside%20the%20search%2C%20unlike%20its%20initial%20list.%20Selecting%20one%20can%20produce%20no%20results.%0A%0APreserve%20the%20free-text%20query%20when%20removing%20the%20selected%20field's%20filter.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductorDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=7"><img alt="Fix in Conductor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInConductor.svg?v=7"></picture></a> <a href="https://app.greptile.com/api/ide/cursor?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20396-405%0A%0AComment%3A%0AFacet%20search%20drops%20the%20query%0A%0AOn%20the%20sessions%20page%2C%20searching%20a%20facet's%20values%20or%20clicking%20%E2%80%9CLoad%20more%E2%80%9D%20drops%20the%20free-text%20query.%20%60filtersChartConfig%60%20stores%20that%20query%20in%20%60filters%60%2C%20but%20%60loadMoreFacetsForKey%60%20replaces%20them%20with%20sidebar%20selections%20alone.%20The%20sidebar%20then%20offers%20values%20outside%20the%20search%2C%20unlike%20its%20initial%20list.%20Selecting%20one%20can%20produce%20no%20results.%0A%0APreserve%20the%20free-text%20query%20when%20removing%20the%20selected%20field's%20filter.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&expires=1792451038&sig=462e07423a289b588e62d146e32832b7ce74e27bd59e7cf8460840a312fb62d2&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursorDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=7"><img alt="Fix in Cursor" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=7"></picture></a> <a href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22hyperdxio%2Fhyperdx%22%20on%20the%20existing%20branch%20%22add-session-filters%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22add-session-filters%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Fapp%2Fsrc%2FSessionsPage.tsx%0ALine%3A%20396-405%0A%0AComment%3A%0AFacet%20search%20drops%20the%20query%0A%0AOn%20the%20sessions%20page%2C%20searching%20a%20facet's%20values%20or%20clicking%20%E2%80%9CLoad%20more%E2%80%9D%20drops%20the%20free-text%20query.%20%60filtersChartConfig%60%20stores%20that%20query%20in%20%60filters%60%2C%20but%20%60loadMoreFacetsForKey%60%20replaces%20them%20with%20sidebar%20selections%20alone.%20The%20sidebar%20then%20offers%20values%20outside%20the%20search%2C%20unlike%20its%20initial%20list.%20Selecting%20one%20can%20produce%20no%20results.%0A%0APreserve%20the%20free-text%20query%20when%20removing%20the%20selected%20field's%20filter.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=hyperdxio%2Fhyperdx&pr=2992&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodexDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=7"><img alt="Fix in Codex" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=7"></picture></a>
Moved to #3358 to be discussed separately.
Moved to #3358 to be discussed separately.
Moved to #3358 to be discussed separately.
Moved to #3358 to be discussed separately.
Split out into #3358.
@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:
keepDirtyValues keeps edited fields when the URL changes (e.g. browser Back after picking another source). Happy to rework how sidebar filters reach the form if you'd like.useSessions SQL test here; the search-condition helpers are unit-tested.I'll hold off on further bot rounds until you've had a look.
pulpdrew
vinzee
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:
<img width="1921" height="929" alt="image" src="https://github.com/user-attachments/assets/e1cc37ea-ffe6-4223-8b39-55ba62256e11" />
How to test on Vercel preview
Preview routes: /sessions
Steps (/sessions):
1. Open /sessions.
2. In the "Data Source" dropdown (combobox labeled "Data Source"), confirm a session source (labeled "Sessions") is selected; if it is not, open the dropdown and choose the "Sessions" source.
3. Wait for the results area (data-testid "session-card-list") to render at least one session card (each card has a data-testid beginning with "session-card-").
4. Confirm the filters sidebar is visible to the left of the results with a "Filters" heading.
5. Confirm the sidebar is populated: at least one facet group is listed (for example a group labeled "ServiceName") and the text "No filters available" is NOT shown.
6. Click the "ServiceName" facet group header to expand it, then click the first value's checkbox inside its panel.
7. Confirm an active filter pill appears above the results list and the page URL gains a "filters=" query parameter.
8. Click "Hide filters", confirm the sidebar collapses, then click "Show filters" and confirm the sidebar reappears.
9. Verify the results area (data-testid "session-card-list") re-rendered after the filter was applied and no red error notification was shown.
References