feat(billing): add operator pause switch for trial enforcement - #2782
Merged
Conversation
Adds `billing.enforcement` (default false/paused) so the trial/billing product can stay fully free for every user while Checkout, webhooks, and Stripe keys keep working behind the scenes. Fails open on a pending or errored /api/config fetch so a slow network never flashes a gate, and never stamps the anonymous trial clock while paused so flipping the switch on later doesn't retroactively burn days. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
billing.enforcement(defaultfalse/paused) as a global operator kill switch so the trial/billing product can stay free for every user while Checkout, webhooks, and Stripe keys keep working behind the scenes in an environment/api/configfetch, so a slow network never flashes a gate at a visitor before the real value loadsassertBillingAllowsWritesno-ops when paused even with valid Stripe keys presentbilling.enforcementaccepts a yaml boolean or a"true"/"false"string (mirrorssync.enforceLeastPrivilege'sBooleanFromInputpattern), since the deploy workflow injects it from a GitHub Environment var — a strict boolean-only schema would crash the entire backend on any casing typoBILLING_ENFORCEMENTGitHub Environment var →compass.yaml→/api/configNot in scope (flagged in docs/features/billing.md for enable day)
Existing hosted accounts are not grandfathered — flipping
enforcement: truewhile Stripe is configured will show any existing account without a Stripe subscription id theBillingGateModal.bun run cli backfill-billingis the existing lever if that's not the intended effect.Test plan
bun run type-check— cleanbun test:core, targetedbun test:backend(billing + config suites), full relevantbun test:websweep (billing, RootShell, Sidebar, AuthModal, auth) — all passing/code-review high(2 findings, both fixed) and/simplify(3 findings fixed, 1 knowingly skipped as out-of-scope)dev:webstandalone with no backend confirms the fail-open default posture (no trial gate, calendar fully usable)billing.enforcement: truein a localcompass.yamland confirm the trial chip/gate return🤖 Generated with Claude Code