Skip to content

fix(alerts): metric search in the rule editor, few-sample blind spots, headroom colours and silences - #2336

Merged
Makisuo merged 2 commits into
mainfrom
fix/alerts-ui-bugs
Nov 7, 2026
Merged

Makisuo merged 2 commits into
mainfrom
fix/alerts-ui-bugs

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the alerts UI bugs that preview browser tests and prod session replays flagged (2026-10-19 to 11-06). Each one was checked against origin/main before fixing.

What changed

Alert editor, Metrics source

  • The metric picker was always empty. The editor never fetched the metric list, and the panel's search and pick events were dropped. The editor now uses the dashboard's metric loaders, which moved into the shared query-builder kit (page/kit/query-builder/metric-options.ts). The dashboard widget imports them from there, and its old copy is deleted.
  • The group-by picker now offers the picked metric's own attribute keys. The where editor suggests the same keys.
  • Switching a query from Traces to another source drops root_only and keeps the rest of the filter.
  • The picker shows the metric name with its type beside it, not name::type. The dashboard picker changes the same way.

Hub

  • A rule whose every check is skipped because it saw fewer than the minimum number of samples is now a "Few samples" blind spot ("Every recent check had under 20 samples"). It used to say "skipped (no data)". The state row keeps no skip reason, so the status is worked out from last_sample_count. The rule chart's rail tooltip also counts these skips.
  • Headroom: a below-minimum window still stores its value (6.3% against a 5% threshold), so the inbox showed a rule that can't fire as near firing. Those values are left out of Headroom on both tabs.
  • The Inbox and the Rules tab used different tests for "near firing". The inbox flagged a floor rule with 26% to spare, which the Rules tab showed as fine. Both now use one test, isNear (under 20% left, or past the threshold).
  • Silences: a silence cancelled before it started showed an "Ended" badge next to "Cancelled …". The badge now says "Cancelled", and the section is "Ended or cancelled in the last 7 days".
  • Mobile: the silence dialog's duration control cut off "Pick time". It now wraps, like the other alert forms. The inbox Headroom rows also lost their bar column on phones; below sm they now show the name, the value and the time.

New lab: /lab/alerts-hub?state= with inbox, rules, loading, error, silences, silence-dialog and silence-dialog-custom. It runs the real hub over fixtures that include a below-minimum rule, a floor rule with headroom, and active, scheduled, cancelled and ended silences.

Already fixed on main, not changed here

  • "All clear 0 / 0 rules watching" while alert rules were loading or had failed: since fix(web): no request or page can stay loading forever #1626 (2026-10-21), the Overview banner only renders once rules and incidents have both loaded. The hub shows its skeleton or "Couldn't load alerts" (screenshots below).

Outside this PR's scope (noted for the owning sessions)

  • /security "Run" answering 402 on plans without security lives in apps/web/src/page/security, not the alerts pages. It needs an upgrade state instead of a failing action.
  • The dashboard widget's own source switch (dashboards/widget/edits.ts) still keeps root_only. Fixing it means changing resetQueryForDataSource in packages/query-engine.
  • packages/views/src/ui/INDEX.md is a generated file. It gains one line for the new shared kit module, as bun run ui:index requires.

Verification

  • New behaviour tests:
    • editor-metrics.scene.test.ts: the list loads and searches, a failed read is retried on the next edit, root_only is dropped, a picked metric's keys reach group-by, and the picker reads the name. With the root_only and name fixes reverted, those two tests fail.
    • Also: the few-samples status and its reasons, Headroom leaving out below-minimum values, the shared near test on floors and ceilings, and the cancelled-silence badge.
  • vitest: apps/web alerts, query-builder, dashboard widget and lab registry (58 files, 465 tests) and packages/web-data alerts (157 tests) all pass.
  • bun run typecheck for apps/web and web-data, oxlint -c .oxlintrc.effect.json on every changed file, ui:patterns:check and ui:index: all clean.
  • Screenshots come from the new lab: dark and light themes, desktop (1440) and mobile (390). The "before" shots use the same fixtures with this PR's source changes reverted.

Screenshots

From /lab/alerts-hub. Before = the same fixtures with this PR's source changes reverted.

Inbox: Headroom and blind spots (dark)
Before After
Inbox (light)
Before After
Inbox, mobile
Before After
Rules tab: Headroom now
Before After
Rules tab, mobile
Before After
Silences (dark)
Before After
Silences (light)
Before After
Silences, mobile
Before After
Silence dialog, mobile
Before After
Silence dialog with Pick time, mobile
Before After
Silence dialog, mobile, light
Before After
Loading (unchanged: skeleton)
Before After
Failed load (unchanged: error state, no false all clear)
Before After

The editor's metric picker needs a signed-in org with metrics, so it is checked on the preview deploy (posted below), alongside its scene tests.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…nces on main

- Alert editor (Metrics): load the metric list and a picked metric's keys
  through the dashboard's loaders, now shared in the query-builder kit; drop
  root_only when leaving traces (dashboard widget too); show the metric name,
  not name::type.
- Hub: a rule skipped for too few samples is a "Few samples" blind spot, not
  "no data"; skipped values stay out of Headroom; Inbox and Rules share one
  near-firing test.
