Skip to content

feat(app): edit chart alerts in a docked side panel - #3222

Merged
kodiakhq[bot] merged 6 commits into
mainfrom
claude/alert-side-panel
Oct 16, 2026
Merged

kodiakhq[bot] merged 6 commits into
mainfrom
claude/alert-side-panel

Conversation

@teeohhem

@teeohhem teeohhem commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The chart editor's alert form now opens in a side panel docked beside the editor, so the preview chart stays in view while you tune the alert.

Before, the alert form sat inline between the series editor and the Save bar. It pushed the preview chart below the fold, so checking a threshold against the chart meant scrolling back and forth.

  • Add alert / Edit alert sits beside the series controls and opens the panel. It replaces the inline alert section.
  • Confirming changes:
    • A new alert stays a draft until Add alert (under the fields) confirms it. Closing the panel discards it.
    • For an existing alert, Update alert keeps the edits. Closing the panel reverts them.
    • The preview updates live either way, and the tile's Save saves whatever the panel shows.
  • Chart explorer: the panel's button is Create alert, which saves the inline alert. It replaces the action-bar button.
  • When the panel opens:
    • Only when you ask for it, except in the edit-alert modal, where the alert is the thing being edited.
    • It also reopens when a save fails on the alert, so the field errors are visible.
  • Size:
    • The panel fills the visible height of the area it scrolls in. The height is measured, so it fits centered modals, titled modals, and pages.
    • Drag the left edge to resize it (default 33% of the window, from 360px up to 50%).
    • useResizable gains optional bounds for this. Existing callers are unchanged.
  • Save / Cancel move up to the chart name row.

Screenshots or video

image image

How to test on Vercel preview

N/A. The alert button is hidden in local mode, so the preview build can't show the panel.

Testing

  • Unit tests:
    • New tests for AlertPanel, ChartSaveActions, the TileAlertEditor panel behavior, and the useResizable bounds.
    • New DBEditTimeChartForm flows: discarding a draft, update vs revert, reopening after a failed save.
    • The full app suite passes.
  • E2E:
    • The alert helpers open the panel before editing an existing alert, and the expected button labels are updated.
    • All 29 alert-related specs, run serially: 28 pass, 1 flaky.
    • The flaky one is "between-threshold alert from a dashboard tile". It fails 5 of 5 on main too (the picked webhook ends up empty), so it's not fixed here.

References

  • Linear Issue:
  • Related PRs:

🤖 Generated with Claude Code

The alert form sat inline between the series editor and the Save bar,
which pushed the preview chart below the fold and made it hard to tune a
threshold against the chart. The alert now lives in a panel docked beside
the editor, so the chart stays in view while it is edited.

- "Add alert" / "Edit alert" beside Add series opens the panel. A new alert
  is a draft until "Add alert" confirms it; closing discards it. Editing an
  existing alert keeps changes with "Update alert"; closing reverts them.
  "Create alert" saves an inline alert on the chart explorer.
- The panel opens on request, except in the edit-alert modal, and reopens
  when a save fails on the alert.
- The panel fills the height of the area it scrolls in (measured, so it fits
  centered modals and pages) and can be resized from its left edge.
- Save and Cancel move to the chart name row.
@vercel

vercel Bot commented Sep 25, 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 16, 2026 4:45pm UTC
hyperdx-storybook Ready Ready Preview Oct 16, 2026 4:45pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a90a655

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 Minor
@hyperdx/api Minor
@hyperdx/otel-collector Minor

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

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with a non-blocking issue in how alert confirmation shows errors.

Fix All in Claude CodeFindings

  1. P2 Invalid bounds hide field errors ▶

Summary

Moves chart alert fields into a resizable side panel and moves Save/Cancel beside the chart name.

  • Chart alerts open in a resizable panel beside the editor.
  • Alert buttons open drafts or existing alerts, with separate keep and discard actions.
  • Chart Save and Cancel sit beside the chart name.

Previous threads were unnumbered, so they receive no previous-finding entries. teeohhem explained that useConfirm provides the cancellation point for removal; Greptile withdrew that finding. The narrow-modal, chart-label, and button-color threads were manually resolved without explanatory replies.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Add or edit alert] --> B[Open side panel]
  B --> C[Live chart preview]
  B --> D[Confirm]
  B --> E[Close]
  D --> F[Keep edits and close]
  E --> G[Discard draft or restore saved edits]
  F --> H[Save chart]
  B --> H
  B --> I[Save alert directly]
Loading

Reviews (6) · Last reviewed commit: "Merge branch 'main' into claude/alert-si..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 428 passed • 1 skipped • 1468s

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

Tests ran across 4 shards in parallel.

View full report →

