Repository navigation
feat(cli): handle plan-gate denials centrally - #7441
Draft
pamelachia wants to merge 6 commits into
Draft
pamelachia wants to merge 6 commits into
pamelachia wants to merge 6 commits into
Conversation
withCommandTelemetry captures cli_upgrade_suggested once, before cli_command_executed, when a failure carries the entitlement_required envelope's entitlement. Commands with no per-command wiring (branches unpause) now fire it too. suggestUpgrade keeps the event only on its entitlements-lookup fallback. vanity-subdomains check-availability keeps its no-event exception through a new trackUpgradeSuggested option. Errors carrying an entitlement classify as plan_limit, whether or not their class declares the field.
The text layer's fail prints the upgrade hint before the error message whenever the error carries the entitlement_required envelope's entitlement, so commands with no per-command wiring (branches unpause) print it too. suggestUpgrade prints only on its entitlements-lookup fallback. Handler tests assert the failure carries the entitlement.
The persistent-branch 402 carries the entitlement_required envelope, so the central hint, event and plan_limit cover it. A 4xx without the envelope no longer triggers the follow-up project and entitlements requests.
pamelachia
force-pushed
the
pamela/growth-1050-central-upgrade-event
branch
from
November 9, 2026 06:26
979e26a to
82f5088
Compare
Contributor
Author
|
Manual check from source against a Free-plan project (
|
pamelachia
force-pushed
the
pamela/growth-1050-central-upgrade-event
branch
from
November 9, 2026 08:09
82f5088 to
33a4c0e
Compare
This branch has not been deployed
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.
I moved plan-gate handling out of each command into shared code. Since #7271,
mapHttpErrorattachesentitlementfrom the Management API'sentitlement_requiredbody, so the upgrade hint, thecli_upgrade_suggestedevent and theplan_limitclassification now all come from that one field, with no per-command wiring and no extra requests.Changed:
withCommandTelemetrycapturescli_upgrade_suggested(same name, same{feature_key, org_slug}payload) after the command, just beforecli_command_executed. Commands that never had wiring, such asbranches unpause, now get both.vanity-subdomains check-availabilitynow fires the event too; its no-event exception only existed for parity with the removed Go CLI.gateMapError/suggestUpgradewrapping atbranches create/update, the fourdomainscommands and the threevanity-subdomainscommands.branches updateno longer fetches the project and org entitlements after a 4xx, since the persistent-branch 402 carries the envelope. Only the SSO commands keep the entitlements lookup.plan_limitfrom the envelope: an error carryingentitlementclassifies asplan_limitwhatever its class declares, so gated denials frombranches unpause,domains get/create/activate/reverifyandvanity-subdomains getmove fromapi_statustoplan_limit(fingerprint suffix:api_statusbecomes:plan_limit).Note: the event moved from mid-handler to post-run. Payload and identity stay the same; it uses the same capture context as
cli_command_executed.Linear