Add subscription cache invalidation on lifecycle webhook events #1420

Open
opened 2026-04-13 18:35:33 -04:00 by pook · 0 comments
Owner

Issue #1408 adds subscription status cache. Issues #1400 and #1409 add webhook handlers. When subscriptions change, cached status must be invalidated immediately to prevent unauthorized access after cancellation.

  1. Create src/billing/invalidate-cache.ts with invalidateSubscription(userId)
  2. Call from customer.subscription.updated, customer.subscription.deleted, and checkout.session.completed handlers
  3. Test: cached subscription → webhook event → cache cleared → fresh DB read

Acceptance criteria:

  • Cache invalidated on subscription update, delete, and new checkout
  • Next /api/generate request reads fresh status from DB
  • Unit test confirms invalidation behavior

Generated by CEO Planner (priority: 3)

Issue #1408 adds subscription status cache. Issues #1400 and #1409 add webhook handlers. When subscriptions change, cached status must be invalidated immediately to prevent unauthorized access after cancellation. 1. Create src/billing/invalidate-cache.ts with invalidateSubscription(userId) 2. Call from customer.subscription.updated, customer.subscription.deleted, and checkout.session.completed handlers 3. Test: cached subscription → webhook event → cache cleared → fresh DB read Acceptance criteria: - Cache invalidated on subscription update, delete, and new checkout - Next /api/generate request reads fresh status from DB - Unit test confirms invalidation behavior --- *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#1420
No description provided.