# Conflicts:
#	packages/app/src/components/DBEditTimeChartForm/ChartEditorControls.tsx
#	packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx
@github-actions

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

@greptile-apps

This comment has been minimized.

Removing an alert unmounts the side panel along with its discard
control, so unlike other alert edits the removal could only be undone
by cancelling the whole chart edit. Ask first with useConfirm.
@teeohhem
teeohhem marked this pull request as ready for review October 15, 2026 18:55
@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 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:

  • Large diff: 1373 production lines changed (threshold: 1000)

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: 10
  • Production lines changed: 1373 (+ 723 in test files, excluded from tier calculation)
  • Branch: claude/alert-side-panel
  • Author: teeohhem

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 15, 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.

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

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

Findings outside the changed lines

1 minor
  • 🔵 packages/app/src/components/DBEditTimeChartForm/ChartSaveActions.tsx:819 — Cancel uses variant="subtle" color="dark", but the REQUIRED Button variants rule says Cancel should be secondary → This is a new file, so it should follow the Button & ActionIcon Variants (REQUIRED) table, which lists Cancel under variant="secondary". Change it to <Button variant="secondary"> and drop the raw palette color="dark".

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 15, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. This is a careful, well-tested frontend refactor: the draft/confirm/revert state machine, panel lifecycle (opened && hasContent gating, portal-via-ref-callback), listener cleanup in useResizable, and the usePanelBounds remeasure guard (no-op when top/height are unchanged, which prevents a ResizeObserver feedback loop) all hold up. The two prior review items that mattered were resolved — color="gray" on the alert button is gone (the icon now uses var(--color-text-danger)/var(--color-text-warning)), and the "removing an alert hides the discard control" thread was withdrawn after the author confirmed useConfirm is the cancellation point. Recommendations below.

🟡 P2 — recommended

  • packages/app/src/components/AlertPanel.tsx:203 — The panel enforces an absolute minWidth: 360px while its maxPercent cap (50) is measured against the window, not the scroll container, so inside a sub-viewport modal on a narrow screen the 360px panel can crowd the editor beside it below usable width.
    • Fix: Size the minimum and maximum against the panel's available container width rather than window.innerWidth, so the editor keeps usable space in a modal.
    • previous-comments, adversarial
  • packages/app/src/components/__tests__/AlertPanel.test.tsx:1 — The new measurement logic (usePanelBounds, getScrollParent, getVisibleHeight, the ResizeObserver/window.resize wiring) is the most intricate code added here and has no unit coverage, since jsdom provides no layout for it to exercise.
    • Fix: Add tests that stub getComputedStyle/getBoundingClientRect/ResizeObserver to assert the scroll-parent selection and the top/height computation across the page and modal cases.
    • testing
🔵 P3 nitpicks (2)
  • packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx:1125 — The relocated label reads Chart Name (and placeholder My Chart Name), which is title case; the repo's style guide calls for sentence case on user-facing labels. Pre-existing text that this diff moves into the chart-name row.
    • Fix: Rename the label to Chart name and the placeholder to My chart name.
  • packages/app/src/components/AlertPanel.tsx:168 — minPercent is derived from window.innerWidth only at render time and is not recomputed on window resize, so after a resize the drag clamp uses a stale minimum until an unrelated re-render.
    • Fix: Recompute the px-to-percent minimum on resize, or pass MIN_PANEL_WIDTH as a pixel bound into useResizable and convert inside the hook.

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

Testing gaps:

  • usePanelBounds scroll-parent detection and visible-height math are unit-untested (jsdom has no layout).
  • No coverage asserts the panel reverts to the correct snapshot when the close/discard control is used in the required-alert (edit-alert modal) path, where onOpen/snapshotAlert never fires and the revert falls back to the initial useRef(formValue.alert).

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

…osed

The alert's error and warning badges render in the side panel, which an
existing alert opens closed, so an edit that broke the alert showed
nothing. Mirror them on the alert button with an icon and tooltip.

Also clear alert errors when the panel's changes are discarded, so a
new draft or a reverted alert doesn't show errors from a failed confirm.
The edit-alert modal saves its alert by saving the chart, but the panel's
"Update alert" only closed the panel, which also let alert errors from
the save land in a closed panel. There the panel action now reads "Save
alert" and saves.

Also drop the raw gray color from the alert button, and replace a
TileAlertEditor test that read as if closing the panel keeps edits.
@kodiakhq
kodiakhq Bot merged commit fe59feb into main Oct 16, 2026
35 of 70 checks passed
@kodiakhq
kodiakhq Bot deleted the claude/alert-side-panel branch October 16, 2026 16:55

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — a90a6555 Deployed Oct 16, 2026 by vercel[bot]
Preview – hyperdx-storybook — a90a6555 Deployed Oct 16, 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