feat(plan-gate): wire billing links into remaining plan-gated commands#5066
Open
pamelachia wants to merge 7 commits intodevelopfrom
Open
Conversation
…k when confirmed gated Previously SuggestUpgradeOnError only triggered on 402. Many plan-gated endpoints return 400 or 404 instead. Now checks entitlements on any non-2xx and only sets CmdSuggestion when hasAccess is confirmed false, preventing false positives.
Aligns variable name with the new semantics: SuggestUpgradeOnError now checks entitlements on any non-2xx, not just 402.
Check org entitlements for auth.saml_2 on any non-2xx response from SSO provider endpoints. Shows billing upgrade link when the feature is confirmed gated, before falling through to existing error handling.
…ands when plan-gated Check org entitlements for vanity_subdomain on any non-2xx response. The platform API returns 400 when vanity subdomains are not available on the org's plan; the entitlements check confirms the gate before showing a billing upgrade link.
Coverage Report for CI Build 24284111986Coverage decreased (-0.3%) to 63.55%Details
Uncovered Changes
Coverage Regressions9 previously-covered lines in 5 files lost coverage.
Coverage Stats
💛 - Coveralls |
…heck to 4xx Two fixes: - branches/update passed flags.ProjectRef instead of the local projectRef resolved from the branch ID, causing entitlements to look up the wrong org - Restrict SuggestUpgradeOnError to 4xx client errors only (skip 2xx success and 5xx server errors) to avoid unnecessary API calls on server outages
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
Extends
SuggestUpgradeOnErrorto check org entitlements on any non-2xx API response (not just 402), then shows a billing upgrade link only when the entitlements API confirmshasAccess == false. Wires this into SSO and vanity-subdomain commands.Previously, only
branches createandbranches updatehad billing links. Many plan-gated endpoints return 400 or 404 instead of 402, so the old 402-only check missed them. The new approach catches all error codes while preventing false positives via entitlements confirmation.Changes
SuggestUpgradeOnErrorto trigger on any non-2xx, confirm gate via entitlements API before showing billing linksso create/update/list/removewithauth.saml_2entitlement checkvanity-subdomains activate/checkwithvanity_subdomainentitlement checkTesting
Tested locally:
go build ./...passesbranches,sso,vanity_subdomains,utils)branches create/updateDescoped (intentionally)
custom_domain,pitr.available_variants: addon-gated, not plan-gated (GROWTH-741)function.max_count:hasAccess: truefor all plans (numeric limit only)network-restrictions: not plan-gated (infra flag)branches delete: intentionally not gatedLinear