Skip to content

feat(app): pick the dashboard live mode refresh interval - #3745

Merged
kodiakhq[bot] merged 5 commits into
mainfrom
cursor/dashboard-live-refresh-interval-06d1
Nov 25, 2026
Merged

kodiakhq[bot] merged 5 commits into
mainfrom
cursor/dashboard-live-refresh-interval-06d1

Conversation

@MikeShi42

@MikeShi42 MikeShi42 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Dashboard live mode always refreshed at the time range's auto granularity: every 30m on a 24-hour range, for example. That is too slow for dashboards watched during an incident, and there was no way to change it.

The Live button is now a split button. The left side still toggles live mode. The right side shows the refresh interval and opens a "Refresh every" menu:

  • Auto (5m) is the first item and the default. It follows the time range, so the value in parentheses changes as the range changes.
  • Below a divider are fixed intervals from 30s up to the time range's auto value. Every one of them is fixed, including the one equal to auto: pinning 5m on a 3-hour range keeps 5m after widening to 24 hours.
  • The trigger reads "Auto (5m)" in auto mode and just "5m" for a fixed choice.
  • Picking any item turns live mode on.
  • If the range is narrowed so a fixed interval is slower than auto, auto is used. Widening the range again restores the fixed choice.
  • Chart granularity in live mode is unchanged; only how often the dashboard refreshes changes.
  • For ranges of 15 minutes or less auto is 15s, which is below the 30s floor, so auto is the only choice.

Screenshots or video

Before After (auto) After (fixed 5m on 24h)
Before: plain Live button Auto (5m) selected on a 3-hour range Fixed 5m kept after widening to 24 hours

How to reproduce

Starting point: yarn app:dev:local connected to the demo server, or the Vercel preview.

On main:

  1. Open Dashboards and create a dashboard.
  2. Set the time picker to "Last 24 hours".
  3. Hover "Live": there is no way to change the refresh interval.

On this branch:

  1. Open Dashboards and create a dashboard.
  2. Set the time picker to "Last 3 hours".
  3. Click "Auto (5m)" next to "Live". The menu lists "Auto (5m)" (checked), then 30s, 1m and 5m.
  4. Pick the fixed "5m". Live turns on and the trigger reads "5m".
  5. Set the time picker to "Last 24 hours". The trigger still reads "5m"; the menu now shows "Auto (30m)" and fixed 30s, 1m, 5m, 15m, 30m.
  6. Pick "Auto (30m)", then set the range back to "Last 3 hours". The trigger reads "Auto (5m)".

How to test on Vercel preview

Preview routes: /dashboards

Steps:

  1. Create a new dashboard.
  2. Set the time picker to "Last 3 hours".
  3. Click data-testid="dashboard-refresh-interval-button".
  4. Verify the menu lists "Auto (5m)", 30s, 1m and 5m, with "Auto (5m)" checked.
  5. Click "5m".
  6. Set the time picker to "Last 24 hours".
  7. Verify the "Live" button is highlighted and the interval button reads "5m".

References

  • Linear Issue: Resolves HDX-6135
  • Related PRs:
Open in Web Open in Cursor 

Note

Low Risk
UI and client-side refresh timing only; chart query granularity in live mode is unchanged, and the hook API remains backward compatible for other call sites.

Reviewed by Cursor Bugbot for commit a46d993. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 2 commits November 20, 2026 18:46
Live mode refreshed at the date range's auto granularity only. The Live
button is now a split button whose menu offers 30s up to that default.

Co-authored-by: Mike Shi <mike@hyperdx.io>
Co-authored-by: Mike Shi <mike@hyperdx.io>
@MikeShi42
MikeShi42 requested a review from a team as a code owner November 20, 2026 18:49
@vercel

vercel Bot commented Nov 20, 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 Nov 25, 2026 8:03pm UTC
hyperdx-storybook Ready Ready Preview Nov 25, 2026 8:03pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a46d993

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-2 Low risk — AI review + quick human skim label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 3
  • Production lines changed: 217 (+ 297 in test files, excluded from tier calculation)
  • Branch: cursor/dashboard-live-refresh-interval-06d1
  • Author: MikeShi42

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

@github-actions

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

@github-actions

