feat(notifications): email on schedule auto-disable and 100% usage limit - #6038
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Schedule failure writes are centralized on 100% usage email fix: New React-email components, render helpers, preview routes, and tests cover templates and recipient resolution. Reviewed by Cursor Bugbot for commit 76e6e4c. 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 and 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 | Guaranteed disable-edge detection and optional notify on all disable-capable schedule updates; failure helper defers mail to callers. |
| apps/sim/lib/workflows/schedules/disable-notifications.ts | Resolves creator plus workspace admins, caps fan-out, best-effort per-recipient send with fixed reason copy. |
| apps/sim/lib/billing/core/usage.ts | 100% threshold for all plans/scopes with paid raise-limit template; 80% paid path skips when also crossing 100%. |
| apps/sim/app/api/schedules/execute/route.ts | Setup-failure and stale-recovery paths call applyScheduleFailureUpdate and notify after disable / after commit. |
Sequence Diagram
sequenceDiagram
participant Tick as Schedule tick / job
participant Apply as applyScheduleUpdate
participant DB as workflow_schedule
participant Notify as notifyScheduleAutoDisabled
participant Mail as sendEmail
Tick->>Apply: updates + disableReason
Apply->>DB: "UPDATE ... status <> disabled RETURNING status"
alt status became disabled and not deferred
Apply->>Notify: scheduleId, reason
Notify->>Mail: one message per recipient
else deferred (failure helper / stale recovery)
Tick->>Notify: after commit (capped batch)
Notify->>Mail: one message per recipient
end
Reviews (3): 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.
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
56ba3db to
76e6e4c
Compare
|
@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 76e6e4c. 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