Repository navigation
fix: reuse request keys for identical queued email digests - #827
Merged
NewWorldVenture merged 5 commits intoOct 3, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This was referenced Oct 2, 2026
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.
Overlapping notification-email workers can accept and report the same digest twice before sent_at is acknowledged. Reuse a deterministic recipient-and-row-set key for identical digests, forward it through the email helper's optional Resend SDK options, and give equal-time rows a stable ID order. Existing callers without a key keep their one-argument SDK call.
This draft targets main and is based on PR #787 (bec49a6). Its own commit changes exactly lib/server/notification-emails.ts, lib/email.ts and tests/queued-email-idempotency.test.ts; it inherits #787's membership/preference fix and tests. Merge #787 first or include both in the reviewed composition.
Validation: author and independent root final17 pass, versus the identical suite on the original sources failing8 cases with9 controls. Original seven test declarations are preserved. All56 related tests in5 files, full nonincremental TypeScript and three-file lint pass. Tests use actual Supabase SDK synthetic transport, the real email helper with an inert documented provider model, and an intercepted installed Resend6.14.0 header boundary. No live sending or rendering was exercised.
Bounded guarantee: identical payload/row-set retries within the provider's24-hour key window. In-flight409 and changed-payload409 remain failures with pending rows; accepted replay counts as an accepted request, not a new physical delivery. Changed batches, partial acknowledgments, expiry, live provider behavior and atomic authorization remain open. No mutex, premark-sent, migrations, provider configuration or audit closure.
Ownership and evidence: #771 (comment) and #787 (comment). Provider contract: https://resend.com/docs/dashboard/emails/idempotency-keys.