fix(cli): stop error tracking for missing bundle versions - #2973
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
fix(cli): stop error tracking for missing bundle versions#2973posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
Throw CliUserError instead of a plain Error when a named bundle version is not found, so error tracking skips it. Move the app id and version out of the message and into the CliUserError context, so one problem stays one issue instead of one per version string. Covers `getVersionData` (used by channel set, bundle delete, bundle cleanup) and both throws in `deleteAppVersion`. Generated-By: PostHog Code Task-Id: 6571dd73-5da0-4970-a26a-9bc5bef6449a
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
|
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
getVersionDataincli/src/api/versions.tsthrew a plainErrorwhen the named bundle was not in the active list.isExpectedUserErroronly knew about bad API keys and not-yet-created apps, so this failure reached error tracking as an unhandled crash.channel set,bundle delete, andbundle cleanup.Fix — the same pattern PR #2885 and PR #2934 applied to auth failures and upload aborts:
throw new Error(\App version ${appid}@${bundle} doesn't exist`)`throw new CliUserError('App version doesn\'t exist', { appId, version })CliUserErroris skipped byshouldCapturePosthogExceptionviainstanceof, so error tracking no longer opens an issue.trackCommandFailedanalytics stay unchanged.CliUserErrorcontextobject, so the message is now constant and one problem stays one issue.deleteAppVersionget the same treatment.Test plan
cd cli && bun run lint— passes clean on the changed file.capgo channel set <channel> --bundle <version>with a version that was never uploaded. The CLI still printsApp version <app>@<version> doesn't existand exits non-zero, but no error tracking$exceptionissue is opened.Screenshots
Checklist
bun run lint:backend && bun run lint.accordingly.
my tests
Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.