Sync workspace Stripe seat billing - #6808
Merged
Merged
Conversation
✅ Deploy Preview for anarlog canceled.
|
ComputelessComputer
force-pushed
the
fix/anlg-215-workspace-billing-bridge
branch
from
August 16, 2026 08:11
2d57c66 to
1c4ec0b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1c4ec0b. Configure here.
ComputelessComputer
force-pushed
the
fix/anlg-215-workspace-billing-bridge
branch
from
August 16, 2026 08:18
1c4ec0b to
2cda0d6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Validation
bunx tsc --noEmitinapps/stripebun test --pass-with-no-testsinapps/stripe(41 passed)supabase db reseton OrbStacksupabase test db(39 files, 1080 tests)pnpm exec dprint fmtpnpm fmt:checkNote
High Risk
Changes payment reconciliation, workspace seat limits, and SECURITY DEFINER RPCs that can alter billing state; incorrect webhook handling could mis-cap seats or misreport billing.
Overview
Extends the Stripe billing bridge so workspace-owned customers (via
workspaceIdmetadata) reconcile Team plan seat limits from subscription webhooks, while user-owned customers keep the existing profile assignment and metadata repair path.syncBillingBridgeis refactored behind injectable dependencies and handlescustomer.subscription.deleted. Workspace events call a newsync_workspace_stripe_billingRPC (service role only) with seat updates derived from configured Team price IDs (STRIPE_TEAM_*, optional until checkout exists). The bridge throws on customer assignment conflicts and no-ops when the workspace row is missing.Customer metadata parsing adds
getCustomerOwner/ workspace aliases with strict agreement rules (user vs workspace ambiguity returns null).is_billedfor seat usage now requires an active or trialing Stripe subscription, not merely a bound customer ID.Reviewed by Cursor Bugbot for commit 2cda0d6. Bugbot is set up for automated code reviews on this repo. Configure here.