Skip to content

fix(find): preserve native visibility and bracket globs - #3352

Closed
ricorna wants to merge 1 commit into
rtk-ai:developfrom
ricorna:fix/find-native-semantics
Closed

ricorna wants to merge 1 commit into
rtk-ai:developfrom
ricorna:fix/find-native-semantics

Conversation

@ricorna

@ricorna ricorna commented Aug 1, 2026 •

Copy link
Copy Markdown

Summary

  • Preserve native find visibility when native flags are used by disabling hidden, .ignore, and git-ignore pruning.
  • Keep the existing ignore-aware behavior for compact RTK syntax.
  • Support positive, ranged, and negated bracket classes such as [123], [0-9], and [!0-9].
  • Support ] as the first class member, including patterns such as []a] and [!]].
  • Preserve unmatched [ as a literal instead of introducing a malformed-pattern regression.

This addresses the hidden/gitignored and bracket-class false negatives documented in #2995 and its follow-up report. It overlaps the visibility portion of draft #2996, while also covering the bracket-class cases that PR does not address.

Root cause

The ignore::WalkBuilder always pruned hidden and ignored entries, even when RTK was transparently rewriting native find ... -name/-type/-maxdepth syntax. The custom glob matcher only implemented * and ?, so valid native bracket expressions silently returned no matches with exit 0.

Verification

  • Added end-to-end tests for hidden and gitignored matches under native syntax.
  • Added end-to-end tests for ranged, negated, and literal-] bracket classes.
  • Added a regression test for an unclosed literal bracket.
  • cargo fmt --all -- --check
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo test --locked

The complete locked suite passed locally: 2,512 unit tests passed, 8 ignored, plus all integration targets.

@CLAassistant

CLAassistant commented Aug 1, 2026 •

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.

@ricorna
ricorna force-pushed the fix/find-native-semantics branch from e5e3f32 to cd2f8f5 Compare August 1, 2026 06:36
Signed-off-by: Ric Orna <33195092+ricorna@users.noreply.github.com>
@KuSh

KuSh commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the bracket-class work and the fixture-backed tests. Bracket patterns have been handled since #3603 (merged 2026-08-26): the subset rtk walks itself now refuses any -name value containing "[" and hands the command to real find, so on current develop "a[0-9].txt", "a[!0-9].txt" and "[]a]*.txt" all return the right files without rtk implementing fnmatch itself. The same merge removed has_native_find_flags and rewrites the compact rtk syntax into find syntax before dispatch, so the native-versus-compact distinction this PR keys its visibility carve-out on no longer exists at that point, and #3854 (merged 2026-09-03) then chose to disclose pruned entries as "... (N filtered: hidden or gitignored)" with a tee file rather than return them. That last decision is still contested: hidden and gitignored matches are indeed missing from the results, and open issue #2995 tracks it, so a narrow PR against the current walker would be the way back in. Please comment or reopen if a case here was missed.

@KuSh KuSh closed this Sep 13, 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.

3 participants