Repository navigation
feat(alerts): rule editor as sentence cards with plain summaries - #2425
Conversation
The query panel's where clause now edits as [field] [operator] [values] rows by default, with a Builder/Text switch back to the text editor. Rows map both ways to the same where-clause string (parse/print over the existing grammar), and every edit leaves as the existing whereClause text change, so previews and saving are unchanged. A clause the rows can't show stays in the text editor with a note. Fields come from the editor's autocomplete vocabulary: common fields, then resource and source attributes in a drill-down picker (new kit ComboboxPicker). Several values OR only on attribute fields, the only filters the query engine ORs; 'is not' AND-s any number. Adds /lab/condition-builder.
Operators come from one engine table (where-key-rules, held to the clause handlers by test), so the builder offers only clauses the query applies. Text mode is explicit state once typed in. Edits rewrite only their own clause and Add condition emits nothing. Single-value rows use a single picker; product-events excludes and user/group ids take one value; values with both quote kinds are refused. Traces intrinsics are named fields and root_only is left to the span select. Rows lay out on a grid where only the values cell wraps, controls carry row-specific labels, and builder state clears when rows re-parse.
…ries Replaces the numbered stepper with When / Alert when / Notify / Name cards on a connected rail. A complete card closes to a one-line summary derived from the form; a card with something missing stays open. The live chart sits above the cards as the preview.
Card issues come from saveIssues with the query timing, so a slow SQL check opens Alert when; destination and chain names are loading, found or removed; a critical-only route reads "Critical: ..."; the Alert when summary shares the action bar's checks phrase and says recovery and no data. Cards keep the lead as the heading with the summary as a disclosure (cardButton), move focus on open and close, render their body only when open, and wrap summaries on phones.
…le-sentence-editor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This comment has been minimized.
This comment has been minimized.
Select takes alignItemWithTrigger={false} to open below its trigger. The chips field takes a size. ComboboxPicker's list is 360px wide and its trigger takes a tooltip. A popup with its own search input keeps focus there when an option is pressed, so typing, Enter and Escape go on working after a mouse pick that leaves the list open.
Rows read as sentences: the field and operator are as wide as their text, the field shows its key without the attr./resource. prefix (the group named only when two fields read the same, the full key in the tooltip and label). A narrow editor puts each row on two lines so the field name always shows, and value inputs are 16px on phones. Every row has one value control of one height: chips where it may hold several values, a combobox with suggestions otherwise. The field list is 360px wide, always has a highlight (the first option on open, the picked field after drilling in), and Enter picks it. The operator list opens below its trigger. The Builder/Text switch is a 28px control at the top right, level with the first row. A clause the rows can't show gets one line saying why, and the dropped OR group warning says only that it is not applied.
… after touch Alert when reads as sentences: each tier is one row with the same severity chip, and the checks and noise settings are inline sentences with short number fields, capped near max-w-3xl. The check interval and breach mode are selects inside the sentence; the mode switch is a select on a phone. The action bar says one thing (No changes, Ready to save, or what to fix as jump links that open the card and focus the field). Field errors show only after the field was left or save was pressed. An open card keeps one border around header and body, Done sits last in it, and Escape collapses a complete card. Notify no longer says no one is notified while a chain routes the tier. The rule chart clips to its window, leaves room for the last tick, draws the series apart from the threshold tones, and says what it is waiting for in text instead of a drawn trend. The lab runs the templates dialog's exit and answers previews from fixtures.
…le-sentence-editor
…le-sentence-editor
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…r a number when the threshold is not one
|
Both notes fixed in d3e87a1. F1: |
…le-sentence-editor
…le-sentence-editor
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
A pressed option took focus to the listbox, where Escape and Enter reached nothing, so a chips picker stayed open until a press outside. Presses in any combobox list now leave focus in the input that handles the keys, and a field's list closes once focus leaves the field (Tab).
…inds is refused The note sat under the field, covered by the open list, which still said "Type a value and press Enter".
The grammar reads `service.name ==` as the value "=", so the builder showed the row "Service is =". A bare value that is the rest of a mistyped operator now keeps the clause in Text with the syntax reason.
Number("") is 0, so clearing the threshold previewed the rule against 0 and
drew "Breach above 0%". A blank threshold now sends no preview and the chart
asks for a number.
…ed by The invalid input pointed aria-describedby at rule-name-error, which nothing rendered.
The rule diff compared the builder draft's JSON, add-on flags included, so opening Group by on a saved rule read as "1 unsaved change". It now compares the draft as the query reads it: an add-on left empty counts as closed.
It was hidden below sm; from sm the header is unchanged.
This comment has been minimized.
This comment has been minimized.
Preview testTested on the combined preview of the whole stack (#2466, app-pr-2466.maple.dev) by a separate test agent in a real browser: happy paths, break attempts, light and dark, and a 390x844 viewport. No uncaught page errors. Passed: a new rule opens as When, Alert when, Notify and Name cards with no step numbers; a threshold rule previews against the chosen range with the dashed threshold and a "Would have fired" verdict; validation marks missing fields amber and real problems (tiers in the wrong order, an interval longer than the window) on the card and in the action bar, whose items focus their field; the bar counts unsaved changes and Cancel returns to the Rules section; save, edit, a filter added with the condition builder and a group-by all persist; the anomaly type drops the condition card and the chart. Found and fixed in this push:
Still open: leaving the editor with unsaved edits gives no warning; the rule detail page words the same threshold differently ( Traces (preview environment |
…ling's quoted value no longer excuses a stray operator
This comment has been minimized.
This comment has been minimized.
…roup rule to what the engine applies
# Conflicts: # apps/web/src/page/alerts/editor/view-action-bar.ts
# Conflicts: # apps/web/src/lab/registry.ts
Maple review🟢 Confidence 10/10 · safe to merge. No defect found in the editor state, summaries, card a11y or chart paths I read; the lab fixtures and the new scene-test files were only partly read. The alert rule editor becomes sentence cards with plain one-line summaries, cards that stay open while they hold a save blocker, and one action bar that turns Save into a validation attempt. Presentation and editor state only; safe to merge.
|



Stacked on #2420. The alert rule editor reads as one sentence instead of a numbered stepper: When (signal and scope), Alert when (threshold, checks, noise), Notify (destinations and escalation chains), Name.
What changed
editor/summary.ts; the check phrasing is shared with the action bar sentence.aria-expanded,aria-controls), focus moves to the opened card and back to the summary on close.sentenceCard/sentenceChain;cardButtongains alabeloption.ruleStep(the numbered step) is deleted.Before / after
Notify open, and phone (390px):

Lab:
/lab/rule-editor?variant=populated|new|anomaly&theme=light|dark&open=condition,notify.Verification
bunx vitest run src/page/alerts src/page/kit src/page/dashboards/widget src/lab src/*.test.ts: 898 tests pass with feat(query-builder): condition builder for the where clause #2420's latest merged in (summary unit tests; scene tests for collapse and expand, missing cards staying open, a late timing blocker opening its card, the clean / dirty / blocked action bar, jump links, no red on a pristine form, Escape, the templates overlay unmounting after "Start blank").oxlint -c .oxlintrc.effect.jsonclean on changed files;ui:index,ui:patterns:checkpass.Not verified: 36px touch heights on a real phone, and the editor against a live org (preview test pending).
🤖 Generated with Claude Code