Skip to content

feat(telemetry): track upgrade suggestion shown on 402 errors#5049

Merged
avallete merged 4 commits intodevelopfrom
feat/cli-upgrade-suggested-telemetry
Apr 8, 2026
Merged

feat(telemetry): track upgrade suggestion shown on 402 errors#5049
avallete merged 4 commits intodevelopfrom
feat/cli-upgrade-suggested-telemetry

Conversation

@pamelachia
Copy link
Copy Markdown
Contributor

@pamelachia pamelachia commented Apr 8, 2026

Summary

Adds a cli_upgrade_suggested PostHog event that fires whenever the CLI displays a billing upgrade link after receiving a 402 Payment Required response. This lets us measure how often users hit plan-gated features from the CLI and size the upgrade conversion opportunity.

Changes

  • Add EventUpgradeSuggested (cli_upgrade_suggested) event constant with feature_key and org_slug properties to telemetry catalog
  • Change SuggestUpgradeOnError to return (string, bool) providing the resolved org slug and whether a 402 was detected
  • Wire telemetry capture into branches create and branches update error paths, passing both feature_key and org_slug

Testing

Tested locally:

  • All TestSuggestUpgradeOnError subtests pass, including (string, bool) return assertions
  • All internal/branches/... tests pass (create, update, delete, list, etc.)
  • All internal/telemetry/... tests pass
  • No import cycle (telemetry event fired from callers, not from utils package)

Linear

  • fixes GROWTH-757

@pamelachia pamelachia requested a review from a team as a code owner April 8, 2026 07:24
@pamelachia pamelachia self-assigned this Apr 8, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 8, 2026

Coverage Report for CI Build 24125911620

Coverage decreased (-0.05%) to 63.79%

Details

  • Coverage decreased (-0.05%) from the base build.
  • Patch coverage: 10 uncovered changes across 2 files (16 of 26 lines covered, 61.54%).
  • 5 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
internal/branches/create/create.go 10 5 50.0%
internal/branches/update/update.go 10 5 50.0%

Coverage Regressions

5 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
internal/utils/git.go 5 57.14%

Coverage Stats

Coverage Status
Relevant Lines: 15330
Covered Lines: 9779
Line Coverage: 63.79%
Coverage Strength: 6.89 hits per line

💛 - Coveralls

@avallete avallete merged commit 31a59cb into develop Apr 8, 2026
10 checks passed
@avallete avallete deleted the feat/cli-upgrade-suggested-telemetry branch April 8, 2026 08:42
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.

3 participants