test(stripe): regression-guard webhook idempotency fence ordering (BUNYIP-210) #249
Loading…
Reference in a new issue
No description provided.
Delete branch "test/bunyip-210-webhook-fence-regression"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The BUNYIP-210 ordering fix (claim event as
processing, promote todoneonly after the handler succeeds, release the claim on failure) shipped in PR #233 but without the regression test the issue's suggested fix called for. Add it.Extract the fence's core decision out of
claim_webhook_eventinto a pureclassify_claim(won_claim, existing_status)so the regression-critical invariant is unit-testable without a live Postgres (CI runs--libtests with SQLX_OFFLINE and no database). The decision is unchanged: only adonerow may short-circuit a redelivery; a won claim isOwned; every other state (no row from a released claim, a stale/in-flightprocessingrow, any non-terminal status) routes toOwned/InFlightso Stripe's retry re-runs the handler instead of being swallowed with a bare 200. That swallow-the-retry behaviour is exactly what the old record-before-success fence got wrong.Derive
PartialEq/Eq/DebugonEventClaimfor the assertions and add three tests covering the non-done-never-skipped invariant, the legitimatedoneshort-circuit, and the won-claim-owns-the-work path.#BUNYIP-210