Skip to content

feat: Add a line interpolation display setting (smooth, linear, step) - #3393

Merged
kodiakhq[bot] merged 4 commits into
mainfrom
drew/line-interpolation
Oct 19, 2026
Merged

kodiakhq[bot] merged 4 commits into
mainfrom
drew/line-interpolation

Conversation

@pulpdrew

@pulpdrew pulpdrew commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds a display setting for line chart interpolation mode. Smooth (default), Linear (default for stacked line charts), and step are options. This setting has been added across the UI, External API, and MCP.

This also fixes another small bug where selecting stacked bar or line chart type in the chart editor would not update the persisted tile's display type.

Screenshots or video

Screenshot 2026-10-16 at 2 14 27 PM Screenshot 2026-10-16 at 2 14 32 PM

How to test on Vercel preview

On chart explorer or a dashboard, create a line or stacked line chart, and change the interpolation setting.

References

  • Linear Issue:
  • Related PRs:

@changeset-bot

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8daed3

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

This PR includes changesets to release 4 packages
Name Type
@hyperdx/common-utils Patch
@hyperdx/api Patch
@hyperdx/app 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 16, 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 19, 2026 9:54pm UTC
hyperdx-storybook Ready Ready Preview Oct 19, 2026 9:54pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 16, 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 124 in total (1.67%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds smooth, linear, and step line interpolation across chart settings, the external API, and MCP.

  • Line charts let people choose how the chart connects data points.
  • Chart types chosen in the preview are saved with the tile.
  • Period comparisons display as regular lines instead of stacked charts.

Reviews (7) · Last reviewed commit: "review: Address review feedback" · Reviewed by Greptile

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 437 passed • 1 skipped • 1876s

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

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew
pulpdrew marked this pull request as ready for review October 16, 2026 18:28
@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Tier 4 — Critical

Touches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI.

Why this tier:

  • Critical-path files (3) — tenancy, public API, or shipped database config:
    • packages/api/src/routers/external-api/v2/dashboards.ts
    • packages/api/src/routers/external-api/v2/utils/alertChartConfig.ts
    • packages/api/src/routers/external-api/v2/utils/dashboards.ts
  • Cross-layer change: touches frontend (packages/app) + backend (packages/api) + shared utils (packages/common-utils)

Review process: Deep review from a domain expert. Synchronous walkthrough may be required.
SLA: Schedule synchronous review within 2 business days.

Stats
  • Production files changed: 13
  • Production lines changed: 258 (+ 326 in test files, excluded from tier calculation)
  • Critical-path lines changed: 41
  • Branch: drew/line-interpolation
  • Author: pulpdrew

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

@github-actions

github-actions Bot commented Oct 16, 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.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. The change is cleanly additive across common-utils, the external API (Zod + OpenAPI JSDoc + regenerated openapi.json), and MCP, with matching defaults (smooth for line, linear for stacked_line) and GET→PUT round-trip integrity verified on all four tile variants. The three prior review comments are all addressed. One recommended fix and a set of nits follow.

🟡 P2 — recommended

  • packages/app/src/components/DBTimeChart.tsx:664 — While comparing to the previous period a stacked tile's displayType is force-derived to Line, but the Line switcher button stays active and clickable, and DisplaySwitcher fires onChange on every click with no active-equality guard; clicking it calls setValue('displayType', 'line', { shouldDirty: true }) and silently overwrites a stacked_line/stacked_bar selection with no visual feedback, so the stacked choice is lost once comparison is turned off or the tile is saved.
    • Fix: Skip the onChange call in DisplaySwitcher when the clicked option already equals the current value, or have handleSetDisplayType ignore a selection equal to the effective displayType while config.compareToPreviousPeriod is true.
    • adversarial
🔵 P3 nitpicks (7)
  • packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx:1210 — Navigating from a stacked_line/stacked_bar tile to a non-time-series tab (Table/Number) and back to Time Series resets displayType to line, because the onChange no-op guard only fires when re-selecting Time Series while already on a time-series type, so the stacked subtype is silently downgraded with no indication.
    • Fix: Remember the last time-series subtype and restore it when the Time Series tab is re-selected, or confirm this downgrade is intended.
    • adversarial
  • packages/common-utils/src/types.ts:1730 — The per-display-type default (smooth for line, linear for stacked_line) owned by getDefaultLineInterpolation is hand-restated as prose in four OpenAPI JSDoc blocks and three MCP .describe() strings, with no compiler or test guard keeping them in sync if the default changes.
    • Fix: Reference the default from a shared constant or add a sync comment on getDefaultLineInterpolation listing the doc sites, mirroring the existing SharedChartSettingsSchema sync note.
    • maintainability, project-standards
  • packages/api/src/mcp/tools/dashboards/schemas.ts:754 — The same lineInterpolation enum is described three different ways across the MCP tile schemas (smooth (default), linear, or step; linear (default), smooth, or step; and a full sentence), so the phrasing drifts per call site.
    • Fix: Factor a shared description helper parameterized by display type so the three stay in lockstep.
    • maintainability
  • packages/api/src/routers/external-api/v2/dashboards.ts:689 — The lineInterpolation OpenAPI property declares its default only in prose, unlike sibling display fields (fitYAxisToData, fillNulls, compareToPreviousPeriod) that declare a machine-readable default: key that codegen clients auto-apply.
    • Fix: Add default: smooth to the two line variants and default: linear to the two stacked variants, then regenerate openapi.json.
    • api-contract
  • packages/api/openapi.json:1850 — All four lineInterpolation variants use example: "step" while their documented default is smooth/linear, which can confuse API consumers reading the spec.
    • Fix: Set each variant's example to its documented default.
    • api-contract
  • packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx:1222 — The new Tabs onChange early-return guard and the isTimeSeriesDisplayType(value) ? DisplayType.Line : value value mapping have no unit or e2e coverage; e2e only switches display type via the preview switcher, never clicking the Time Series tab while on a stacked variant.
    • Fix: Add a test that selects a stacked variant, clicks the Time Series tab, and asserts displayType stays the stacked variant.
    • testing
  • packages/app/src/components/DBEditTimeChartForm/__tests__/ChartPreviewPanel.test.tsx:117 — The new setDisplayType prop is wired as a bare jest.fn() with no assertion that it is invoked with the selected type when the preview switcher changes, so the preview→form persistence plumbing is present but unverified.
    • Fix: Assert setDisplayType is called with the selected type on a preview display-switcher change.
    • testing

Reviewers (8): correctness, testing, maintainability, api-contract, kieran-typescript, adversarial, previous-comments, project-standards.

Testing gaps:

  • No test asserts the compareToPreviousPeriod-forced-Line path still honors an explicitly set lineInterpolation (e.g. a stacked_line with step while comparing should draw stepAfter).
  • External-API coverage validates POST→GET persistence but not a literal GET→PUT round-trip for the raw-SQL stacked_line variant (the { displayType, lineInterpolation, ...stacked } spread branch).

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/line-interpolation branch from 60b4e8e to 54f8b1d Compare October 16, 2026 18:40

@brandon-pereira brandon-pereira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me. My only feedback is small UX: maybe the SegmentedControl should be full width to match other element styles, and also, might be helpful to add a tooltip explaining each and why we provide the ability to customize


const isTimeChart = isTimeSeriesDisplayType(displayType);

const showLineInterpolation =

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.

🔵 minor — Interpolation control disagrees with the chart when 'Compare to previous period' forces a line

DBTimeChart now always draws a plain Line when compareToPreviousPeriod is on (DBTimeChart.tsx:650), and MemoChart picks its curve with getLineCurveType(DisplayType.Line, …). This drawer still uses the form's saved displayType, and the editor can now save stacked types. The result: a stacked_line tile with compare on shows 'Linear' as the selected default but draws smooth (monotone) lines, and a stacked_bar tile with compare on draws a line but hides the interpolation control. Fix: work out the rendered display type once (Line when compare is on) and use it both for showLineInterpolation/getDefaultLineInterpolation here and in DBTimeChart. Another option is to pass the stored stacked type to getLineCurveType so the default matches.

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

{showLineInterpolation && (
<Input.Wrapper
size="xs"
label={

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.

🔵 minor — Hand-built label-with-help-tooltip duplicates the existing InputLabelWithTooltip

packages/app/src/components/InputLabelWithTooltip.tsx already renders a label followed by an IconHelpCircle inside a Tooltip. Use label={<InputLabelWithTooltip label="Line interpolation" tooltip="…" />}, or extend it with a size prop, instead of the inline Group+Tooltip+IconHelpCircle (Code Organization → DRY, REQUIRED).

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

@kodiakhq
kodiakhq Bot merged commit 0000fa4 into main Oct 19, 2026
30 checks passed
@kodiakhq
kodiakhq Bot deleted the drew/line-interpolation branch October 19, 2026 22:01

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — f8daed3b Deployed Oct 19, 2026 by vercel[bot]
Preview – hyperdx-storybook — f8daed3b Deployed Oct 19, 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-4 Critical — deep review + domain expert sign-off

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants