fix(error-reporting): silence ContextError to stop crash reports (CLI-3B)#1149
Merged
Conversation
) ContextError is thrown when the user omits a required value — no org/project could be auto-detected, a required ID was not provided, etc. It is an expected user-input error, never a CLI bug, yet it was still reported to Sentry as an unhandled crash. This made it the single highest-volume issue (CLI-3B: ~2000 users / ~9000 events, plus CLI-CG, CLI-1BC, CLI-1BD). Classify ContextError as silenced in classifySilenced, mirroring the existing OutputError / expected-AuthError / 4xx-ApiError rules. Volume is preserved via the cli.error.silenced metric, now enriched with the ContextError resource so the missing value (e.g. "Organization and project" vs "Event ID") keeps sub-grouping context. Unlike ResolutionError — where a provided-but-unmatched value can signal a product/access issue worth observing — ContextError has nothing per-instance to investigate, so the whole class is silenced. Silenced errors also no longer mark the session as crashed, which keeps release-health from being skewed by missing-input errors.
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5133 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 81.53% 81.46% -0.07%
==========================================
Files 397 397 —
Lines 27682 27686 +4
Branches 17968 17972 +4
==========================================
+ Hits 22570 22553 -17
- Misses 5112 5133 +21
- Partials 1867 1861 -6Generated by Codecov Action |
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
ContextErroris thrown when the user omits a required value — noorg/project could be auto-detected, a required ID was not provided, etc. It is
an expected user-input error (per
AGENTS.md: "User omitted a required value →ContextError"), yet it was still reported to Sentry as an unhandled crash.
That made it the single highest-volume issue in the project:
Fix
Classify
ContextErroras silenced inclassifySilenced, mirroring theexisting
OutputError/ expected-AuthError/ 401–499ApiErrorrules:cli.error.silencedmetric, now enriched with theContextError.resourceso the missing value (e.g."Organization and project"vs"Event ID") keeps sub-grouping context.resourcevalues are asmall fixed set, so metric cardinality stays low.
errors stop skewing release-health.
Why the whole class (vs. opt-in like ResolutionError)
ContextErroralways means "you didn't provide X" — there is nothingper-instance to investigate. This differs from
ResolutionError, where aprovided value that can't be matched may signal a product/access issue worth
observing (which is why that class is silenced opt-in). The
cli.error.silencedmetric still records the volume and which value was missing.
Test plan
classifySilencedtests updated:ContextErrornow asserts"context_missing"(removed from the "does NOT silence" list).
reportCliErrorintegration:ContextErrornow asserts nocaptureExceptioncli.error.silencedmetric carryingerror_class,reason,resource.telemetrytest updated:ContextErroris silenced and does not mark thesession crashed.
vitest run test/lib/error-reporting.test.ts test/lib/telemetry.test.ts→ 183 passedbiome checkclean on changed filesFixes CLI-3B