fix(search): zero-match steering probe works on the grep fallback - #79605
Open
webtecnica wants to merge 1 commit into
Open
fix(search): zero-match steering probe works on the grep fallback#79605webtecnica wants to merge 1 commit into
webtecnica wants to merge 1 commit into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The
search_fileszero-match steering probe was a silent no-op on hosts withoutripgrepinstalled._zero_match_probeintools/file_operations.pyreturnedNoneimmediately whenrgwas absent (if not self._has_command('rg'): return None), so all three zero-match hints ("case-insensitive matches — casing may be wrong" / "literal matches — metacharacters need escaping" / "match only in hidden or gitignored files") were lost even though the grep fallback search itself worked.Root Cause
The probe feature added in
5797b5028was implemented only for thergengine path; the grep fallback path bailed out before running any probe variants.Change
tools/file_operations.py:_zero_match_probeis now a dispatcher —rg→_zero_match_probe_rg(original body, byte-identical, no regression), otherwise → new_zero_match_probe_grepthat mirrors the three probe variants using the existing grep-fallback helpers (count-only output,head -50,2>/dev/null, 30s timeout):grep -r -i -c -H --exclude-dir='.*' [--include glob] …→ "case-insensitive match(es) … casing may be wrong"--exclude-dir→ "N match(es) in N hidden file(s) — hidden files are excluded by default"grep -r -F -c -H(only when the pattern has metacharacters) → "literal match(es) … need escaping"tests/tools/test_search_zero_match_and_multipath.py: new coverage for the no-rgpath (via_has_commandpatch) plus the existingrgpath.Verification
tests/tools/test_search_zero_match_and_multipath.py: 20 passed.Closes #79512