Skip to content

Python: dict .get() calls misidentified as Route nodes #28

@RyanKim17920

Description

@RyanKim17920

Bug

dict.get("key") calls inside function bodies are parsed as Route nodes, inflating route counts with false positives.

Example

user_id = payload.get("sub")       # → creates Route node "GET sub"
username = payload.get("username") # → creates Route node "GET username"

These appear in search_graph(label="Route") results alongside real FastAPI routes.

Impact

Running get_architecture(aspects=["routes"]) or querying Route nodes returns ~125 spurious nodes mixed with real endpoints, making route discovery unreliable without manual filtering.

Workaround

Filter by WHERE qualified_name =~ '.*routers.*' to restrict to actual router files.

Suggested Fix

Route detection should require the .get() call to be on an APIRouter or FastAPI instance (i.e. the receiver is typed as or assigned from APIRouter()), not arbitrary dict variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    parsing/qualityGraph extraction bugs, false positives, missing edges

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions