Skip to content

Keep Stripe selected when webhook cleanup fails - #1841

Merged
stefan-burke merged 1 commit into
mainfrom
fix-stripe-cleanup-activation
Jul 16, 2026
Merged

Keep Stripe selected when webhook cleanup fails#1841
stefan-burke merged 1 commit into
mainfrom
fix-stripe-cleanup-activation

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

  • save the Stripe key, webhook pair, and selected payment provider in one atomic batch
  • run old endpoint cleanup only after that durable activation
  • keep the previous provider and credentials when the atomic save fails
  • rename the shared Stripe test setup to match its activation behavior

This follows up on the final review thread from #1830, which merged while the fix was being verified.

Testing

  • deno task precommit
  • 263 focused Stripe, settings, and debug tests
  • strict lint and zero-duplication checks

Summary by CodeRabbit

  • Bug Fixes

    • Improved Stripe activation so payment-provider status stays synchronized with saved credentials.
    • Preserved the active Stripe provider when webhook cleanup fails.
    • Prevented inconsistent provider and webhook configuration after failed updates.
  • Tests

    • Expanded coverage for Stripe activation, webhook handling, credential persistence, and cleanup failure scenarios.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b263a7d8-7759-4aac-b856-a3223cae5f2a

📥 Commits

Reviewing files that changed from the base of the PR and between 1e7ab1b and 0b9a581.

📒 Files selected for processing (11)
  • src/features/admin/settings-stripe.ts
  • src/shared/db/settings.ts
  • test/lib/server-debug.test.ts
  • test/lib/server-settings/stripe.test.ts
  • test/lib/stripe/connection.test.ts
  • test/lib/stripe/core.test.ts
  • test/lib/stripe/provider.test.ts
  • test/lib/stripe/webhook-setup.test.ts
  • test/lib/stripe/webhook.test.ts
  • test/shared/db/stripe-settings.test.ts
  • test/test-utils/settings.ts

📝 Walkthrough

Walkthrough

Stripe credential persistence now activates Stripe as the selected payment provider, updates in-memory provider state, and uses the renamed activation helper across admin, database, and Stripe tests.

Changes

Stripe activation flow

Layer / File(s) Summary
Persist Stripe activation state
src/shared/db/settings.ts, test/shared/db/stripe-settings.test.ts
The Stripe writer now stores credentials and PAYMENT_PROVIDER together, while failure tests verify provider and credential state preservation.
Wire activation entrypoints
src/features/admin/settings-stripe.ts, test/test-utils/settings.ts
The admin save flow and shared test helper now call activate instead of credentials.
Validate admin cleanup behavior
test/lib/server-settings/stripe.test.ts
Cleanup-failure setup uses Stripe activation and verifies the payment provider remains Stripe.
Migrate Stripe test setup
test/lib/server-debug.test.ts, test/lib/stripe/*
Stripe-related tests replace setStripeCredentials with activateStripe while retaining existing assertions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main behavioral change: Stripe stays selected when webhook cleanup fails.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-stripe-cleanup-activation

Comment @coderabbitai help to get the list of available commands.

@stefan-burke
stefan-burke added this pull request to the merge queue Jul 16, 2026
Merged via the queue into main with commit 3222a51 Jul 16, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the fix-stripe-cleanup-activation branch July 16, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant