feat(orgs): ORG_CREATE_NOTIFY_ADDR override for org-lifecycle notifications#524
Merged
Conversation
…ations Org create/delete/self-service-signup notifications fan out to every active superadmin in every environment. In preview that means the e2e org-creation firehose pages all superadmins (Tim, etc.) with test-org noise. Add email.OrgNotifyOverride(): when ORG_CREATE_NOTIFY_ADDR is set, all three superadmin org-lifecycle notifications go to that single address instead of the superadmin fan-out (and the superadmin lookup is skipped). Unset — the default, including prod — keeps the existing all-superadmins behavior unchanged. Set it to one operator address in preview to silence the churn for everyone else. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
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.
Problem
Org create, delete, and self-service signup notifications fan out to every active superadmin, in every environment. In preview that means the e2e org-creation firehose pages all superadmins with test-org noise — Tim got preview test-org create notes and asked "what is this?"
Change
New
email.OrgNotifyOverride(): whenORG_CREATE_NOTIFY_ADDRis set, all three superadmin org-lifecycle notifications route to that single address instead of the superadmin fan-out (and the superadmin DB lookup is skipped entirely). Unset — the default, including prod — keeps the existing all-superadmins behavior byte-for-byte.Set
ORG_CREATE_NOTIFY_ADDR=<your-addr>in the preview environment and the churn goes only to you; Tim and everyone else stop getting it. Prod leaves it unset.Touched paths
email/resend.go—OrgNotifyOverride()helper (env read, trimmed, empty = unset)orgs/service.go—notifySuperadmins(covers create + delete) honors the overrideauth/auth.go—notifyTrialSignup(self-service signup) honors the overrideNotes / decisions
ORG_NOTIFY_ADDR) to reflect the delete coverage.Tests
emailunitTestOrgNotifyOverride— unset/whitespace → nil, set/trimmed → single (no DB) ✅sent == 1with two superadmins seeded); existing fan-out + nil-client tests still green ✅🤖 Generated with Claude Code