Skip to content

fix(alerts): maintenance window revision guard, locked org cap, shared weekdays - #2343

Merged
Makisuo merged 3 commits into
mainfrom
fix/alerts-maintenance-window-guards
Nov 7, 2026
Merged

Makisuo merged 3 commits into
mainfrom
fix/alerts-maintenance-window-guards

refactor(alerts): MCP weekdays come from the domain's MAINTENANCE_WEE…

d8eee5d
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 7, 2026 in 1m 0s

Confidence 9/10 · No issues found

🟢 Confidence 9/10 · safe to merge. The revision guard and recount are pinned by new tests; the advisory lock itself is untested because PGlite serialises transactions.
no findings · tests partial −1 · risk medium

Replaces the millisecond updatedAt guard with a revision column bumped by every write, moves the 100-window cap count inside an org-scoped advisory lock, and de-duplicates the weekday literals. Safe to merge.

  • alert_maintenance_windows.revision bumps on every update; syncWindow writes only at the revision it read
  • create counts the per-org cap inside pg_advisory_xact_lock(org, 'alert_maintenance_windows')
  • MAINTENANCE_WEEKDAYS moves to @maple/domain/http; the MCP copy is deleted

Before merge

What was checked
  • Only the service writes the window row (grep for update/insert/delete), so enable, disable and schedule edits all bump revision
  • selectMaintenanceWindows spreads ...$, so revision reaches findRow, the materialize pages and the decoded row type
  • The advisory lock uses the transaction's db, the same idiom as lockOrgAlertRules (AlertRulesService.ts:252)

d8eee5d · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.