Skip to content

feat(backend): send Wrapper transactional email - #39

Merged
icanvardar merged 11 commits into
mainfrom
dev
Aug 25, 2026
Merged

feat(backend): send Wrapper transactional email#39
icanvardar merged 11 commits into
mainfrom
dev

Conversation

@icanvardar

@icanvardar icanvardar commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Land Relic's Resend email pipeline on production with Wrapper-branded templates (welcome, plan change, restriction, deletion).
  • Include Homebrew formula path, sign-in layout, privacy/Resend mention, and the polished mobile submodule pointer from dev.
  • Follow-up hardening so duplicate Autumn events cannot restart the grace window or resend plan emails.

Test plan

  • Quality gate and full CI lane are green
  • After merge, prod /webhook/autumn and /webhook/resend are no longer 404
  • Welcome and plan-change emails send from wrapper.sh in production

Note

Medium Risk
Touches billing webhooks, account lifecycle emails, and deletion flows; misconfigured secrets or webhook handling could affect plan state or duplicate notifications, though idempotency and claim/release logic reduce replay risk.

Overview
Adds Resend-backed transactional email on Convex: React Email templates (welcome, Pro upgrade, plan downgrade, access restricted, account deleted, collaborator), @convex-dev/resend integration, and sends tied to signup, Autumn plan changes, account deletion, and a daily cron for users still on Free seven days after downgrade.

Webhook HTTP routes on the Convex .site origin verify Svix signatures and idempotently process Autumn customer.products.updated (Pro upgrade/downgrade → internal plan handlers) and Resend delivery/bounce events (email state updates). New schema tables track emailState and processedWebhook claims; account deletion clears email state.

Release and docs: Homebrew tap workflow validates HOMEBREW_TAP_TOKEN against heycupola/homebrew-tap and installs CLI binaries from bin/ paths; env examples and ENVIRONMENTS.md document Autumn/Resend secrets and webhook URLs; OPERATIONS.md reflects current branch protection; privacy policy and sign-in UI mention Resend and rename social sign-in layout classes.

Reviewed by Cursor Bugbot for commit f824a8b. Bugbot is set up for automated code reviews on this repo. Configure here.

Port Resend, Autumn/Resend webhooks, and brand templates so welcome, billing, and deletion mail can go out in production. Also land the Homebrew formula install path, sign-in layout, and ops doc updates still sitting in the tree.
Keep generated API files aligned with oxfmt so the format check does not fail after the email pipeline codegen.
Claim Autumn and Resend events before side effects, keep the original grace window on duplicate downgrades, and drop the local Resend smoke script that hardcoded a personal inbox.
Overlapping Autumn cancel/expired/past_due jobs now serialize on the same emailState row, so only the first mutation is allowed to send.
…window

A failed in-flight send no longer clears a later claim after the user upgrades and downgrades again.
feat(backend): send Wrapper transactional email
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
wrapper-web Skipped Skipped Aug 25, 2026 12:25pm

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 454272d. Configure here.

Comment thread packages/backend/convex/appleNotifications.ts
Comment thread packages/backend/convex/user.ts
Skip the Apple-path deletion mail so Better Auth onDelete is the single sender, and claim the Pro upgrade mail when hasPro flips to true.
adapter.deleteOne does not run Better Auth onDelete, so Apple-only deletes must send the confirmation themselves. Upgrade mail is claimed with planUpgradedEmailSent and released if the send fails.
Unset planUpgradedEmailSent now means a legacy Pro user, not a retry. Failed sends set the flag to false so only those can claim again.
fix(backend): send plan and deletion emails only once
Comment thread packages/backend/convex/appleNotifications.ts
@icanvardar
icanvardar merged commit ced49d5 into main Aug 25, 2026
13 checks passed
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