Skip to content

fix(find): prevent silent false negatives - #2996

Closed
coyaSONG wants to merge 2 commits into
rtk-ai:developfrom
coyaSONG:fix/find-silent-false-negatives
Closed

coyaSONG wants to merge 2 commits into
rtk-ai:developfrom
coyaSONG:fix/find-silent-false-negatives

Conversation

@coyaSONG

@coyaSONG coyaSONG commented Jul 14, 2026 •

Copy link
Copy Markdown

Summary

  • Preserve explicit file and directory search roots instead of dropping the walker's empty relative path.
  • Treat explicit existing file paths such as ./journal.md as native search roots.
  • Preserve native find visibility for hidden and gitignored entries, while keeping compact RTK syntax ignore-aware.

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. Dispatch also classified explicit file paths as compact basename patterns, and native-flag syntax still applied RTK's hidden and ignore-file pruning. These paths produced silent false negatives with exit code 0.

Native syntax now disables hidden and ignore-file pruning. Compact RTK syntax retains its existing pruning behavior, including the existing dotfile-pattern exception. Bare basenames such as Cargo.toml remain compact patterns for backward compatibility; ./Cargo.toml and absolute file paths are unambiguous native roots.

The branch has been merged with the current develop branch. That upstream rewrite already fixed bracket globs and final-newline handling, and the current transparency contract intentionally keeps zero-match output empty, so this update does not duplicate or reverse those behaviors.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets
  • cargo test --all — 2,666 unit tests passed, 8 ignored; all integration test binaries passed
  • bash scripts/check-test-presence.sh upstream/develop
  • bash scripts/check-test-presence.sh --self-test
  • Manual checks for explicit file roots, directory roots, native hidden/gitignored matches, compact pruning, bracket globs, and final newline
  • Release startup comparison over 200 runs: updated branch 6.97 ms mean, upstream 8.95 ms mean

@CLAassistant

CLAassistant commented Jul 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coyaSONG
coyaSONG marked this pull request as ready for review August 29, 2026 17:19
@coyaSONG

Copy link
Copy Markdown
Author

Resolved the develop conflict in 5252fad and revalidated the report against the current implementation.

The refreshed patch is intentionally narrower: current develop already handles bracket globs and final newlines, and its tested zero-match contract is empty output. This PR now covers only the remaining reproducible false negatives: explicit file roots, directory roots, and hidden/gitignored matches under native find syntax. Compact RTK syntax remains ignore-aware.

Local verification is green: formatting, clippy, all tests (2,666 passed / 8 ignored), test-presence guards, manual behavior checks, and a 200-run release startup comparison. The PR is ready for review; the remaining contributor-side prerequisite is the CLA check.

@KuSh

KuSh commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this. #3854, merged on 2026-09-03, rewrote find's dispatch and walk: any first token containing a path separator is now treated as a path, so rtk find ./journal.md reports the file, and hidden or gitignored matches are no longer dropped silently but reported as a ... (N filtered) note with a recovery file rather than being included in the listing. Running the current develop binary on your fixture gives the file-root and disclosure results this PR was after, so the prune_ignored plumbing no longer applies to the code as it stands. One case is still open: a directory search root is dropped, so rtk find ./sub -type d prints nothing where find prints ./sub. That one would be welcome as an issue or a small PR against the current entry_display. If I missed a part of this, please comment or reopen.

@KuSh KuSh closed this Sep 19, 2026
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

3 participants