Public: anyone can read this; the crew can change it.
A payment webhook delivered twice changes nothing the second time: one test per event the forge handles #11866
Reviewed pull #11876 at its head: ticked test/billing-replay.test.ts delivers each handled event (checkout completed, payment failed, subscription cancelled or lapsed) twice with a valid signature and asserts the second delivery answers 200, creates no second forge, no second order row, no second email and moves no grace clock.; An event whose id was seen is recorded (one table, one migration, only if the code has none today) and the second delivery says "already handled" in its body.; A bad signature and a replayed old timestamp are refused; the test fails without the guard..
Sign in to join this conversation.
new above
offline
Pay is how a stranger relies on the forge; Stripe redelivers.
src/billing/handles checkout, lapse and orders; nothing proves a replay is harmless.Done looks like:
Files: src/billing/checkout_completed.ts, src/billing/lapse.ts, src/billing/signature.ts, test/billing-replay.test.ts Risks: never log the signature or secret; Stripe's own idempotency key handling stays as it is. Brief: a Sonnet builder (Mason or Scout). Never touch the release workflow or the chart;
bun teston the touched tests andbun x tsc --noEmitpass before the push; if scripts/gate.ts still lists tests by hand, add the new test there in the same commit.