feat(lifecycle): attach the whitepaper PDF to the fulfillment email - #1092
Merged
Conversation
The whitepaper fulfillment email pointed at a URL. It now carries the guide as an attachment, with the link kept underneath as the fallback for mail gateways that strip attachments from an unfamiliar sender. Resend fetches the bytes from the public threadplane.ai path itself, so no PDF flows through the lifecycle function and the attachment is always whatever generate-whitepaper.ts last deployed. Because Resend performs that fetch under the Threadplane sender, the attachment is a closed registry rather than a free-form field: only fulfill jobs may carry one, at most one, the filename must be a lowercase PDF name, and the path must be one of the four approved deliverables. Every guard is mutation-tested. dispatchRecipient took nine positional parameters and would have taken ten, so its message-shaped arguments collapse into one object. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
enabled auto-merge (squash)
September 9, 2026 17:24
Contributor
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.
What
The whitepaper fulfillment email ("Here is the guide you requested") pointed at a URL. It now carries the guide as an attachment, with the link kept underneath as a fallback.
New body:
Subjects stay per-paper. The link is kept because corporate mail gateways do strip PDF attachments from an unfamiliar sender, and a link-free email would leave those recipients with nothing. It is still one link, still an approved one, so
campaignDraftViolationspasses unchanged.How
Resend's
attachments[].pathtakes a hosted URL and Resend fetches the bytes itself. So no PDF flows through the lifecycle function, nothing is bundled, and the attachment is always whatevergenerate-whitepaper.tslast deployed. The alternatives — inlining ~1.4 MB of base64 per send, or shipping the four PDFs inside the lifecycle artifact where they would drift from the website's generated copies — both cost more than they buy.Attachment filenames match the ones
WhitePaperForm.tsxputs on the on-page download.The guard
Resend performs that fetch under the Threadplane sender, so the attachment is a closed registry, not a free-form field — the same shape as the existing
campaignTemplatehandling, and validated in the same place, after authorization, because the rule depends on the authorizedjob.kind:fulfillmail may carry an attachment (send_stepthrows)filenamemust match/^[a-z0-9]+(?:-[a-z0-9]+)*\.pdf$/pathmust be one of the four approvedthreadplane.aideliverablesNo code path can talk Resend into fetching an arbitrary URL on our behalf.
Failure behavior
If Resend cannot fetch the PDF it returns an error, and the existing
classifyResendProviderErrorsplit applies unchanged: 4xx marks the jobprovider_rejected, 5xx/429 marks it unknown. No new retry path was added — a missing deliverable is something to hear about, not to silently retry.Cleanup
dispatchRecipienttook nine positional parameters and would have taken ten. Its message-shaped arguments collapse into one object. Two call sites, same file.Verification
apps/lifecycle— 313 passed (was 305)libs/growth— 547 passednx lint lifecycle growth— 0 errorsnx check lifecycle(tsc + Dawn) — greennx build growth— greenEvery guard was mutation-tested rather than assumed. Seven mutants, all killed:
send.tsdrops the attachmentNote that this ships behind the lifecycle app's own Vercel project, which
ci.yml's promote job does not cover — worth a live send check after deploy.🤖 Generated with Claude Code