- Silences: a cancelled silence is badged "Cancelled"; the duration control
  wraps on mobile; Headroom rows drop the bar below sm.
- /lab/alerts-hub over fixtures for every hub state.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e333f03c-4e31-4568-96de-50b51d013d4e
Commits

Reviewing files that changed from the base of the PR and between 2cc3cac and 145043e.

Files selected for processing: 42

  • apps/web/src/lab/alerts-hub-lab.ts
  • apps/web/src/lab/entries/alerts-hub.ts
  • apps/web/src/lab/registry.ts
  • apps/web/src/page/alerts/editor/command.ts
  • apps/web/src/page/alerts/editor/editor-metrics.scene.test.ts
  • apps/web/src/page/alerts/editor/init.ts
  • apps/web/src/page/alerts/editor/message.ts
  • apps/web/src/page/alerts/editor/model.ts
  • apps/web/src/page/alerts/editor/plan.ts
  • apps/web/src/page/alerts/editor/steps.ts
  • apps/web/src/page/alerts/editor/sub-steps.ts
  • apps/web/src/page/alerts/editor/update.ts
  • apps/web/src/page/alerts/editor/view-query.ts
  • apps/web/src/page/alerts/editor/where-inputs.ts
  • apps/web/src/page/alerts/hub/hub-silences.scene.test.ts
  • apps/web/src/page/alerts/hub/update.ts
  • apps/web/src/page/alerts/hub/view-inbox.ts
  • apps/web/src/page/alerts/hub/view-rules.ts
  • apps/web/src/page/alerts/hub/view-silences.ts
  • apps/web/src/page/alerts/shared/rule-chart.ts
  • apps/web/src/page/alerts/shared/silences.ts
  • apps/web/src/page/alerts/silence-dialog/view.ts
  • apps/web/src/page/dashboards/widget/edits.ts
  • apps/web/src/page/dashboards/widget/message.ts
  • apps/web/src/page/dashboards/widget/metric-option.ts
  • apps/web/src/page/dashboards/widget/metric-options.ts
  • apps/web/src/page/dashboards/widget/model.ts
  • apps/web/src/page/dashboards/widget/step.ts
  • apps/web/src/page/kit/query-builder/change.test.ts
  • apps/web/src/page/kit/query-builder/change.ts
  • apps/web/src/page/kit/query-builder/metric-options.test.ts
  • apps/web/src/page/kit/query-builder/metric-options.ts
  • apps/web/src/page/kit/query-builder/metrics-body.ts
  • apps/web/src/page/kit/query-builder/panel-message.ts
  • apps/web/src/page/kit/query-builder/view.ts
  • packages/views/src/ui/INDEX.md
  • packages/web-data/src/alerts/headroom.test.ts
  • packages/web-data/src/alerts/headroom.ts
  • packages/web-data/src/alerts/overview-derive.test.ts
  • packages/web-data/src/alerts/overview-derive.ts
  • packages/web-data/src/alerts/rule-status.test.ts
  • packages/web-data/src/alerts/rule-status.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@Makisuo Makisuo added the preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md label Nov 7, 2026
@maple-review-bot

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🍁 Maple PR preview

Note

Preview resources were removed when this pull request closed.

Final commit 145043e · View workflow run

@Makisuo

Makisuo commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author

The deploy-pr-preview failure is the preview cap, not this change: 9 open PRs carry a preview label (cap 8), all from the same audit sweep (#2326, #2329 to #2336). The preview:web label stays on, and the deploy will be re-run once a slot frees up.

@maple-review-bot

maple-review-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Maple review

Nothing to review

Commit 145043e only regenerates the kit index: two lines added for switchDataSource and the new shared metric-options.ts. Generated documentation carries no reviewable behavior, so there is nothing new to assess here.

145043e · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@Makisuo

Makisuo commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author

Second deploy-pr-preview failure: also a shared limit, not this change. The preview-cap gate passed, but tb branch create failed with "Max number of Branches allowed for Workspace". The Tinybird PR branches are held by the other open previews from this sweep. The deploy will be re-run once one of them is unlabelled and its branch freed. CodeRabbit skipped this PR because its free review limit is used up; the Maple review bot passed with no findings.

@Makisuo
Makisuo merged commit 5a55f5d into main Nov 7, 2026
28 of 30 checks passed
@Makisuo
Makisuo deleted the fix/alerts-ui-bugs branch November 7, 2026 14:08
@maple-review-bot

Copy link
Copy Markdown

Maple: after this shipped

⚠️ Something changed after this shipped. Details below.

Deployed to maple-web (pr-2344) at 2026-11-07 14:24 UTC as 116918d, the first version after the merge (the merge commit itself never reported). Compared the 60 minutes before and after.

New errors since the deploy:

  • @maple/web/errors/WarehouseQueryError (maple-web, 5/h)
Operation Calls/h Errors p95
productEventNames 0 → 2 0.0% → 0.0% 0 → 1708 ms

Maple looks once, an hour after the first deploy that carries the merge.

This branch was previously deployed

1 inactive deployment
pr-preview — 145043e2 Deployed Nov 7, 2026 by Makisuo via deploy-pr-preview #10188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant