-
-
Notifications
You must be signed in to change notification settings - Fork 10
fix(error-reporting): silence ValidationError from user input #1225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,8 @@ type SilenceReason = | |
| | "auth_expected" | ||
| | "api_user_error" | ||
| | "api_query_error" | ||
| | "network_error"; | ||
| | "network_error" | ||
| | "validation_error"; | ||
|
|
||
| /** | ||
| * Classify whether an error should be silenced. | ||
|
|
@@ -82,6 +83,12 @@ export function classifySilenced(error: unknown): SilenceReason | null { | |
| if (error instanceof ContextError) { | ||
| return "context_missing"; | ||
| } | ||
| // A ValidationError always means the user supplied an invalid argument value | ||
| // (e.g. an empty issue identifier). It is never a CLI bug, so silence the | ||
| // whole class to avoid noise from AI-agent callers passing bad input. | ||
| if (error instanceof ValidationError) { | ||
| return "validation_error"; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Over-broad ValidationError silencingMedium Severity The new branch treats every Reviewed by Cursor Bugbot for commit f48ea79. Configure here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Outdated silence classification testMedium Severity
Reviewed by Cursor Bugbot for commit f48ea79. Configure here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing validation field metricLow Severity Silenced Additional Locations (1)Reviewed by Cursor Bugbot for commit f48ea79. Configure here. |
||
| // All AuthError reasons are expected auth states the user must act on, not | ||
| // CLI bugs: `not_authenticated` (no token), `expired` (token aged out), and | ||
| // `invalid` (a bad/insufficiently-scoped token the user supplied). `invalid` | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: When a
ValidationErroris silenced, the recorded metric inrecordSilencedErroromits thefieldproperty, losing context about which validation rule failed.Severity: LOW
Suggested Fix
In
recordSilencedError(), add a condition to include thefieldattribute in the metric when the error is an instance ofValidationErrorand thefieldproperty is present. This should follow the existing pattern forContextError.resource. For example:if (error instanceof ValidationError && error.field) { attributes.field = error.field; }.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.