Skip to content

AST extractor emits duplicate import edges with absolute-path node IDs (dangling endpoints) #1961

Closed

Description

@ugomez809

On graphifyy 0.9.17, building a graph over a TypeScript repo (Vite + @/ path alias from tsconfig), the AST extractor emits some import/imports_from edges twice: once with correct repo-relative endpoint IDs (src_lib_utils_cn) and once with IDs prefixed by the absolute scan path (home_user_postcallnotes_src_lib_utils_cn). The absolute-path variants never match any node ID, so they show up as dangling endpoints and get dropped at build.

In my run: 1300 AST nodes, 3126 edges → 301 endpoints dangling with the abs-path prefix, all of which had an exact counterpart node once the prefix was stripped. graphify diagnose multigraph flags them as dangling-endpoint edges.

Repro conditions:

extract(files, cache_root=Path('.')) with relative file paths and a fresh cache — still occurs
Repo uses tsconfig path alias @/* → ./src/*; the affected edges are the alias-resolved imports, which suggests the alias resolver normalizes to an absolute path and skips the relativize-against-cache_root step that normal IDs go through
Workaround I'm using: post-process the extraction, strip the absolute-path prefix from edge endpoints when the stripped ID exists in the node set (recovered all 301).

Activity

  1. oleksii-tumanov commented on Jul 17, 2026

    @oleksii-tumanov
    Contributor

    I reproduced this on current v8. The #1529 regression test verifies the correct edge but misses the additional dangling named-import edge.

    I'll do a small fix for this issue.

  2. safishamsi commented on Jul 17, 2026

    @safishamsi
    Member

    Fixed on v8 (ships in 0.9.18) via #1967 (dea6ec0), thanks @oleksii-tumanov. The duplicate import edge with an absolute-path-prefixed (dangling) target — emitted when a JS/TS import resolves through a tsconfig alias or workspace package — is dropped when its canonical twin exists, leaving only the correct edge.

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