Skip to content

Send conference letters and updates from their own subdomains - #2360

Closed
fastfadingviolets wants to merge 9 commits into
codeforboston:mainfrom
hyphacoop:conference-senders
Closed

fastfadingviolets wants to merge 9 commits into
codeforboston:mainfrom
hyphacoop:conference-senders

Conversation

@fastfadingviolets

Copy link
Copy Markdown
Contributor

Stacked on #2359: review only the last commit, which changes two .env files; everything below it is #2359. Conference letters to legislators and weekly updates to conferees switch from notifications@ to their own authenticated subdomains, noreply@letters.mapletestimony.org and noreply@updates.mapletestimony.org, so each stream keeps a sender reputation apart from the other and from the digests on the main domain. Merge after #2359, and only once SendGrid has verified both subdomains, since it rejects mail from a sender domain it has not authenticated.

What's in it

  • Send conference letters and updates from their own subdomains

Not verified

  • 7a8c1cc: a send from either address; the subdomains' DNS was not live, so SendGrid has not verified either yet.

🤖 Generated with Claude Code

fastfadingviolets and others added 9 commits November 11, 2026 14:59
Conference letters and weekly updates send from letters.mapletestimony.org
and updates.mapletestimony.org, so a reputation problem in one stream cannot
reach the other or the main domain. Add SendGrid's link-branding CNAME, two
DKIM CNAMEs and a DMARC TXT for each to the DNS root, beside the existing
SendGrid block. No MX: mail to a sending address bounces and replies go to
Reply-To. The README's record count is dropped so it stops going stale.

Closes #140

Verified: terraform fmt -check and validate pass in a scratch copy without
the backend; local.records holds 28 keys, the 20 existing plus these 8.

Not verified: a plan against the prod state (needs GCP credentials; it
should show 8 additions and nothing else), DNS resolution after a
maintainer applies, and SendGrid showing both subdomains verified.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A trigger on published testimony records each add, edit and withdrawal of
conference input in conferenceInputEvents, kept apart from
notificationEvents so the digest never sees them. On Mondays at 8:00
Eastern a job reads the previous Monday-to-Sunday window of events for the
net change, reads the conference's live input for where it stands, renders
the email HTML, and creates conferenceUpdates/{court}_{id}_{week}. A week
with no change stores nothing, and a second run leaves the first update as
it was. All conference input counts; an admin deletion counts as a
withdrawal. The update has no number and no unsubscribe line, and follows
the designer's mockup without its open-questions section and form.

The conference stance wording moves to shared/conferences so the digest
and the update use one copy.

Closes #137

Verified: functions jest and the conference component tests (119) pass;
the integration cases "conference weekly update" pass on a throwaway
emulator with the opt-in removed: the trigger, a callable edit, an admin
deletion, the job, an idempotent rerun and an empty week; functions and
website type checks pass apart from untracked scratch scripts under
scripts/firebase-admin.

Not verified: the HTML was laid beside the mockup before two lines of its
wording changed (the footer, and the note under "Read the testimony"); how
it renders in real mail clients; a full run of the integration file; the
job on a deployed schedule. "Read the testimony" links the conference page
without a total because Public Input has no date filter.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The job that compiles a conference's update now also queues its email, in
the same batch that stores the update, so a second run in the week finds the
update and sends nothing. The email goes out from MAPLE with replies to
info@ and a SendGrid category for the update, set in the document's
top-level headers: the send-email extension ignores message.headers. The
update records which conferees it went to and which were skipped for having
no email address.

Outside production no email reaches a legislator: the To line becomes
LETTER_TEST_RECIPIENT and the subject names who it would have gone to. With
no test address set, nothing is sent. The sending address comes from
CONFEREE_UPDATE_FROM and defaults to notifications@ until the updates
subdomain is authenticated.

Closes #138

Verified: functions jest (176); integration "conference weekly update" on a
throwaway emulator: swapped recipient and subject prefix, headers, replyTo,
no second email on rerun, real addresses in production mode, skipped
conferee without an address, update stored with no email when none has one;
that extension 0.1.36 reads headers from the top level of the document, from
its source; a run on the local emulator with the send-email extension sent
an update through SendGrid that reached the test inbox.

