Skip to content

fix(backend): gate hosted users without a stripe subscription - #2780

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/gate-unpaid-accounts-51f1
Aug 14, 2026
Merged

fix(backend): gate hosted users without a stripe subscription#2780
cursor[bot] merged 2 commits into
mainfrom
cursor/gate-unpaid-accounts-51f1

Conversation

@tyler-dane

@tyler-dane tyler-dane commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Google OAuth for an email that already has a Compass user is a SIGNIN (session remapped; existing calendars stay). The Start-trial gate never appeared because missing billing, none, and local/backfill trialing rows were writable.

Hosted users without a Stripe subscription id now derive as awaiting_checkout (read-only). A trial starts only via Stripe Checkout. Self-host is unchanged (billing.isConfigured: false keeps the app open).

backfill-billing stamps awaiting_checkout instead of a local 7-day trial.

Follow-up: creating a Stripe customer no longer leaves a billing document without subscriptionStatus (that used to fail Zod parse and fail-open the client gate).

Simplicity

Derivation-only for existing unpaid rows; no Mongo migration. Customer create stamps awaiting_checkout only when status is missing or none.

Automated validation

  • bun test:backend: 345 pass, 1 skip (first commit)
  • Focused billing tests after the P1 fix: 26 pass
  • bun test:scripts: 33 pass
  • bun type-check: pass
  • bun lint: pass (pre-existing warnings only)

Staging Google OAuth cannot be finished from this agent. After deploy, the same sign-in should keep calendars and show Start your 7-day trial.

Independent review

Approve after fixing P1: a customer-only billing document must not drop the client gate. No remaining P0/P1.

Test plan

  • bun test:backend
  • bun test:scripts
  • bun type-check
  • bun lint
  • bun packages/scripts/src/testing/test-mongo-env.ts backend -- on the four billing files after the P1 fix
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 14, 2026 03:38
Treat missing billing, none, and local trialing rows as awaiting_checkout
so existing accounts see the Start-trial gate until Checkout succeeds.

Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
A customer-only billing document used to fail Zod parse on /billing/status
and fail-open the client gate. Derive missing status as awaiting_checkout
and stamp it when creating the Stripe customer.

Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
@tyler-dane
tyler-dane marked this pull request as ready for review August 14, 2026 04:04
@cursor
cursor Bot merged commit d9cb6f8 into main Aug 14, 2026
20 checks passed
@cursor
cursor Bot deleted the cursor/gate-unpaid-accounts-51f1 branch August 14, 2026 04:06
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.

2 participants