/** * Runtime Graph * * Derives the runtime microservice graph SOLELY from architecture/dependencies.json * (the single source of truth): each project's `apiRelations` carry which api * classes it implements/uses and their transport (rpc | pubsub). Both * `architecture:generate` and `architecture:validate-runtime-architecture` call * the SAME `deriveRuntimeGraph`, so the committed graph and the validated graph * can never diverge. * * The runtime edge Z -> X (Z depends on X at runtime) is INFERRED: Z `uses` api * Y and X `implements` api Y. This edge does not exist in the compile-time * dependencies.json (both Z and X only compile-depend on the api library Y). * * WHICH X is decided by the call site, not by "everyone who implements Y", in * priority order: (1) a literal at the call site — * `createRpcClient(Y, new ClientConfig('helper-fsdb'))` — kept as * `ApiRef.targetService`; else (2) the calling project's declared `callsService` * (project.json metadata.webpieces.callsService), the symmetric half of * `serviceName` for the shared-library case where the client is built once from a * config field so no literal can sit at the call site; else (3) fan-out. A named * target from (1) or (2) is matched against each node's DECLARED `serviceName`. * Fanning an edge out to every implementer is catastrophic for a company-wide * contract registered in a shared library — it manufactures calls that cannot * happen, and cycles that do not exist. When a target cannot be resolved the old * fan-out still happens, but a warning names the call site (see * RuntimeGraphReport.warnings): a wrong-but-green graph is worse than a failing * one, so it must never degrade silently. */ import type { EnhancedGraph } from './graph-sorter'; import type { ApiContracts, ExternalSystemDecls } from './api-usage/api-relations'; import type { RuntimeGraph } from './runtime-graph-model'; export type { RuntimeApi, RuntimeEdge, RuntimeExternalSystem, RuntimeGraph, RuntimeQueue, RuntimeService, RuntimeTrigger, RuntimeUnresolved, } from './runtime-graph-model'; export { DEFAULT_RUNTIME_GRAPH_PATH, saveRuntimeGraph, runtimeGraphFileExists, loadRuntimeGraph, serializeRuntimeGraph, } from './runtime-graph-io'; /** * The derived graph PLUS everything the derivation had to guess at. `warnings` is deliberately not * part of RuntimeGraph: it is not committed data, it is the report that stops a guessed edge from * passing for a derived one. Executors print it. */ export declare class RuntimeGraphReport { readonly graph: RuntimeGraph; /** Human-readable lines naming every call site whose target the graph could not pin down. */ readonly warnings: string[]; /** * Call sites that name a target the repo does not contain. Unlike a warning these FAIL the * build: the contract IS served in-repo, so the name is a typo or a stale rename, and the * only reason it stayed invisible is that the graph quietly fanned the edge out instead. * (A call to a service outside the repo never reaches here — nothing in-repo implements its * contract, so it is `unresolvedUses`.) */ readonly problems: string[]; /** * role:server nodes omitted from the DRAWING because they declare no webpieces runtime * package anywhere in their library closure and serve/call nothing in-repo. Neither a * warning nor a problem — this is intended behavior, and shouting on every clean run is how * warnings stop being read. Deliberately NOT persisted: a graph file that records its own * omissions gets committed and stops being read. Executors print it instead, so the * omission is always visible and never silent. */ readonly autoHidden: string[]; constructor(graph: RuntimeGraph, /** Human-readable lines naming every call site whose target the graph could not pin down. */ warnings: string[], /** * Call sites that name a target the repo does not contain. Unlike a warning these FAIL the * build: the contract IS served in-repo, so the name is a typo or a stale rename, and the * only reason it stayed invisible is that the graph quietly fanned the edge out instead. * (A call to a service outside the repo never reaches here — nothing in-repo implements its * contract, so it is `unresolvedUses`.) */ problems?: string[], /** * role:server nodes omitted from the DRAWING because they declare no webpieces runtime * package anywhere in their library closure and serve/call nothing in-repo. Neither a * warning nor a problem — this is intended behavior, and shouting on every clean run is how * warnings stop being read. Deliberately NOT persisted: a graph file that records its own * omissions gets committed and stops being read. Executors print it instead, so the * omission is always visible and never silent. */ autoHidden?: string[]); } /** Adjacency (service -> [targets]) from a loaded runtime graph. */ export declare function runtimeAdjacency(graph: RuntimeGraph): Record; /** * Derive the runtime graph from dependencies.json's project `apiRelations` — the * single source of truth shared by generate + validate. `hiddenProjects` * (drawOnGraph:false, defaults to none) are kept in the graph but flagged so the * runtime visualizer omits their nodes + edges. */ export declare function deriveRuntimeGraph(projects: EnhancedGraph, hiddenProjects?: Set, apiContracts?: ApiContracts): RuntimeGraph; /** * The same derivation, plus the warnings it produced (every edge it had to GUESS at). Executors use * this form and print the warnings; `deriveRuntimeGraph` is the convenience form for callers that * only want the data. The warnings are deliberately kept OUT of runtime-dependencies.json — a graph * file that records its own doubts would just get committed and stop being read. */ export declare function deriveRuntimeGraphReport(projects: EnhancedGraph, hiddenProjects?: Set, apiContracts?: ApiContracts, externalSystems?: ExternalSystemDecls): RuntimeGraphReport;