-
-
Notifications
You must be signed in to change notification settings - Fork 10
fix(errors): surface user search-query 400s as ValidationError, keep CLI-built 400s reported (CLI-FA) #1154
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
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| import { | ||
| AuthError, | ||
| stringifyUnknown, | ||
| toSearchQueryError, | ||
|
Check warning on line 25 in src/commands/log/list.ts
|
||
| ValidationError, | ||
| } from "../../lib/errors.js"; | ||
| import { | ||
|
|
@@ -180,6 +181,9 @@ | |
| ...timeRangeToApiParams(timeRange), | ||
| sort: flags.sort, | ||
| extraFields: flags.fields, | ||
| }).catch((error: unknown): never => { | ||
|
Check warning on line 184 in src/commands/log/list.ts
|
||
| // An unparseable user --query is a user input mistake, not a CLI bug. | ||
| throw toSearchQueryError(error, flags.query); | ||
|
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. Log follow mode missing handlerMedium Severity Non-follow fetches use Reviewed by Cursor Bugbot for commit a44094d. Configure here. |
||
| }); | ||
|
|
||
| const periodLabel = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
| hasPreviousPage, | ||
| resolveCursor, | ||
| } from "../../lib/db/pagination.js"; | ||
| import { toSearchQueryError } from "../../lib/errors.js"; | ||
|
Check warning on line 23 in src/commands/span/list.ts
|
||
| import { | ||
| type FlatSpan, | ||
| formatSpanTable, | ||
|
|
@@ -390,6 +391,9 @@ | |
| ...timeRangeToApiParams(timeRange), | ||
| extraFields: extraApiFields, | ||
| allProjects: true, | ||
| }).catch((error: unknown): never => { | ||
| // An unparseable user --query is a user input mistake, not a CLI bug. | ||
| throw toSearchQueryError(error, flags.query); | ||
|
Check warning on line 396 in src/commands/span/list.ts
|
||
|
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. Span project mode missing handlerMedium Severity
Reviewed by Cursor Bugbot for commit a44094d. Configure here. |
||
| }) | ||
| ); | ||
|
|
||
|
Comment on lines
391
to
399
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. Bug: The Suggested FixWrap the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import { | |
| hasPreviousPage, | ||
| resolveCursor, | ||
| } from "../../lib/db/pagination.js"; | ||
| import { toSearchQueryError } from "../../lib/errors.js"; | ||
|
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. User-query 400s in log/list, span/list, event/list, and issue/events now falsely reported to Sentry as CLI bugs Removing Evidence
Also found at 2 additional locations
Identified by Warden find-bugs · DS5-SH4
Member
Author
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. Good catch — fixed in a44094d. Wired |
||
| import { formatTraceTable } from "../../lib/formatters/index.js"; | ||
| import { filterFields } from "../../lib/formatters/json.js"; | ||
| import { CommandOutput } from "../../lib/formatters/output.js"; | ||
|
|
@@ -289,6 +290,9 @@ export const listCommand = buildListCommand("trace", { | |
| sort: flags.sort, | ||
| cursor, | ||
| ...timeRangeToApiParams(timeRange), | ||
| }).catch((error: unknown): never => { | ||
| // An unparseable user --query is a user input mistake, not a CLI bug. | ||
| throw toSearchQueryError(error, flags.query); | ||
| }) | ||
| ); | ||
|
|
||
|
|
||


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.
executeTraceSingleFetchskipstoSearchQueryError, leaving user-query 400s as rawApiErrorin trace modeIn
log/list.ts,executeSingleFetchwraps itslistLogscall with.catch((error) => { throw toSearchQueryError(error, flags.query); })so an invalid user--querysurfaces as an actionableValidationErrorinstead of being reported to Sentry as a CLI bug. The parallelexecuteTraceSingleFetch(used bysentry log list <trace>) callslistTraceLogsat line 487 without this guard. A user-supplied--queryrejected by the server with a 400 parse error therefore surfaces as a rawApiError(400)and is misclassified as a CLI defect, getting reported to Sentry. The sibling commandtrace/logs.ts(line 213) wraps the identicallistTraceLogscall withtoSearchQueryError(error, flags.query), confirming the intended pattern. Fix: wrap thelistTraceLogscall inexecuteTraceSingleFetchwith.catch((error) => { throw toSearchQueryError(error, flags.query); }).Evidence
executeSingleFetch(log/list.ts:183-188) catcheslistLogsfailures and rethrows viatoSearchQueryError(error, flags.query).executeTraceSingleFetch(log/list.ts:487) awaitslistTraceLogs(org, traceId, { query, ... })with no.catch, so a parse-400 propagates unchanged.queryis built from the user value:buildProjectQuery(flags.query, projectFilter)(line 486), so an invalid user--queryreaches the endpoint.trace/logs.ts:206-214wraps the samelistTraceLogscall withtoSearchQueryError(error, flags.query), showing the guard was intended for trace-logs queries.Also found at 2 additional locations
src/commands/log/list.ts:184src/lib/telemetry.ts:364-366Identified by Warden find-bugs · SWM-6YD