Repository navigation
feat(mcp): preview_alert_rule dry-runs a rule before it is saved - #1207
Merged
Makisuo merged 2 commits intoOct 2, 2026
Merged
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_rulereplays a saved rule or acreate_alert_ruledraft over a windowAlertsService.previewRuleemitsAlertRulePreviewPoint.skipReasonand seeds an empty seriesskip_reasonadded 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
- 🟠 Warning · F2 · Unbounded
pointsarray in the structured output ·apps/ai/src/mcp/tools/preview-alert-rule.ts:207
What was checked
- Empty-result seed keys match storage vocabulary:
toStorageGroupKey(AlertRuleModel.ts:189) yields"all"for raw_sql/grouped and__total__for ungrouped, asevaluateRuledoes (AlertsService.ts:… - Multi-service seed keys equal
perServiceRules' group keys (AlertRuleModel.ts:225), the same keys the scheduler stores buildUpdatedRequestnever readsparams.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.
Loading