-
-
Notifications
You must be signed in to change notification settings - Fork 10
fix(explore): handle single -F flag as array to prevent TypeError #1218
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 |
|---|---|---|
|
|
@@ -713,7 +713,7 @@ | |
| const userSuppliedFields = flags.field && flags.field.length > 0; | ||
| let fieldList = [...defaultFieldsForDataset(dataset)]; | ||
| if (userSuppliedFields) { | ||
| fieldList = flags.field; | ||
| fieldList = Array.isArray(flags.field) ? flags.field : [flags.field]; | ||
|
Check warning on line 716 in src/commands/explore.ts
|
||
|
Contributor
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. Bug: The Suggested FixEnsure that Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews.
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. Incomplete field array coercionHigh Severity The single Additional Locations (2)Reviewed by Cursor Bugbot for commit 487dba7. Configure here. |
||
| } | ||
| const timeRange = flags.period; | ||
| const environment = parseReplayEnvironmentFilter(flags.environment); | ||
|
|
||


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.
Single
-Fflag still causes TypeError inappendFieldHintsviaappendFlagHintsThe fix normalizes
flags.fieldintofieldListbut leaves the rawflags.fieldstring un-normalized.appendFlagHintsis called withhintFlags = { ...flags, dataset }, sohintFlags.fieldremains the bare string, which is passed toappendFieldHints. There the string reachesfields.filter(...)(when--metricis active) orfieldList.join(",")(the common non-metric case) — both throwTypeErrorbecause strings lack those array methods, reproducing the same crash the PR set out to fix.Evidence
flags.fieldis typedstring[] | undefinedbut the CLI parser emits astringfor a single-Fflag (the PR's root cause).flags.fieldinto a localfieldList, but never mutates or re-bindsflags.fielditself.hintFlags = { ...flags, dataset }(line ~803) spreads the originalflags, sohintFlags.fieldstays the raw string.prevHint/nextHintare evaluated eagerly as arguments topaginationHint, soappendFlagHintsruns on every invocation regardless of pagination state.appendFieldHints,const fields = rawFields ?? []keeps the string; non-metric path hitsfieldList.join(",")and metric path hitsfields.filter(...), both throwing on a string.Identified by Warden find-bugs · PQ4-HKP