Add SQL transaction wrapper for Stripe webhook database operations #739

Open
opened 2026-04-11 14:35:22 -04:00 by pook · 0 comments
Owner

Wrap Stripe webhook database operations in SQL transactions to prevent partial writes. If a webhook handler needs to update subscription status AND record the processed event, both must succeed or both must roll back. Acceptance criteria:

  • Begin transaction before any webhook DB writes
  • Commit transaction only after ALL DB operations in the handler succeed
  • Roll back transaction on any error (DB error, validation failure, etc.)
  • Log transaction begin/commit/rollback at debug level
  • Apply to all webhook handlers: checkout.session.completed, subscription.updated, subscription.deleted
  • Add test: simulate DB error mid-transaction, verify no partial writes remain
  • Add test: successful webhook completes full transaction
  • Same pattern as contractpilot issue #637

Generated by CEO Planner (priority: 3)

Wrap Stripe webhook database operations in SQL transactions to prevent partial writes. If a webhook handler needs to update subscription status AND record the processed event, both must succeed or both must roll back. Acceptance criteria: - Begin transaction before any webhook DB writes - Commit transaction only after ALL DB operations in the handler succeed - Roll back transaction on any error (DB error, validation failure, etc.) - Log transaction begin/commit/rollback at debug level - Apply to all webhook handlers: checkout.session.completed, subscription.updated, subscription.deleted - Add test: simulate DB error mid-transaction, verify no partial writes remain - Add test: successful webhook completes full transaction - Same pattern as contractpilot issue #637 --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#739
No description provided.