fix(native): stop dropping dotfile-named source files, fix undercounted build summary - #2532
Merged
Conversation
…ed build summary (#2391) The native orchestrator's file collector set .hidden(true) on its ignore::WalkBuilder, blanket-skipping both hidden directories AND hidden files. Dotfile-named source files are common and legitimate (.terraform.lock.hcl, .pa11yci.authed.cjs), so every build in a repo containing one silently dropped it, logged a misleading "likely a Rust extractor bug" warning, and paid a second WASM parse pass to backfill it — even though the real bug was file discovery, not extraction. The JS/TS collector (shouldIgnore in shared/constants.ts) only ever skips hidden directories, never files; collect_files.rs now matches that, with the existing filter_entry closure continuing to skip hidden directories. Also fixes the secondary defect from the same report: the build-completion log line's file count reflected only the files the native orchestrator itself collected, captured before any WASM backfill inserted additional file nodes, so it under-reported relative to `codegraph stats` whenever a backfill happened. Re-derives it the same way `codegraph stats` counts files (kind = 'file') whenever a post-pass wrote data, mirroring the existing node/edge re-count fix for the identical under-report shape (#1452). docs check acknowledged Impact: 1 functions changed, 4 affected
Contributor
Greptile SummaryThe PR aligns native file discovery with the JS/WASM collector by retaining dotfile-named source files while continuing to exclude hidden directories. It also reconciles the native completion summary’s file count with persisted file nodes after post-pass writes.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. The updated walker preserves hidden-directory exclusion while collecting supported dotfiles, and the reconciled file count remains accurate because no later native pass mutates file nodes. Important Files Changed
Reviews (1): Last reviewed commit: "fix(native): stop dropping dotfile-named..." | Re-trigger Greptile |
Contributor
Codegraph Impact Analysis1 functions changed → 4 callers affected across 4 files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2391
Root cause
collect_files.rs'signore::WalkBuilderset.hidden(true), which blanket-skips both hidden directories AND hidden files. Dotfile-named source files are common and legitimate:.terraform.lock.hcl— Terraform's dependency lock file, meant to be committed to git.pa11yci.authed.cjs— a pa11y accessibility-testing configBoth were silently dropped by the native collector, which then logged "likely a Rust extractor bug" and paid a second WASM parse pass to backfill them — but the real bug was file discovery, not extraction (the extraction logic itself is correct, as proven by WASM producing identical symbols once it got the chance to see the file).
The JS/TS collector (
shouldIgnoreinshared/constants.ts) only ever skips hidden directories, never files.collect_files.rsnow matches that asymmetry exactly — the existingfilter_entryclosure right below.hidden(false)already re-implements hidden-directory skipping independently, so directory-level behavior (.git,.next, arbitrary dotdirs) is unchanged.Secondary defect (same issue report)
The build-completion log line (
Native build orchestrator completed: N nodes, M edges, K files) reflected only the files the native orchestrator itself collected, captured before any WASM backfill inserted additional file nodes — soKunder-reported relative tocodegraph statswhenever a backfill happened for any reason. This is the same shape as #1452's node/edge under-report, fixed the same way: re-derive the count (SELECT COUNT(*) FROM nodes WHERE kind='file', matching howcodegraph statscounts files) whenever a post-pass wrote data.Verification
.terraform.lock.hclwith aprovider { ... hashes = [...] }block, and a.cjsfile) against the pre-fix binary; confirmed the warning, the backfill, and the undercounted completion line.collect_files.rs(collect_finds_dotfile_named_source_files,collect_still_skips_hidden_directories) — both verified to fail without the fix (temporarily reverted.hidden(false)→.hidden(true), confirmed failure, restored). Fullcargo test: 1034 passed.cargo clippy --all-targets -- -D warningsandcargo fmt --checkclean.tests/integration/issue-2391-hidden-dotfile-native-drop.test.tscovering the.hcland.cjsdotfile cases plus a hidden-directory-still-excluded regression guard — all verified to fail without the Rust fix (same revert-rebuild-confirm-restore cycle).codegraph stats; then restored only the file-count fix (keeping the primary bug reverted) and confirmed the log became correct; then restored both fixes together. No independent automated regression test was constructible for the secondary defect alone — the only known real-world trigger for "native's own file collector misses a file WASM would find" is the primary bug this same PR fixes, so once it's fixed there's no remaining scenario in this codebase where the two file counts diverge. Documented this explicitly in the test file's top comment for future readers.npm test: 5323 passed.npm run lintclean.codegraph diff-impact --staged -T: bounded torunPostNativePassesand its normal build-pipeline callers.Not in scope
No Rust changes needed beyond
collect_files.rs— the HCL/JS extractors' own logic was already correct; native and WASM already agree on symbol shape once native can see the file. No otherWalkBuilderinstances exist in the Rust codebase (grepped to confirm).