feat(notifications): email on schedule auto-disable and 100% usage limit - #6038
feat(notifications): email on schedule auto-disable and 100% usage limit#6038TheodoreSpeaks wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview 100% usage limit fixes paid and organization accounts that previously got no email at full usage (only free personal users did). They now receive New email previews, render tests, and broad unit coverage accompany the billing and schedule paths. Reviewed by Cursor Bugbot for commit 10eb774. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryAdds schedule auto-disable emails and fixes 100% usage-limit notices for paid/org accounts.
Confidence Score: 5/5This PR appears safe to merge; no blocking failures remain from prior or current follow-up review. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/background/schedule-execution.ts | Guarded schedule updates return status, opt into one-shot disable notify via disableReason, and export failure-update helper with deferred notification. |
| apps/sim/app/api/schedules/execute/route.ts | Setup-failure and stale-recovery paths use applyScheduleFailureUpdate and notify only when a row newly disables; recovery notify is post-commit and capped. |
| apps/sim/lib/workflows/schedules/disable-notifications.ts | Best-effort fan-out to schedule creator and workspace admins with per-recipient sends and recipient cap. |
| apps/sim/lib/billing/core/usage.ts | 100% threshold emails for paid/org with raise-limit template; free personal keeps exhausted copy; 80% suppressed when 100% crossed in same call. |
| apps/sim/components/emails/notifications/schedule-disabled-email.tsx | New schedule-disabled notification template with reason copy and manage CTA. |
| apps/sim/components/emails/billing/usage-limit-reached-email.tsx | New paid/org 100% usage limit email with raise-limit CTA by scope. |
Sequence Diagram
sequenceDiagram
participant Tick as Schedule tick / job
participant Upd as applyScheduleUpdate
participant DB as workflow_schedule
participant Nfy as notifyScheduleAutoDisabled
participant Mail as sendEmail
Tick->>Upd: update with disableReason
Upd->>DB: "UPDATE ... status <> disabled RETURNING status"
alt status became disabled and not deferred
Upd->>Nfy: notifyScheduleAutoDisabled
Nfy->>Mail: creator + workspace admins
else deferred (stale recovery)
Tick->>DB: commit transaction
Tick->>Nfy: flush disabled ids (cap 25)
Nfy->>Mail: creator + workspace admins
end
Reviews (2): Last reviewed commit: "fix(notifications): keep partial recipie..." | Re-trigger Greptile
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 10eb774. Configure here.
Summary
isFreeUserplusscope === 'user', so a Pro user or an entire Team org got blocked at admission with no notice!crosses100to the paid 80% branch so one execution crossing both thresholds sends "reached" alone, not "nearing" and "reached" togetherNotes
applyScheduleUpdatenow returns{ updated, status }and takes adisableReason. Passing a reason also adds astatus <> 'disabled'guard — PostgresRETURNINGyields the new row, sostatus === 'disabled'alone means "is disabled", not "just became disabled".to:array —prepare.tsonly checksto[0]for unsubscribe.limit-notifications.ts's race-free claim is a follow-up.Type of Change
Testing
bun run lint,bun run type-check,check:api-validation:strictand the full audit suite passChecklist