Skip to content

tests: Make billing lifecycle retries idempotent#9735

Closed
nishantmonu51 wants to merge 2 commits into
mainfrom
nishant/test-audit-billing-lifecycle
Closed

tests: Make billing lifecycle retries idempotent#9735
nishantmonu51 wants to merge 2 commits into
mainfrom
nishant/test-audit-billing-lifecycle

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator

Protect subscription changes and billing lifecycle workers from duplicate or partial side effects.

  • add stable provider idempotency keys for plan changes and credit rollover
  • finish credit transfer before changing the subscription plan
  • reject private plans before starting trial side effects
  • atomically claim overdue billing issues before notifications
  • make duplicate and out-of-order invoice events converge monotonically
  • continue processing organizations after recoverable per-org failures
  • test exact timing boundaries, partial hibernation, retry, and PostgreSQL concurrency behavior

Validation:

  • go test -short -race -count=1 -timeout=20m ./admin ./admin/billing ./admin/jobs/river ./admin/server

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. No documentation update is required.
  • Intend to cherry-pick into the release branch
  • I am proud of this work!

@nishantmonu51 nishantmonu51 changed the title Make billing lifecycle retries idempotent tests: Make billing lifecycle retries idempotent Jul 23, 2026
@nishantmonu51 nishantmonu51 added the tests Changes to tests and test infrastructure label Jul 23, 2026
@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

Temporarily closing to keep the first review wave focused. We will reopen this PR after #9730, #9731, and #9732 have merged. The branch is being retained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Changes to tests and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant