A subscription reconcile's Stripe calls ignore the caller's deadline #285

Closed
opened 2026-10-29 05:03:49 +00:00 by cgalo5758 · 1 comment
Owner

What happens

The subscription reconcile, which brings the console's record of a subscription in line with Stripe, reads the subscription from Stripe and may pause or clear its payment collection and release a spent schedule. None of these three calls carries a context. Each one therefore runs under stripe-go's defaults, an 80-second timeout and two retries, so about four minutes, whatever deadline its caller set. The webhook's one-minute attempt and the outbox's two-minute attempt bound the reconcile's database work, but neither bound reaches these calls.

What should happen

Each of the three calls carries the reconcile's context, and a test reads, through the Stripe mock, the deadline each call carried. A reconcile whose context ends then fails at its read from Stripe, as it already fails at its transaction.

Where

fetchSubscription (internal/fulfillment/reconcile.go), applyCollectionAction (internal/fulfillment/collection.go), and the release in releaseSpentSchedule (internal/fulfillment/reconcile.go)

Why it matters

A caller's time bound does not hold, and the switch of a paused subscription (#278) needs its restore of the pause bounded, so that a renewal cannot finalize while the subscription is unpaused.

### What happens The subscription reconcile, which brings the console's record of a subscription in line with Stripe, reads the subscription from Stripe and may pause or clear its payment collection and release a spent schedule. None of these three calls carries a context. Each one therefore runs under stripe-go's defaults, an 80-second timeout and two retries, so about four minutes, whatever deadline its caller set. The webhook's one-minute attempt and the outbox's two-minute attempt bound the reconcile's database work, but neither bound reaches these calls. ### What should happen Each of the three calls carries the reconcile's context, and a test reads, through the Stripe mock, the deadline each call carried. A reconcile whose context ends then fails at its read from Stripe, as it already fails at its transaction. ### Where `fetchSubscription` (`internal/fulfillment/reconcile.go`), `applyCollectionAction` (`internal/fulfillment/collection.go`), and the release in `releaseSpentSchedule` (`internal/fulfillment/reconcile.go`) ### Why it matters A caller's time bound does not hold, and the switch of a paused subscription (#278) needs its restore of the pause bounded, so that a renewal cannot finalize while the subscription is unpaused.
cgalo5758 added this to the Public launch milestone 2026-10-29 05:03:49 +00:00
cgalo5758 added the
kind
bug
area/billing
labels 2026-10-29 05:03:49 +00:00
Author
Owner

The subscription reconcile is the step that reads a subscription from Stripe and brings the console's records and entitlements in line with it. Each Stripe call it makes now carries its caller's context, so the call ends when the caller's deadline passes or the caller is cancelled, instead of running under the Stripe library's own 80-second timeout and two retries. Its calls are the read of the subscription, the release of a subscription schedule the console attached that has nothing left to do, the pause or clear of the subscription's payment collection made from the outbox (the console's queue of Stripe actions, retried in the background), and the list of a customer's latest subscription with which the checkout return (the dashboard a member lands on after paying at Stripe) starts. A webhook event's reconcile now ends with its one-minute attempt, an outbox entry's with its two-minute attempt, a member's plan change with the request's 32 seconds, and the checkout return's after its five seconds. A reconcile whose context has already ended fails at the read and writes nothing. A release or a collection change that a deadline cuts may still have reached Stripe; the next reconcile reads the subscription again and either finds the change made or makes it again. Tests read, through the Stripe mock, the deadline each call carried.

Commit: 84709d96

The subscription reconcile is the step that reads a subscription from Stripe and brings the console's records and entitlements in line with it. Each Stripe call it makes now carries its caller's context, so the call ends when the caller's deadline passes or the caller is cancelled, instead of running under the Stripe library's own 80-second timeout and two retries. Its calls are the read of the subscription, the release of a subscription schedule the console attached that has nothing left to do, the pause or clear of the subscription's payment collection made from the outbox (the console's queue of Stripe actions, retried in the background), and the list of a customer's latest subscription with which the checkout return (the dashboard a member lands on after paying at Stripe) starts. A webhook event's reconcile now ends with its one-minute attempt, an outbox entry's with its two-minute attempt, a member's plan change with the request's 32 seconds, and the checkout return's after its five seconds. A reconcile whose context has already ended fails at the read and writes nothing. A release or a collection change that a deadline cuts may still have reached Stripe; the next reconcile reads the subscription again and either finds the change made or makes it again. Tests read, through the Stripe mock, the deadline each call carried. Commit: 84709d96
Sign in to join this conversation.
No labels area/billing
kind
bug
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#285