Skip to content

fix(plans): treat trialing subscriptions as active in web plan-guard - #285

Merged
gkhngyk merged 1 commit into
mainfrom
fix/trialing-treated-as-active
Jun 22, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
fix/trialing-treated-as-active

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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() in web/src/lib/guards/plan-guard.ts gated on subscription_status === 'active':

if (data?.subscription_status !== 'active') {
  return getPlan('starter');
}

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 (isSubscriptionActive in server/src/config/plans.js = active || trialing, with a comment saying exactly this) — the web side had drifted.

Because getOrgPlan backs every web-side entitlement gate, the downgrade wasn't limited to team seats — it also affected maxBrands, maxPrompts, maxPlatforms, and the daily_monitoring feature for any trialing org.

Fix. Add isSubscriptionActive(status) to web/src/config/plans.ts (mirroring the server), and use it in getOrgPlan so 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 feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. An org with plan = 'growth' and subscription_status = 'trialing'.
  2. Before: Settings → Team shows "Starter", 1 seat, invite blocked. After: shows "Growth", 3 seats, invite works.
  3. Same org can now create brands/prompts/platforms up to the Growth limits during the trial.
  4. A canceled/past_due/inactive org still correctly falls back to starter limits.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

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.
@gkhngyk
gkhngyk merged commit e368662 into main Jun 22, 2026
4 checks passed
@gkhngyk
gkhngyk deleted the fix/trialing-treated-as-active branch June 22, 2026 06:33
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.

1 participant