Repository navigation
fix(discover): make/cargo dep-info .d files are parsed with the D grammar #2414
Description
Activity
- addedstability/performanceServer crashes, OOM, hangs, high CPU/memoryServer crashes, OOM, hangs, high CPU/memory
on Sep 28, 2026 - addedparsing/qualityGraph extraction bugs, false positives, missing edgesGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
on Oct 1, 2026 Thank you for the measurements and for explicitly asking about the graph-content change. Yes: in principle, confidently recognized Make/Cargo dependency artifacts should be excluded rather than indexed as D source, including omitting their file/module nodes and any folders left with no indexed content. Ambiguous .d files must remain eligible as D source. The current extension table maps .d to D, so this needs a conservative disambiguation rule, not a blanket extension exclusion. This approves that direction, subject to review of the implementation, negative controls and preservation of real D inputs. It is not a merge approval. Thank you for keeping the behavior decision explicit.
Thanks. I pushed the graph-level test and two disambiguation fixes to #2421 (head 006f2a9).
pipeline_d_dep_info_leaves_no_nodesindexes a cargo dep-info file alone under its own directory and a gcc-MDfile next to real D source. The dep-info files get no File or Module node, the dependency-only directory chain gets no Folder node, and the D file keeps its File, Module and shared Folder. With the probe disabled it fails with three Folder nodes.lang_d_source_stays_dlangnow also covers float attributes (@1.0:), comments between tokens (public/**/:) and every D whitespace between tokens, including form feed, vertical tab, U+2028 and U+2029. The probe still reads at most 4 KB, a user.doverride still skips it, and anything uncertain stays D. On real inputs, 12,062 of 12,062 D files from phobos, dmd, ldc, dub and vibe.d still detect as D. One trade-off: a dep-info file whose target path contains@stays D, as on main.CI is pending.
Version
built from source, main @ 2278498 (v0.11.0-186)
Platform
Linux (x64)
Install channel
Built from source
Binary variant
standard
What happened, and what did you expect?
.dalways maps to D (src/discover/language.c:406). Make-style dependency files written by cargo/rustc, gcc/clang-MDand CMake therefore go through the D grammar and then the unbudgeted unified walk (internal/cbm/cbm.c:301). They yield nothing useful, and the cost grows superlinearly with size: a 128 KB cargo dep-info file takes about 2 s to parse and 13 s to walk. Discovery always skips onlytarget/, so a cargo--target-dirwith another name, or in-tree-MDoutput that is not gitignored, gets indexed.My fix adds
cbm_disambiguate_d, a 4 KB first-line sniff in the shape of the.frm/.cls/.mdisambiguators (#2074) and the new.resone (#2352). It drops a.dfile only when its first non-blank line is a make rule whose targets all look like paths, and keeps D on any doubt. Dep-info files lose their File/Module/Folder nodes (they were never D source), so please confirm that is the behavior you want.Reproduction
Repro: copy the
.dfiles from a cargotarget/debug/depsinto a directory with a few.rsfiles and index it..rsLogs
Diagnostics trajectory (memory / performance / leak issues)
Project scale (if relevant)
No response
Confirmations