fix: ignore Rust target/ build directory during file collection (#2374) - #2511
fix: ignore Rust target/ build directory during file collection (#2374)#2511carlos-alm wants to merge 1 commit into
Conversation
docs check acknowledged: small ignore-list addition, no doc updates needed.
Greptile SummaryAdds Cargo’s
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "fix: ignore Rust target/ build directory..." | Re-trigger Greptile |
| 'venv', | ||
| 'env', | ||
| '.env', | ||
| 'target', |
There was a problem hiding this comment.
Incremental collection retains target files
When an existing graph contains files under target/ and the next build uses incremental collection, the fast path reconstructs its file set without applying this new default ignore, causing generated Rust files to remain in the graph until a full rebuild invalidates them.
Knowledge Base Used:
There was a problem hiding this comment.
Confirmed — this is real, but it's a general characteristic of the incremental fast path (tryFastCollect/try_fast_collect), not something specific to target: neither engine's fast path re-applies IGNORE_DIRS/DEFAULT_IGNORE_DIRS at all, so any file already in file_hashes from a prior build survives incremental rebuilds regardless of which ignore-dir entry would now exclude it. Fixing that means changing the fast path for every ignore-dir entry, which is out of scope for this PR. Filed as #2512 to track separately. Existing graphs self-heal via the documented --no-incremental full rebuild in the meantime.
Summary
Neither
IGNORE_DIRS(TypeScript,src/shared/constants.ts) nor its mirrorDEFAULT_IGNORE_DIRS(Rust,crates/codegraph-core/src/domain/graph/builder/stages/collect_files.rs) skipped Cargo'starget/build output directory. For any non-trivial Rust project this directory can be enormous, and codegen tools (bindgen,prost,tonic-build, etc.) emit real, syntactically valid.rsfiles intoOUT_DIRundertarget/— codegraph's file walk was parsing these as hand-written project source, polluting the graph and adding real walk-time cost.Added
"target"to both lists, keeping the dual-engine mirroring convention intact.Verification
shouldIgnore('target')+IGNORE_DIRSmembership (TS), an end-to-endcollectFiles()walk test with atarget/debug/build.rsfixture (TS), and acollect_skips_target_dirtest mirroring the existingcollect_skips_ignored_dirspattern (Rust)Closes #2374