GRAPHIFY_OUT with a nested path excludes every directory whose basename matches, not just the output dir.
Root cause
paths.py reduces GRAPHIFY_OUT to a bare basename:
GRAPHIFY_OUT_NAME = os.path.basename(os.path.normpath(GRAPHIFY_OUT))
and detect.py (~line 696) puts that bare name into the set of directory names excluded from the scan, to avoid re-ingesting the output as source (#524, #1423):
"graphify-out", GRAPHIFY_OUT_NAME, # never treat own output as source input
Because the exclude is matched by directory name anywhere in the tree rather than by the resolved output path, any source directory whose name equals the output dir's basename is silently dropped from the graph.
Impact
A canonical multi-scope layout that writes each scope to graphify-out/<scope>/ gives GRAPHIFY_OUT the basename <scope>. If the scanned tree contains a directory named <scope> (very common for a Python src-layout package, e.g. src/<ns>/<scope>/), that entire directory is excluded. The graph is missing the module's source with no error or warning.
Repro
A Python src-layout package where the source lives under src/.../<name>/, scanned with the output dir basename set to <name>:
graphify update path/to/pkg --no-cluster # GRAPHIFY_OUT=graphify-out/<name>
Result, holding everything constant except the GRAPHIFY_OUT basename:
- basename
<name> (matches the module dir): 0 files under src/.../<name>/
- basename
xyz (no match): full coverage
Measured on a real package: GRAPHIFY_OUT basename nlp produced 0 files under src/revil/nexus/nlp/ (18,188 nodes); basename xyz produced 4,770 files under it (23,258 nodes). Deterministic across runs, same source, same command.
Suggested fix
Exclude the output directory by resolved path (e.g. skip paths under the actual GRAPHIFY_OUT directory) rather than by bare basename. The literal graphify-out name exclude is fine as a convenience, but deriving a global directory-name exclude from GRAPHIFY_OUT's basename over-matches real source directories.
GRAPHIFY_OUTwith a nested path excludes every directory whose basename matches, not just the output dir.Root cause
paths.pyreducesGRAPHIFY_OUTto a bare basename:and
detect.py(~line 696) puts that bare name into the set of directory names excluded from the scan, to avoid re-ingesting the output as source (#524, #1423):Because the exclude is matched by directory name anywhere in the tree rather than by the resolved output path, any source directory whose name equals the output dir's basename is silently dropped from the graph.
Impact
A canonical multi-scope layout that writes each scope to
graphify-out/<scope>/givesGRAPHIFY_OUTthe basename<scope>. If the scanned tree contains a directory named<scope>(very common for a Python src-layout package, e.g.src/<ns>/<scope>/), that entire directory is excluded. The graph is missing the module's source with no error or warning.Repro
A Python src-layout package where the source lives under
src/.../<name>/, scanned with the output dir basename set to<name>:Result, holding everything constant except the
GRAPHIFY_OUTbasename:<name>(matches the module dir): 0 files undersrc/.../<name>/xyz(no match): full coverageMeasured on a real package:
GRAPHIFY_OUTbasenamenlpproduced 0 files undersrc/revil/nexus/nlp/(18,188 nodes); basenamexyzproduced 4,770 files under it (23,258 nodes). Deterministic across runs, same source, same command.Suggested fix
Exclude the output directory by resolved path (e.g. skip paths under the actual
GRAPHIFY_OUTdirectory) rather than by bare basename. The literalgraphify-outname exclude is fine as a convenience, but deriving a global directory-name exclude fromGRAPHIFY_OUT's basename over-matches real source directories.