Skip to content

feat(metrics): split unresolved edges into external vs unresolved-local#50

Merged
smochan merged 1 commit into
mainfrom
feat/external-edge-classification
May 30, 2026
Merged

feat(metrics): split unresolved edges into external vs unresolved-local#50
smochan merged 1 commit into
mainfrom
feat/external-edge-classification

Conversation

@smochan

@smochan smochan commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • The single `unresolved_edges` count was conflating external imports (`fastapi`, `os`, `react`) with edges that pointed at in-repo symbols but couldn't be matched.
  • New fields: `external_edges` and `unresolved_local_edges`. Old field is kept as the sum for back-compat.
  • Surfaced in the markdown report and the MCP `metrics` tool.

v0.1.2 backlog item #2. Surfaced when a user added polycodegraph to a FastAPI project and saw "1,423 unresolved edges," almost all of which were external imports.

Test plan

  • 4 new unit tests in `tests/test_metrics_external.py`.
  • Full Python suite green (600 passed).

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

codegraph PR review

Diff vs main · severity ≤ high

codegraph review (target: main)

Diff: +10 / -0 / ~0 nodes, +36 / -0 edges

Findings (0)

No findings.

Triggered by codegraph CI · last run

The `unresolved_edges` count conflated two very different things:

1. External imports — `fastapi`, `os`, `react`. Static analysis without
   a venv/site-packages parse can't resolve these and isn't supposed to.
   These are expected, not errors.
2. Local-unresolved — target's root module IS in the repo but the
   specific symbol couldn't be matched (rename drift, dynamic import,
   missed binding). These are the actionable ones.

`compute_metrics` now classifies each unresolved edge by checking whether
the target's root module appears as a MODULE node's qualname-root in the
graph. New fields: `external_edges`, `unresolved_local_edges`. The
`unresolved_edges` total is kept as the sum for back-compat.

Surfaced + exposed in the markdown report and the MCP `metrics` tool.

v0.1.2 backlog item #2.
@smochan smochan force-pushed the feat/external-edge-classification branch from 7f2b57f to e07a63c Compare May 30, 2026 17:06
@github-actions

Copy link
Copy Markdown

codegraph PR review

Diff vs main · severity ≤ high

codegraph review (target: main)

Diff: +10 / -0 / ~0 nodes, +36 / -0 edges

Findings (0)

No findings.

Triggered by codegraph CI · last run

@smochan smochan merged commit ba557ee into main May 30, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant