Skip to content

feat: Filter and select sources by language and display type - #3185

Merged
kodiakhq[bot] merged 7 commits into
mainfrom
drew/show-appropriate-sources
Sep 28, 2026
Merged

kodiakhq[bot] merged 7 commits into
mainfrom
drew/show-appropriate-sources

Conversation

@pulpdrew

@pulpdrew pulpdrew commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR updates the chart editor so that

  1. Only sources that are supported by the current config type (builder, sql, promql) and display type (timeseries, heatmap, search, etc) are shown in the source select
  2. Auto-selects the first allowed source when changing to a config or display type where the current source is not valid.

This helps avoid query errors and error states caused by invalid sources being selected when switching between config and display types. It also reduces user confusion from showing incompatible sources in the list of selectable sources.

Screenshots or video

Before

Screen.Recording.2026-09-22.at.11.32.41.AM.mov

After

Screen.Recording.2026-09-22.at.11.29.51.AM.mov

How to test on Vercel preview

Try navigating around the chart editor, varying source kind, display type, and editor type (sql, promql, builder)

References

  • Linear Issue: Closes HDX-5193
  • Related PRs:

@vercel

vercel Bot commented Sep 22, 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 Sep 28, 2026 6:35pm UTC
hyperdx-storybook Ready Ready Preview Sep 28, 2026 6:35pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 99780c6

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

@github-actions github-actions Bot added the review/tier-3 Standard — full human review required label Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Tier 3 — Standard

Introduces new logic, modifies core functionality, or touches areas with non-trivial risk.

Why this tier:

  • Cross-layer change: touches frontend (packages/app) + shared utils (packages/common-utils)

Review process: Full human review — logic, architecture, edge cases.
SLA: First-pass feedback within 1 business day.

Stats
  • Production files changed: 7
  • Production lines changed: 188 (+ 279 in test files, excluded from tier calculation)
  • Branch: drew/show-appropriate-sources
  • Author: pulpdrew

To override this classification, remove the review/tier-3 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Filters data sources by editor mode and display type.

The PR should not merge until removing an aliased column from a saved search leaves a valid sort.

Summary

The PR filters chart-editor sources by editor and display type and switches incompatible selections. The changes since the previous review also label Map attributes added from search sidebars and adjust column-toggle and sort handling.

  • Removing an aliased attribute from a saved search can retain its now-invalid sort.

Reviews (10) · Last reviewed commit: "Merge branch 'main' into drew/show-appro..."

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical (P0/P1) issues found. The change is well-scoped, and the source-compatibility logic (getAllowedSourceKinds) is cleanly extracted and unit-tested. The remaining notes concern a submission race and maintainability.

🟡 P2 — recommended

  • packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx:697 — When displayType/configType changes while sources is still loading (sources == null), the auto-select effect returns early leaving isDisplayTypeSourceSwapPendingRef.current = false, so the display-type effect auto-submits with the now-possibly-invalid source; once sources resolves the effect re-runs, swaps the source, and submits a second time — a stale query followed by a duplicate submission.
    • Fix: Defer the display-type auto-submit until sources has loaded and source validity can be evaluated, rather than submitting when the pending-swap flag is still unset because sources were absent.
    • previous-comments, correctness, frontend-races
  • packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx:695 — This diff adds a three-effect, two-ref source-swap state machine to a file that is already 1234 lines, well past the documented 300-line component ceiling in AGENTS.md; the new coordination logic is a self-contained unit that resists being followed in place.
    • Fix: Extract the source-swap coordination (the two refs and their effects) into a dedicated hook so the new logic is testable and the component shrinks toward the standard.
    • maintainability, project-standards, previous-comments
🔵 P3 nitpicks (2)
  • packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx:719 — The "keep current source" guard validates kind and disabled but not connection, whereas the picker filters by connectionId in sql mode; switching into sql mode with a source bound to a different connection keeps it in form state while the picker no longer lists it.
    • Fix: Include the same connection check the picker uses when deciding whether the current source is still valid in sql mode.
  • packages/common-utils/src/guards.ts:11 — The comment rewrite for HEATMAP_ALLOWED_SOURCE_KINDS drops the note that the constant is the shared source of truth for both the external dashboards API and the UI picker, losing the "change these together" context.
    • Fix: Restore a one-line note that this set gates both the UI picker and the external API so the two surfaces stay aligned.

Reviewers (10): correctness, adversarial, frontend-races, kieran-typescript, testing, maintainability, project-standards, previous-comments, agent-native, learnings-researcher.

Testing gaps: The auto-select/auto-submit effect choreography (including the stale/duplicate-submission race on async source load) is exercised only by e2e, with no unit or hook-level test asserting single-submission behavior after a display-type change.

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

@pulpdrew
pulpdrew force-pushed the drew/show-appropriate-sources branch 2 times, most recently from c408d57 to ee29833 Compare September 22, 2026 15:31
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 385 passed • 1 skipped • 1461s

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

Tests ran across 4 shards in parallel.

View full report →

Comment thread packages/common-utils/src/guards.ts Resolved
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

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.

2 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 2 minor

2 posted as inline comment(s) on the changed lines.


Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.

@pulpdrew
pulpdrew requested review from a team and karl-power and removed request for a team September 22, 2026 19:05
@kodiakhq

kodiakhq Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@kodiakhq kodiakhq Bot removed the automerge label Sep 28, 2026
@github-actions

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 128 in total (1.83%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@kodiakhq
kodiakhq Bot merged commit ec25b81 into main Sep 28, 2026
29 checks passed
@kodiakhq
kodiakhq Bot deleted the drew/show-appropriate-sources branch September 28, 2026 18:41

This branch was successfully deployed

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

Labels

automerge review/tier-3 Standard — full human review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants