Skip to content

[FEATURE] Hybrid type resolution: import-aware call edge refinement #13

@Wolfvin

Description

@Wolfvin

Problem

Current typeinfer_engine.py does lightweight inference but doesn't track import chains. Result: user.profile.update() gets recorded as a call to update with no target type — the call graph has holes wherever methods are called on imported objects.

Proposed Change

Add a Hybrid Type Resolution pass that runs after the AST parse pass:

  1. Build a per-file import registry: from models import User -> User -> models.User
  2. For each call site, resolve the receiver type via the import registry
  3. Refine the CALLS edge: user.profile.update -> Profile.update in models/profile.py

Priority Languages (for CodeLens agent use case)

  • Python: dotted imports, dataclasses, @property, isinstance narrowing
  • TypeScript: module re-exports, generic return types, method chaining

Why This Matters

Accurate call edges = accurate trace + accurate impact = agents can trust the graph. Without this, agents can't rely on trace for anything beyond same-file calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureCore architecture changeenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions