What is missing / Why it matters
In backend/features/repo_ingestion/graph_builder.py, extract_python_imports parses Python source code using AST. When it encounters a relative import (e.g., from .database import get_db), it only extracts node.module (which evaluates to "database" without the dot prefix) and completely ignores node.level (which indicates the relative nesting depth). As a result, the resolver receives "database" instead of ".database", causing it to fail relative import resolution and misinterpret import edges.
Acceptance Criteria
- Modify
extract_python_imports to inspect node.level of ast.ImportFrom nodes. Prepend a corresponding number of dots . based on level to the module string before yielding it.
- Verify using pytest that relative Python imports are correctly resolved to their target files.
What is missing / Why it matters
In
backend/features/repo_ingestion/graph_builder.py,extract_python_importsparses Python source code using AST. When it encounters a relative import (e.g.,from .database import get_db), it only extractsnode.module(which evaluates to"database"without the dot prefix) and completely ignoresnode.level(which indicates the relative nesting depth). As a result, the resolver receives"database"instead of".database", causing it to fail relative import resolution and misinterpret import edges.Acceptance Criteria
extract_python_importsto inspectnode.levelofast.ImportFromnodes. Prepend a corresponding number of dots.based onlevelto the module string before yielding it.