Not verified: the SendGrid category arriving; the sending address on the
updates subdomain, which waits on #140.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The review step before posting new conference input or a cosign now says
where it goes (public on MAPLE, emailed to the reader's own rep and
senator, counted in the weekly update), shows the letter as it will be
sent with a Cc row, and lets the reader give a different reply-to for that
letter alone. A cosign gains a review step after writing; a cosign without
a note gets the mockup's "add a line" banner. A reader whose profile has no
rep or senator is told MAPLE has no one to notify, and sees no letter.

The reply-to is kept on the reader's private draft and never copied to the
publication. The letter text comes from one pure renderer under
functions/src, so the daily sender can mail exactly what was previewed.

Closes #142

Verified: yarn test:website, yarn test, check-types, lint on the changed
files and yarn build:dev pass. A throwaway-emulator integration test shows the reply-to stays
on the draft and is absent from the publication. The review blocks were laid
beside the mockup's Review frame at panel width.

Not verified: phone width, and the review flow in the real panel with a
signed-in reader on the emulator. The cosign screens were not laid beside
their mockup frames.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A daily job reads the previous Eastern day's newly added conference input
and writes one email per letter, using the same renderer as the review
step's preview, to whichever of the reader's rep and senator has an
address. The reader is copied and replies go to the address they chose for
that letter, else their verified one. The email is created under the input
event's id, so a rerun sends nothing twice, and an input posted twice in a
day sends only its last. Inputs that are not mailed are recorded with the
reason. Outside production recipients are swapped for the test address.

Tracking headers go in the email document's top-level headers: the
send-email extension ignores message.headers.

Closes #143

Verified: unit tests for the day window, From header and email document;
an integration test on a throwaway emulator covering a sent letter, rerun,
reply-to override, a legislator without an address, each skip reason, and
a repost; input posted through the review step on the local emulator
was mailed through the send-email extension and SendGrid and reached the
test inbox, copying the reader.

Not verified: the letter's look beside the mockup, and DKIM and DMARC from
the letters subdomain.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test checked that the conference had no input events after compiling,
but compiling never removes events, so it passed only when the assertion
ran before the trigger wrote the event. Wait for the event, then check
that none fall in the compiled week.

Verified: yarn test:integration-ci tests/integration/testimony.test.ts -t weekly, 5 pass.

Not verified: the rest of testimony.test.ts and CI's full integration list.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The text part of each email was the HTML's textContent, which drops
line breaks: a letter's signature ran together ("Fake VioletHouse
district: 12th Suffolk...") and the update's figures ran into their
labels. Each is now rendered from the same data as its HTML, with a
line per signature line or figure and the cosigned input quoted.

Verified: letter and update unit tests (36) and functions tsc pass; a
letter and two weekly updates sent through the local emulator's
send-email extension and SendGrid arrived with readable text parts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The emulators never fire schedules, so a new admin script runs the
letters or weekly-update job as its next scheduled run would, or at a
given --now. It is local only, and mails LETTER_TEST_RECIPIENT as read
from the functions env files. The README says how to start the
emulators with the send-email extension, and the extension's local
secret file is ignored.

Verified: with the extension emulator and a SendGrid key, letters and
updates runs reached the test inbox; the only recipients were the test
address and the reader's reply-to, with legislators named only in the
subject; a bad --job is refused with the usual arguments error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Letters to legislators now come from noreply@letters.mapletestimony.org
and the weekly update to conferees from noreply@updates.mapletestimony.org,
on dev and prod, instead of notifications@. Each stream keeps its own
sender reputation, apart from the other and from the digests on the main
domain. Merge only after SendGrid has verified both subdomains, since it
rejects mail from a sender domain it has not authenticated.

Not verified: a send from either address; the subdomains' DNS was not
live, so SendGrid has not verified either yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
maple-dev Ready Ready Preview Nov 12, 2026 6:06pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview – maple-dev — 7a8c1cc4 Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant