Repository navigation
Conversation
|
Thanks for the pull request, @armbrusl. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
…tp_endpoint nodes
A full-stack repo extracts as two disconnected islands: the frontend calls
fetch('/api/devices') while the backend binds path("devices", views.devices),
and no static edge can cross the gap (the coupling is an API contract, which
the code graph has no node for). First adapter pair proposed in Graphify-Labs#1595.
Two suffix-gated language resolvers mint one deterministic http_endpoint node
per normalized URL pattern, so the contract becomes the meeting point:
- django_routes (.py): a urls.py tree walk stamps path()/re_path()/include()
calls (module-level route declarations never reach the generic raw_call
walk), then composes include() prefixes and binds views through import
evidence: one serves edge per unambiguously resolved route.
- http_fetch_calls (JS/TS/Svelte/Vue/Astro): fetch()/axios call sites get
their first string argument stamped onto raw_calls (config-gated via
http_callees): one calls_endpoint edge per caller.
Both edges are EXTRACTED because each is explicit text in source, and the
cross-boundary meeting is node identity, not a matched guess. Placeholder
syntaxes converge on one node: fetch(`/api/runs/${id}`) and Django's
api/ + runs/<int:run_id> normalize identically. Ambiguity fails closed
(unresolved views and regex routes park name-only; duplicate pairs are
skipped), and re-extraction stays idempotent across the AST cache (schema
48), including incremental updates.
Limitations: regex re_path routes are parked, not bound; module-level
fetch() calls are outside the JS walk; axios capture keys on the literal
receiver name; matching is path-only because Django's path() declares no
HTTP method (observed methods land in the endpoint node's metadata).
Co-Authored-By: GLM 5.3 <[email protected]>
d3ea621 to
8dbee40
Compare
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; no formal proof of the changed code.
No blocking issues. I didn't find anything I'd hold the merge for.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 0 functions depend on the 0 functions this change touches.
Health — grade A; no new coupling hotspots.
Verification — 0 functions in the blast radius were not formally verified this run (proofs are advisory here).
Diff could not be reliably attributed to this PR: the base/head merge-base was unreachable in the shallow clone, so detailed findings were skipped (rather than emit a two-dot diff, which would misattribute base-branch changes).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Test selection
Test selection
0 of 584 test file(s) selected (0%) via static blast radius.
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
|
Nice work, this is the shape I'd hoped for. Two small things I ran into while writing edges in the same shape from a cross-repo tool:
|
What does this PR do?
Implements the first client/server adapter pair proposed in #1595: the frontend island and the backend island of a full-stack repo share no code edge — the frontend calls
fetch('/api/devices'), the backend bindspath("devices", views.devices), and the wire between them has no node in the graph.graphify affected <a backend view>therefore cannot see the client call sites that break when a response shape changes.Two suffix-gated language resolvers mint one deterministic
http_endpointnode per normalized URL pattern, and each side binds to it:django_routes(.py): aurls.pytree walk stampspath()/re_path()/include()calls — module-level route declarations never reach the generic raw_call walk — then composesinclude()prefixes and binds views through import evidence: oneservesedge per unambiguously resolved route.http_fetch_calls(JS/TS/Svelte/Vue/Astro):fetch()/axioscall sites get their first string argument stamped ontoraw_calls(config-gated viahttp_callees): onecalls_endpointedge per caller.Placeholder syntaxes converge on one node:
fetch(\/api/runs/${id}`)and Django'sapi/+runs/int:run_id` normalize identically (endpoint ids are hash-addressed, terraform-scope style, so both derivations meet by construction).Two deliberate deviations from #1595, offered for discussion:
EXTRACTEDrather thanINFERRED. Each edge is explicit text in source — the call site names the URL it fetches, the route names the view it serves — and the cross-boundary meeting is node identity, not a matched guess. Nothing is inferred, so nothing should be discounted.path()declares no HTTP method, so method agreement (this issue's guard) is impossible to honor for this server framework; observed methods are recorded in the endpoint node's metadata instead. A verb-declaring server adapter (Express,@GetMapping) can raise the bar later.Client paths with no server route (and vice versa) mint an orphan node with
originmetadata — the dangling-contract drift in #1595 is visible without emitting any edge.Design lives in
graphify/http_endpoints.py(shared contract: normalization, id, node/edge builders, guards);graphify/django_routes.pyandgraphify/http_fetch.pyare the adapters; stamping sits in the python extractor and the generic engine's raw_call emission, gated byhttp_calleeson the language config.Real-world check (Svelte + Django repo, 232 files; before → after: 1780 → 1802 nodes, 5349 → 5387 edges):
Type of change
Verification & Invariants
pathbetween a frontend file and a backend file exits with "no route" on 0.9.110; the invariant this protects is extraction determinism — endpoint ids derive from pattern text alone (no fs order, no env, no timestamps), so both derivations meet and re-extraction is stable.engine.pyhunk stashed (verified viagit stash), and the resolver gate test fails before registration wiring.urls.pycache blobs (which carry no route stamps) are retired, not silently misread.include()module strings and view references resolve only on exactly one candidate (zero or many → park name-only, never a guessed edge); duplicate(source, target, relation)keys are skipped; re-drive idempotence asserted by node identity.re_pathroutes are parked (unresolved_route), not bound; module-levelfetch()calls are outside the JS function-body walk; axios capture keys on the literal receiver name; matching is path-only (see deviation 2).How was this tested