Skip to content

feat(app): SLO objective, details and editing in the builder - #3804

Open
alex-fedotyev wants to merge 1 commit into
alex/HDX-3001-slo-16-app-builderfrom
alex/HDX-3001-slo-17-app-builder-objective
Open

alex-fedotyev wants to merge 1 commit into
alex/HDX-3001-slo-16-app-builderfrom
alex/HDX-3001-slo-17-app-builder-objective

Conversation

@alex-fedotyev

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

Copy link
Copy Markdown
Contributor

Summary

Adds the objective section to the SLO builder (a target with presets for
99%, 99.5%, 99.9% and 99.95%, the error budget it leaves, and a rolling 7
or 30 day window) and a details section with a description and tags. SLOs
can now be edited at /slos//edit, from the list's row menu: the form
loads the saved definition and keeps what the builder does not show, such
as a group-by, alerts and eligible-event filters, as saved.

Stack

Part 17 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 (this PR)
  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
  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, objective and details, light
after, dark
after, editing an SLO, 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: the builder has only the indicator section, and SLOs cannot be edited.

On this branch:

  1. In the builder, pick a target preset and the window, and add a description and tags.
  2. Open Edit from a row's menu: the form loads the saved SLO, and Save SLO keeps settings the builder does not show yet (group-by, alerts, filters).

Test plan

  • unit: sloForm.test.ts (a saved SLO loads back unchanged)
  • 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: 044921c

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

Adds the objective section to the SLO builder (a target with presets for
99%, 99.5%, 99.9% and 99.95%, the error budget it leaves, and a rolling 7
or 30 day window) and a details section with a description and tags. SLOs
can now be edited at /slos/<id>/edit, from the list's row menu: the form
loads the saved definition and keeps what the builder does not show, such
as a group-by, alerts and eligible-event filters, as saved.

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 • 1125s

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

Tests ran across 4 shards in parallel.

View full report →

@alex-fedotyev
alex-fedotyev force-pushed the alex/HDX-3001-slo-17-app-builder-objective branch from 56f8e5c to 044921c Compare November 24, 2026 18:58
@alex-fedotyev
alex-fedotyev marked this pull request as ready for review November 24, 2026 21:30
@alex-fedotyev
alex-fedotyev requested a review from a team as a code owner November 24, 2026 21:30
@github-actions github-actions Bot added the review/tier-3 Standard — full human review required label Nov 24, 2026
@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:

  • Diff size: 262 production lines changed (Tier 2 max: < 250)

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: 262 (+ 46 in test files, excluded from tier calculation)
  • Branch: alex/HDX-3001-slo-17-app-builder-objective
  • 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.

<Button component={Link} href="/slos" variant="secondary">
<Button
component={Link}
href={editId ? `/slos/${editId}` : '/slos'}

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 — In edit mode, Cancel and the SLO-name breadcrumb link to /slos/, which has no page in this PR

At this commit packages/app/pages/slos/ only has index.tsx, new.tsx and [sloId]/edit.tsx; the detail page arrives in #3808. Until it lands, clicking Cancel (and the breadcrumb at line 105) while editing leads to a 404. Point both at /slos for now, and switch them to /slos/${editId} in #3808.

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


