fix(search): keep grep fallback root searchable - #83848
Closed
wanquanY wants to merge 1 commit into
Closed
Conversation
Collaborator
Collaborator
|
Salvaged via #84780 — your commit was cherry-picked onto current Review notes from the salvage: your Thanks for the fix! |
19 tasks
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.
What does this PR do?
Fixes the
search_filesgrep fallback silently returning zero matches for its defaultpath="."search.The fallback intentionally passes
--exclude-dir='.*'to match ripgrep's hidden-directory behavior. grep also applies that glob to the command-line search root, however, so a relative root such as.(or./directory) excludes itself before traversal begins.This change anchors relative grep roots at the terminal backend's live, shell-quoted
$PWD. It preserves the existing hidden-directory exclusion, avoids resolving remote/container paths on the host, and keeps the user-provided path component shell-escaped.Related Issue
N/A — searched open and closed issues/PRs for the error and
--exclude-dirbehavior; no duplicate found.Type of Change
Changes Made
ShellFileOperations._search_with_grep()at the backend's live$PWD.., an explicit./directory, the.hubprompt-injection cache, and an arbitrary hidden directory.How to Test
python -m pytest tests/tools/test_search_hidden_dirs.py tests/tools/test_search_error_guard.py tests/tools/test_file_operations.py -q(80 passed, 2 skipped on macOS 26.2).python -m ruff check tools/file_operations.py tests/tools/test_search_hidden_dirs.pyandgit diff --check.The canonical full macOS run reached 29,484 passed / 306 skipped, with 22 unrelated platform/environment failures and one isolated test-file timeout; every touched and search-related suite passed. The PR's Ubuntu CI is the authoritative full-suite gate.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass (see macOS full-run note above; scoped suites are green)Documentation & Housekeeping
docs/, docstrings) — N/A; behavior is internal and covered by an inline rationalecli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs