Repository navigation
fix(plans): treat trialing subscriptions as active in web plan-guard - #285
Merged
Merged
Conversation
getOrgPlan() gated on subscription_status === 'active', so an org in its paid free trial (status 'trialing') was silently dropped to starter limits even though its plan is growth/enterprise. That downgraded every web-side gate built on getOrgPlan — team seats (the reported symptom: a trialing Growth org saw 'Starter' with 1 seat and couldn't invite), plus maxBrands, maxPrompts, maxPlatforms, and daily_monitoring. Add isSubscriptionActive() to web config/plans.ts (active || trialing), mirroring the server's helper, and use it in getOrgPlan so trial customers get their actual plan's limits. Keeps web and server entitlement logic in sync.
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
A customer on a Growth plan in their free trial couldn't invite teammates — the Team section showed Starter with 1 seat, even though billing (and the DB) correctly showed Growth.
Root cause.
getOrgPlan()inweb/src/lib/guards/plan-guard.tsgated onsubscription_status === 'active':A paid plan inside its trial window has
subscription_status === 'trialing', which fails that check and falls through to starter limits. The server already treats trialing as active (isSubscriptionActiveinserver/src/config/plans.js=active || trialing, with a comment saying exactly this) — the web side had drifted.Because
getOrgPlanbacks every web-side entitlement gate, the downgrade wasn't limited to team seats — it also affectedmaxBrands,maxPrompts,maxPlatforms, and thedaily_monitoringfeature for any trialing org.Fix. Add
isSubscriptionActive(status)toweb/src/config/plans.ts(mirroring the server), and use it ingetOrgPlanso trialing orgs get their real plan's limits. Keeps web and server entitlement logic in sync.Related issue
None — reported by a customer (trialing Growth org couldn't invite).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
plan = 'growth'andsubscription_status = 'trialing'.canceled/past_due/inactiveorg still correctly falls back to starter limits.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)