Skip to content

test(native): add regression test for crates/ directory not being ignored#1680

Merged
carlos-alm merged 1 commit into
mainfrom
fix/issue-1674
Jun 21, 2026
Merged

test(native): add regression test for crates/ directory not being ignored#1680
carlos-alm merged 1 commit into
mainfrom
fix/issue-1674

Conversation

@carlos-alm

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Rust unit test to collect_files.rs verifying that files under a crates/ directory are collected by the native engine
  • The test guards against re-introduction of the "crates" entry that was mistakenly in DEFAULT_IGNORE_DIRS, causing the native engine to silently skip all files under any crates/ directory in user repositories (while the WASM engine did not — parity divergence)
  • The actual removal of "crates" from DEFAULT_IGNORE_DIRS landed in commit 53cc57d5 (shipped in v3.14.x); this PR adds the regression test coverage that was missing

Test plan

  • New Rust unit test collect_does_not_skip_crates_dir passes: cargo test collect_does_not_skip_crates_dir
  • Parity integration tests pass: npx vitest run tests/integration/build-parity.test.ts
  • DEFAULT_IGNORE_DIRS in collect_files.rs does not contain "crates" (verified at commit 53cc57d5)
  • TypeScript IGNORE_DIRS in constants.ts does not contain "crates" (verified)

Fixes #1674

…ored (#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
@greptile-apps

greptile-apps Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a Rust unit test to guard against the regression where "crates" was mistakenly present in DEFAULT_IGNORE_DIRS, causing the native engine to silently drop all files under any crates/ directory (the WASM engine was unaffected, creating a parity divergence). The actual fix landed in commit 53cc57d5; this PR supplies the missing test coverage.

  • New test collect_does_not_skip_crates_dir: creates a real temp-dir fixture at {tmp}/crates/my-crate/src/lib.rs, calls collect_files, and asserts the file appears in results — exercising the full walk-and-filter pipeline rather than just checking the constant.
  • No production code changed: the only diff is in the #[cfg(test)] module; the test follows the file's existing fixture pattern (hardcoded temp dir name, remove_dir_all bookends, empty file content).

Confidence Score: 5/5

Test-only change that adds coverage for a previously shipped bug fix; no production code is touched.

The new test correctly exercises the full collect_files pipeline with a real filesystem fixture, follows every convention already established in the test module (same temp-dir bookend pattern, same empty-file approach, same assertion style), uses a unique directory name that won't collide with existing tests, and makes the right assertions. There are no changes to production logic.

No files require special attention.

Important Files Changed

Filename Overview
crates/codegraph-core/src/domain/graph/builder/stages/collect_files.rs Adds a regression test collect_does_not_skip_crates_dir that creates a real temp-dir fixture under crates/my-crate/src/lib.rs and asserts collect_files returns it, guarding against re-introduction of "crates" in DEFAULT_IGNORE_DIRS. Follows established test conventions; no functional changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Test: collect_does_not_skip_crates_dir] --> B[Create temp dir\ncodegraph_collect_crates_test]
    B --> C[Create crates/my-crate/src/lib.rs\nempty file]
    C --> D[Call collect_files root, empty filters]
    D --> E{Walk directory tree\nvia ignore crate}
    E --> F{Entry in\nDEFAULT_IGNORE_DIRS?}
    F -- Yes skip --> G[Directory skipped]
    F -- No continue --> H{Supported\nextension?}
    H -- .rs Yes --> I[File added to results]
    H -- No --> J[File skipped]
    I --> K[Assert: files not empty]
    K --> L[Assert: lib.rs present in results]
    L --> M[Cleanup temp dir]
    M --> N[Test passes]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Test: collect_does_not_skip_crates_dir] --> B[Create temp dir\ncodegraph_collect_crates_test]
    B --> C[Create crates/my-crate/src/lib.rs\nempty file]
    C --> D[Call collect_files root, empty filters]
    D --> E{Walk directory tree\nvia ignore crate}
    E --> F{Entry in\nDEFAULT_IGNORE_DIRS?}
    F -- Yes skip --> G[Directory skipped]
    F -- No continue --> H{Supported\nextension?}
    H -- .rs Yes --> I[File added to results]
    H -- No --> J[File skipped]
    I --> K[Assert: files not empty]
    K --> L[Assert: lib.rs present in results]
    L --> M[Cleanup temp dir]
    M --> N[Test passes]
Loading

Reviews (1): Last reviewed commit: "test(native): add regression test for cr..." | Re-trigger Greptile

@carlos-alm carlos-alm merged commit d21c1ee into main Jun 21, 2026
31 checks passed
@carlos-alm carlos-alm deleted the fix/issue-1674 branch June 21, 2026 21:08
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: remove 'crates' from DEFAULT_IGNORE_DIRS in collect_files.rs

1 participant