Repository navigation
feat: checkout recovery email - #4854
richiemcilroy wants to merge 9 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
hey @greptileai, please re-review the PR |
| export const checkoutRecoveryEmails = mysqlTable("checkout_recovery_emails", { | ||
| userId: nanoId("userId").notNull().primaryKey().$type<User.UserId>(), | ||
| checkoutSessionId: varchar("checkoutSessionId", { length: 255 }).notNull(), | ||
| sentAt: datetime("sentAt", { mode: "date" }).notNull(), | ||
| }); |
There was a problem hiding this comment.
Recovery table has no migration
checkout_recovery_emails has no generated migration, snapshot, or journal change. Enabling recovery on a database built from the committed migrations makes lastSentAt fail because the table does not exist. AGENTS.md requires these generated artifacts alongside every schema change. Run bun run db:generate and commit its output before merging.
Context Used: AGENTS.md (source)
Knowledge Base Used: Database schema and migrations
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/database/schema.ts
Line: 176-180
Comment:
**Recovery table has no migration**
`checkout_recovery_emails` has no generated migration, snapshot, or journal change. Enabling recovery on a database built from the committed migrations makes `lastSentAt` fail because the table does not exist. `AGENTS.md` requires these generated artifacts alongside every schema change. Run `bun run db:generate` and commit its output before merging.
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
**Knowledge Base Used:** [Database schema and migrations](https://app.greptile.com/-/switch-tenant?tenant=cap&next=%2Fcustom-context%2Fknowledge-base%2Fcapsoftware%2Fcap%2F-%2Fdocs%2Fdatabase-schema-and-migrations.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| <Text className="text-sm leading-6 text-black"> | ||
| I saw you started upgrading to Cap Pro but didn't get to the end. | ||
| You picked {choice}, and the button below takes you straight back | ||
| to it. |
There was a problem hiding this comment.
This adds marketing email copy to packages/database/emails/, but AGENTS.md says marketing and lifecycle copy belongs in the private marketing repository. This directory is reserved for transactional emails. Move the recovery copy to the required repository and keep only the necessary runtime connection here. This repository requirement must be satisfied before merging.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/database/emails/checkout-recovery.tsx
Line: 47-50
Comment:
**Marketing copy lives here**
This adds marketing email copy to `packages/database/emails/`, but `AGENTS.md` says marketing and lifecycle copy belongs in the private marketing repository. This directory is reserved for transactional emails. Move the recovery copy to the required repository and keep only the necessary runtime connection here. This repository requirement must be satisfied before merging.
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
hey @greptileai, please re-review the PR |
|
hey @greptileai, please re-review the PR |
When a Cap Pro checkout expires, Cap can now send one short follow-up email that links straight back to checkout with the same plan and seats.
What changes
checkout.session.expired. It sends only when the session belongs to an existing Cap account that is not on Pro (own subscription, Pro seat or license), has no newer checkout or purchase since, has not had this email in the last 30 days, and is subscribed to Cap emails. Guests without an account get nothing.checkoutSourcetag on the Stripe session and in the checkout and purchase analytics events.Rollout
CHECKOUT_RECOVERY_EMAILS=trueto enable.checkout.session.expiredevent added.checkout_recovery_emailstable.Testing
Confidence Score: 4/5

The latest ordering fix looks sound, but the missing migration and the repository requirement for marketing copy still need to be addressed before merging.
Findings
Fix with agent prompt
Summary
Adds an opt-in checkout recovery email with the buyer’s plan and seats, consent checks, signed unsubscribe links, and recovery attribution.
Reviews (3) · Last reviewed commit: "fix: break ties between checkouts create..." · Reviewed by Greptile