Skip to content

fix(app): carry WHERE filter across chart type switches - #3274

Closed
pulpdrew wants to merge 1 commit into
mainfrom
cursor/carry-where-aggcondition-chart-type-switch-3f93
Closed

pulpdrew wants to merge 1 commit into
mainfrom
cursor/carry-where-aggcondition-chart-type-switch-3f93

Conversation

@pulpdrew

@pulpdrew pulpdrew commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Why

Filters selected from the Search panel didn't stick when switching to another chart type (e.g. Time Series). On a Search chart the filter lives in the chart-level where form field, while builder chart types (Line/Bar/Table/Number/Pie) filter per-series via each series' aggCondition. The display-type switch effect cleared where and created a default series with an empty aggCondition, silently dropping the filter.

Fixes HDX-5602.

What

In EditTimeChartForm's display-type switch effect:

  • Search/EventPatterns → builder chart type: carry the chart-level where (and its language) into the new single series' aggCondition, instead of starting from an empty condition.
  • builder chart type → Search/EventPatterns: carry a single series' aggCondition (and its language) back into where. Only when there's exactly one series and where is empty, so a filter isn't guessed across multiple series or allowed to clobber an existing where.

The hidden chart-level where is still cleared on the forward switch so the filter isn't applied twice (once globally, once per-series) and stays visible in the per-series WHERE the builder shows.

Tests

Added two E2E tests in chart-explorer.spec.ts covering both directions, plus a getLuceneWhere reader on the chart editor component.

Linear Issue: HDX-5602

Open in Web Open in Cursor 

A filter set on the Search tab lives in the chart-level `where`, while
builder chart types filter per-series via `aggCondition`. Switching chart
types reset the filter instead of carrying it over.

Carry a single series' aggCondition into `where` when switching to
Search/EventPatterns, and the Search `where` into the new series'
aggCondition when switching to a builder chart type. Add E2E coverage for
both directions.

HDX-5602

Co-authored-by: Drew Davis <pulpdrew@gmail.com>
@changeset-bot

changeset-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 583b550

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

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

@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Oct 2, 2026 1:21pm UTC
hyperdx-storybook Ready Ready Preview Oct 2, 2026 1:21pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 127 in total (1.80%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Preserves filter state when switching between chart display modes.

The PR appears safe to merge, though the new tests should verify filter language without changing it.

Fix All in Claude CodeFindings

  1. P2 Reader changes filter language ▶

Summary

The PR carries a Search or Event Patterns WHERE filter into a builder series and carries a single builder-series filter back when switching chart types.

  • Adds two end-to-end tests and a WHERE-input reader.
  • The tests check transferred text but do not preserve the language state they need to verify.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["Search / Event Patterns<br/>where + whereLanguage"] -->|"switch to builder"| B["Single builder series<br/>aggCondition + aggConditionLanguage"]
  B -->|"switch to Search; one series and empty where"| A
Loading

Reviews (1) · Last reviewed commit: "fix(app): carry WHERE filter across char..."

Comment on lines +168 to +170
async getLuceneWhere(scope: 'chart' | 'series' = 'chart'): Promise<string> {
await this.setWhereLanguage('Lucene', scope);
return this.whereInput(scope).luceneInput.inputValue();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Reader changes filter language

getLuceneWhere switches the input to Lucene before reading it. Both new tests therefore check that the filter text survived, but could pass even if the chart-type switch carried the wrong language. Selecting Lucene also changes the editor’s stored language preference. Check the carried language before changing the input, and cover an SQL filter.

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 396 passed • 1 skipped • 1360s

Status Count
✅ Passed 396
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@elizabetdev

Copy link
Copy Markdown
Member

@pulpdrew I think addressing some of the UX issues on this page could also help with carrying the WHERE across chart types. I tried to address this in the Explore prototype: https://hyperdx-oss-git-elizabet-search-view-switcher-hyperdx.vercel.app/explore?source=975eb452c10479ad&where=&select=&whereLanguage=sql&filters=%255B%255D&orderBy=&mode=timeseries&isLive=false

I wonder if we could make WHERE, Data Source, and Date top-level controls, along with the chart name/Run/save.

Then below those pickers, we could have the series/chart-specific configuration.

I think that would make the overall structure a lot clearer. Right now, the page feels a bit confusing, especially when switching between chart types.

@pulpdrew

pulpdrew commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@pulpdrew I think addressing some of the UX issues on this page could also help with carrying the WHERE across chart types. I tried to address this in the Explore prototype: https://hyperdx-oss-git-elizabet-search-view-switcher-hyperdx.vercel.app/explore?source=975eb452c10479ad&where=&select=&whereLanguage=sql&filters=%255B%255D&orderBy=&mode=timeseries&isLive=false

I wonder if we could make WHERE, Data Source, and Date top-level controls, along with the chart name/Run/save.

Then below those pickers, we could have the series/chart-specific configuration.

I think that would make the overall structure a lot clearer. Right now, the page feels a bit confusing, especially when switching between chart types.

I think that largely makes sense. One tricky aspect of that is that some chart types support independent, per-series WHERE and others only support a single top-level WHERE. We can defer this improvement until we decide it's worth doing the restructuring.

@pulpdrew pulpdrew closed this Oct 2, 2026

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 583b5502 Deployed Oct 2, 2026 by vercel[bot]
Preview – hyperdx-storybook — 583b5502 Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants