Skip to content

cross-repo-intelligence: 0 edges for FastAPI backend — Route.path empty, router prefix stripped #678

Description

@adityapapu

Summary

cross-repo-intelligence mode makes 0 CROSS_HTTP_CALLS edges between FastAPI backend and its frontend client. FastAPI extractor leaves Route.path empty. Path text lands only in Route.name / Route.qualified_name, and router mount prefix gets stripped. Matcher keys on Route.path, so it compares against nothing.

Environment

  • Backend: FastAPI (@router.get(...) + include_router(prefix=...)). ~10.9k nodes, 143 Route nodes.
  • Frontend: TanStack Router SPA. HTTP_CALLS.url_path populates fine (e.g. /admin/scenarios/:id).

Reproduction

  1. Index FastAPI repo (mode: fast or full).
  2. Index frontend repo that calls that backend. Confirm HTTP_CALLS.url_path populates.
  3. Run index_repository(mode="cross-repo-intelligence", target_projects=[backend]) from frontend.

Result:

{"mode":"cross-repo-intelligence","cross_http_calls":0,"total_cross_edges":0}

Root cause

Backend Route nodes after fresh index:

MATCH (r:Route) WHERE r.file_path =~ '.*drona/scenario.*'
RETURN r.name, r.method, r.path, r.qualified_name

"/scenarios/{scenario_id}"  "GET"  ""  "__route__GET__/scenarios/{scenario_id}"
"/scenarios/{scenario_id}/draft/publish"  "POST"  ""  "__route__POST__/scenarios/{scenario_id}/draft/publish"
  • r.path is "" on every FastAPI route.
  • MATCH (r:Route) WHERE r.path <> '' ... returns 0 rows across the whole project.
  • Path text sits in name / qualified_name only.

Two gaps

  1. Route.path empty for FastAPI. Matcher key field holds nothing. This one fact makes cross-repo linking a no-op.
  2. Router prefix stripped. Backend stores /scenarios. Real mounted path is /admin/scenarios. Extractor drops include_router(prefix=...). Even with path filled from name, prefix gap plus param style ({scenario_id} vs :id) breaks a plain string match.

Suggested fix

  • Fill Route.path from decorator arg during FastAPI extraction.
  • Resolve include_router(prefix=...) mounts, prepend them, store full external path.
  • Normalize path params ({id} / :id / {id:int}) in matcher before compare.

Impact

trace_path(mode=cross_service) cannot bridge any FastAPI backend to its clients until Route.path populates. Cross-repo mode stays dead for the FastAPI plus SPA stack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/normalStandard review queue; useful PR with ordinary maintainer urgency.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions