-
Notifications
You must be signed in to change notification settings - Fork 0
fix(audit-sprint-6a): make the Scale tier sellable #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
ejay-dev
wants to merge
1
commit into
fix/audit-sprint-4b-plan-catalog
from
fix/audit-sprint-6a-scale-provisioning-v2
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
31 changes: 31 additions & 0 deletions
31
supabase/migrations/20260624020_audit_sprint6a_scale_tier_check.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| -- Sprint 6a — make the Scale tier sellable. | ||
| -- | ||
| -- The 2026-05-23 audit deep-dive caught that `scale` was advertised in | ||
| -- marketing for $1,800/mo but unsellable at the DB level: the | ||
| -- org_subscriptions_plan_key_check CHECK constraint rejected any row | ||
| -- with plan_key='scale'. End-to-end: | ||
| -- | ||
| -- 1. STRIPE_PRICE_SCALE was already in productionRequiredKeys | ||
| -- (scripts/check-env.js:65) — env scaffolding ready. | ||
| -- 2. STRIPE_PRICE_ENV['scale'] = 'STRIPE_PRICE_FOUNDATION'... wait | ||
| -- no, that's basic. Scale maps to STRIPE_PRICE_SCALE (lib/plans.ts | ||
| -- already correct). | ||
|
Comment on lines
+10
to
+12
|
||
| -- 3. PLAN_CATALOG.scale exists with $1,800 monthly (lib/plans.ts). | ||
| -- 4. The DB CHECK rejected it. THIS migration fixes that. | ||
| -- | ||
| -- Also tightens documentation: the existing comment on the constraint | ||
| -- (added by 20260616_org_subscriptions_plan_key_check.sql) implied the | ||
| -- catalog was basic|pro|enterprise. After this migration that's wrong. | ||
|
Comment on lines
+16
to
+18
|
||
|
|
||
| ALTER TABLE public.org_subscriptions | ||
| DROP CONSTRAINT IF EXISTS org_subscriptions_plan_key_check; | ||
|
|
||
| ALTER TABLE public.org_subscriptions | ||
| ADD CONSTRAINT org_subscriptions_plan_key_check | ||
| CHECK (plan_key = ANY (ARRAY['basic'::text, 'pro'::text, 'scale'::text, 'enterprise'::text])); | ||
|
|
||
| COMMENT ON CONSTRAINT org_subscriptions_plan_key_check ON public.org_subscriptions IS | ||
| 'Audit Sprint 6a (2026-05-23): scale tier added so the marketed ' | ||
| '$1,800/mo Scale plan is actually writable. Requires ' | ||
| 'STRIPE_PRICE_SCALE env var set in production — see scripts/check-env.js ' | ||
| 'productionRequiredKeys.'; | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
PLAN_CATALOG.scaleto onboarding choices makes users able to select Scale, but step 2 submission still callsvalidatePlan(planCandidate)insaveOrgDetails, andvalidatePlanonly acceptsbasic|pro|enterprise(lib/validators/organization.tsPLAN_OPTIONS). In practice, choosing Scale will be rejected as invalid and redirect back witherror=1, so the tier remains unsellable through onboarding despite the UI change.Useful? React with 👍 / 👎.