Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…or user inquiries
…l-to-ses # Conflicts: # backend/requirements.txt # backend/tests/services/test_email_service.py
…ple rendering for SES review
… match backend conventions
Collaborator
Author
|
TODO before merging:
|
This branch was successfully deployed
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.
Summary
Closes #84
What changed
Backend
Logic
Sending (
app/services/email_service.py)_send()now calls SES v2send_emailthroughboto3, run inasyncio.to_threadso it never blocks the event loop._get_ses_client()caches onesesv2client per credential set, built from a dedicatedboto3Session (clients are thread-safe, the default session isn't).TooManyRequestsException.SES_MAX_ATTEMPTStimes before the address is reported as failed._SendRateLimiterspaces all sends1 / SES_MAX_SEND_RATEseconds apart so bulk staff invites stay under the SES quota.SES_MAX_SEND_RATEto quota / N.Email content
Config
RESEND_API_KEYwithAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION(defaultus-west-2),EMAIL_FROM_ADDRESS,SES_MAX_SEND_RATE(default 1, the sandbox cap) andSES_MAX_ATTEMPTS(default 4).EMAIL_FROM_ADDRESS, and the default changes fromverify@toNEXUS <noreply@nexus.socalscioly.org>.Settingsignores unknown.envkeys, so a leftoverRESEND_API_KEYdoesn't crash startup.resend[async]removed andboto3added.Dev tooling and docs
scripts/render_emails.py(uv run python -m scripts.render_emails) writes every email to a gitignoredtmp_emails/with anindex.htmlpreview page, using a recording SES client so nothing is sent.backend/docs/email-previews.mddocuments the script;backend/CLAUDE.md,README.mdandCONTRIBUTING.mdpoint to it.CONTRIBUTING.mdandbackend/CLAUDE.mdnow describe SES setup instead of Resend.Out of scope
Test plan
pytestpasses locallyAutomated
tests/services/test_email_service.pycovers the SES request shape, failure propagation, staff-invite partial failure, real botocore retry behavior, rate-limit spacing, event-loop responsiveness, and the unconfigured paths in development, preview and production.test_resend_has_async_http_client.mock_send_emailfixture (auth, users, staff invites) pass unchanged.Manual (personal sandbox SES account in
us-west-2, sending from the verified test domainnexus.kennethlin.dev, with Easy DKIM and custom MAIL FROMmail.nexus.kennethlin.dev)NEXUS <noreply@nexus.kennethlin.dev>, and the link verifies the account.render_emailswrites all seven emails, andFRONTEND_URL=https://nexus.socalscioly.orgswitches their links to the real domain.