Repository navigation
fix(core): surface malformed glob errors from ripgrep - #56518
rudycelekli wants to merge 2 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
The fix works for the reported case, but as written it breaks some searches that work today.
How I checked: your two new tests fail on the base and pass with this change (29/29 in ripgrep.test.ts and tool-search.test.ts), and the packages/core typecheck passes. I also ran ripgrep by hand and with a temporary test against both branches.
Public API: unchanged.
The problem: ripgrep prints the same error parsing glob text for a bad line in a project's .gitignore or .ignore, and then keeps searching. If anything else in the same run makes ripgrep exit 2, such as a broken symlink with follow: true, the new check discards the results. With a .ignore containing [ plus a broken symlink, glob and find return [a.ts] on the base but fail with Ripgrep.Error on this branch. find backs Search.find. grep isn't affected because it passes --no-messages. Details are in the inline comment.
|
|
||
| const code = yield* handle.exitCode | ||
| const stderr = yield* Fiber.join(stderrFiber) | ||
| if (code === 2 && stderr.includes("error parsing glob")) return yield* failure(stderr.trim()) |
There was a problem hiding this comment.
This also matches ignore-file errors. A [ line in a project's .gitignore or .ignore makes ripgrep print rg: ./.gitignore: line 1: error parsing glob '[': ... and it keeps searching. If anything else then makes it exit 2 (for example a broken symlink with follow: true), glob and find now fail completely instead of returning their results. On the base they return the files.
Only a bad --glob value stops ripgrep, and that message has no file path: rg: error parsing glob '[': .... Could you match just that form, e.g. /^rg: error parsing glob/m, and add a test with a bad ignore file so that case keeps returning results?
Issue for this PR
Closes #47474
Type of change
What does this PR do?
Report ripgrep’s malformed-glob diagnostics instead of presenting an empty successful search. Keep valid no-match searches and other exit-2 partial results intact.
How did you verify your code works?
Real ripgrep and production search-tool regressions: two failures before; 29 owning tests, 34 related tests, and 290 repeated passes after. Hosted strict baseline, full Core suite, Core typecheck, and root check pass.
Source-bound qualification.
Screenshots / recordings
No visual UI code changed; behavior is asserted directly.
Checklist