// Load the SLO being edited, once.
const initializedRef = useRef(false);
useEffect(() => {

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 — Edit page shows an editable default form while loading, then overwrites any input; a failed fetch leaves a blank 'Save SLO' form

useSlo is read only for data, so while it loads the page shows the defaults (Untitled SLO, 99.9%, 30d) as an editable form. Anything typed before the response arrives is thrown away by reset(sloToFormValues(existing)). If the fetch fails (for example a 404 for a deleted id), the page stays on the empty form forever and Save PUTs to a missing id. Show a loader until existing is loaded, and an error or not-found state (using EmptyState) when isError.

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

Comment thread packages/app/src/slo.ts
queryKey: [...SLOS_QUERY_KEY, id],
queryFn: () => hdxServer(`slos/${id}`).json<SloApiResponse>(),
enabled: IS_SLOS_ENABLED && id != null,
refetchInterval: query =>

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 — useSlo keeps polling every 10s on the edit page, which never reads status

The only caller, SloEditorPage, reads existing once to seed the form and then only uses its name. Because refetchInterval falls back to SLO_FIRST_SNAPSHOT_POLL_MS until a status exists, an open edit page refetches /slos/:id every 10s for nothing. Let callers choose the interval (for example useSlo(id, { poll: false })), or add the polling in the detail-page PR that needs it.

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.

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

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

Findings outside the changed lines

  • 🟡 P2 packages/app/src/components/Slos/__tests__/sloForm.test.ts:397 — Round-trip test covers only an availability SLO and skips source, so latency settings lost on edit go unnoticed → toSloLatency (sloForm.ts:85) recomputes numeric from the source. A saved latency SLO with numeric: true that is round-tripped without the source (toSloInput(values), or a save made before useSource resolves on the edit page) comes back with numeric: false. Add a latency fixture that asserts indicator.latency survives with a source passed in, and include source in the objectContaining check.
  • 🟡 P2 packages/app/src/components/Slos/SloDefinitionFields.tsx:89 — Clearing the target input turns it into 0, so the field can't be emptied and the error budget shows 100% → onChange={v => field.onChange(typeof v === 'number' ? v : 0)} writes 0 as soon as the user clears the field. The controlled input then displays "0" (the next digit types after it), the error budget line reads 100%, and the field shows a 'must be above 0%' error mid-edit. Keep the empty string in form state (or map it to undefined) and let the resolver report it.
🔵 1 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/components/Slos/SloDefinitionFields.tsx:107 — target ?? 0 can never use its fallback → target is typed number in SloFormValues, and the Controller always writes a number, so the ?? 0 fallback is unreachable. Drop it, or replace it with real handling once empty input is allowed (see the previous finding).

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. The change is additive UI plus an edit flow that reuses the existing builder. The round-trip transform is sound, the one-time init guard prevents refetch-clobbering of in-progress edits, and save correctly routes to PUT/POST by id. The items below are recommended hardening and nits.

🟡 P2 -- recommended

  • packages/app/src/components/Slos/SloEditorPage.tsx:135 -- In edit mode the Save button is enabled while useSlo(editId) is still loading (or has errored), during which the form holds DEFAULT_SLO_FORM_VALUES; a save in that window issues PUT /slos/<id> and overwrites the stored objective, window and indicator with defaults.
    • Fix: Disable or hide the save control until the edited SLO has loaded (gate on existing / query status) so a submit cannot replace saved fields with form defaults.
  • packages/app/src/components/Slos/__tests__/sloForm.test.ts:148 -- The round-trip test exercises toSloInput(sloToFormValues(saved)) directly, so it never covers the react-hook-form reset → handleSubmit path that actually carries the unregistered groupBy and alerts fields through save, which is the PR's stated guarantee.
    • Fix: Add a test that drives the form through reset(sloToFormValues(...)) and submit to assert groupBy, alerts, and eligible.filters survive a round trip.
🔵 P3 nitpicks (3)
  • packages/app/src/components/Slos/sloUtils.ts:86 -- formatSloWindow hard-codes '7 days'/'30 days' and sits alongside the existing formatSloWindowAdjective ('7-day'/'30-day'), duplicating the window-label mapping.
    • Fix: Derive both labels from one window-metadata source so a future window value only needs one edit.
  • packages/app/src/components/Slos/SloDefinitionFields.tsx:147 -- Clearing the target NumberInput coerces an empty value to 0, which trips the target > 0 validator and renders the error-budget line as 100% until corrected.
    • Fix: Coerce the empty input to undefined/NaN rather than 0 so the field reads as empty instead of an out-of-range zero.
  • packages/app/src/slo.ts:38 -- When an SLO never produces a status snapshot (e.g. a persistently errored definition), useSlo polls at the 10s first-snapshot interval indefinitely rather than backing off.
    • Fix: Fall back to the slower poll interval once the first fetch settles, regardless of whether status has appeared.

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

Testing gaps: Edit-mode init (load-before-save, invalid/deleted id) and the RHF submit-time preservation of unregistered groupBy/alerts are not covered by automated tests.

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 — 044921c0 Deployed Nov 24, 2026 by vercel[bot]
Preview – hyperdx-storybook — 044921c0 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