github-actions Bot commented Nov 20, 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:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • 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
    priority. Reply with one sentence; if it is P0, 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 P0/P1 · 🟡 1 P2 · 🔵 3 P3

No inline comments. 3 P3 folded at the bottom. 1 unchanged from an earlier push (already inline above).

🔵 3 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/hooks/useDashboardRefresh.tsx:17 — REFRESH_INTERVAL_CHOICES hand-copies the auto-granularity ladder, and no test keeps the two in sync → This list repeats the steps that convertDateRangeToGranularityString (packages/common-utils/src/core/utils.ts:664-719) can return. The comment promises that any default of 30s or more is always one of the choices, but nothing enforces that. If a step is added there (for example 10m), the auto value would be missing from the fixed list. Fix: build the list from the same ladder (export the steps from common-utils), or add a test that sweeps date ranges and checks every result of 30s or more is in getRefreshIntervalOptions(result).
  • 🔵 P3 packages/app/src/DBDashboardPage.tsx:2190 — Untested: picking an interval should turn live mode on → The PR says picking any menu item turns live on, but that happens only in onRefreshIntervalChange in DBDashboardPage. The component test replaces it with a jest.fn() and the hook test never touches it, so dropping setIsLive(true) would still pass. Fix: add a page-level or E2E test that picks an interval while live is off and checks the Live button turns primary. Or let DashboardLiveButton report one { interval, live: true } change so its own test can cover it.
  • 🔵 P3 packages/app/src/DBDashboardPage.tsx:565 — Heatmap comment is now wrong: live granularity is no longer the refresh interval → The comment says a live dashboard's granularity "is the coarse refresh interval". After this PR, tiles still get granularityOverride (line 2548) while refreshes run at refreshInterval, which can be much shorter (for example 30s on a 24h range with 30m buckets). Reword it to "the date range's auto granularity" so readers don't assume the two are tied.

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a small, well-tested client-side feature: the refresh interval is ephemeral view state driving a window.setInterval, with a stray/out-of-range selection safely falling back to auto (refreshIntervalOptions.includes(...) guard) and the setInterval delay clamped against 32-bit overflow. The three prior cursor[bot] points (empty-options → Auto-only, the 2**31-1 clamp, and the deferred ARIA decision) are all reflected in the current head. No agent-native gap — the setting is a local browser-tab preference with no backend surface.

🟡 P2 — recommended

  • packages/app/src/hooks/useDashboardRefresh.tsx:17 — REFRESH_INTERVAL_CHOICES hand-duplicates the granularities convertDateRangeToGranularityString can emit (minus sub-30s), so if a new bucket is added there, getRefreshIntervalOptions silently stops offering/capping on it with no test failure.
    • Fix: Add a unit test asserting every Granularity the auto-inference can return at ≥30s is present in REFRESH_INTERVAL_CHOICES, or derive the choices from a single shared source.
    • maintainability-reviewer
🔵 P3 nitpicks (2)
  • packages/app/src/hooks/useDashboardRefresh.tsx:110 — a 30 day interval exceeds MAX_TIMER_DELAY_MS (~24.86 days), so the longest choice fires sooner than its label implies; harmless and strictly better than the pre-existing overflow, but label and cadence diverge at multi-year ranges.

    • Fix: Note the clamp in the interval label when the computed delay is capped, or document that the longest intervals refresh at the timer ceiling.
  • packages/app/src/components/DashboardLiveButton.tsx:16 — menu items signal selection only via data-checked and an icon; there is no role="menuitemradio"/aria-checked, so screen readers do not announce the active interval.

    • Fix: Track the Mantine Menu.Item role limitation as a follow-up and revisit with a custom item when feasible.
    • previous-comments-reviewer

Reviewers (3 returned): maintainability, previous-comments, agent-native. Correctness, testing, adversarial, kieran-typescript, and julik-frontend-races were dispatched but had not returned when output was finalized; the orchestrator independently verified the interval-selection/fallback logic, the getRefreshIntervalOptions boundary filter, the overflow clamp, and the component render states against the underlying Granularity helpers and found no P0/P1 issues.

Testing gaps: No test guards the REFRESH_INTERVAL_CHOICES ↔ convertDateRangeToGranularityString invariant against future drift.

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

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 476 passed • 1 skipped • 1054s

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

