Skip to content

rtk find -iname silently drops matches inside a gitignored-but-tracked directory #4244

Closed as duplicate

Description

@BeeKnown

Summary

rtk find <dir> -iname "<pattern>" silently drops a real, matching result when the match lives inside a directory listed in .gitignore — even when that specific file is force-tracked by git (git add -f) and genuinely matches the -iname pattern. The dropped result is replaced with a (N filtered) line pointing at a ~/Library/Application Support/rtk/tee/<ts>_find-hidden.log file, and that log does not contain the missing match — it just contains the ignored directory name, so there is no way to recover the real result from it.

rtk proxy find ... (raw passthrough) returns the correct, complete result in the same repo.

Environment

  • rtk --version: rtk 0.50.0
  • Installed via Homebrew (brew info rtk → stable 0.50.0 (bottled))
  • macOS (Darwin 25.6.0)

Minimal repro

mkdir repro && cd repro
git init -q
printf 'node_modules/\n*.log\n' > .gitignore
mkdir -p src && echo "x = 1" > src/target.py
git add -A && git commit -q -m init

# a file inside a gitignored dir, but force-tracked (a common real-world
# pattern: gitignore a whole data/ dir wholesale, then force-add specific
# files that should be tracked)
mkdir -p data/subdir && echo "y = 2" > data/subdir/target.py
echo 'data/' >> .gitignore
git add -f data/subdir/target.py
git add .gitignore
git commit -q -m "add gitignored-but-forced file"

echo "=== rtk find (direct) ==="
rtk find . -iname "target*"

echo
echo "=== rtk proxy find (control) ==="
rtk proxy find . -iname "target*"

Actual output

=== rtk find (direct) ===
src/target.py
... (1 filtered)
[see remaining: tail -n +1 "$HOME/Library/Application Support/rtk/tee/<ts>_find-hidden.log"]

=== rtk proxy find (control) ===
./data/subdir/target.py
./src/target.py

cat of the referenced find-hidden.log contains only:

data/

— not the actual matched path, so the "see remaining" pointer doesn't let the caller recover the dropped result at all.

Expected output

rtk find should return the same two matches rtk proxy find returns (or, at minimum, if suppressing gitignored-directory matches is intentional filtering behavior, the "filtered" pointer should show what was filtered, not an unrelated directory-name log with no path in it).

Impact

This is silent data loss for an explicit, deterministic query (-iname with a specific pattern) — not a generic "too much output, let me summarize" heuristic. It's especially dangerous in the pattern shown above (gitignore a directory wholesale, then force-track specific files inside it for governance/audit reasons), where the whole point of the force-add is that those files are supposed to be discoverable and it silently looks like they don't exist.

Workaround: rtk proxy <command> for raw passthrough.

Additional context

This is a recurring bug class, not a one-off: a similarly garbled result (same find-hidden.log artifact, unrelated content) was also observed on grep -rn in an earlier rtk version, well before 0.50.0. Confirmed the find -iname case still reproduces identically on the current 0.50.0 release, so the underlying issue predates this version and the update didn't fix it.

Activity

  1. added
    bug
    help wanted
    on Sep 25, 2026
  2. rtk-wshm-sync-bot commented on Sep 25, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 88%

    Summary

    rtk find silently drops a valid match inside a gitignored-but-force-tracked directory, with a misleading/unrecoverable filtered-log pointer; rtk proxy find works correctly.

    📁 Relevant files
    • src/discover/find.rs
    • src/filter/find.rs

    Suggested Actions

    1. Confirm root cause: find filters out matches under gitignored dirs even when the specific file is force-tracked
    2. Fix the filtered-summary log to record the actual dropped path, not just the ignored directory name
    3. Compare with rtk proxy rg silently corrupts matched text: replaces "cypress" with "n" #4212 and grep/rg piped into head -N / tail -N return the wrong lines after the #3343 safe-consumer rewrite #4207 — part of a recurring class of silent/corrupted output-filtering bugs
    4. Consider treating force-added (git ls-files) paths as always included regardless of directory-level gitignore

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. added a commit that references this issue on Sep 26, 2026
    8cdfa7c
  4. KuSh commented on Sep 26, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #2995, which tracks rtk find pruning gitignored paths under native find flags, including files that git still tracks inside an ignored directory. Your observation that the recall log names only the ignored directory, not the dropped match, is useful for that fix, so please add it on #2995 and follow up there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibughelp wantedpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions