Skip to content

Alerting v1: error spike and quota threshold rules - #113

Merged
unjica merged 8 commits into
developfrom
feature/alerting-v1
Jul 1, 2026
Merged

unjica merged 8 commits into
developfrom
feature/alerting-v1

Conversation

@unjica

@unjica unjica commented Jul 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add per-project alert rules for error spikes (configurable threshold + rolling window) and ingest quota warnings (configurable near-percent).
  • Fire alerts on ingest with deduplicated history (AlertEvent), in-app bell delivery, and email to owners/editors via the new Alerts notification category.
  • Ship live /dashboard/alerts UI to configure rules and view recent fired alerts.

Part of #97 — Slack/webhook delivery remains for a follow-up.

Test plan

  • Run pnpm db:migrate to apply 20260702120000_project_alerts
  • Open Alerts in the sidebar — confirm default rules load for the active project
  • Lower error spike threshold (e.g. 3 / 15 min), ingest errors, confirm alert appears in history + bell
  • Adjust quota warning percent and verify near-limit alert fires once per project/month
  • Confirm Settings → Notifications → Alerts controls in-app and email routing
  • Verify viewers cannot save alert settings; editors/owners can

Made with Cursor

Per-project alert settings, fired-alert history, in-app and email delivery, and a live /dashboard/alerts page for milestone v1.2.0.

Co-authored-by: Cursor <[email protected]>
@unjica unjica added this to the v1.2.0 milestone Jul 1, 2026
Comment thread apps/api/src/lib/quota-alert.ts Resolved
Comment thread apps/api/src/lib/alert-dispatch.ts Resolved
unjica and others added 6 commits July 1, 2026 20:29
Stub alertEvent.findMany in unit tests after recent alert notifications were added to the bell builder.

Co-authored-by: Cursor <[email protected]>
Normalize parsed preferences so alerts defaults are applied in both parse and PATCH validation paths.

Co-authored-by: Cursor <[email protected]>
Prevent AlertsClient from pulling next/headers via dashboard-api through alert-settings imports during production build.

Co-authored-by: Cursor <[email protected]>
Store the fire-time destination (e.g. /dashboard/errors for spikes) and use it in recentAlertNotifications with rule-based fallback for legacy rows.

Co-authored-by: Cursor <[email protected]>
Only surface ERROR_SPIKE fired alerts in the bell, prefer quota over alert when ids match, and keep live quota items on billing routing when alerts routing is off.

Co-authored-by: Cursor <[email protected]>
Quota warning toggle now only gates near-limit alerts so exceeded history and email still send when warnings are disabled.

Co-authored-by: Cursor <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5f7fddb. Configure here.

Comment thread apps/api/src/lib/alert-dispatch.ts Resolved
…settings.

Restore quota AlertEvent rows in recentAlertNotifications, dedupe by routing preferences, and derive session nearQuota from configurable nearPercent instead of a fixed 90%.

Co-authored-by: Cursor <[email protected]>
@unjica
unjica merged commit 9769042 into develop Jul 1, 2026
2 checks passed
@unjica
unjica deleted the feature/alerting-v1 branch July 1, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant