Skip to content

Cross-service edges: bridge client ↔ backend across the network boundary (API-contract matching) #1595

Open

Description

@sheik-hiiobd

Proposing a direction — keen on your read before any code. graphify is excellent at blast-radius within a service; this is about extending affected across the client/backend network boundary. Would this fit graphify's scope? Happy to prototype a first adapter pair if so.

Cross-service edges — bridge client ↔ backend across the network boundary

Type: feature proposal / design discussion (not a bug — current behavior is correct).

Problem

graphify maps code edges — calls, imports, references. In a full-stack repo (a mobile/web client + an HTTP backend), the two sides share no code; they talk over the network. So the graph draws them as two disconnected islands with zero edges crossing — even though they are one system and tightly coupled.

Evidence

A full-stack monorepo (a mobile client + an HTTP backend), ~2,249 nodes, zero links crossing the client/backend boundary. That's correct — there is no code reference between them — but the system's real coupling is invisible to every graph query. graphify affected <backend endpoint> cannot answer "which client screens break if I change this response shape," which is exactly the blast-radius question the tool is best at within a service.

Root cause

The coupling is an API contract — an HTTP (method, path) — not a code reference. A static code-graph has no node for "the wire," so there is nothing to link. This is a known wall for every code-graph tool on distributed / full-stack systems; it is not a defect in resolution (the integrity self-check is clean, and rightly so).

Proposed direction — synthetic cross-service edges via API-contract matching

Bridge the islands by matching client call sites to server route handlers on the contract, and emitting a distinct edge — never a calls edge (there is no code call), but a new relation, e.g. calls_endpoint / serves (INFERRED, context "api"):

  1. Extract client call sites → (method, path-template) from the HTTP client idioms per framework (Retrofit/OkHttp annotations, fetch/axios, URLSession, …).
  2. Extract server routes → (method, path-template) from route declarations (@app.get("/users/{id}"), @GetMapping, router.get(...), …).
  3. Match on (method, normalized path-template) → emit client-call-site → server-handler.

Framework-specific, so it fits graphify's existing shape — per-framework adapters, mirroring the per-language tree-sitter extractors. Start with one client + one server framework (whatever pair is most common) and grow the adapter set.

Guards (the accuracy story, learned from the indirect_call work)

  • Path-template normalization is the crux: /users/{id} ≡ /users/:id ≡ /users/<int:id> ≡ a concrete /users/123. Match on the template, parameter-agnostic.
  • Method must agree — never match on path alone (GET /users ≠ POST /users).
  • Stay INFERRED — a matched contract is evidence of a call, not a proven one (same posture as indirect_call).
  • Negatives up front — a client path with no server route (and vice-versa) emits nothing and is worth surfacing as a dangling contract (a real bug class: an endpoint the client calls that the backend doesn't serve).

Scope for v1

  • One adapter pair; (method, path) matching only. Leave semantic depth (auth scopes, API versioning, request/response shape compatibility) to later.
  • The payoff is immediate: full-stack affected (change an endpoint → the client call sites light up) and dangling-contract detection (client/server drift).

Note

This frames the problem + the solution space. I have a concrete plan for the matching/adapter design to bring to the discussion — happy to prototype a first client/server adapter pair if the direction lands.

Activity

  1. armbrusl commented on Nov 15, 2026

    @armbrusl

    Put together a working prototype of the first adapter pair proposed here — fetch()/axios on the client side (JS/TS/Svelte/Vue/Astro), Django routes on the server side — in #5232. It landed on the same two relations this issue proposes, calls_endpoint and serves, with two deliberate deviations the PR discusses:

    1. Each edge is EXTRACTED, not INFERRED — the call site names the URL it fetches and the route names the view it serves, so the client/server meeting is node identity (one hash-addressed http_endpoint node per normalized pattern) rather than a matched pair. affected then crosses the boundary through ordinary traversal.
    2. v1 matches path only, because the chosen server framework (Django's path()) declares no HTTP method; observed methods land in the endpoint node's metadata, and honest method verification needs a verb-declaring server adapter (Express, @GetMapping).

    Dangling contracts come out as visible orphan endpoint nodes with origin metadata rather than emitted edges, per the proposal's negatives-up-front guard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions