Skip to content

v1.108.58 - Framework flow-edge resolver for get_signal_chains

Choose a tag to compare

@jgravelle jgravelle released this 17 Jun 18:26
· 50 commits to main since this release

Framework flow-edge resolver for get_signal_chains

A new language-agnostic resolver (tools/flow_edges.py) recovers the two request-flow links the AST call graph is structurally blind to, working entirely off the existing index (symbols + import graph + file content) — no reindex, no INDEX_VERSION bump, nothing persisted.

route → handler

String-dispatched handlers — Django path()/re_path()/url(), Express/Fastify/Koa router.get(path, handler), Flask add_url_rule(view_func=...), Rails get "x", to: "ctrl#action" — are referenced, not called or decorated, so they leave no call edge and never surfaced as entry points. The resolver detects the registration shape, resolves the handler reference to a symbol through the index's own import graph, and get_signal_chains promotes it to an http gateway. Repos that dispatch by string now produce signal chains where they previously returned none. Decorator-bound handlers (@app.route, @GetMapping, @Get()) already surface as gateways and are deliberately not re-emitted.

render → view

A handler rendering a template named by a string literal (render(request, "x.html"), render_template("x.html"), res.render("index"), view("home")) has no call edge to the template. Each chain now carries an additive views list of the templates it renders; when the template file is itself indexed, the edge resolves to that file.

This is one shape-keyed resolver, not a plugin per framework — detection keys on the structural shape of the call, and resolution reuses the same symbol-table + import-graph machinery find_direct_callees uses.

API

get_signal_chains gains include_flow_edges (default true; set false for pure call-graph behavior). _meta.flow_edges reports {route_gateways, unresolved_routes, render_views}. With the flag off, or on a repo with no route/render shapes, output is byte-identical to the previous behavior.

Also fixed

  • load_live_journal 0-minute-budget boundary (>>=), a timing flake on fast Windows CI runners.

10 tests in tests/test_v1_108_58.py; full matrix (Ubuntu + Windows, py3.10–3.13) green.