Skip to content

fix(cli)!: keep plan gates that carry no upgrade URL - #7760

Open
jgoux wants to merge 1 commit into
nextfrom
fix/plan-gate-without-upgrade-url
Open

jgoux wants to merge 1 commit into
nextfrom
fix/plan-gate-without-upgrade-url

Conversation

@jgoux

@jgoux jgoux commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

The Management API's entitlement_required body has an optional upgrade_url: the API leaves it out when it can't resolve the organization. The CLI treated a gate without a usable URL as no gate at all. The failure carried no entitlement, telemetry classified it from the bare status instead of plan_limit, and text mode printed no upgrade hint.

A gate with a valid feature now always keeps its entitlement.

  • upgrade_url is included only when it's a safe web URL, as before. A missing, non-web, credential-bearing or oversized URL now gives { feature } instead of dropping the gate, so an unsafe URL is still never printed.
  • The text hint without a URL reads Your organization's plan does not include this feature.
  • cli_upgrade_suggested fires with an empty org_slug, as it already did for a URL it couldn't parse.

Breaking change

In json and stream-json errors, error.entitlement can now be { "feature": "…" } without upgrade_url. Until now, entitlement appeared only with both fields. Consumers that use upgrade_url whenever entitlement is present should treat it as optional.

@jgoux
jgoux requested a review from a team as a code owner November 23, 2026 14:14
@jgoux
jgoux requested a review from kanadgupta November 23, 2026 14:14
@jgoux jgoux self-assigned this Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit 987ad4b against develop at ed02850 · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 247 ms 281 ms no real change (+13%, within normal variation)
supabase --help help 228 ms 224 ms no real change
supabase init init 230 ms 237 ms no real change
supabase migration new bench migration-new 242 ms 251 ms no real change
supabase config convert config-convert 248 ms 252 ms no real change
supabase config validate config-validate 247 ms 254 ms no real change
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 251 ms 254 ms no real change
supabase projects list projects-list 229 ms 234 ms no real change
supabase functions list --project-ref replayfixtureprojref functions-list 230 ms 232 ms no real change

API calls: unchanged for all 9 commands.

Binary size: 135.6 MB, unchanged.

