Skip to content

Fix decorator import resolution without source#1273

Open
gojun077 wants to merge 1 commit into
CodeGraphContext:mainfrom
gojun077:feature/none-split-decorator-imports
Open

Fix decorator import resolution without source#1273
gojun077 wants to merge 1 commit into
CodeGraphContext:mainfrom
gojun077:feature/none-split-decorator-imports

Conversation

@gojun077

Copy link
Copy Markdown
Contributor

Resolves [1272(https://github.com//issues/1272)

Root cause: build_decorated_by_links() assumed every parsed import had a source field. Python parser imports use full_import_name instead, so an imported decorator like @dataclass produced local_imports["dataclass"] = None, then crashed at None.split(".")

What changed:

Added shared import normalization for decorator/metaclass resolution in CodeGraphContext/src/codegraphcontext/tools/indexing/resolution/inheritance.py#L311-L342

  • Uses source when present.
  • Falls back to full_import_name.
  • Falls back to name.
  • Skips empty targets.

Reused that normalization for both DECORATED_BY and Python METACLASS link building in CodeGraphContext/src/codegraphcontext/tools/indexing/resolution/inheritance.py#L353-L413.

Added a regression test for Python imports without source in CodeGraphContext/tests/unit/tools/test_cross_lang_call_resolution_patterns.py#L681-L723

Amp-Thread-ID: https://ampcode.com/threads/T-019ed3c3-1f34-7278-87d8-1b741154a281

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

@gojun077 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

Status: Backlog tasks

Development

Successfully merging this pull request may close these issues.

1 participant