fix(error-reporting): silence ValidationError for invalid trace IDs#1226
fix(error-reporting): silence ValidationError for invalid trace IDs#1226sentry[bot] wants to merge 1 commit into
Conversation
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6284299. Configure here.
| "validation_error", | ||
| ); | ||
| }); | ||
|
|
There was a problem hiding this comment.
Stale ValidationError capture tests
Medium Severity
Silencing ValidationError in classifySilenced makes reportCliError return before withScope, but the integration tests at lines 491–526 still use capturedScopeTags with ValidationError and expect cli_error.* tags from the capture path. Those expectations no longer match behavior and the suite should fail.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 6284299. Configure here.
| // A ValidationError means the user supplied malformed input (e.g. a project | ||
| // slug where a 32-char hex trace ID was required). It is never a CLI bug — | ||
| // the CLI correctly rejects the input and displays an actionable message. |
There was a problem hiding this comment.
Bug: Silencing ValidationError causes reportCliError to return early, which will break new tests in this PR that expect Sentry tags to be set for this error type.
Severity: HIGH
Suggested Fix
The new tests for ValidationError tagging should be removed or modified. Since ValidationError is now intentionally silenced and not reported to Sentry with scope, the tests that assert on its Sentry scope tags are no longer valid. Alternatively, if tagging is still desired, the early return in reportCliError for silenced errors needs to be reconsidered.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/lib/error-reporting.ts#L95-L97
Potential issue: The pull request modifies `classifySilenced` to treat `ValidationError`
as a silenced error. This change causes the `reportCliError` function to return early,
before `Sentry.withScope` is called. However, the PR also introduces new integration
tests that rely on a `capturedScopeTags` helper function. This helper mocks
`Sentry.withScope` to verify that specific tags are set for `ValidationError`. Because
`Sentry.withScope` is no longer invoked for these errors, the tests will receive an
empty set of tags, causing their assertions to fail and breaking the test suite.
Also affects:
test/lib/error-reporting.test.ts:492~518
Did we get this right? 👍 / 👎 to inform future reviews.


Previously,
ValidationErrorinstances, specifically those arising from invalid trace IDs provided to commands likesentry.trace.view,sentry.trace.logs, andsentry.span.view, were being reported to Sentry as unhandled errors (CLI-1GP).The root cause was that the
classifySilenced()function insrc/lib/error-reporting.tsdid not explicitly recognizeValidationErroras a user-input error that should be silenced. This led to noise in Sentry for expected user mistakes.This fix addresses the issue by:
"validation_error"to theSilenceReasonunion type.ValidationErrorwithinclassifySilenced(), returning"validation_error"to prevent these errors from being reported.error-reporting.tsto reflect this new silencing rule.test/lib/error-reporting.test.tsto assert thatValidationErroris now correctly silenced.Fixes CLI-1GP
Comment
@sentry <feedback>on this PR to have Autofix iterate on the changes.