Details: timing ranges, API calls per command, slowest phases

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 227-361 ms 221-328 ms +33 ms (+13%) within noise
supabase --help help 215-261 ms 210-300 ms -4 ms (-2%) within noise
supabase init init 221-271 ms 212-285 ms +7 ms (+3%) within noise
supabase migration new bench migration-new 218-291 ms 207-309 ms +9 ms (+4%) within noise
supabase config convert config-convert 205-356 ms 225-367 ms +4 ms (+2%) within noise
supabase config validate config-validate 230-266 ms 230-288 ms +7 ms (+3%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 239-275 ms 241-291 ms +3 ms (+1%) within noise
supabase projects list projects-list 205-262 ms 206-253 ms +5 ms (+2%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 219-241 ms 225-239 ms +2 ms (+1%) within noise

API calls per command

Command Workload Before After Endpoint changes
supabase --version version 0 0
supabase --help help 0 0
supabase init init 0 0
supabase migration new bench migration-new 0 0
supabase config convert config-convert 0 0
supabase config validate config-validate 0 0
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 2 2
supabase projects list projects-list 1 1
supabase functions list --project-ref replayfixtureprojref functions-list 2 2

Slowest phases

No command moved beyond noise, so there are no phase deltas.

Workflow run

Comment /bench to run the lightweight benchmark (this comment) again on the latest commit, or /bench full to also run the integration-heavy benchmark, which posts in its own comment.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

CLI reference prose guidance: snapshot supabase/supabase@ca8ee0b supplied to reviewers (advisory, not a style pass).

Machine-readable errors can now carry an entitlement without the upgrade URL required by stable v3.3.0, which can break consumers that rely on that field. SSO denials also lose the billing link when the previous lookup would have succeeded. The PR changes no CLI reference prose, and the supplied next-branch context shows no fundamental conflict.

Findings

Severity Location Category Sources Claim
🟠 MAJOR apps/cli/src/shared/output/normalize-error.ts:56 compatibility codex Consumers of json or stream-json errors that check for error.entitlement before validating or using upgrade_url can now fail while handling a plan denial. A response that previously omitted the entire entitlement can now emit an entitlement without the required URL.
🟡 MINOR apps/cli/src/command-internal/upgrade-suggest.ts:83 ux-regression claude For sso add, update, list, and remove, plan denials without an upgrade URL now skip a lookup that could supply the organization billing link and telemetry slug. When the handler forwards the entitlement, the hint omits the link and cli_upgrade_suggested carries an empty org_slug. The SSO 404 branches that discard the entitlement also lose the hint and event when the old lookup would have succeeded.
⚪ NIT apps/cli/src/shared/output/normalize-error.ts:18 documentation codex The upgradeHint JSDoc describes only the billing-link variant.
⚪ NIT apps/cli/src/command-internal/http-errors.unit.test.ts:138 test-quality codex The new assertion reads the entitlement through reflection, bypassing the TestStatusError field declaration.
⚪ NIT apps/cli/AGENTS.md:253 docs claude The contributor guide describes entitlement as an optional object containing both feature and upgrade_url. The URL is now optional within the object.

Findings outside the diff

  • 🟡 MINOR apps/cli/src/command-internal/upgrade-suggest.ts:83 — For sso add, update, list, and remove, plan denials without an upgrade URL now skip a lookup that could supply the organization billing link and telemetry slug. When the handler forwards the entitlement, the hint omits the link and cli_upgrade_suggested carries an empty org_slug. The SSO 404 branches that discard the entitlement also lose the hint and event when the old lookup would have succeeded.
  • ⚪ NIT apps/cli/AGENTS.md:253 — The contributor guide describes entitlement as an optional object containing both feature and upgrade_url. The URL is now optional within the object.
Refuted findings (kept for transparency, not posted as review comments)
  • apps/cli/src/command-internal/http-errors.ts:136 (error-handling): When a branching denial omits the upgrade URL, text-mode users lose the organization billing link even when the existing fallback could resolve it.
    Refuted: The pre-PR branch handler already mapped the status error directly and had no billing lookup to lose. The changed unit test exercises the shared helper in isolation with a synthetic feature key. The actual callers that lose the fallback are the SSO handlers covered by claude-1.

Stats

Claude findings: 2 · Codex findings: 4 · Confirmed: 5 · Refuted: 1 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

@jgoux
jgoux force-pushed the fix/plan-gate-without-upgrade-url branch from 987ad4b to 5718fae Compare November 23, 2026 14:31
@jgoux jgoux changed the title fix(cli): keep plan gates that carry no upgrade URL fix(cli)!: keep plan gates that carry no upgrade URL Nov 23, 2026
@jgoux
jgoux changed the base branch from develop to next November 23, 2026 14:31
@jgoux

jgoux commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

On the AI review's findings outside the diff:

  • 🟡 upgrade-suggest.ts:83, SSO denials lose the billing link: deferred. The API leaves upgrade_url out only when it can't resolve the organization. The old fallback looked up that same organization through the project, so it would usually fail at the same step and has no link to recover. The SSO 404 branches already drop the entitlement when a URL is present, so that gap predates this PR. The 404 path is the generated SSO commands' concern once they replace these handlers.
  • ⚪ apps/cli/AGENTS.md:253, entitlement shape: fixed in 5718fae. The guide now documents entitlement: { feature, upgrade_url? }.

The Management API omits upgrade_url from an entitlement_required body
when it cannot resolve the organization. The CLI dropped such gates, so
the error had no entitlement, telemetry did not classify it as plan_limit,
and no upgrade hint printed. A gate with a valid feature now keeps its
entitlement, with upgrade_url only when it is a safe web URL, and the text
hint omits the upgrade link when there is none.

BREAKING CHANGE: in json and stream-json errors, `error.entitlement` can
now be `{ feature }` without `upgrade_url`.
@jgoux
jgoux force-pushed the fix/plan-gate-without-upgrade-url branch from d9374a6 to ea538eb Compare December 3, 2026 14:21

This branch has not been deployed

No deployments
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