Repository navigation
feat(plans): gate Claude tracking to Enterprise per-customer opt-in on cloud - #423
Merged
Merged
Conversation
…n cloud
On cloud, API-model (Claude) tracking leaves Growth and becomes a
per-customer switch on Enterprise: both plans now set allowedModels: []
and a chosen customer is enabled by setting
organizations.plan_overrides = { "allowedModels": ["claude-sonnet-5"] },
which the existing override merge (web getOrgPlan / server
applyPlanOverrides) already folds into the effective limits. Self-host
resolves to the self_hosted plan and is untouched.
Enforcement covers every path: the dashboard layout now computes the
effective allowlist (overrides included) and threads it through
PlanProvider so the prompt pickers reflect per-customer state; the save
path already filtered via getOrgPlan; alignPromptsToPlanForOrg learns
about enterprise overrides so plan changes don't strip an enabled
customer's Claude; and the tracking worker filters prompt.models at run
time, so existing Growth prompts that still carry claude ids stop
producing API calls immediately without a data migration.
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
On cloud, API-model (Claude) tracking is no longer part of Growth and becomes a per-customer opt-in on Enterprise. Self-host is untouched (
isCloud() === falsealways resolves to the unrestrictedself_hostedplan).plans.ts+ serverplans.js, kept in sync): Growth and Enterprise both setallowedModels: []. Enabling a specific Enterprise customer is a single DB write —organizations.plan_overrides = { "allowedModels": ["claude-sonnet-5"] }— because the existing override merge (webgetOrgPlan, serverapplyPlanOverrides) already foldsplan_overridesinto the effective limits. No new mechanism.PlanProviderasallowedModelIds; the prompt pickers (brand prompts page, brands/new, suggestion card via prop) read it from context instead of the staticPLANS[planId], which can't see overrides.alignPromptsToPlanForOrgnow reads Enterpriseplan_overridesso an alignment run doesn't strip Claude from a customer we've enabled.prompt.modelsis filtered against the org's effective allowlist at run time (applyPlanOverridesexported from the server plan-guard), so stored arrays that still carry Claude ids stop producing API calls immediately on deploy — no data migration required. Task counting uses the filtered list, keeping the progress bar denominator accurate.Save-path enforcement needed no changes:
filterByPlanalready resolves throughgetOrgPlan.Notes
modelsarrays have already been cleaned up separately; this PR is the standing rule that keeps things consistent going forward.Related Issue
N/A — packaging change requested directly.
Type of Change
How to Test
NEXT_PUBLIC_IS_CLOUD=true/IS_CLOUD=true), Growth org → prompt create/edit dialogs show no Claude checkbox; saving a prompt withmodels: ["claude-sonnet-5"]via the action strips it.plan_overrides = {"allowedModels": ["claude-sonnet-5"]}on the Enterprise org → after reload, the Claude checkbox appears; saved prompts keep the model; a tracking run calls the Anthropic API.models: ["claude-sonnet-5"]directly in the DB → the tracking worker logsapi-model tracking plan-gated for this organd makes no Anthropic call; progress total excludes the skipped task.Checklist
npx tsc --noEmitpasses