You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
code_search -l was parsing filenames as JSON and reporting zero matches. Parse filename output directly while preserving -l and the existing limits. Non-UTF-8 paths use base64, matching ripgrep's JSON output, so distinct filenames stay distinct.
All 33 existing tests and 14 additional local checks pass. SDK typecheck still has the same 6 existing errors as main.
Good catch — when flags contains -l/--files-with-matches, ripgrep's last-flag-wins semantics mean it emits a plain filename list instead of JSON lines, and the current parser silently drops every match. That's a legitimate defect worth porting.
The execution is where I'd push back. hasFilenameOutput() hand-rolls a chunk of ripgrep's CLI grammar: a hardcoded RIPGREP_VALUE_FLAGS set for long options, plus a second hardcoded string 'efEmjgdtTABCMr' for short options that consume a value. Both lists have to stay perfectly in sync with ripgrep's actual flag set (e.g. is -d really a value-taking short flag in rg? I don't think it exists at all), and any omission means either a glob/value gets misread as a flag toggle, or a real toggle gets swallowed as someone else's value. This is exactly the kind of code that needs dedicated unit tests for combined short options (-lin), split short options with embedded values (-eFOO vs -e FOO), glob-like tokens (-g*.html), and flags after --. The PR only reports that the existing 33 e2e-style tests pass — none of those exercise hasFilenameOutput directly, so its many branches are effectively untested.
Consider a simpler, more robust approach: rather than statically predicting rg's output mode by re-parsing the flag array, sniff the actual first bytes of stdout (JSON lines start with {, -l output doesn't) and switch parsing strategy at runtime. That avoids reimplementing rg's flag precedence rules entirely and is far less likely to drift as ripgrep's flag surface changes.
Also worth double-checking: formatCollectedOutput's filenames-only branch hardcodes Found ${matchesGlobal} matches — confirm this reads sensibly when -l is combined with -c-style overrides mid-flag-list (last-wins logic determines filenamesOnly for the whole run, but is that always what a user combining flags expects?).
Right problem, but I'd want the flag-classification logic replaced or heavily tested before this goes in as-is.
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
bot:triagedClassified by the community triage botpr:needs-workRight idea, not mergeable as written
2 participants
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.
code_search -lwas parsing filenames as JSON and reporting zero matches. Parse filename output directly while preserving-land the existing limits. Non-UTF-8 paths use base64, matching ripgrep's JSON output, so distinct filenames stay distinct.All 33 existing tests and 14 additional local checks pass. SDK typecheck still has the same 6 existing errors as
main.