Repository navigation
feat(app): SLO objective, details and editing in the builder - #3804
alex-fedotyev wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Duplicate code analysis1 new clone introduced by this PR.
If one of these duplicates a helper that already exists, import it instead jscpd compared this branch against |
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>
E2E Test Results✅ All tests passed • 474 passed • 1 skipped • 1125s
Tests ran across 4 shards in parallel. |
56f8e5c to
044921c
Compare
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
| <Button component={Link} href="/slos" variant="secondary"> | ||
| <Button | ||
| component={Link} | ||
| href={editId ? `/slos/${editId}` : '/slos'} |
There was a problem hiding this comment.
🟡 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(() => { |
There was a problem hiding this comment.
🟡 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
| queryKey: [...SLOS_QUERY_KEY, id], | ||
| queryFn: () => hdxServer(`slos/${id}`).json<SloApiResponse>(), | ||
| enabled: IS_SLOS_ENABLED && id != null, | ||
| refetchInterval: query => |
There was a problem hiding this comment.
🟡 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
PR Review
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
🔵 1 P3 — no action needed before merge
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. |
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 🟡 P2 -- recommended
🔵 P3 nitpicks (3)
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 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 |
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 onmain, one squashed commit each. Each diff is only its own change, and CI runs as if each PR targetsmain.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) andNEXT_PUBLIC_ENABLE_SLOS(app), both off by default.Screenshots or video
How to reproduce
Starting point:
yarn devon this branch (the pages need the API)..env.developmentturns onENABLE_SLOSandNEXT_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:
Test plan
sloForm.test.ts(a saved SLO loads back unchanged)How to test on Vercel preview
N/A: SLOs need the API, and the preview runs in local mode, where they are off.
References
[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.