fix(cli): CliUserError for channel add missing API key
Closed
RI
18d ago+133+133+012345678901234567890123456789-2-2-0123456789
Summary (AI generated)
- Convert
channel addmissing API key toCliUserErrorso it is filtered from PostHog exception capture - Rebased onto latest
main; channel-create API failures stay plainErrorwith formatted API bodies (duplicate recovery + PostHog observability unchanged) - Extend PostHog tests to assert channel-create RBAC/duplicate failures remain captured; add
formatCapgoCliInvokeErrorcoverage
Motivation (AI generated)
PostHog issue channel add unhandled_error highlighted noisy tracking for expected CLI states. Review feedback confirmed channel-creation RBAC/duplicate failures must stay observable in error tracking — only missing API key should become CliUserError.
Business Impact (AI generated)
Keeps error tracking signal for real channel-create failures while silencing the common missing-key configuration state. Aligns with duplicate-channel recovery shipped on main.
Test Plan (AI generated)
-
bun run lint(cli) -
bun run test:posthog-exception -
bun run test:init-app-conflict -
bun run test:channel-add-exists - CI: Run Capgo CLI integration tests (pass — https://github.com/Cap-go/capgo.app/actions/runs/32851500650/job/97813355613)
- CI: full test matrix green (0 fail, 0 pending)
- CodeRabbit APPROVED (blocked on org rate limit — awaiting
@coderabbitai approve/ on-demand review)
Generated with AI


Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by CodeRabbit
- Bug Fixes
- Improved channel creation error handling for missing API keys and duplicate channel names.
- Added clearer CLI error messages for permission, Edge Function, infrastructure, and duplicate-channel failures.
- Improved recognition and reporting of channel name conflicts.
- Improved handling when a duplicate channel already exists but cannot be accessed.
- Improved consistency when reporting channel creation failures across different error conditions.