Skip to content

fix(extract): remove dangling alias import edges - #1967

Closed
oleksii-tumanov wants to merge 1 commit into
Graphify-Labs:v8from
oleksii-tumanov:fix/ts-alias-dangling-imports
Closed

oleksii-tumanov wants to merge 1 commit into
Graphify-Labs:v8from
oleksii-tumanov:fix/ts-alias-dangling-imports

Conversation

@oleksii-tumanov

Copy link
Copy Markdown
Contributor

Summary

  • remove the absolute-path named-import edge when the resolver already emitted its exact canonical twin
  • preserve legitimately owned alias targets and same-line import multiplicity
  • cover relative inputs from both the project root and a parent working directory

Fixes #1961

Testing

  • uv run pytest tests/test_js_import_resolution.py tests/test_extract.py tests/test_import_extension_resolution.py tests/test_extraction_spec_ids.py -q (273 passed)
  • uv run ruff check graphify/extract.py tests/test_js_import_resolution.py
  • uv run --frozen python -m tools.skillgen --check
  • graphify update .

@safishamsi

Copy link
Copy Markdown
Member

Landed on v8 (ships in 0.9.18), cherry-picked so your authorship is preserved. Thanks @oleksii-tumanov — a JS/TS import resolving through a tsconfig alias or workspace package was emitting a duplicate import edge whose target was an absolute-path-prefixed id (a dangling endpoint). The fix drops that edge only when its exact canonical twin already exists and the target is the abs-form alias of exactly one owned node, so external/sourceless stubs and legitimate edges are untouched. Verified end to end: 0 dangling / 0 abs-path import targets, resolvable imports still produced. One follow-up worth a separate issue: re_exports (export ... from "@/x") has the same abs-path shape and needs target-rewriting rather than this twin-dedupe.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants