Skip to content

feat(app): SLO alerts on the Alerts page - #3812

Open
alex-fedotyev wants to merge 1 commit into
alex/HDX-3001-slo-24-app-alertsfrom
alex/HDX-3001-slo-25-app-alerts-page
Open

alex-fedotyev wants to merge 1 commit into
alex/HDX-3001-slo-24-app-alertsfrom
alex/HDX-3001-slo-25-app-alerts-page

Conversation

@alex-fedotyev

@alex-fedotyev alex-fedotyev commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

SLO burn alerts now read as such on the Alerts page: the source shows as
"SLO" with the SLO page's icon, the rule shows as "Fast burn: if 2% of the
error budget is spent within 1 hour", and the alert's name, the source link
and "Edit" open its SLO, where its settings and history live. Deleting one
says which burn alert of which SLO goes, and that the SLO keeps tracking.
An SLO alert's detail page redirects to its SLO, and the source filter only
offers SLO when SLOs are enabled. The shared alert types get the SLO
source and, for SLO alerts, the SLO and the rule.

Stack

Part 25 of 27 PRs in a GitHub stack (stack #3815). The header says this PR merges into the branch below it, but the stack's base is main: merging a PR lands it and every PR below it on main, one squashed commit each. Each diff is only its own change, and CI runs as if each PR targets main.

  1. feat(common-utils): SLO definition schema #3788 common-utils: SLO definition schema
  2. feat(common-utils): SLO fast and slow burn rules #3789 common-utils: SLO fast and slow burn rules
  3. feat(common-utils): SLO alert targets and status types #3790 common-utils: SLO alert targets and status types
  4. feat(common-utils): SLO counts query #3791 common-utils: SLO counts query
  5. feat(common-utils): SLO stats and state #3792 common-utils: SLO stats and state
  6. feat(common-utils): SLO history and ordering #3793 common-utils: SLO history and ordering
  7. feat(api): SLO definitions behind ENABLE_SLOS #3794 api: SLO definitions behind ENABLE_SLOS
  8. feat(api): refresh SLO statuses in the check-alerts task #3795 api: refresh SLO statuses in the check-alerts task
  9. feat(api): SLO burn alerts as their own alert source #3796 api: SLO burn alerts as their own alert source
  10. feat(api): keep SLO alerts out of the external alerts API #3797 api: keep SLO alerts out of the external alerts API
  11. feat(api): evaluate SLO burn alerts and notify #3798 api: evaluate SLO burn alerts and notify
  12. feat(api): clickstack_get_slo MCP tool #3799 api: clickstack_get_slo MCP tool
  13. feat(api): SLO preview, save and delete MCP tools #3800 api: SLO preview, save and delete MCP tools
  14. feat(app): SLO list page behind NEXT_PUBLIC_ENABLE_SLOS #3801 app: SLO list page behind NEXT_PUBLIC_ENABLE_SLOS
  15. feat(app): search, filter, sort and delete SLOs in the list #3802 app: search, filter, sort and delete SLOs in the list
  16. feat(app): SLO builder for a new SLO #3803 app: SLO builder for a new SLO
  17. feat(app): SLO objective, details and editing in the builder #3804 app: SLO objective, details and editing in the builder
  18. feat(app): eligible-event filters and the latency template in the builder #3805 app: eligible-event filters and the latency template in the builder
  19. feat(app): preview an SLO in the builder before saving it #3806 app: preview an SLO in the builder before saving it
  20. feat(app): create an SLO from a search, and duplicate an SLO #3807 app: create an SLO from a search, and duplicate an SLO
  21. feat(app): SLO detail page #3808 app: SLO detail page
  22. feat(app): bad events flyout on the SLO page #3809 app: bad events flyout on the SLO page
  23. feat(app): SLI, error budget and burn rate charts on the SLO page #3810 app: SLI, error budget and burn rate charts on the SLO page
  24. feat(app): fast and slow burn alerts in the SLO builder, list and page #3811 app: fast and slow burn alerts in the SLO builder, list and page
  25. feat(app): SLO alerts on the Alerts page #3812 app: SLO alerts on the Alerts page (this PR)
  26. feat(app): group-by in the SLO builder #3813 app: group-by in the SLO builder
  27. feat(app): grouped SLOs in the list and on the SLO page #3814 app: grouped SLOs in the list and on the SLO page

Parts 1 to 6 are shared code, 7 to 13 the API and its MCP tools, and 14 to 27 the app. Everything ships behind ENABLE_SLOS (API) and NEXT_PUBLIC_ENABLE_SLOS (app), both off by default.

Screenshots or video

Before After
before, light after, light
after, dark
after, the row menu, light

How to reproduce

Starting point: yarn dev on this branch (the pages need the API). .env.development turns on ENABLE_SLOS and NEXT_PUBLIC_ENABLE_SLOS (parts 7 and 14). Use a trace or log source with data; the demo server works.

On the previous part: SLO alerts show on the Alerts page as plain alerts with an unknown source.

On this branch:

  1. Open Alerts: SLO alerts show the SLO icon and their rule, and the row menu offers Edit in SLO and Open SLO.
  2. Delete one: the confirmation names the burn alert and the SLO, and the SLO keeps tracking. Opening an SLO alert's own page goes to its SLO.

Test plan

  • unit: AlertPropertiesSummary.test.tsx, AlertRowMenu.test.tsx, utils/__tests__/alerts.test.ts
  • viewport: checked at 1440 px and in a narrow 900 px window. The list scrolls sideways and its toolbar wraps, the builder's preview moves under the form, and the SLO page's stats wrap to two columns.
  • app typecheck, lint and knip at this commit

How to test on Vercel preview

N/A: SLOs need the API, and the preview runs in local mode, where they are off.

References

  • Linear Issue: HDX-3001
  • Related PRs: the rest of this stack, listed above

[no-changeset: allow] The changeset for this piece is in part 27.

[ui-states: allow] No new empty, loading or error states here beyond the ones listed above.

@vercel

vercel Bot commented Nov 24, 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 24, 2026 7:01pm UTC
hyperdx-storybook Ready Ready Preview Nov 24, 2026 7:01pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: be95b8d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Duplicate code analysis

1 new clone introduced by this PR.

  • packages/api/src/routers/external-api/v2/alerts.ts:908-925 ↔ packages/api/src/routers/external-api/v2/alerts.ts:1181-1197 — 18 lines

If one of these duplicates a helper that already exists, import it instead
of redefining it. If the duplication is deliberate, ignore this comment —
the check is advisory and never fails the build.


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

SLO burn alerts now read as such on the Alerts page: the source shows as
"SLO" with the SLO page's icon, the rule shows as "Fast burn: if 2% of the
error budget is spent within 1 hour", and the alert's name, the source link
and "Edit" open its SLO, where its settings and history live. Deleting one
says which burn alert of which SLO goes, and that the SLO keeps tracking.
An SLO alert's detail page redirects to its SLO, and the source filter only
offers SLO when SLOs are enabled. The shared alert types get the SLO
source and, for SLO alerts, the SLO and the rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 474 passed • 1 skipped • 1126s

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

Tests ran across 4 shards in parallel.

View full report →

@github-actions

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: 6
  • Production lines changed: 122 (+ 134 in test files, excluded from tier calculation)
  • Branch: alex/HDX-3001-slo-25-app-alerts-page
  • Author: alex-fedotyev

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

if (alert.source === AlertSource.INLINE) {
return `/chart?alertId=${alert._id}`;
}
if (alert.source === AlertSource.SLO && alert.sloId) {

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 — getAlertSourceUrl still links SLO alerts to /slos/:id when SLOs are turned off

With IS_SLOS_ENABLED false, this URL still drives the row name link (details off), the "Open SLO" menu item (details on), the history cards and the detail page's source icon. useSlosEnabledGuard in packages/app/src/slo.ts bounces that route to /search. Add IS_SLOS_ENABLED && to this branch, as ALERT_SOURCE_FILTER_OPTIONS already does.

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

source => ({ value: source, label: getAlertSourceLabel({ source }) }),
);
export const ALERT_SOURCE_FILTER_OPTIONS = Object.values(AlertSource)
.filter(source => source !== AlertSource.SLO || IS_SLOS_ENABLED)

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 — Source filter hides SLO, but the URL parser still accepts ?source=slo

packages/app/src/AlertsPage.tsx:38 parses source with Object.values(AlertSource). With SLOs off, ?source=slo still filters the list, while the Select shows no matching option. Build the parser's allowed values from the same filtered list as ALERT_SOURCE_FILTER_OPTIONS.

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

@github-actions

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.

8 finding(s): 🔴 0 P0/P1 · 🟡 5 P2 · 🔵 3 P3

2 posted as inline comment(s) on the changed lines. 3 listed below. 3 P3 folded at the bottom.

Findings outside the changed lines

  • 🟡 P2 packages/app/src/AlertDetailPage.tsx:287 — SLO alert detail page renders the full body before the redirect fires → The redirect runs in an effect, but !isLoading && alert && <AlertDetailBody/> still mounts for an SLO alert first. That briefly shows the generic page (with the "can't be previewed" chart fallback) and fires useAlertEvaluations. When sloId is set, render the skeleton or null instead of AlertDetailBody.
  • 🟡 P2 packages/app/src/components/alerts/AlertDetails.tsx:176 — SLO alert name link is titled "Alert details" but opens the SLO → When details are enabled, an SLO alert's nameHref is the SLO URL, yet title still says 'Alert details' because it only checks IS_ALERT_DETAILS_ENABLED. Base the title on whether nameHref is the /alerts/:id URL, and use linkTitle otherwise.
  • 🟡 P2 packages/app/src/components/alerts/__tests__/AlertRowMenu.test.tsx:376 — SLOs-off test passes no alertUrl, so the dead "Open SLO" link is never checked → The real caller (AlertDetails) passes alertUrl='/slos/…' even with SLOs off, and this test omits it, so it can't catch the dead link. Pass the real getAlertSourceUrl(sloAlert) and assert that no "Open SLO" item is rendered.
🔵 3 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/components/alerts/AlertRowMenu.tsx:192 — "Edit in SLO" builds /slos/undefined/edit when sloId is missing → sloManaged checks only the source and the flag, but sloId is optional in AlertsPageItemSchema. getAlertSourceUrl guards on alert.sloId and this link does not. Include alert.sloId in sloManaged so the item is dropped when there is no SLO to link to.
  • 🔵 P3 packages/app/src/components/alerts/AlertRowMenu.tsx:155 — Hardcoded ['slos'] duplicates SLOS_QUERY_KEY → packages/app/src/slo.ts:9 defines SLOS_QUERY_KEY = ['slos'] for useSlos/useSlo. Export it, or add an invalidate helper there, and use it here so the two keys cannot drift apart.
  • 🔵 P3 packages/common-utils/src/types.ts:3214 — sloRule enum restates SloAlertRuleSchema without naming its twin → packages/common-utils/src/slo.ts:36 already defines SloAlertRuleSchema = z.enum(['fastBurn','slowBurn']), and slo.ts imports types.ts, so it can't be imported here. Per the DRY rule, move SloAlertRuleSchema into types.ts and re-export it from slo.ts, or at least doc-comment this copy as its twin.

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

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. No P0/P1: the change is flag-gated (NEXT_PUBLIC_ENABLE_SLOS), additive at the schema level, and the data-shape risks below hinge on schema-optional fields the owning SLO populates in practice rather than any demonstrated breakage on the happy path.

🟡 P2 — recommended

  • packages/common-utils/src/types.ts:3214 — sloRule is declared as a fresh z.enum(['fastBurn', 'slowBurn']) that duplicates the canonical SloAlertRuleSchema in slo.ts, so the two lists can silently diverge if a third burn rule is ever added while the alerts page keeps rejecting it.
    • Fix: Hoist the shared enum into types.ts and re-export it from slo.ts to dodge the circular import, or document the twin and pin both with a test.
    • kieran-typescript, api-contract, project-standards
  • packages/app/src/AlertDetailPage.tsx:287 — an SLO alert's full detail body mounts, firing a useAlertEvaluations query that is immediately discarded, for at least one frame before the post-commit effect redirects to /slos/{sloId}.
    • Fix: Return null (or the loading skeleton) when sloId is set, mirroring the existing !IS_ALERT_DETAILS_ENABLED early return, so the body never mounts.
    • julik-frontend-races, adversarial
  • packages/app/src/components/alerts/AlertRowMenu.tsx:73 — sloManaged is not gated on alert.sloId, so an SLO alert arriving without a sloId renders an "Edit in SLO" link to /slos/undefined/edit#alerts while getAlertSourceUrl correctly suppresses "Open SLO" — an internal inconsistency, and the same gap makes the AlertDetailPage redirect silently no-op and show the generic detail page.
    • Fix: Gate sloManaged and the redirect's sloId on alert.sloId being present, falling through to delete-only when it is absent.
    • adversarial, correctness
  • packages/app/src/AlertDetailPage.tsx:246 — the new SLO redirect effect is the sole guard keeping an SLO alert off the generic detail page, yet it has no test (no AlertDetailPage.test.tsx exists).
    • Fix: Add a test asserting router.replace('/slos/{sloId}') fires for an SLO alert and does not for a non-SLO alert or when IS_SLOS_ENABLED is false.
    • testing, correctness, maintainability, project-standards
🔵 P3 nitpicks (6)
  • packages/app/src/utils/alerts.ts:338 — the SLO branch of getAlertSourceUrl returns /slos/{sloId} regardless of IS_SLOS_ENABLED, unlike every other SLO surface; with SLOs disabled this renders a live "Open SLO" link that bounces the user to /search via the SLO page guard.
    • Fix: Gate the SLO branch on IS_SLOS_ENABLED, returning '' when disabled.
    • adversarial
  • packages/app/src/components/alerts/AlertPropertiesSummary.tsx:202 — alert.sloRule ?? 'fastBurn' (repeated at AlertRowMenu.tsx:77) confidently labels a slow-burn alert as "Fast burn" in the row summary and delete confirmation if sloRule is ever absent.
    • Fix: Render a source-neutral label ("burn alert") when sloRule is missing instead of defaulting to fastBurn.
    • correctness, adversarial, kieran-typescript
  • packages/app/src/components/alerts/AlertPropertiesSummary.tsx:188 — this component gates the SLO rendering on alert.source alone, while AlertDetails, AlertDetailPage, AlertRowMenu, and the filter options also require IS_SLOS_ENABLED; an SLO alert reaching this component with the flag off would render burn-rule phrasing the rest of the UI hides.
    • Fix: Combine the source check with IS_SLOS_ENABLED here too.
    • kieran-typescript, maintainability
  • packages/app/src/components/alerts/AlertRowMenu.tsx:73 — the "SLO-managed" predicate (source === AlertSource.SLO with/without IS_SLOS_ENABLED) is re-derived inline across five files, inviting the inconsistency above.
    • Fix: Extract isSloAlert(alert) / isSloManaged(alert) helpers into utils/alerts.ts and call them everywhere.
    • maintainability
  • packages/app/src/components/alerts/AlertRowMenu.tsx:189 — the edit menu item uses a nested ternary (sloManaged ? … : (!isSloAlert && …)) whose silent third case (SLO alert with SLOs disabled) is hard to read.
    • Fix: Replace with two mutually-exclusive sibling conditionals (sloManaged && … and !isSloAlert && …).
    • kieran-typescript, maintainability
  • packages/app/src/components/alerts/AlertDetails.tsx:176 — an SLO alert's name link points at its SLO, but the hover title still reads 'Alert details' when IS_ALERT_DETAILS_ENABLED is true.
    • Fix: Use linkTitle ("SLO") as the title when the name href resolves to the SLO.
    • correctness

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

Testing gaps:

  • AlertDetails SLO source glyph (IconTargetArrow) and SLO nameHref suppression when details are enabled are untested (no AlertDetails.test.tsx).
  • ALERT_SOURCE_FILTER_OPTIONS SLO gating on IS_SLOS_ENABLED is asserted in neither flag state.
  • The delete path's invalidateQueries({ queryKey: ['slos'] }) is not asserted (the delete test uses a real QueryClient with no spy).
  • The sloRule-undefined 'fastBurn' fallback is exercised only in AlertRowMenu, not in AlertPropertiesSummary.
  • Prior PR comments (Vercel, changeset-bot, jscpd, e2e) are all automated; the jscpd clone is in external-api/v2/alerts.ts, outside this diff. Agent-native parity holds — SLO burn-alert delete/edit map onto the existing clickstack_get_slo / clickstack_save_slo tools.

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

This branch was successfully deployed

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

Labels

review/tier-3 Standard — full human review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant