Skip to content

GRAPHIFY_OUT nested path excludes every directory matching its basename from the scan (detect.py GRAPHIFY_OUT_NAME) #2273

Closed

Description

@vanjos

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.

Activity

  1. vanjos commented on Jul 29, 2026

    @vanjos
    Author

    Any read on this one? Happy to test a patch or share more detail if useful.

  2. oleksii-tumanov commented on Jul 31, 2026

    @oleksii-tumanov
    Contributor

    Thanks for the detailed report. I opened #2335 with a focused fix.

  3. safishamsi commented on Aug 1, 2026

    @safishamsi
    Member

    Fixed in v0.9.32. A custom GRAPHIFY_OUT name no longer excludes every same-named directory in the tree; only the configured output path is pruned. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions