From 20002edaa97bbfcfed5edd78e3e92b770b4a84c4 Mon Sep 17 00:00:00 2001 From: carlos-alm Date: Sun, 21 Jun 2026 14:25:47 -0600 Subject: [PATCH] test(native): add regression test for crates/ directory not being ignored (#1674) Adds a Rust unit test to collect_files.rs verifying that files under a crates/ directory are collected by the native engine. This guards against re-introduction of the DEFAULT_IGNORE_DIRS entry that caused parity divergence between the WASM and native engines. Fixes #1674 --- .../graph/builder/stages/collect_files.rs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/codegraph-core/src/domain/graph/builder/stages/collect_files.rs b/crates/codegraph-core/src/domain/graph/builder/stages/collect_files.rs index cf127d92d..c2dd7f761 100644 --- a/crates/codegraph-core/src/domain/graph/builder/stages/collect_files.rs +++ b/crates/codegraph-core/src/domain/graph/builder/stages/collect_files.rs @@ -557,4 +557,28 @@ mod tests { "fast path must filter out excluded files so incremental builds honor config changes" ); } + + /// Regression test for issue #1674 — files under a `crates/` directory must + /// NOT be silently dropped by the native engine. A `crates/` entry was + /// mistakenly present in DEFAULT_IGNORE_DIRS; this verifies it is absent. + #[test] + fn collect_does_not_skip_crates_dir() { + let tmp = std::env::temp_dir().join("codegraph_collect_crates_test"); + let _ = fs::remove_dir_all(&tmp); + let crate_src = tmp.join("crates").join("my-crate").join("src"); + fs::create_dir_all(&crate_src).unwrap(); + fs::write(crate_src.join("lib.rs"), "").unwrap(); + + let result = collect_files(tmp.to_str().unwrap(), &[], &[], &[]); + assert!( + !result.files.is_empty(), + "files inside crates/ must not be silently ignored by DEFAULT_IGNORE_DIRS" + ); + assert!( + result.files.iter().any(|f| f.contains("lib.rs")), + "crates/my-crate/src/lib.rs must appear in collected files" + ); + + let _ = fs::remove_dir_all(&tmp); + } }