feat(notify): purchase and refund emails through SMTP and the job queue (#34, email slice) #101
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!101
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/34-email"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Email slice of #34 (does not close it: FCM push remains).
What
internal/notify: provider-agnosticSender, embedded text and HTML templates,notify.PlainAddress(ASCII, no header injection).notify/smtpsender: SMTP adapter (implicit TLS on 465, STARTTLS elsewhere, plain only to localhost, TLS required before AUTH, 10 s dial and 30 s send bounds).Completer.Complete(on the real transition toCompleted) andService.Refundenqueuenotify.purchase/notify.refundwithEnqueueTxand a dedupe key in their own transaction, so a rollback queues nothing and the worker sends after commit. One purchase job each for waive, wallet pay, M-Pesa callback and free checkout; none for a late payment.KWS_SMTP_HOST/PORT/USERNAME/PASSWORD/FROM: all or none, unset = email disabled (nothing queued). The worker refuses to start on bad SMTP config. ADR 0016, plandocs/superpowers/plans/2026-10-26-email-notifications.md, CLAUDE.md, docs/02.Rulings and known limits (ADR 0016)
notification_bcc_email(an invalid one is dropped with a warning; a relay-refused BCC does not fail the send).Review
Dual pass done. Pass 1 (ponytail): no Must fix. Pass 2 found a data race on the port-465 timeout path, fixed in
6ffb896together with five smaller items; Pass 1 re-check: Ship.Checks
make cover: 89.2% (minimum 80%).go test -race ./...,make lint,make contractgreen (implementer run). The real-relay smoke test (KWS_SMTP_SANDBOX=1) was not run.Deploy
No migration. Set the five
KWS_SMTP_*variables on both the API and the worker and keep the worker running; email stays off until they are set (API-only config dead-letters the jobs).🤖 Generated with Claude Code