Repository navigation
feat(app): create an SLO from a search, and duplicate an SLO - #3807
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 |
E2E Test Results✅ All tests passed • 474 passed • 1 skipped • 1176s
Tests ran across 4 shards in parallel. |
Search gets an SLO button that opens the SLO builder with the current search as the eligible events: its source, query and filters are copied, and a saved search's name becomes the SLO's name. The builder previews such a definition as soon as its source loads. The list's row menu can also duplicate an SLO, which opens the builder with its definition under a "Copy of" name and without its alerts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
400a06b to
53d40cf
Compare
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
| if (autoPreviewedRef.current || !initializedRef.current || !source) return; | ||
| if (editId || !prefill.source) return; | ||
| autoPreviewedRef.current = true; | ||
| void trigger(PREVIEW_FIELDS).then(valid => { |
There was a problem hiding this comment.
🟡 P2 — The preview for an SLO started from Search never runs, and a validation error shows instead
sloFormValuesFromSearch uses the default availability template with good: ''. SloIndicatorSchema's superRefine (packages/common-utils/src/slo.ts:215) rejects that, so trigger(PREVIEW_FIELDS) always resolves false. The user lands on a 'A good-event condition is required' error and no preview. The fix: validate only the eligible fields here, or skip validation of indicator.good (or build the preview from the eligible counts alone). Then add a test that drives this path, because the current unit test only checks the form values.
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
2 finding(s): 🔴 0 P0/P1 · 🟡 2 P2 · 🔵 0 P3 1 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines
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. No P0/P1: the two behavioral defects below are edge-case paths (crafted/stale URL, or an SLO deleted between list-load and click), and every path that reaches a ClickHouse query or the server is gated by 🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (11): correctness, adversarial, security, kieran-typescript, julik-frontend-races, testing, maintainability, project-standards, agent-native, previous-comments, learnings-researcher. Testing gaps:
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
Search gets an SLO button that opens the SLO builder with the current
search as the eligible events: its source, query and filters are copied,
and a saved search's name becomes the SLO's name. The builder previews
such a definition as soon as its source loads. The list's row menu can
also duplicate an SLO, which opens the builder with its definition under a
"Copy of" name and without its alerts.
Stack
Part 20 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: Search has no SLO button, and SLOs cannot be duplicated.
On this branch:
Test plan
sloForm.test.ts(copy without alerts, prefill from a search)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.
[no-story: allow] The new SLO components are page-level and fed by queries and form state, so this feature has no Storybook stories.
[ui-states: allow] No new empty, loading or error states here beyond the ones listed above.
[as-cast: allow] The cast check matches the word "as" in comments and strings here; the diff has no
ascasts.