Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(workspace): links between two services, resolved and paged (#4598)
Raghav Chamadiya6c997b766192
diff --git a/packages/api-client/src/types/workspace.ts b/packages/api-client/src/types/workspace.tsindex 13713be27..67c9baf33 100644--- a/packages/api-client/src/types/workspace.ts+++ b/packages/api-client/src/types/workspace.ts@@ -243,6 +243,11 @@ export type {SystemGraph,SystemEdgeKind,SystemEdgeMatchType,+ ServiceLinkDirection,+ ServiceLinkEntry,+ ServiceLinkEvidence,+ ServiceLinksTotal,+ ServiceLinksBetween,ExtractionDiagnostics,RepoDiagnostics,UnmatchedConsumer,@@ -277,6 +282,7 @@ export type {import type {SystemGraph,+ ServiceLinksBetween,CrossRepoBlastRadius,BreakingChangeReport,ConformanceReport,@@ -286,6 +292,9 @@ import type {/** `GET /api/workspace/system-graph` — the service-granular system graph (`?view=map`: its lean view). */export type WorkspaceSystemGraphResponse = SystemGraph;+/** `GET /api/workspace/system-graph/links` — one page of links between two services. */+export type WorkspaceLinksBetweenResponse = ServiceLinksBetween;+/** `GET /api/workspace/blast-radius` — cross-repo downstream impact set. */export type WorkspaceBlastRadiusResponse = CrossRepoBlastRadius;diff --git a/packages/api-client/src/workspace.ts b/packages/api-client/src/workspace.tsindex 89f1f651f..e0611850c 100644--- a/packages/api-client/src/workspace.ts+++ b/packages/api-client/src/workspace.ts@@ -10,6 +10,7 @@ import type {WorkspaceSyncResponse,WorkspaceSystemGraphResponse,WorkspaceBlastRadiusResponse,+ WorkspaceLinksBetweenResponse,WorkspaceBreakingChangesResponse,WorkspaceConformanceResponse,WorkspaceArchitectureResponse,@@ -132,6 +133,36 @@ export async function getWorkspaceSystemGraph();}+/**+ * Everything behind the edges between two service nodes (contract links,+ * package dependencies, co-changes), both directions, one page at a time.+ * Each end is resolved to its service server-side, the way the graph was built.+ */+export async function getWorkspaceLinksBetween(+ opts: {+ a: string;+ b: string;+ /** One edge kind: `http`, `grpc`, `event`, `db`, `package`, `co_change`... */+ kind?: string;+ /** Every whitespace-separated term must match the row's ids, files, symbols or packages. */+ q?: string;+ limit?: number;+ offset?: number;+ },+ fetchOptions?: RequestInit,+): Promise<WorkspaceLinksBetweenResponse> {+ const params: Record<string, string | number> = { a: opts.a, b: opts.b };+ if (opts.kind) params.kind = opts.kind;+ if (opts.q) params.q = opts.q;+ if (opts.limit != null) params.limit = opts.limit;+ if (opts.offset != null) params.offset = opts.offset;+ return apiGet<WorkspaceLinksBetweenResponse>(+ "/api/workspace/system-graph/links",+ params,+ fetchOptions,+ );+}+/*** Cross-repo blast radius from a service node (or repo alias): the downstream* services impacted if it changes, ranked by impact. Reads the same systemdiff --git a/packages/core/src/repowise/core/workspace/links_between.py b/packages/core/src/repowise/core/workspace/links_between.pynew file mode 100644index 000000000..6059284a6--- /dev/null+++ b/packages/core/src/repowise/core/workspace/links_between.py@@ -0,0 +1,259 @@+"""Every link between two services, in both directions, one page at a time.++The system graph folds a pair's evidence into one edge per ``(source, target,+kind)`` and keeps at most :data:`.system_graph.MAX_EDGE_REFS` refs on it. This+is the read behind such an edge: the contract links, service links, package+dependencies and co-changes themselves, each end resolved to its service with+the resolver the graph builder used, so a row lands on exactly the edge the+map drew and a pair's rows add up to its edges' weights.++Pure over the stored artifacts: :func:`build_links_index` reads the parsed+``system_graph.json``, ``contracts.json`` and ``cross_repo_edges.json``+payloads once, and :func:`links_between` pages one pair out of that index. Any+server holding those payloads builds the same index and answers the same way.+"""++from __future__ import annotations++from dataclasses import dataclass, field+from typing import Any++from repowise.core.workspace.reads import _consumer_id, _link_haystack, _matches_terms, link_row+from repowise.core.workspace.system_graph import (+ boundaries_from_nodes,+ edge_kind_for_contract_type,+ resolve_service_id,+)++__all__ = ["A_TO_B", "BOTH", "B_TO_A", "LinksIndex", "build_links_index", "links_between"]++#: The row's ``direction``: ``a`` calls / depends on ``b``, the reverse, or+#: both ways at once (a co-change, which has no direction).+A_TO_B = "a_to_b"+B_TO_A = "b_to_a"+BOTH = "both"++_PACKAGE_DEP_FIELDS = (+ "source_repo",+ "source_manifest",+ "target_repo",+ "target_package",+ "kind",+ "target_manifest",+ "requested_version",+ "scope",+ "resolution_basis",+)+_CO_CHANGE_FIELDS = (+ "source_repo",+ "source_file",+ "target_repo",+ "target_file",+ "strength",+ "frequency",+ "last_date",+)+++@dataclass(frozen=True)+class _Entry:+ source: str+ target: str+ kind: str+ evidence: str # contract | package | co_change+ raw: dict+ haystack: str+ order: tuple[str, ...]+++@dataclass+class LinksIndex:+ """Every stored link of the estate, resolved once to the service pair it joins.++ Build with :func:`build_links_index`; a server keeps one per loaded set of+ artifacts and pages every pair out of it.+ """++ nodes: dict[str, dict] = field(default_factory=dict)+ #: Unordered pair ``(min id, max id)`` -> its entries, both directions.+ pairs: dict[tuple[str, str], list[_Entry]] = field(default_factory=dict)+ #: ``(role, repo, file, contract_id) -> origin``; first contract row wins.+ origins: dict[tuple, str | None] = field(default_factory=dict)+ #: The graph and the contracts come from different builds, so some links+ #: may resolve to services the graph no longer has and drop out.+ stale_graph: bool = False++ def _add(self, entry: _Entry) -> None:+ if entry.source == entry.target:+ return # calls inside one service are never an edge+ key = (min(entry.source, entry.target), max(entry.source, entry.target))+ self.pairs.setdefault(key, []).append(entry)+++def build_links_index(graph: dict, store: dict, overlay: dict | None = None) -> LinksIndex:+ """Resolve every link, package dependency and co-change of the estate to its pair.++ *graph* is ``system_graph.json`` (its ``nodes`` and ``repo_provenance``),+ *store* is ``contracts.json`` (``contracts``, ``contract_links``,+ ``service_links``, ``repo_provenance``) and *overlay* is+ ``cross_repo_edges.json`` (``package_deps``, ``co_changes``). Each end is+ resolved the way :func:`.system_graph.build_system_graph` resolved it.++ The premise is that the three come from one workspace update, which writes+ them together. When the graph and the contracts both record the repo heads+ they were built from and those differ, ``stale_graph`` says so.+ """+ nodes = graph.get("nodes", [])+ graph_prov, store_prov = graph.get("repo_provenance"), store.get("repo_provenance")+ index = LinksIndex(+ nodes={n["id"]: n for n in nodes},+ stale_graph=bool(graph_prov and store_prov and graph_prov != store_prov),+ )+ boundaries = boundaries_from_nodes(nodes)++ def resolve(repo: str, file_path: str | None) -> str:+ return resolve_service_id(repo, file_path, boundaries)++ for lk in _rows(+ [*store.get("contract_links", []), *store.get("service_links", [])],+ "consumer_repo",+ "provider_repo",+ ):+ # A service link has no provider file, so it lands on the repo-root node.+ index._add(+ _Entry(+ source=resolve(lk["consumer_repo"], lk.get("consumer_file")),+ target=resolve(lk["provider_repo"], lk.get("provider_file") or None),+ kind=edge_kind_for_contract_type(lk.get("contract_type", "")),+ evidence="contract",+ raw=lk,+ haystack=_link_haystack(lk),+ order=_order(lk, "contract_id", "consumer_file", "provider_file"),+ )+ )+ for dep in _rows((overlay or {}).get("package_deps", []), "source_repo", "target_repo"):+ index._add(+ _Entry(+ source=resolve(dep["source_repo"], dep.get("source_manifest")),+ target=resolve(dep["target_repo"], dep.get("target_manifest") or None),+ kind="package",+ evidence="package",+ raw=dep,+ haystack=_haystack(dep, _PACKAGE_DEP_FIELDS),+ order=_order(dep, "target_package", "source_manifest"),+ )+ )+ for cc in _rows((overlay or {}).get("co_changes", []), "source_repo", "target_repo"):+ index._add(+ _Entry(+ source=resolve(cc["source_repo"], cc.get("source_file")),+ target=resolve(cc["target_repo"], cc.get("target_file")),+ kind="co_change",+ evidence="co_change",+ raw=cc,+ haystack=_haystack(cc, _CO_CHANGE_FIELDS),+ order=_order(cc, "source_file", "target_file"),+ )+ )+ for c in store.get("contracts", []):+ key = (c.get("role"), c.get("repo"), c.get("file_path"), c.get("contract_id"))+ index.origins.setdefault(key, c.get("origin"))+ return index+++def links_between(+ index: LinksIndex,+ *,+ a: str,+ b: str,+ kind: str | None = None,+ q: str | None = None,+ limit: int = 50,+ offset: int = 0,+) -> dict[str, Any] | None:+ """The links between service nodes *a* and *b*, both directions, paged.++ Every row carries its edge ``kind``, its ``direction`` (:data:`A_TO_B` when+ *a* is the consumer or dependent, :data:`BOTH` for a co-change) and its+ ``evidence``: a ``contract`` row holds the contract-link row+ (:func:`.reads.link_row`) and both ends' contract origins, a ``package``+ row the manifest dependency, a ``co_change`` row the file pair.++ ``q`` keeps rows where every whitespace-separated term matches, ``kind``+ keeps one edge kind. ``total`` counts the filtered rows the page is cut+ from; ``totals`` counts every kind and direction under ``q`` but not+ ``kind``, so a caller grouping kinds into families sums them itself.++ None when *a* or *b* is not a node of the graph.+ """+ if a not in index.nodes or b not in index.nodes:+ return None+ terms = (q or "").lower().split()+ matched = [+ (_direction(e, a), e)+ for e in index.pairs.get((min(a, b), max(a, b)), [])+ if not terms or _matches_terms(e.haystack, terms)+ ]++ totals: dict[tuple[str, str], int] = {}+ for direction, e in matched:+ totals[(e.kind, direction)] = totals.get((e.kind, direction), 0) + 1++ rows = sorted(+ (m for m in matched if kind is None or m[1].kind == kind),+ key=lambda m: (m[0], m[1].kind, m[1].evidence, *m[1].order),+ )+ return {+ "a": a,+ "b": b,+ "stale_graph": index.stale_graph,+ "links": [_row(e, d, index.origins) for d, e in rows[offset : offset + limit]],+ "total": len(rows),+ "totals": [{"kind": k, "direction": d, "count": n} for (k, d), n in sorted(totals.items())],+ }+++def _rows(rows: list[dict], *required: str) -> list[dict]:+ """*rows* that name both repos; a malformed stored row is skipped, as the builder never saw it."""+ return [r for r in rows if all(r.get(k) for k in required)]+++def _direction(entry: _Entry, a: str) -> str:+ if entry.evidence == "co_change":+ return BOTH+ return A_TO_B if entry.source == a else B_TO_A+++def _haystack(row: dict, fields: tuple[str, ...]) -> str:+ return " ".join(str(row.get(f) or "") for f in fields).lower()+++def _order(row: dict, *fields: str) -> tuple[str, ...]:+ return tuple(str(row.get(f) or "") for f in fields)+++def _row(entry: _Entry, direction: str, origins: dict[tuple, str | None]) -> dict[str, Any]:+ out: dict[str, Any] = {+ "kind": entry.kind,+ "direction": direction,+ "evidence": entry.evidence,+ "link": None,+ "provider_origin": None,+ "consumer_origin": None,+ "package_dep": None,+ "co_change": None,+ }+ raw = entry.raw+ if entry.evidence == "contract":+ out["link"] = link_row(raw)+ out["provider_origin"] = origins.get(+ ("provider", raw.get("provider_repo"), raw.get("provider_file"), raw.get("contract_id"))+ )+ out["consumer_origin"] = origins.get(+ ("consumer", raw.get("consumer_repo"), raw.get("consumer_file"), _consumer_id(raw))+ )+ elif entry.evidence == "package":+ out["package_dep"] = {f: raw[f] for f in _PACKAGE_DEP_FIELDS if raw.get(f) is not None}+ else:+ out["co_change"] = {f: raw[f] for f in _CO_CHANGE_FIELDS if raw.get(f) is not None}+ return outdiff --git a/packages/core/src/repowise/core/workspace/system_graph.py b/packages/core/src/repowise/core/workspace/system_graph.pyindex a502b19ab..0da1f1158 100644--- a/packages/core/src/repowise/core/workspace/system_graph.py+++ b/packages/core/src/repowise/core/workspace/system_graph.py@@ -37,7 +37,7 @@ import loggingfrom dataclasses import dataclass, fieldfrom datetime import UTC, datetimefrom pathlib import Path-from typing import Any+from typing import TYPE_CHECKING, Anyfrom repowise.core.fsutils import atomic_write_textfrom repowise.core.workspace.config import (@@ -55,6 +55,9 @@ from repowise.core.workspace.extractors.service_boundary import ()from repowise.core.workspace.origins import LinkStrategy, legacy_strategy+if TYPE_CHECKING:+ from collections.abc import Iterable+_log = logging.getLogger("repowise.workspace.system_graph")# ---------------------------------------------------------------------------@@ -290,6 +293,48 @@ def _node_id(repo: str, service_path: str | None) -> str:return repo if service_path is None else f"{repo}::{service_path}"+def resolve_service_id(+ repo: str,+ file_path: str | None,+ boundaries_by_repo: dict[str, list[ServiceBoundary]],+) -> str:+ """The node id *file_path* in *repo* belongs to: its deepest service, else the repo root.++ ``file_path is None`` resolves to the repo-root node (repo-level facts+ like a package dependency on a whole repo). The builder and every read+ that maps a file to a service call this, so they cannot disagree.+ """+ return _node_id(repo, _service_path(repo, file_path, boundaries_by_repo))+++def _service_path(+ repo: str, file_path: str | None, boundaries_by_repo: dict[str, list[ServiceBoundary]]+) -> str | None:+ if file_path is None:+ return None+ return assign_service(file_path, boundaries_by_repo.get(repo, []))+++def boundaries_from_nodes(nodes: Iterable[dict[str, Any]]) -> dict[str, list[ServiceBoundary]]:+ """The service boundaries a stored graph's nodes stand for, by repo.++ The graph does not persist boundary detection, but it does not need to:+ every link end the builder resolved became a node, so the deepest boundary+ holding that end is among the nodes, and longest-prefix matching against+ the nodes alone resolves the same end to the same id.+ That holds for nodes and links written by the same build, which a+ workspace update always does.+ """+ out: dict[str, list[ServiceBoundary]] = {}+ for node in nodes:+ path = node.get("service_path")+ if path:+ out.setdefault(node["repo"], []).append(+ ServiceBoundary(service_path=path, service_name=path.rsplit("/", 1)[-1])+ )+ return out++class _GraphBuilder:"""Accumulates nodes and aggregated edges as contracts/edges are walked.@@ -311,11 +356,7 @@ class _GraphBuilder:``file_path is None`` resolves to the repo-root node (repo-level factslike a package dependency on a whole repo)."""- service = (- assign_service(file_path, self._boundaries.get(repo, []))- if file_path is not None- else None- )+ service = _service_path(repo, file_path, self._boundaries)nid = _node_id(repo, service)if nid not in self._nodes:self._nodes[nid] = SystemNode(diff --git a/packages/server/src/repowise/server/mcp_server/_enrichment.py b/packages/server/src/repowise/server/mcp_server/_enrichment.pyindex 61f6dc517..815be37b6 100644--- a/packages/server/src/repowise/server/mcp_server/_enrichment.py+++ b/packages/server/src/repowise/server/mcp_server/_enrichment.py@@ -113,6 +113,7 @@ class CrossRepoEnricher:# Contract indexesself._contracts: list[dict] = []self._contract_links: list[dict] = []+ self._service_links: list[dict] = []self._contract_provider_index: dict[tuple[str, str], list[dict]] = defaultdict(list)self._contract_consumer_index: dict[tuple[str, str], list[dict]] = defaultdict(list)# Keyed by the ingestion symbol id, so a caller holding a symbol can@@ -129,6 +130,9 @@ class CrossRepoEnricher:# Read once per loaded graph: its evidence brief and parsed diagnostics.self._evidence_brief: Any = _ABSENTself._parsed_diagnostics: Any = _ABSENT+ # Every link resolved to its service pair, built on the first+ # links-between read and dropped with the artifacts it was built from.+ self._links_index: Any = None# Provider changes from the latest update that break consumers, with the# impacted consumer files. Read-only.@@ -326,6 +330,7 @@ class CrossRepoEnricher:def _ingest_contracts(self, data: dict) -> None:self._contracts = data.get("contracts", [])self._contract_links = data.get("contract_links", [])+ self._service_links = data.get("service_links", [])self._contract_analysis = {"status": "available","contract_version": data.get("version", 1),@@ -459,6 +464,11 @@ class CrossRepoEnricher:"""Every matched link row, as stored."""return self._contract_links+ @property+ def service_links(self) -> list[dict]:+ """Service-level link rows: a host named but no route, and gateway routes."""+ return self._service_links+@propertydef co_changes(self) -> list[dict]:"""The stored co-change pairs, already capped by the miner."""@@ -493,6 +503,29 @@ class CrossRepoEnricher:"""Return the raw system graph dict (nodes, edges, diagnostics)."""return self._system_graph+ def links_index(self) -> Any:+ """The loaded artifacts' :class:`~repowise.core.workspace.links_between.LinksIndex`.++ None without a system graph. Built once, so paging a pair never+ rescans the estate's links.+ """+ if self._system_graph is None:+ return None+ if self._links_index is None:+ from repowise.core.workspace.links_between import build_links_index++ self._links_index = build_links_index(+ self._system_graph,+ {+ "contracts": self._contracts,+ "contract_links": self._contract_links,+ "service_links": self._service_links,+ "repo_provenance": self._contract_analysis.get("repo_provenance"),+ },+ {"package_deps": self._package_deps, "co_changes": self._co_changes},+ )+ return self._links_index+@propertydef has_breaking_changes(self) -> bool:"""True if a breaking-change report has been loaded *and* it ran.diff --git a/packages/server/src/repowise/server/routers/workspace.py b/packages/server/src/repowise/server/routers/workspace.pyindex 81b77c2f3..eb4e5036e 100644--- a/packages/server/src/repowise/server/routers/workspace.py+++ b/packages/server/src/repowise/server/routers/workspace.py@@ -53,6 +53,7 @@ from repowise.server.schemas.actions import (WorkspaceCrossRepoAction,WorkspaceRepoActions,)+from repowise.server.schemas.workspace import WorkspaceLinksBetweenResponsefrom repowise.server.services.module_health import read_repo_health_scorerouter = APIRouter(@@ -616,6 +617,51 @@ async def get_blast_radius(return WorkspaceBlastRadiusResponse(**result.to_dict())+# ---------------------------------------------------------------------------+# GET /api/workspace/system-graph/links+# ---------------------------------------------------------------------------++[email protected]("/system-graph/links", response_model=WorkspaceLinksBetweenResponse)+async def get_links_between(+ ws_config=Depends(get_workspace_config),+ enricher=Depends(get_cross_repo_enricher),+ a: str = Query(..., description="A service node id ('repo' or 'repo::service/path')."),+ b: str = Query(..., description="The other service node id."),+ kind: str | None = Query(+ None, description="One edge kind: http, grpc, event, db, package, co_change..."+ ),+ q: str | None = Query(+ None,+ description="Every whitespace-separated term must match the row's ids, files, symbols or packages.",+ ),+ limit: int = Query(50, ge=1, le=500),+ offset: int = Query(0, ge=0),+):+ """Everything behind the edges between two services, both directions, paged.++ Contract links, service links, package dependencies and co-changes, each+ end resolved to its service the way the system graph was built, so a+ pair's rows add up to its edges' weights. The graph, contracts and+ cross-repo artifacts are read as one build; ``stale_graph`` flags a graph+ whose repo heads differ from the contracts'. 404 when either id is not a+ node of the graph (or no graph is built).+ """+ _require_workspace(ws_config)++ from repowise.core.workspace.links_between import links_between++ index = enricher.links_index() if enricher is not None else None+ result = (+ links_between(index, a=a, b=b, kind=kind, q=q, limit=limit, offset=offset)+ if index is not None+ else None+ )+ if result is None:+ raise HTTPException(status_code=404, detail="Service not found in the system graph")+ return WorkspaceLinksBetweenResponse(**result)++# ---------------------------------------------------------------------------# GET /api/workspace/test-impact# ---------------------------------------------------------------------------diff --git a/packages/server/src/repowise/server/schemas/workspace.py b/packages/server/src/repowise/server/schemas/workspace.pyindex b30dfc86b..ec763a240 100644--- a/packages/server/src/repowise/server/schemas/workspace.py+++ b/packages/server/src/repowise/server/schemas/workspace.py@@ -187,6 +187,70 @@ class WorkspaceCoChangeEntry(BaseModel):last_date: str+class WorkspacePackageDepEntry(BaseModel):+ """One manifest dependency of one repo on another, as ``cross_repo_edges.json`` stores it."""++ source_repo: str+ source_manifest: str = ""+ target_repo: str+ target_package: str = ""+ #: How the dependency resolved (``npm_package``, ``dotnet_project_ref``...).+ kind: str = ""+ target_manifest: str = ""+ requested_version: str | None = None+ scope: str = ""+ resolution_basis: str = ""+++class WorkspaceServiceLinkEntry(BaseModel):+ """One piece of evidence behind an edge between two services.++ ``evidence`` says which of ``link``, ``package_dep`` or ``co_change`` is set.+ """++ #: The system-graph edge kind it folds into (``http``, ``event``, ``db``,+ #: ``package``, ``co_change``...).+ kind: str+ #: ``a_to_b`` when service ``a`` is the consumer or dependent, ``b_to_a``+ #: when ``b`` is, ``both`` for a co-change (it has no direction).+ direction: Literal["a_to_b", "b_to_a", "both"]+ evidence: Literal["contract", "package", "co_change"]+ #: A contract link or service link (host-only, gateway route).+ link: WorkspaceContractLinkEntry | None = None+ #: What established each end's contract (``route_registration``,+ #: ``client_call``...), one of ``repowise.core.workspace.origins``. None+ #: when that end has no stored contract row or predates origins.+ provider_origin: str | None = None+ consumer_origin: str | None = None+ package_dep: WorkspacePackageDepEntry | None = None+ co_change: WorkspaceCoChangeEntry | None = None+++class WorkspaceServiceLinksTotal(BaseModel):+ kind: str+ direction: Literal["a_to_b", "b_to_a", "both"]+ count: int+++class WorkspaceLinksBetweenResponse(BaseModel):+ """Links between two services, read from ``system_graph.json``, ``contracts.json``+ and ``cross_repo_edges.json``. The three are written together by one+ workspace update; ``stale_graph`` is true when the graph and the contracts+ record different repo heads, and rows may then be missing."""++ a: str+ b: str+ stale_graph: bool = False+ #: One page of rows, ordered by direction, kind, evidence, then ids and files.+ links: list[WorkspaceServiceLinkEntry]+ #: Rows matching every filter; the page is cut from these.+ total: int+ #: Rows per edge kind and direction, for every kind present, under ``q``+ #: but not ``kind``. Kinds are not grouped here: a view that shows kind+ #: families (runtime, data, build, history) sums them itself.+ totals: list[WorkspaceServiceLinksTotal]++class WorkspaceCoChangesResponse(BaseModel):co_changes: list[WorkspaceCoChangeEntry]#: Pairs matching the query, before ``limit`` paged them.diff --git a/packages/types/src/generated/http.ts b/packages/types/src/generated/http.tsindex 858ec52fc..1042856ab 100644--- a/packages/types/src/generated/http.ts+++ b/packages/types/src/generated/http.ts@@ -4816,6 +4816,21 @@ export interface WorkspaceImpactedNode {edge_kinds?: string[];}+/**+ * Links between two services, read from ``system_graph.json``, ``contracts.json``+ * and ``cross_repo_edges.json``. The three are written together by one+ * workspace update; ``stale_graph`` is true when the graph and the contracts+ * record different repo heads, and rows may then be missing.+ */+export interface WorkspaceLinksBetweenResponse {+ a: string;+ b: string;+ stale_graph?: boolean;+ links: WorkspaceServiceLinkEntry[];+ total: number;+ totals: WorkspaceServiceLinksTotal[];+}+export interface WorkspaceNodeArchitectureRole {id: string;repo?: string;@@ -4846,6 +4861,19 @@ export interface WorkspaceOrphanProvider {other_files?: string[];}+/** One manifest dependency of one repo on another, as ``cross_repo_edges.json`` stores it. */+export interface WorkspacePackageDepEntry {+ source_repo: string;+ source_manifest?: string;+ target_repo: string;+ target_package?: string;+ kind?: string;+ target_manifest?: string;+ requested_version?: string | null;+ scope?: string;+ resolution_basis?: string;+}+export interface WorkspaceRepoActions {alias: string;repo_id: string | null;@@ -4913,6 +4941,28 @@ export interface WorkspaceSchemaCoverage {recovered_ratio_eligible?: number | null;}+/**+ * One piece of evidence behind an edge between two services.+ *+ * ``evidence`` says which of ``link``, ``package_dep`` or ``co_change`` is set.+ */+export interface WorkspaceServiceLinkEntry {+ kind: string;+ direction: "a_to_b" | "b_to_a" | "both";+ evidence: "contract" | "package" | "co_change";+ link?: WorkspaceContractLinkEntry | null;+ provider_origin?: string | null;+ consumer_origin?: string | null;+ package_dep?: WorkspacePackageDepEntry | null;+ co_change?: WorkspaceCoChangeEntry | null;+}++export interface WorkspaceServiceLinksTotal {+ kind: string;+ direction: "a_to_b" | "b_to_a" | "both";+ count: number;+}+export interface WorkspaceSymbolIdentity {total?: number;bound?: number;diff --git a/packages/types/src/workspace.ts b/packages/types/src/workspace.tsindex f55c136bd..c8087b12e 100644--- a/packages/types/src/workspace.ts+++ b/packages/types/src/workspace.ts@@ -111,6 +111,59 @@ export interface WorkspaceContractLinkEntry {consumer_contract_id?: string | null;}+/**+ * Which way a link between two services runs: `a_to_b` when `a` is the consumer+ * or dependent, `both` for a co-change (it has no direction).+ */+export type ServiceLinkDirection = "a_to_b" | "b_to_a" | "both";++/** What a row between two services is: which of its payload fields is set. */+export type ServiceLinkEvidence = "contract" | "package" | "co_change";++/**+ * One piece of evidence behind an edge between two services, each end resolved+ * to its service the way the system graph was built. Mirrors+ * `repowise.core.workspace.links_between`.+ */+export interface ServiceLinkEntry {+ /** The system-graph edge kind it folds into. */+ kind: SystemEdgeKind | (string & {});+ direction: ServiceLinkDirection;+ evidence: ServiceLinkEvidence;+ /** Set when `evidence` is `contract`: a contract link or service link. */+ link?: WorkspaceContractLinkEntry | null;+ /** What established each end's contract; null when unknown. */+ provider_origin?: ContractOriginWire | null;+ consumer_origin?: ContractOriginWire | null;+ /** Set when `evidence` is `package`. */+ package_dep?: WorkspacePackageDepEntry | null;+ /** Set when `evidence` is `co_change`. */+ co_change?: WorkspaceCoChangeEntry | null;+}++export interface ServiceLinksTotal {+ kind: SystemEdgeKind | (string & {});+ direction: ServiceLinkDirection;+ count: number;+}++/** `GET /api/workspace/system-graph/links`: one page of rows between `a` and `b`. */+export interface ServiceLinksBetween {+ a: string;+ b: string;+ /** The graph and the contracts record different repo heads; rows may be missing. */+ stale_graph?: boolean;+ /** Ordered by direction, kind, evidence, then ids and files. */+ links: ServiceLinkEntry[];+ /** Rows matching every filter; the page is cut from these. */+ total: number;+ /**+ * Rows per edge kind and direction, for every kind present, under `q` but not+ * `kind`. Not grouped: a view showing kind families sums them itself.+ */+ totals: ServiceLinksTotal[];+}+export interface WorkspaceCoChangeEntry {source_repo: string;source_file: string;diff --git a/tests/fixtures/workspace_links/eshop.json b/tests/fixtures/workspace_links/eshop.jsonnew file mode 100644index 000000000..e14d8e2b2--- /dev/null+++ b/tests/fixtures/workspace_links/eshop.json@@ -0,0 +1,1070 @@+{+ "nodes": [+ {+ "id": "basket.api",+ "repo": "basket.api",+ "service_path": null,+ "name": "basket.api"+ },+ {+ "id": "catalog.api",+ "repo": "catalog.api",+ "service_path": null,+ "name": "catalog.api"+ },+ {+ "id": "clientapp",+ "repo": "clientapp",+ "service_path": null,+ "name": "clientapp"+ },+ {+ "id": "eshop.servicedefaults",+ "repo": "eshop.servicedefaults",+ "service_path": null,+ "name": "eshop.servicedefaults"+ },+ {+ "id": "eventbus",+ "repo": "eventbus",+ "service_path": null,+ "name": "eventbus"+ },+ {+ "id": "eventbusrabbitmq",+ "repo": "eventbusrabbitmq",+ "service_path": null,+ "name": "eventbusrabbitmq"+ },+ {+ "id": "hybridapp",+ "repo": "hybridapp",+ "service_path": null,+ "name": "hybridapp"+ },+ {+ "id": "identity.api",+ "repo": "identity.api",+ "service_path": null,+ "name": "identity.api"+ },+ {+ "id": "integrationeventlogef",+ "repo": "integrationeventlogef",+ "service_path": null,+ "name": "integrationeventlogef"+ },+ {+ "id": "ordering.api",+ "repo": "ordering.api",+ "service_path": null,+ "name": "ordering.api"+ },+ {+ "id": "ordering.domain",+ "repo": "ordering.domain",+ "service_path": null,+ "name": "ordering.domain"+ },+ {+ "id": "ordering.infrastructure",+ "repo": "ordering.infrastructure",+ "service_path": null,+ "name": "ordering.infrastructure"+ },+ {+ "id": "orderprocessor",+ "repo": "orderprocessor",+ "service_path": null,+ "name": "orderprocessor"+ },+ {+ "id": "paymentprocessor",+ "repo": "paymentprocessor",+ "service_path": null,+ "name": "paymentprocessor"+ },+ {+ "id": "webapp",+ "repo": "webapp",+ "service_path": null,+ "name": "webapp"+ },+ {+ "id": "webappcomponents",+ "repo": "webappcomponents",+ "service_path": null,+ "name": "webappcomponents"+ },+ {+ "id": "webhookclient",+ "repo": "webhookclient",+ "service_path": null,+ "name": "webhookclient"+ },+ {+ "id": "webhooks.api",+ "repo": "webhooks.api",+ "service_path": null,+ "name": "webhooks.api"+ }+ ],+ "contracts": [+ {+ "repo": "ordering.api",+ "contract_id": "http::PUT::/api/orders/cancel",+ "contract_type": "http",+ "role": "provider",+ "file_path": "Apis/OrdersApi.cs",+ "symbol_name": "aspnet-minimal:PUT /api/orders/cancel",+ "confidence": 0.85,+ "line": 11,+ "symbol_id": "Apis/OrdersApi.cs::OrdersApi::CancelOrderAsync",+ "origin": "route_registration"+ },+ {+ "repo": "ordering.api",+ "contract_id": "http::PUT::/api/orders/ship",+ "contract_type": "http",+ "role": "provider",+ "file_path": "Apis/OrdersApi.cs",+ "symbol_name": "aspnet-minimal:PUT /api/orders/ship",+ "confidence": 0.85,+ "line": 12,+ "symbol_id": "Apis/OrdersApi.cs::OrdersApi::ShipOrderAsync",+ "origin": "route_registration"+ },+ {+ "repo": "ordering.api",+ "contract_id": "http::GET::/api/orders/{param}",+ "contract_type": "http",+ "role": "provider",+ "file_path": "Apis/OrdersApi.cs",+ "symbol_name": "aspnet-minimal:GET /api/orders/{orderId:int}",+ "confidence": 0.85,+ "line": 13,+ "symbol_id": "Apis/OrdersApi.cs::OrdersApi::MapOrdersApiV1",+ "origin": "route_registration"+ },+ {+ "repo": "ordering.api",+ "contract_id": "http::GET::/api/orders",+ "contract_type": "http",+ "role": "provider",+ "file_path": "Apis/OrdersApi.cs",+ "symbol_name": "aspnet-minimal:GET /api/orders/",+ "confidence": 0.85,+ "line": 14,+ "symbol_id": "Apis/OrdersApi.cs::OrdersApi::GetOrdersByUserAsync",+ "origin": "route_registration"+ },+ {+ "repo": "ordering.api",+ "contract_id": "http::GET::/api/orders/cardtypes",+ "contract_type": "http",+ "role": "provider",+ "file_path": "Apis/OrdersApi.cs",+ "symbol_name": "aspnet-minimal:GET /api/orders/cardtypes",+ "confidence": 0.85,+ "line": 15,+ "symbol_id": "Apis/OrdersApi.cs::OrdersApi::MapOrdersApiV1",+ "origin": "route_registration"+ },+ {+ "repo": "ordering.api",+ "contract_id": "http::POST::/api/orders/draft",+ "contract_type": "http",+ "role": "provider",+ "file_path": "Apis/OrdersApi.cs",+ "symbol_name": "aspnet-minimal:POST /api/orders/draft",+ "confidence": 0.85,+ "line": 16,+ "symbol_id": "Apis/OrdersApi.cs::OrdersApi::CreateOrderDraftAsync",+ "origin": "route_registration"+ },+ {+ "repo": "ordering.api",+ "contract_id": "http::POST::/api/orders",+ "contract_type": "http",+ "role": "provider",+ "file_path": "Apis/OrdersApi.cs",+ "symbol_name": "aspnet-minimal:POST /api/orders/",+ "confidence": 0.85,+ "line": 17,+ "symbol_id": "Apis/OrdersApi.cs::OrdersApi::CreateOrderAsync",+ "origin": "route_registration"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstartedintegrationevent",+ "contract_type": "topic",+ "role": "provider",+ "file_path": "Application/Commands/CreateOrderCommandHandler.cs",+ "symbol_name": "new('OrderStartedIntegrationEvent')",+ "confidence": 0.7,+ "line": 32,+ "symbol_id": "Application/Commands/CreateOrderCommandHandler.cs::CreateOrderCommandHandler::Handle",+ "origin": "dataflow"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstatuschangedtocancelledintegrationevent",+ "contract_type": "topic",+ "role": "provider",+ "file_path": "Application/DomainEventHandlers/OrderCancelledDomainEventHandler.cs",+ "symbol_name": "new('OrderStatusChangedToCancelledIntegrationEvent')",+ "confidence": 0.7,+ "line": 30,+ "symbol_id": "Application/DomainEventHandlers/OrderCancelledDomainEventHandler.cs::OrderCancelledDomainEventHandler::Handle",+ "origin": "dataflow"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstatuschangedtoshippedintegrationevent",+ "contract_type": "topic",+ "role": "provider",+ "file_path": "Application/DomainEventHandlers/OrderShippedDomainEventHandler.cs",+ "symbol_name": "new('OrderStatusChangedToShippedIntegrationEvent')",+ "confidence": 0.7,+ "line": 30,+ "symbol_id": "Application/DomainEventHandlers/OrderShippedDomainEventHandler.cs::OrderShippedDomainEventHandler::Handle",+ "origin": "dataflow"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstatuschangedtoawaitingvalidationintegrationevent",+ "contract_type": "topic",+ "role": "provider",+ "file_path": "Application/DomainEventHandlers/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs",+ "symbol_name": "new('OrderStatusChangedToAwaitingValidationIntegrationEvent')",+ "confidence": 0.7,+ "line": 33,+ "symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs::OrderStatusChangedToAwaitingValidationDomainEventHandler::Handle",+ "origin": "dataflow"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstatuschangedtopaidintegrationevent",+ "contract_type": "topic",+ "role": "provider",+ "file_path": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs",+ "symbol_name": "new('OrderStatusChangedToPaidIntegrationEvent')",+ "confidence": 0.7,+ "line": 32,+ "symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs::OrderStatusChangedToPaidDomainEventHandler::Handle",+ "origin": "dataflow"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstatuschangedtostockconfirmedintegrationevent",+ "contract_type": "topic",+ "role": "provider",+ "file_path": "Application/DomainEventHandlers/OrderStatusChangedToStockConfirmedDomainEventHandler.cs",+ "symbol_name": "new('OrderStatusChangedToStockConfirmedIntegrationEvent')",+ "confidence": 0.7,+ "line": 30,+ "symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToStockConfirmedDomainEventHandler.cs::OrderStatusChangedToStockConfirmedDomainEventHandler::Handle",+ "origin": "dataflow"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstatuschangedtosubmittedintegrationevent",+ "contract_type": "topic",+ "role": "provider",+ "file_path": "Application/DomainEventHandlers/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs",+ "symbol_name": "new('OrderStatusChangedToSubmittedIntegrationEvent')",+ "confidence": 0.7,+ "line": 50,+ "symbol_id": "Application/DomainEventHandlers/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs::ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler::Handle",+ "origin": "dataflow"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::graceperiodconfirmedintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('GracePeriodConfirmedIntegrationEvent')",+ "confidence": 0.75,+ "line": 55,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstockconfirmedintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStockConfirmedIntegrationEvent')",+ "confidence": 0.75,+ "line": 56,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderstockrejectedintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStockRejectedIntegrationEvent')",+ "confidence": 0.75,+ "line": 57,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderpaymentfailedintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderPaymentFailedIntegrationEvent')",+ "confidence": 0.75,+ "line": 58,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "ordering.api",+ "contract_id": "topic::orderpaymentsucceededintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderPaymentSucceededIntegrationEvent')",+ "confidence": 0.75,+ "line": 59,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "http::*::/api/catalog/items/{param}/pic",+ "contract_type": "http",+ "role": "consumer",+ "file_path": "Program.cs",+ "symbol_name": "yarp-forwarder:* https+http://catalog-api/api/catalog/items/{id}/pic",+ "confidence": 0.75,+ "line": 32,+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "http::GET::/api/orders",+ "contract_type": "http",+ "role": "consumer",+ "file_path": "Services/OrderingService.cs",+ "symbol_name": "httpclient:GET https+http://ordering-api/api/Orders/",+ "confidence": 0.75,+ "line": 9,+ "symbol_id": "Services/OrderingService.cs::OrderingService::GetOrders",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "http::POST::/api/orders",+ "contract_type": "http",+ "role": "consumer",+ "file_path": "Services/OrderingService.cs",+ "symbol_name": "httpclient:POST https+http://ordering-api/api/Orders/",+ "confidence": 0.75,+ "line": 14,+ "symbol_id": "Services/OrderingService.cs::OrderingService::CreateOrder",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "grpc::Basket/*",+ "contract_type": "grpc",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "cs:AddGrpcClient<Basket.BasketClient>",+ "confidence": 0.75,+ "line": 31,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddApplicationServices",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "grpc::Basket/*",+ "contract_type": "grpc",+ "role": "consumer",+ "file_path": "Services/BasketService.cs",+ "symbol_name": "cs:Basket.BasketClient",+ "confidence": 0.65,+ "line": 3,+ "origin": "name_heuristic"+ },+ {+ "repo": "webapp",+ "contract_id": "topic::orderstatuschangedtoawaitingvalidationintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStatusChangedToAwaitingValidationIntegrationEvent')",+ "confidence": 0.75,+ "line": 45,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "topic::orderstatuschangedtopaidintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStatusChangedToPaidIntegrationEvent')",+ "confidence": 0.75,+ "line": 46,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "topic::orderstatuschangedtostockconfirmedintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStatusChangedToStockConfirmedIntegrationEvent')",+ "confidence": 0.75,+ "line": 47,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "topic::orderstatuschangedtoshippedintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStatusChangedToShippedIntegrationEvent')",+ "confidence": 0.75,+ "line": 48,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "topic::orderstatuschangedtocancelledintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStatusChangedToCancelledIntegrationEvent')",+ "confidence": 0.75,+ "line": 49,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ },+ {+ "repo": "webapp",+ "contract_id": "topic::orderstatuschangedtosubmittedintegrationevent",+ "contract_type": "topic",+ "role": "consumer",+ "file_path": "Extensions/Extensions.cs",+ "symbol_name": "AddSubscription('OrderStatusChangedToSubmittedIntegrationEvent')",+ "confidence": 0.75,+ "line": 50,+ "symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "origin": "client_call"+ }+ ],+ "contract_links": [+ {+ "contract_id": "topic::orderstartedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/Commands/CreateOrderCommandHandler.cs",+ "provider_symbol": "new('OrderStartedIntegrationEvent')",+ "consumer_repo": "basket.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStartedIntegrationEvent')",+ "provider_symbol_id": "Application/Commands/CreateOrderCommandHandler.cs::CreateOrderCommandHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddApplicationServices",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtoawaitingvalidationintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToAwaitingValidationIntegrationEvent')",+ "consumer_repo": "catalog.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToAwaitingValidationIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs::OrderStatusChangedToAwaitingValidationDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddApplicationServices",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtopaidintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToPaidIntegrationEvent')",+ "consumer_repo": "catalog.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToPaidIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs::OrderStatusChangedToPaidDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddApplicationServices",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::graceperiodconfirmedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "orderprocessor",+ "provider_file": "Services/GracePeriodManagerService.cs",+ "provider_symbol": "new('GracePeriodConfirmedIntegrationEvent')",+ "consumer_repo": "ordering.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('GracePeriodConfirmedIntegrationEvent')",+ "provider_symbol_id": "Services/GracePeriodManagerService.cs::GracePeriodManagerService::CheckConfirmedGracePeriodOrders",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstockconfirmedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "catalog.api",+ "provider_file": "IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs",+ "provider_symbol": "new('OrderStockConfirmedIntegrationEvent')",+ "consumer_repo": "ordering.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStockConfirmedIntegrationEvent')",+ "provider_symbol_id": "IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs::OrderStatusChangedToAwaitingValidationIntegrationEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstockrejectedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "catalog.api",+ "provider_file": "IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs",+ "provider_symbol": "new('OrderStockRejectedIntegrationEvent')",+ "consumer_repo": "ordering.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStockRejectedIntegrationEvent')",+ "provider_symbol_id": "IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs::OrderStatusChangedToAwaitingValidationIntegrationEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderpaymentfailedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "paymentprocessor",+ "provider_file": "IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs",+ "provider_symbol": "new('OrderPaymentFailedIntegrationEvent')",+ "consumer_repo": "ordering.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderPaymentFailedIntegrationEvent')",+ "provider_symbol_id": "IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs::OrderStatusChangedToStockConfirmedIntegrationEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderpaymentsucceededintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "paymentprocessor",+ "provider_file": "IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs",+ "provider_symbol": "new('OrderPaymentSucceededIntegrationEvent')",+ "consumer_repo": "ordering.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderPaymentSucceededIntegrationEvent')",+ "provider_symbol_id": "IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs::OrderStatusChangedToStockConfirmedIntegrationEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtostockconfirmedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderStatusChangedToStockConfirmedDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToStockConfirmedIntegrationEvent')",+ "consumer_repo": "paymentprocessor",+ "consumer_file": "Program.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToStockConfirmedIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToStockConfirmedDomainEventHandler.cs::OrderStatusChangedToStockConfirmedDomainEventHandler::Handle",+ "strategy": "exact_id"+ },+ {+ "contract_id": "http::GET::/api/catalog/items/{param}/pic",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.75,+ "provider_repo": "catalog.api",+ "provider_file": "Apis/CatalogApi.cs",+ "provider_symbol": "aspnet-minimal:GET /api/catalog/items/{id:int}/pic",+ "consumer_repo": "webapp",+ "consumer_file": "Program.cs",+ "consumer_symbol": "yarp-forwarder:* https+http://catalog-api/api/catalog/items/{id}/pic",+ "provider_symbol_id": "Apis/CatalogApi.cs::CatalogApi::GetItemPictureById",+ "consumer_contract_id": "http::*::/api/catalog/items/{param}/pic",+ "strategy": "service_mapped"+ },+ {+ "contract_id": "http::GET::/api/orders",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.75,+ "provider_repo": "ordering.api",+ "provider_file": "Apis/OrdersApi.cs",+ "provider_symbol": "aspnet-minimal:GET /api/orders/",+ "consumer_repo": "webapp",+ "consumer_file": "Services/OrderingService.cs",+ "consumer_symbol": "httpclient:GET https+http://ordering-api/api/Orders/",+ "provider_symbol_id": "Apis/OrdersApi.cs::OrdersApi::GetOrdersByUserAsync",+ "consumer_symbol_id": "Services/OrderingService.cs::OrderingService::GetOrders",+ "strategy": "service_mapped"+ },+ {+ "contract_id": "http::POST::/api/orders",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.75,+ "provider_repo": "ordering.api",+ "provider_file": "Apis/OrdersApi.cs",+ "provider_symbol": "aspnet-minimal:POST /api/orders/",+ "consumer_repo": "webapp",+ "consumer_file": "Services/OrderingService.cs",+ "consumer_symbol": "httpclient:POST https+http://ordering-api/api/Orders/",+ "provider_symbol_id": "Apis/OrdersApi.cs::OrdersApi::CreateOrderAsync",+ "consumer_symbol_id": "Services/OrderingService.cs::OrderingService::CreateOrder",+ "strategy": "service_mapped"+ },+ {+ "contract_id": "grpc::Basket/*",+ "contract_type": "grpc",+ "match_type": "exact",+ "confidence": 0.75,+ "provider_repo": "basket.api",+ "provider_file": "Grpc/BasketService.cs",+ "provider_symbol": "cs:extends Basket.BasketServiceBase",+ "consumer_repo": "webapp",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "cs:AddGrpcClient<Basket.BasketClient>",+ "provider_symbol_id": "Grpc/BasketService.cs::BasketService",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddApplicationServices",+ "strategy": "exact_id"+ },+ {+ "contract_id": "grpc::Basket/*",+ "contract_type": "grpc",+ "match_type": "exact",+ "confidence": 0.65,+ "provider_repo": "basket.api",+ "provider_file": "Grpc/BasketService.cs",+ "provider_symbol": "cs:extends Basket.BasketServiceBase",+ "consumer_repo": "webapp",+ "consumer_file": "Services/BasketService.cs",+ "consumer_symbol": "cs:Basket.BasketClient",+ "provider_symbol_id": "Grpc/BasketService.cs::BasketService",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtoawaitingvalidationintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToAwaitingValidationIntegrationEvent')",+ "consumer_repo": "webapp",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToAwaitingValidationIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs::OrderStatusChangedToAwaitingValidationDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtopaidintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToPaidIntegrationEvent')",+ "consumer_repo": "webapp",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToPaidIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs::OrderStatusChangedToPaidDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtostockconfirmedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderStatusChangedToStockConfirmedDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToStockConfirmedIntegrationEvent')",+ "consumer_repo": "webapp",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToStockConfirmedIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToStockConfirmedDomainEventHandler.cs::OrderStatusChangedToStockConfirmedDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtoshippedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderShippedDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToShippedIntegrationEvent')",+ "consumer_repo": "webapp",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToShippedIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderShippedDomainEventHandler.cs::OrderShippedDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtocancelledintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderCancelledDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToCancelledIntegrationEvent')",+ "consumer_repo": "webapp",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToCancelledIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderCancelledDomainEventHandler.cs::OrderCancelledDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtosubmittedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToSubmittedIntegrationEvent')",+ "consumer_repo": "webapp",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToSubmittedIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs::ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtoshippedintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderShippedDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToShippedIntegrationEvent')",+ "consumer_repo": "webhooks.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToShippedIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderShippedDomainEventHandler.cs::OrderShippedDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "topic::orderstatuschangedtopaidintegrationevent",+ "contract_type": "topic",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs",+ "provider_symbol": "new('OrderStatusChangedToPaidIntegrationEvent')",+ "consumer_repo": "webhooks.api",+ "consumer_file": "Extensions/Extensions.cs",+ "consumer_symbol": "AddSubscription('OrderStatusChangedToPaidIntegrationEvent')",+ "provider_symbol_id": "Application/DomainEventHandlers/OrderStatusChangedToPaidDomainEventHandler.cs::OrderStatusChangedToPaidDomainEventHandler::Handle",+ "consumer_symbol_id": "Extensions/Extensions.cs::Extensions::AddEventBusSubscriptions",+ "strategy": "exact_id"+ },+ {+ "contract_id": "http::POST::/api/orders",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.65,+ "provider_repo": "ordering.api",+ "provider_file": "Apis/OrdersApi.cs",+ "provider_symbol": "aspnet-minimal:POST /api/orders/",+ "consumer_repo": "clientapp",+ "consumer_file": "Services/Order/OrderService.cs",+ "consumer_symbol": "httpclient:POST ${_settingsService.GatewayOrdersEndpointBase}/api/orders",+ "provider_symbol_id": "Apis/OrdersApi.cs::OrdersApi::CreateOrderAsync",+ "consumer_symbol_id": "Services/Order/OrderService.cs::OrderService::CreateOrderAsync",+ "strategy": "unique_path"+ },+ {+ "contract_id": "http::GET::/api/orders",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Apis/OrdersApi.cs",+ "provider_symbol": "aspnet-minimal:GET /api/orders/",+ "consumer_repo": "clientapp",+ "consumer_file": "Services/Order/OrderService.cs",+ "consumer_symbol": "GetAsync:GET ${_settingsService.GatewayOrdersEndpointBase}/api/orders",+ "provider_symbol_id": "Apis/OrdersApi.cs::OrdersApi::GetOrdersByUserAsync",+ "consumer_symbol_id": "Services/Order/OrderService.cs::OrderService::GetOrdersAsync",+ "strategy": "unique_path"+ },+ {+ "contract_id": "http::GET::/api/orders/{param}",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Apis/OrdersApi.cs",+ "provider_symbol": "aspnet-minimal:GET /api/orders/{orderId:int}",+ "consumer_repo": "clientapp",+ "consumer_file": "Services/Order/OrderService.cs",+ "consumer_symbol": "GetAsync:GET ${_settingsService.GatewayOrdersEndpointBase}/api/orders/${orderId}",+ "provider_symbol_id": "Apis/OrdersApi.cs::OrdersApi::MapOrdersApiV1",+ "consumer_symbol_id": "Services/Order/OrderService.cs::OrderService::GetOrderAsync",+ "strategy": "unique_path"+ },+ {+ "contract_id": "http::PUT::/api/orders/cancel",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.7,+ "provider_repo": "ordering.api",+ "provider_file": "Apis/OrdersApi.cs",+ "provider_symbol": "aspnet-minimal:PUT /api/orders/cancel",+ "consumer_repo": "clientapp",+ "consumer_file": "Services/Order/OrderService.cs",+ "consumer_symbol": "PutAsync:PUT ${_settingsService.GatewayOrdersEndpointBase}/api/orders/cancel",+ "provider_symbol_id": "Apis/OrdersApi.cs::OrdersApi::CancelOrderAsync",+ "consumer_symbol_id": "Services/Order/OrderService.cs::OrderService::CancelOrderAsync",+ "strategy": "unique_path"+ }+ ],+ "service_links": [+ {+ "contract_id": "http::*::/product-images/**",+ "contract_type": "http",+ "match_type": "exact",+ "confidence": 0.85,+ "provider_repo": "catalog.api",+ "provider_file": "",+ "provider_symbol": "catalog-api (yarp_forwarder)",+ "consumer_repo": "webapp",+ "consumer_file": "Program.cs",+ "consumer_symbol": "/product-images/** -> ?",+ "strategy": "gateway_route"+ }+ ],+ "package_deps": [+ {+ "source_repo": "ordering.api",+ "target_repo": "eshop.servicedefaults",+ "source_manifest": "Ordering.API.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ },+ {+ "source_repo": "ordering.api",+ "target_repo": "eventbusrabbitmq",+ "source_manifest": "Ordering.API.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ },+ {+ "source_repo": "ordering.api",+ "target_repo": "integrationeventlogef",+ "source_manifest": "Ordering.API.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ },+ {+ "source_repo": "ordering.api",+ "target_repo": "ordering.domain",+ "source_manifest": "Ordering.API.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ },+ {+ "source_repo": "ordering.api",+ "target_repo": "ordering.infrastructure",+ "source_manifest": "Ordering.API.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ },+ {+ "source_repo": "webapp",+ "target_repo": "eshop.servicedefaults",+ "source_manifest": "WebApp.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ },+ {+ "source_repo": "webapp",+ "target_repo": "eventbusrabbitmq",+ "source_manifest": "WebApp.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ },+ {+ "source_repo": "webapp",+ "target_repo": "webappcomponents",+ "source_manifest": "WebApp.csproj",+ "kind": "dotnet_project_ref",+ "target_package": "",+ "target_manifest": "",+ "requested_version": null,+ "scope": "",+ "resolution_basis": ""+ }+ ],+ "co_changes": [],+ "repo_provenance": {+ "basket.api": {+ "head": "b80aab99f422cc5711d55f6d840d96400cc95fe0",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "catalog.api": {+ "head": "fe49004bed18e00396912f3572ebbdbf7bcab6e8",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "clientapp": {+ "head": "b67e31c1190c94d4b1e93e35ee5b7f6ac3c76129",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "eshop.apphost": {+ "head": "2b8bd2d54ba695f00bc3cc9bc1a6e03a008dbf42",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "eshop.servicedefaults": {+ "head": "d86fcfbeaeaa2c295925c9f20d089fcaf3b9d37a",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "eventbus": {+ "head": "d43cbc98a852e11efe167683bce8ff9d64329fdf",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "eventbusrabbitmq": {+ "head": "d69fed8205360a6fedd99e9250f76874884ee286",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "hybridapp": {+ "head": "c6118241f772f53806f4b6852d9bc6e4dfd89c5e",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "identity.api": {+ "head": "9d01ff7bd729d2c62e37c69763c2768fa2338af1",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "integrationeventlogef": {+ "head": "34290a1c3e5b2bd143d7f24e57e6160eb8968df7",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "ordering.api": {+ "head": "d079a9e8537ae2e65d1bcc2f7c28cf90709bae15",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "ordering.domain": {+ "head": "6ba73fe5d31ea6caac91c0f021116d3d80fc5614",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "ordering.infrastructure": {+ "head": "b349083becc2c4fd315005fd0a4ae55533601771",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "orderprocessor": {+ "head": "aaede1f5fdc096b290ef4cbab2147eddf1f962db",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "paymentprocessor": {+ "head": "d50e1e0cae8a98a418ab5a26d77a0510c5876024",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "shared": {+ "head": "9d9684e0c43cd77de1948f1616c0513fedf61fb0",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "webapp": {+ "head": "16ee25205ae8aa76461f9019ebee854d49dc372e",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "webappcomponents": {+ "head": "2d404794ee49793cb4bddafde3a03bc7c0e6f653",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "webhookclient": {+ "head": "47c67aa9895dd2375ac1cb8e7bef2f2caef53ea5",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ },+ "webhooks.api": {+ "head": "41e0f14fc5c930ebf08ee83c3577fd78ad3b93b2",+ "extracted_at": "2026-10-23T20:58:09.942554+00:00",+ "config_fp": "f02e1ebcb01fe3f4"+ }+ }+}diff --git a/tests/unit/server/test_workspace_links_between.py b/tests/unit/server/test_workspace_links_between.pynew file mode 100644index 000000000..904d3012b--- /dev/null+++ b/tests/unit/server/test_workspace_links_between.py@@ -0,0 +1,105 @@+"""GET /api/workspace/system-graph/links over a real enricher and stored artifacts."""++from __future__ import annotations++import json+from pathlib import Path++import pytest+from httpx import ASGITransport, AsyncClient++from repowise.server.mcp_server._enrichment import CrossRepoEnricher++from .test_workspace_router import _make_workspace_app, _make_ws_config, _write_json++FIXTURE = Path(__file__).parents[2] / "fixtures" / "workspace_links" / "eshop.json"+++def _enricher(tmp_path: Path) -> CrossRepoEnricher:+ data = json.loads(FIXTURE.read_text(encoding="utf-8"))+ _write_json(+ tmp_path / "contracts.json",+ {+ "version": 15,+ "contracts": data["contracts"],+ "contract_links": data["contract_links"],+ "service_links": data["service_links"],+ "repo_provenance": data["repo_provenance"],+ },+ )+ _write_json(+ tmp_path / "cross_repo_edges.json",+ {"version": 2, "package_deps": data["package_deps"], "co_changes": data["co_changes"]},+ )+ _write_json(+ tmp_path / "system_graph.json",+ {+ "version": 2,+ "nodes": data["nodes"],+ "edges": [],+ "diagnostics": {},+ "repo_provenance": data["repo_provenance"],+ },+ )+ return CrossRepoEnricher(+ tmp_path / "cross_repo_edges.json",+ contracts_path=tmp_path / "contracts.json",+ system_graph_path=tmp_path / "system_graph.json",+ )+++async def _get(app, **params):+ async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as c:+ return await c.get("/api/workspace/system-graph/links", params=params)+++async def test_pages_the_links_between_two_services(tmp_path: Path) -> None:+ app = _make_workspace_app(ws_config=_make_ws_config(), enricher=_enricher(tmp_path))+ resp = await _get(app, a="webapp", b="ordering.api", limit=5)+ assert resp.status_code == 200+ data = resp.json()+ assert data["total"] == 8+ assert len(data["links"]) == 5+ assert {t["kind"]: t["count"] for t in data["totals"]} == {"event": 6, "http": 2}+ row = data["links"][0]+ assert row["direction"] == "a_to_b"+ assert row["kind"] == "event"+ assert row["link"]["strategy"] == "exact_id"+ assert data["stale_graph"] is False+++async def test_gateway_service_link_is_served(tmp_path: Path) -> None:+ app = _make_workspace_app(ws_config=_make_ws_config(), enricher=_enricher(tmp_path))+ data = (await _get(app, a="webapp", b="catalog.api", kind="http")).json()+ assert "gateway_route" in {row["link"]["strategy"] for row in data["links"]}+++async def test_package_dependency_rows_are_served(tmp_path: Path) -> None:+ app = _make_workspace_app(ws_config=_make_ws_config(), enricher=_enricher(tmp_path))+ data = (await _get(app, a="webapp", b="eventbusrabbitmq")).json()+ assert data["total"] == 1+ row = data["links"][0]+ assert (row["evidence"], row["kind"], row["direction"]) == ("package", "package", "a_to_b")+ assert row["package_dep"]["target_repo"] == "eventbusrabbitmq"+++async def test_unknown_service_is_404(tmp_path: Path) -> None:+ app = _make_workspace_app(ws_config=_make_ws_config(), enricher=_enricher(tmp_path))+ assert (await _get(app, a="webapp", b="nope")).status_code == 404+++async def test_no_graph_is_404() -> None:+ app = _make_workspace_app(ws_config=_make_ws_config(), enricher=None)+ assert (await _get(app, a="webapp", b="ordering.api")).status_code == 404+++async def test_not_workspace_mode_and_missing_params() -> None:+ assert (await _get(_make_workspace_app(), a="x", b="y")).status_code == 404+ app = _make_workspace_app(ws_config=_make_ws_config(), enricher=None)+ assert (await _get(app, a="webapp")).status_code == 422diff --git a/tests/unit/workspace/test_links_between.py b/tests/unit/workspace/test_links_between.pynew file mode 100644index 000000000..705883c44--- /dev/null+++ b/tests/unit/workspace/test_links_between.py@@ -0,0 +1,216 @@+"""Links between two services, read from the stored artifacts.++``eshop.json`` is cut from a real index of the eShop sample: every node of its+system graph, the contract links, package dependencies and co-changes touching+webapp or ordering.api, the contracts at their ends and the service links.+"""++from __future__ import annotations++import json+from pathlib import Path++from repowise.core.workspace.contracts import Contract, ContractLink+from repowise.core.workspace.cross_repo import CrossRepoCoChange, CrossRepoOverlay+from repowise.core.workspace.extractors.service_boundary import ServiceBoundary+from repowise.core.workspace.links_between import (+ A_TO_B,+ B_TO_A,+ BOTH,+ build_links_index,+ links_between,+)+from repowise.core.workspace.manifests import CrossRepoPackageDep+from repowise.core.workspace.system_graph import build_system_graph++FIXTURE = Path(__file__).parents[2] / "fixtures" / "workspace_links" / "eshop.json"+++def _eshop_index(**graph_extra):+ data = json.loads(FIXTURE.read_text(encoding="utf-8"))+ graph = {"nodes": data["nodes"], "repo_provenance": data["repo_provenance"], **graph_extra}+ return build_links_index(graph, data, data)+++def _eshop(**kwargs):+ return links_between(_eshop_index(), **kwargs)+++def test_webapp_and_ordering_api_share_eight_links_all_one_way():+ result = _eshop(a="webapp", b="ordering.api")+ assert result["total"] == 8+ assert result["stale_graph"] is False+ assert result["totals"] == [+ {"kind": "event", "direction": A_TO_B, "count": 6},+ {"kind": "http", "direction": A_TO_B, "count": 2},+ ]+ assert {row["direction"] for row in result["links"]} == {A_TO_B}+ http = [row["link"] for row in result["links"] if row["kind"] == "http"]+ assert [lk["contract_id"] for lk in http] == [+ "http::GET::/api/orders",+ "http::POST::/api/orders",+ ]+ assert {lk["strategy"] for lk in http} == {"service_mapped"}+++def test_swapping_the_pair_flips_the_direction_only():+ result = _eshop(a="ordering.api", b="webapp")+ assert result["total"] == 8+ assert {row["direction"] for row in result["links"]} == {B_TO_A}+++def test_rows_carry_both_ends_origin():+ row = _eshop(a="webapp", b="ordering.api", kind="event")["links"][0]+ assert row["evidence"] == "contract"+ assert row["provider_origin"] == "dataflow"+ assert row["consumer_origin"] == "client_call"+++def test_kind_filters_rows_but_keeps_every_kind_counted():+ result = _eshop(a="webapp", b="ordering.api", kind="http")+ assert result["total"] == 2+ assert {row["kind"] for row in result["links"]} == {"http"}+ assert sum(t["count"] for t in result["totals"]) == 8+++def test_q_narrows_rows_and_totals():+ result = _eshop(a="webapp", b="ordering.api", q="orderstatuschangedtopaid")+ assert result["total"] == 1+ assert result["totals"] == [{"kind": "event", "direction": A_TO_B, "count": 1}]+++def test_pages_are_cut_from_the_ordered_rows():+ index = _eshop_index()+ whole = links_between(index, a="webapp", b="ordering.api")["links"]+ page = links_between(index, a="webapp", b="ordering.api", limit=3, offset=6)+ assert page["total"] == 8+ assert page["links"] == whole[6:9]+++def test_a_gateway_route_counts_as_the_graph_counts_it():+ result = _eshop(a="webapp", b="catalog.api")+ assert sorted(row["link"]["strategy"] for row in result["links"]) == [+ "gateway_route",+ "service_mapped",+ ]+++def test_a_build_edge_lists_its_manifest_dependency():+ result = _eshop(a="webapp", b="eshop.servicedefaults")+ assert result["totals"] == [{"kind": "package", "direction": A_TO_B, "count": 1}]+ row = result["links"][0]+ assert row["evidence"] == "package"+ assert row["link"] is None+ assert row["package_dep"]["kind"] == "dotnet_project_ref"+ assert _eshop(a="webapp", b="eshop.servicedefaults", q="nothing-matches")["total"] == 0+++def test_graph_from_another_build_is_flagged_stale():+ index = _eshop_index(repo_provenance={"webapp": {"head": "other"}})+ assert links_between(index, a="webapp", b="ordering.api")["stale_graph"] is True+++def test_unknown_service_is_none():+ assert _eshop(a="webapp", b="nope") is None+++def _link(cid, consumer_file, provider_file):+ return ContractLink(+ contract_id=cid,+ contract_type="http",+ match_type="exact",+ confidence=0.8,+ provider_repo="shop",+ provider_file=provider_file,+ provider_symbol=cid,+ provider_service=None,+ consumer_repo="shop",+ consumer_file=consumer_file,+ consumer_symbol=cid,+ consumer_service=None,+ )+++def _monorepo():+ boundaries = {+ "shop": [+ ServiceBoundary(service_path="services/orders", service_name="orders"),+ ServiceBoundary(service_path="services/orders/worker", service_name="worker"),+ ServiceBoundary(service_path="services/cart", service_name="cart"),+ ]+ }+ links = [+ _link("http::GET::/orders", "services/cart/api.py", "services/orders/routes.py"),+ _link("http::POST::/orders", "services/cart/api.py", "services/orders/routes.py"),+ _link("http::GET::/carts", "services/orders/client.py", "services/cart/routes.py"),+ # The deeper boundary is its own service, not orders.+ _link("http::GET::/jobs", "services/cart/api.py", "services/orders/worker/jobs.py"),+ # Same service on both ends: never an edge, never a row.+ _link("http::GET::/self", "services/cart/a.py", "services/cart/b.py"),+ ]+ overlay = CrossRepoOverlay(+ co_changes=[+ CrossRepoCoChange(+ source_repo="shop",+ source_file="services/orders/models.py",+ target_repo="shop",+ target_file="services/cart/models.py",+ strength=0.5,+ frequency=3,+ last_date="2026-10-01",+ )+ ],+ package_deps=[+ CrossRepoPackageDep(+ source_repo="shop",+ target_repo="shop",+ source_manifest="services/cart/pyproject.toml",+ target_manifest="services/orders/pyproject.toml",+ kind="pip_path",+ )+ ],+ )+ contract = Contract(+ repo="shop",+ contract_id="http::GET::/orders",+ contract_type="http",+ role="provider",+ file_path="services/orders/routes.py",+ symbol_name="orders",+ confidence=0.85,+ )+ graph = build_system_graph([contract], links, overlay, boundaries).to_dict()+ store = {"contracts": [contract.to_dict()], "contract_links": [lk.to_dict() for lk in links]}+ return graph, build_links_index(graph, store, overlay.to_dict())+++CART, ORDERS = "shop::services/cart", "shop::services/orders"+++def test_two_services_in_one_repo_list_every_kind():+ _, index = _monorepo()+ result = links_between(index, a=CART, b=ORDERS)+ assert result["totals"] == [+ {"kind": "co_change", "direction": BOTH, "count": 1},+ {"kind": "http", "direction": A_TO_B, "count": 2},+ {"kind": "http", "direction": B_TO_A, "count": 1},+ {"kind": "package", "direction": A_TO_B, "count": 1},+ ]+ co_change = next(row for row in result["links"] if row["evidence"] == "co_change")+ assert co_change["co_change"]["frequency"] == 3+ assert links_between(index, a=CART, b=CART)["total"] == 0+++def test_a_pairs_rows_add_up_to_its_edge_weights():+ graph, index = _monorepo()+ edges = [e for e in graph["edges"] if {e["source"], e["target"]} == {CART, ORDERS}]+ assert {e["kind"] for e in edges} == {"http", "package", "co_change"}+ for edge in edges:+ result = links_between(index, a=edge["source"], b=edge["target"], kind=edge["kind"])+ direction = BOTH if edge["kind"] == "co_change" else A_TO_B+ count = sum(+ t["count"]+ for t in result["totals"]+ if t["kind"] == edge["kind"] and t["direction"] == direction+ )+ assert count == edge["weight"], edge["id"]