Tests ran across 4 shards in parallel.

View full report →

Every listed interval, including the date range's default, is now a
fixed choice. Auto is a separate first item.

Co-authored-by: Mike Shi <mike@hyperdx.io>
defaultInterval: Granularity,
): Granularity[] {
const maxSeconds = convertGranularityToSeconds(defaultInterval);
if (maxSeconds < MIN_REFRESH_INTERVAL_SECONDS) {

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 — Ranges of 15 minutes or less offer a fixed 15s interval that goes below the 30s floor, not 'auto only'

When the default is below MIN_REFRESH_INTERVAL_SECONDS, getRefreshIntervalOptions returns [defaultInterval]. DashboardLiveButton then renders it as a separate fixed item under 'Auto (15s)'. If the user picks it, selectedRefreshInterval becomes 15s and the trigger reads '15s', so the user has pinned a 15s refresh. The PR description says auto should be the only choice in this case. Fix: return [] here so only Auto is shown and no 15s selection can be stored. Then update the keeps a default faster than 30s test, which currently locks in the wrong behaviour.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in 726b2e4: getRefreshIntervalOptions returns [] when the default is under 30s, so only Auto shows (the divider is hidden too). Test updated, plus a DashboardLiveButton test for the auto-only menu.

refresh();
},
convertGranularityToSeconds(granularityOverride) * 1000,
convertGranularityToSeconds(refreshInterval) * 1000,

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 — A 30d refresh interval overflows setInterval's 32-bit delay and refreshes in a tight loop

REFRESH_INTERVAL_CHOICES includes ThirtyDay. convertDateRangeToGranularityString returns it for ranges over about 420 days (60 buckets × 7d). 30d is 2,592,000,000 ms, which is above setInterval's limit of 2^31-1 ms, so browsers fire it almost immediately. Each refresh changes searchedTimeRange, which rebuilds refresh and restarts the interval, so the dashboard re-queries continuously. Fix: clamp the delay, e.g. Math.min(seconds * 1000, 2**31 - 1), or cap the choices at 7d.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in 726b2e4: the delay is clamped to 2^31-1 ms, with a test for a 2-year range (30d auto). This also covers auto mode, which had the same overflow on main.

…elay

Ranges of 15 minutes or less now offer only Auto. A 30d interval exceeded
setInterval's maximum delay and refreshed in a tight loop. Also derives
auto vs fixed once and adds DashboardLiveButton tests.

Co-authored-by: Mike Shi <mike@hyperdx.io>
onClick: () => void;
}) {
return (
<Menu.Item

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 — Screen readers can't tell which refresh interval is selected

The selected item is marked only by a visual IconCheck and a data-checked attribute, and assistive tech reads neither. Give each Menu.Item role="menuitemradio" and aria-checked={checked}, and have the tests assert aria-checked instead of data-checked.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tried this: Mantine's Menu.Item sets role: "menuitem" after spreading props, so role="menuitemradio" is overridden, and aria-checked isn't valid on a plain menuitem. Fixing it means replacing Menu.Item with a custom item, which is more than this PR should take on; leaving it for a maintainer to decide.

@security-ai-gate-reviewer security-ai-gate-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Auto-approved by the AI review gate on a46d993. Details in the approver's comment on this pull request.

@security-ai-gate-reviewer

Copy link
Copy Markdown

AI review gate — auto-approved

a46d993d5097 is approved by security-ai-gate-reviewer[bot], an automated identity, not a human. The approval stands on the required AI review: Cursor Bugbot concluded green on this commit and the AI review gate is SUCCESS (its own comment has the verdict), and the change touches no path that requires a human reviewer. It is bound to this commit: a new push dismisses it and the approver re-evaluates.

History (latest 5 heads, newest first)

  • a46d993d5097 approved — green: Cursor Bugbot

@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.

LGTM

@kodiakhq
kodiakhq Bot merged commit 5581b95 into main Nov 25, 2026
31 of 33 checks passed
@kodiakhq
kodiakhq Bot deleted the cursor/dashboard-live-refresh-interval-06d1 branch November 25, 2026 23:28

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — a46d993d Deployed Nov 25, 2026 by vercel[bot]
Preview – hyperdx-storybook — a46d993d Deployed Nov 25, 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-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants