Skip to content

Email survey finishers their answers and claim link - #6609

Open
brsbl wants to merge 1 commit into
web/community-survey-stickersfrom
web/community-survey-email
Open

brsbl wants to merge 1 commit into
web/community-survey-stickersfrom
web/community-survey-email

Conversation

@brsbl

@brsbl brsbl commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Finishers had no copy of their answers, and a sticker claim Shopify couldn't create had no way to recover. Layer 4 of 4.

What changed

  • Each finisher with a sticker claim gets one email: the claim button, then their filled-out survey.
  • A claim whose code exists is the email waiting to send, so a created code can't lose its email. There's no separate queue table.
  • Emails go through Resend with one idempotency key per submission. A sent email stamps the response (emailed_at) and unlinks the claim.
  • An hourly cron emails waiting claims, finishes pending claims and emails their links in the same run, and expires anything undelivered after 30 days.
  • The pending pass stops at the first Shopify auth or connection failure, so a run stays well inside the 15-minute cron limit.
  • One community_sticker_deliveries_stuck log line reports anything left undelivered.
  • The thank-you and repeat-send copy say whether the email was sent or is on its way.

How you verified

  • Tests run against a real D1 database with stubbed Shopify and Resend.
  • They cover delivery, a rate-limited send retried right away, emails retried past six runs with one key, a created claim whose request ended before sending, a pending claim finished after Shopify recovers, 30-day expiry, no email without a claim, a hanging Shopify that still lets due emails send, and the auth-failure log.
  • A real Resend send and a real Shopify code need the launch setup.
  • Remote CI: passed. Run

BB-Thread-ID: thr_yz6t8hi7s8

AGENT GENERATED

@brsbl
brsbl force-pushed the web/community-survey-email branch from fd00e87 to 54ef7f3 Compare October 29, 2026 23:26
@brsbl
brsbl force-pushed the web/community-survey-email branch from 54ef7f3 to b110951 Compare October 30, 2026 03:12
@brsbl
brsbl force-pushed the web/community-survey-email branch from b110951 to b0f54aa Compare October 30, 2026 03:41
@brsbl
brsbl force-pushed the web/community-survey-email branch from b0f54aa to ad67d49 Compare October 30, 2026 03:55
@brsbl
brsbl force-pushed the web/community-survey-email branch from ad67d49 to 4e7a3a7 Compare October 30, 2026 04:21
@brsbl
brsbl force-pushed the web/community-survey-email branch from 4e7a3a7 to 1f398e5 Compare October 30, 2026 04:24
@brsbl
brsbl added this pull request to stack #6625 October 30, 2026 04:38
@brsbl
brsbl force-pushed the web/community-survey-email branch 2 times, most recently from 18178e9 to 83eec1d Compare October 30, 2026 05:23
@brsbl
brsbl force-pushed the web/community-survey-email branch from 83eec1d to ef61512 Compare October 30, 2026 05:57
@brsbl
brsbl force-pushed the web/community-survey-email branch from ef61512 to 0e81fe3 Compare October 30, 2026 06:16
@brsbl
brsbl force-pushed the web/community-survey-email branch 2 times, most recently from 1cd695c to 22aae66 Compare October 30, 2026 06:50
@brsbl
brsbl force-pushed the web/community-survey-email branch from 22aae66 to 46c8c53 Compare October 30, 2026 07:04
@brsbl
brsbl force-pushed the web/community-survey-email branch from 46c8c53 to 09cd5a6 Compare October 30, 2026 07:09
@brsbl
brsbl force-pushed the web/community-survey-email branch from 09cd5a6 to 511f0e9 Compare October 30, 2026 08:40
@brsbl
brsbl force-pushed the web/community-survey-email branch 2 times, most recently from 980af85 to 592c5f6 Compare October 30, 2026 10:18
@brsbl
brsbl marked this pull request as ready for review October 30, 2026 10:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T10:28:29.113009Z 592c5f6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@brsbl
brsbl force-pushed the web/community-survey-email branch from 592c5f6 to 12e2e77 Compare October 30, 2026 11:01
@brsbl
brsbl force-pushed the web/community-survey-email branch from 12e2e77 to 93d8132 Compare October 30, 2026 11:38
A claim whose Shopify code exists is an email waiting to send: the worker
sends it through Resend right away, and an hourly job resends failures,
finishes pending claims and expires anything undelivered after 30 days.
Sent emails stamp the response and unlink the claim. One log line reports
stuck deliveries.

BB-Thread-ID: thr_yz6t8hi7s8

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

This branch has not been deployed

No deployments
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