feat(api): send notifier email through Postmark - #158
Merged
Conversation
Postmark is what the legacy site already sends through, with the
codeforphilly.org sender domain verified there; Resend was an
unreviewed choice. Generated by:
npm install -w apps/api postmark
npm uninstall -w apps/api resend
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
Postmark is the provider the legacy site already sends through, and the codeforphilly.org sender domain is verified there; Resend was a provider choice nobody reviewed. The notifier contract itself (LoggingNotifier fallback when unconfigured, log-not-throw delivery, CFP_NOTIFICATION_FROM / CFP_SITE_HOST) is unchanged. Env surface becomes POSTMARK_SERVER_TOKEN (secret, optional) plus POSTMARK_MESSAGE_STREAM (ConfigMap, default `outbound`). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
Replace the Resend-backed EmailNotifier with a provider-neutral seam.
EmailNotifier now depends on a one-method `EmailTransport`
(`transport.ts`), and `PostmarkTransport` is the only file that knows
a vendor: it maps our from/to/subject/text/html onto Postmark's
PascalCase Message and tags the configured MessageStream. The notifier
contract is unchanged — LoggingNotifier fallback when unconfigured,
log-and-`delivered:false` on any failure, same templates, same
CFP_NOTIFICATION_FROM / CFP_SITE_HOST inputs.
Postmark's SDK throws on every non-2xx rather than resolving with an
`{ error }` envelope, so the notifier's four copy-pasted send blocks
collapse into one `#deliver` with a single catch; the logged `err`
carries Postmark's code/statusCode so operators can still tell a
rejected sender from a network blip.
Env: `RESEND_API_KEY` -> `POSTMARK_SERVER_TOKEN` (optional), plus
`POSTMARK_MESSAGE_STREAM` (default `outbound`). The cutover-mailout
script drops its hand-rolled fetch call and reuses PostmarkTransport.
Tests: the notifier suite stubs the transport seam directly; a new
postmark-transport suite covers the field mapping with a stub and the
real ServerClient against an MSW intercept of POST /email, so an SDK
wire-format change surfaces in CI instead of production.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
Merged
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
Replaces the Resend email transport with Postmark. Postmark is what the legacy site already sends through, with the
codeforphilly.orgsender domain verified there; Resend was an unreviewed agent choice.specs/architecture.md(stack table + env table),specs/deferred.md,docs/operations/{secrets,deploy,cutover,cutover-announcement}.md, and thedeploy/kustomize/base/configmap.yamlcomment now describe Postmark.EmailNotifiernow depends on a one-methodEmailTransportinterface (apps/api/src/notify/transport.ts).PostmarkTransport(postmark-transport.ts) is the only file that knows a vendor. The notifier contract is unchanged:LoggingNotifierfallback when unconfigured, log-and-delivered:falseon any failure, same templates, sameCFP_NOTIFICATION_FROM/CFP_SITE_HOSTinputs.RESEND_API_KEY→POSTMARK_SERVER_TOKEN(optional secret); newPOSTMARK_MESSAGE_STREAM(ConfigMap, defaultoutbound).fetchand reusesPostmarkTransport.postmark-transport.test.tscovers the field mapping with a stub and runs the realServerClientagainst an MSW intercept ofPOST https://api.postmarkapp.com/email.Postmark's SDK throws on every non-2xx instead of resolving
{ error }, so the notifier's four copy-pasted send blocks collapse into one#deliverwith a single catch.Plan:
plans/postmark-notifier.md(closeout commit follows).Operator follow-through (not in this PR)
POSTMARK_SERVER_TOKENincfp-sandbox-clustercodeforphilly-ng.secrets/(a server token from the existing Code for Philly Postmark account; one server per environment is recommended). Until then the pod keeps usingLoggingNotifier, exactly as before.POSTMARK_MESSAGE_STREAMin the overlay if a stream other thanoutboundis wanted.RESEND_API_KEYsealed secret if one was ever created.Validation
npm run type-checkclean (afternpm run -w packages/shared build)npm run lintcleannpm test: api 427/427, web 89/89, shared 75/75🤖 Generated with Claude Code
https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr