GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — fix(billing): checkout guard, admin panel case by icecrasher321 · Pull Request #6641 · simstudioai/sim Conversation
Contributor
SummaryPrevent Stripe webhooks from rebinding an existing local row to a different Stripe subscription. Type of Change
TestingTested manually Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PR SummaryHigh Risk Overview Pending payment guard blocks a new checkout when the reference already has an Stripe adapter guard now refuses updates that rebind an existing local subscription row to a different Enterprise provisioning on correlated issuance sweeps the owner’s attachable personal workspaces into the new org (with locks, identity lock, stable workspace-set check, cache invalidation), and retries if the workspace set changes mid-reconciliation. Diagnostics: subscription/reference mismatch errors mention the bound reference explicitly. Reviewed by Cursor Bugbot for commit 89877b4. Configure here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Greptile SummaryThe PR adds database-backed checkout admission fencing and bound-incomplete-subscription checks, while tightening Stripe subscription binding and Enterprise workspace reconciliation.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported concurrent checkout race is addressed by an atomic database claim keyed by billing reference, with claim-token-fenced release preventing stale requests from releasing newer claims.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/auth/auth.ts | Wraps subscription upgrades in a database-backed checkout-admission claim spanning authorization and Stripe Checkout creation. |
| apps/sim/lib/billing/checkout-admission.ts | Adds reference resolution and short-lived, token-fenced database leases that serialize checkout creation. |
| apps/sim/lib/billing/authorization.ts | Rejects personal and organization checkouts while a bound incomplete Stripe subscription remains pending. |
| apps/sim/lib/auth/stripe-adapter-guard.ts | Prevents existing local subscription rows from being rebound to a different Stripe subscription ID. |
| apps/sim/lib/billing/webhooks/enterprise.ts | Reconciles eligible Enterprise-owner workspaces into the organization under workspace, organization, and billing-identity locks. |
sequenceDiagram
participant Client
participant Auth as Better Auth hooks
participant Lease as Checkout admission DB
participant Stripe as Stripe plugin
participant DB as Subscription DB
Client->>Auth: POST /subscription/upgrade
Auth->>Lease: Atomically claim billing reference
alt Claim already held
Lease-->>Auth: Conflict
Auth-->>Client: Checkout already starting
else Claim acquired
Auth->>DB: Check bound incomplete subscription
Auth->>Stripe: Prepare local row and create Checkout
Stripe-->>Auth: Checkout result
Auth->>Lease: Release with fencing token
Auth-->>Client: Checkout response
end
Reviews (3): Last reviewed commit: "fix(billing): release checkout admission..." | Re-trigger Greptile
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
cad7f04 to
485d1ab
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cursor review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cursor review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 89877b4. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
89877b42
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.