Skip to content

fix(find): prevent silent false negatives#2996

Draft
coyaSONG wants to merge 1 commit into
rtk-ai:developfrom
coyaSONG:fix/find-silent-false-negatives
Draft

fix(find): prevent silent false negatives#2996
coyaSONG wants to merge 1 commit into
rtk-ai:developfrom
coyaSONG:fix/find-silent-false-negatives

Conversation

@coyaSONG

Copy link
Copy Markdown

Summary

  • Preserve explicit file and directory roots instead of dropping their empty relative path.
  • Treat a lone existing RTK-syntax argument as the search root, and preserve native find visibility for hidden and gitignored entries.
  • Print an explicit zero-match result so a successful search cannot be mistaken for missing data.

Closes #2995.

Root cause and impact

The walker stripped the search root from every result and discarded the resulting empty path, so an explicitly requested file or directory disappeared. RTK syntax also treated a lone existing path as a basename glob, while native-flag syntax still applied RTK's ignore-aware pruning. Finally, the zero-result branch returned without output. Together these paths produced silent false negatives with exit code 0.

Native-flag syntax now disables hidden and ignore-file pruning, while compact RTK syntax retains its existing pruning behavior. An explicit second positional search root still wins over path auto-detection, preserving inputs such as rtk find . src.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk find ./journal.md -type f, bare file roots, directory roots, native hidden/gitignored matches, compact pruning, and zero-match output inspected

The full suite passed with 2,437 unit tests and all integration test binaries green (8 tests ignored by the repository).

Signed-off-by: coyaSONG <66289470+coyaSONG@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

find: existing file as search root returns empty output with exit 0; hidden/gitignored matches silently dropped

2 participants