Skip to content

fix(alerts): explain raw-SQL sample counts and warn when they count rows - #1205

Merged
Makisuo merged 2 commits into
mainfrom
fix/alert-raw-sql-samples-docs
Oct 2, 2026
Merged

Makisuo merged 2 commits into
mainfrom
fix/alert-raw-sql-samples-docs

fix(alerts): detect the samples alias the way the engine reads it

ff972f2
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 2, 2026 in 9m 18s

Confidence 5/5 · No issues found

🟢 Confidence 5/5 · safe to merge
rawAlertSqlSelectsSamples now matches the engine's exact samples key, and the two new test files exercise both warning states.
quality 100/100 · no findings · tests covered · risk low

Documents what minimum_sample_count counts for raw-SQL rules and adds rawAlertSampleCountWarning, surfaced in the alert editor and as warnings/notices on create, update and get. No evaluation behavior changes; safe to merge.

  • rawAlertSampleCountWarning flags a raw-SQL rule whose minimum exceeds 1 with no samples column
  • ruleConfigWarnings feeds warnings on create/update outputs and notices in renderRuleWrite
  • Editor shows the warning and a raw-SQL samples/no-rows hint
  • create_alert_rule parameter descriptions now state the real defaults (2/2/30)

Fixed since the last review

  • ✅ F1 · rawAlertSqlSelectsSamples accepts Samples, which the engine never reads
What was checked
  • F1: alias match is case-sensitive and rejects Samples (raw-sql.ts:296), matching RawSqlAlertRowSchema's exact samples key in query-engine.ts
  • Masked text is used only to locate AS, the alias is read from the original at the same offset (raw-sql.ts:294), so comments and string literals are ignored
  • New parameter/schema defaults (2, 2, 30) match packages/db/src/schema/alerts.ts

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