Skip to content

feat(mcp): preview_alert_rule dry-runs a rule before it is saved - #1207

Merged
Makisuo merged 2 commits into
fix/alert-check-skip-reasonsfrom
feat/mcp-preview-alert-rule
Oct 2, 2026
Merged

Makisuo merged 2 commits into
fix/alert-check-skip-reasonsfrom
feat/mcp-preview-alert-rule

fix(alerts): preview a no-data series when a rule's query matches not…

3bb3e2b
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review completed Oct 2, 2026 in 3m 16s

Confidence 3/5 · 1 issue to address

🟡 Confidence 3/5 · needs attention
The one remaining defect is F2: points is now capped per group but still scales with the unbounded group count, which the author should look at.
quality 90/100 · 1 warning · tests covered · risk medium · 2/2 new units observable

Adds the read-only preview_alert_rule MCP tool, threads skipReason through the preview point schemas (v1/v2/MCP output) and seeds a no-data series when a preview matches nothing. Safe to merge apart from the still-open unbounded structured output.

  • preview_alert_rule replays a saved rule or a create_alert_rule draft over a window
  • AlertsService.previewRule emits AlertRulePreviewPoint.skipReason and seeds an empty series
  • skip_reason added to the v2 preview schema and the MCP output schema
  • create/update/get_alert_rule, list_alert_checks and the instructions link to the preview tool

Still open from earlier reviews

What was checked
  • Empty-result seed keys match storage vocabulary: toStorageGroupKey (AlertRuleModel.ts:189) yields "all" for raw_sql/grouped and __total__ for ungrouped, as evaluateRule does (AlertsService.ts:…
  • Multi-service seed keys equal perServiceRules' group keys (AlertRuleModel.ts:225), the same keys the scheduler stores
  • buildUpdatedRequest never reads params.template (update-alert-rule.ts:100), so the 'template is ignored with rule_id' doc holds
Observability coverage: 2 of 2 changes observable
Change Kind Observable Evidence
MCP tool preview_alert_rule (inbound entrypoint) entrypoint yes handler is Effect.fn("McpTool.previewAlertRule") and annotates org, signal type and group count (preview-alert-rule.ts:194); dispatcher adds maple.mcp.tool
Preview warehouse evaluation (spec and raw-SQL reads) outbound yes runs through queryEngine.evaluateSeries / computeAlertBuckets, which annotate alert.preview.buckets and execute via the existing warehouse client (AlertsService.ts:1235, query-engine.ts:2362)

3bb3e2b · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.