Conversation
The daily integration-checks scheduler fans out one Trigger.dev run per task, and each run emailed independently on transition into `failed`. An org with N failing tasks therefore received N separate emails (times every assignee + admin/owner) — noisy spam. Add a per-org runner (run-org-integration-checks) that the orchestrator dispatches once per org (fire-and-forget). It batchTriggerAndWaits that org's per-task checks, collects the tasks that freshly transitioned to failed, and sends ONE bundled email (AutomationBulkFailuresEmail) per recipient. The per-task worker no longer emails — it returns statusChangedToFailed/failedCount/totalCount so the runner can aggregate. - Preserves "notify only on the transition into failed" (an already-failed task is not re-reported, matching prior behavior) - Recipients unchanged: assignees of failed tasks UNION admins/owners, with the same org-scoped unsubscribe check - Bundled email is best-effort: a DB/email blip is swallowed so it cannot fail the runner and trigger a wasteful re-run of the whole org's checks - maxDuration on the new runner uses the correct seconds unit (60 * 60) - 32 unit tests: groupTasksByOrg, collectFailedTasks, bundled-email recipients/unsubscribe/resilience, and per-org dispatch Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EejssC59aJJacLuZNVh5vm
…ole filter
Address cubic review on run-org-integration-checks recipient resolution by
aligning it with the canonical getOwnerAdminRecipients resolver:
- Match EXACT member-role tokens (split on comma + trim) instead of a substring
`role.includes('admin'|'owner')`, so a custom role like "co-owner" or
"billing-admin" can't be mis-authorized into the failure digest.
- Drop the `user.role != 'admin'` query filter (that's the better-auth PLATFORM
role, not the org role); an org owner/admin is now notified regardless of
platform role, matching the live notifyStatusChange/notifyBulkStatusChange.
Both patterns were copied verbatim from the old per-task email; this brings the
bundled path in line with the codebase's canonical resolver. Adds tests for
exact-token exclusion ("co-owner") and the unfiltered member query.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EejssC59aJJacLuZNVh5vm
fix(integration-checks): bundle per-task failure emails into one per org
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Contributor
|
🎉 This PR is included in version 3.91.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.
Summary by cubic
Bundle integration-check failure notifications per organization to stop one-email-per-task spam. The scheduler now triggers a per-org runner that aggregates failures and sends a single digest.
run-org-integration-checksper org.statusChangedToFailed,failedCount, andtotalCountfor aggregation.maxDurationunits (seconds).Written for commit 2fcc5c5. Summary will update on new commits.