@webpieces/nx-webpieces-rules 0.4.899 → 0.4.901
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/lib/graph-generator.d.ts +3 -1
- package/src/lib/graph-generator.js +22 -3
- package/src/lib/graph-generator.js.map +1 -1
- package/src/lib/graph-legend.js +2 -2
- package/src/lib/graph-legend.js.map +1 -1
- package/src/lib/graph-loader.d.ts +2 -2
- package/src/lib/graph-loader.js +2 -2
- package/src/lib/graph-loader.js.map +1 -1
- package/src/lib/graph-metadata.d.ts +1 -1
- package/src/lib/graph-metadata.js +3 -4
- package/src/lib/graph-metadata.js.map +1 -1
- package/src/lib/graph-mode-state.client.js +1 -1
- package/src/lib/graph-mode-state.client.js.map +1 -1
- package/src/lib/graph-page-shell.d.ts +1 -1
- package/src/lib/graph-page-shell.js +2 -2
- package/src/lib/graph-page-shell.js.map +1 -1
- package/src/lib/graph-products.d.ts +24 -42
- package/src/lib/graph-products.js +31 -127
- package/src/lib/graph-products.js.map +1 -1
- package/src/lib/graph-sorter.d.ts +3 -6
- package/src/lib/graph-sorter.js.map +1 -1
- package/src/lib/product-dependencies.d.ts +5 -3
- package/src/lib/product-dependencies.js +6 -5
- package/src/lib/product-dependencies.js.map +1 -1
- package/src/lib/product-resolver.d.ts +5 -6
- package/src/lib/product-resolver.js +5 -6
- package/src/lib/product-resolver.js.map +1 -1
- package/src/lib/runtime-graph-model.d.ts +4 -6
- package/src/lib/runtime-graph-model.js.map +1 -1
- package/src/lib/runtime-graph.js +1 -1
- package/src/lib/runtime-graph.js.map +1 -1
- package/src/lib/tag-truth.d.ts +2 -2
- package/src/lib/tag-truth.js +2 -2
- package/src/lib/tag-truth.js.map +1 -1
- package/src/lib/visible-transitive-reduction.d.ts +33 -0
- package/src/lib/visible-transitive-reduction.js +60 -0
- package/src/lib/visible-transitive-reduction.js.map +1 -0
package/src/lib/runtime-graph.js
CHANGED
|
@@ -179,7 +179,7 @@ class RuntimeGraphDeriver {
|
|
|
179
179
|
queues: edgeResult.queues,
|
|
180
180
|
triggers: this.buildTriggers(decls),
|
|
181
181
|
};
|
|
182
|
-
// #1179: each
|
|
182
|
+
// #1179/#1216: each service's products are exactly its project's declared product tags.
|
|
183
183
|
new graph_products_1.RuntimeProductMembership().apply(graph, this.projects);
|
|
184
184
|
// A destination whose address arrives at RUNTIME is declared on its CONTRACT
|
|
185
185
|
// (`@externalSystem runtime partner-webhooks`), so it needs no branch of its own here: it is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-graph.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-graph.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAsoBH,gDAMC;AASD,4DAcC;AAxpBD,6DAAwD;AACxD,+DAAqD;AAErD,mEAAmG;AACnG,mEAA6F;AAC7F,qDAA4D;AAC5D,iEAA6D;AA4B7D,iEAA0F;AAE1F,gGAAgG;AAChG,uDAM4B;AALxB,8HAAA,0BAA0B,OAAA;AAC1B,oHAAA,gBAAgB,OAAA;AAChB,0HAAA,sBAAsB,OAAA;AACtB,oHAAA,gBAAgB,OAAA;AAChB,yHAAA,qBAAqB,OAAA;AASzB;;;;GAIG;AACH,MAAa,kBAAkB;IAEP;IAEA;IAQA;IASA;IApBpB,YACoB,KAAmB;IACnC,6FAA6F;IAC7E,QAAkB;IAClC;;;;;;OAMG;IACa,WAAqB,EAAE;IACvC;;;;;;;OAOG;IACa,aAAuB,EAAE;QAnBzB,UAAK,GAAL,KAAK,CAAc;QAEnB,aAAQ,GAAR,QAAQ,CAAU;QAQlB,aAAQ,GAAR,QAAQ,CAAe;QASvB,eAAU,GAAV,UAAU,CAAe;IAC1C,CAAC;CACP;AAvBD,gDAuBC;AAED;;;;;;;;GAQG;AACH,MAAM,mBAAmB;IAsBA;IAEA;IAMA;IAKA;IAlCrB,8FAA8F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CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;QACL,CAAC;QACD,MAAM,MAAM,GAAG,IAAA,mCAAY,EAAC,IAAA,yCAAkB,EAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9E,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnF,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED;;;;;GAKG;AACH,qGAAqG;AACrG,SAAgB,kBAAkB,CAC9B,QAAuB,EACvB,iBAA8B,IAAI,GAAG,EAAU,EAC/C,eAA6B,EAAE;IAE/B,OAAO,wBAAwB,CAAC,QAAQ,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC;AAClF,CAAC;AAED;;;;;GAKG;AACH,qGAAqG;AACrG,SAAgB,wBAAwB,CACpC,QAAuB,EACvB,iBAA8B,IAAI,GAAG,EAAU,EAC/C,eAA6B,EAAE,EAC/B,kBAAuC,EAAE,EACzC,iBAAiC,EAAE;IAEnC,OAAO,IAAI,mBAAmB,CAC1B,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,CACjB,CAAC,QAAQ,EAAE,CAAC;AACjB,CAAC;AAED,sGAAsG;AACtG,qFAAqF;AACrF,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA","sourcesContent":["/**\n * Runtime Graph\n *\n * Derives the runtime microservice graph SOLELY from architecture/dependencies.json\n * (the single source of truth): each project's `apiRelations` carry which api\n * classes it implements/uses and their transport (rpc | pubsub). Both\n * `architecture:generate` and `architecture:validate-runtime-architecture` call\n * the SAME `deriveRuntimeGraph`, so the committed graph and the validated graph\n * can never diverge.\n *\n * The runtime edge Z -> X (Z depends on X at runtime) is INFERRED: Z `uses` api\n * Y and X `implements` api Y. This edge does not exist in the compile-time\n * dependencies.json (both Z and X only compile-depend on the api library Y).\n *\n * WHICH X is decided by the call site, not by \"everyone who implements Y\", in\n * priority order: (1) a literal at the call site —\n * `createRpcClient(Y, new ClientConfig('helper-fsdb'))` — kept as\n * `ApiRef.targetService`; else (2) the calling project's declared `callsService`\n * (project.json metadata.webpieces.callsService), the symmetric half of\n * `serviceName` for the shared-library case where the client is built once from a\n * config field so no literal can sit at the call site; else (3) fan-out. A named\n * target from (1) or (2) is matched against each node's DECLARED `serviceName`.\n * Fanning an edge out to every implementer is catastrophic for a company-wide\n * contract registered in a shared library — it manufactures calls that cannot\n * happen, and cycles that do not exist. When a target cannot be resolved the old\n * fan-out still happens, but a warning names the call site (see\n * RuntimeGraphReport.warnings): a wrong-but-green graph is worse than a failing\n * one, so it must never degrade silently.\n */\n\nimport { sortGraphTopologically } from './graph-sorter';\nimport type { EnhancedGraph, GraphEntry } from './graph-sorter';\nimport type {\n ApiContracts,\n ApiMethodMeta,\n ApiRef,\n ApiTransport,\n ExternalSystemDecls,\n} from './api-usage/api-relations';\nimport { sortApiRefs } from './api-usage/api-relations';\nimport { RelationSink } from './runtime-graph-decls';\nimport type { ScanDecl } from './runtime-graph-decls';\nimport { dedupApiRefs, sortedQueues, sortedRecord, sortUnresolved } from './runtime-graph-sorters';\nimport { attachExternalSystems, resolveExternalSystems } from './api-usage/external-systems';\nimport { RuntimeProductMembership } from './graph-products';\nimport { RemoteCallCollector } from './runtime-remote-calls';\nimport type { RemoteServices } from './remote-services';\nimport type {\n RuntimeApi,\n RuntimeEdge,\n RuntimeExternalSystem,\n RuntimeGraph,\n RuntimeQueue,\n RuntimeService,\n RuntimeTrigger,\n RuntimeUnresolved,\n} from './runtime-graph-model';\nimport { toError } from '../toError';\n\n// The committed data shape lives in runtime-graph-model.ts; re-exported here so every existing\n// `from './runtime-graph'` import keeps working and there is still one obvious place to import from.\nexport type {\n RuntimeApi,\n RuntimeEdge,\n RuntimeExternalSystem,\n RuntimeGraph,\n RuntimeQueue,\n RuntimeRemoteCall,\n RuntimeRemoteService,\n RuntimeService,\n RuntimeTrigger,\n RuntimeUnresolved,\n} from './runtime-graph-model';\nimport { adjacencyFromEdges, applyCycleCuts, assignLevels } from './runtime-graph-levels';\n\n// Persistence lives in runtime-graph-io.ts; re-exported for the same reason as the model types.\nexport {\n DEFAULT_RUNTIME_GRAPH_PATH,\n saveRuntimeGraph,\n runtimeGraphFileExists,\n loadRuntimeGraph,\n serializeRuntimeGraph,\n} from './runtime-graph-io';\n\ninterface EdgeResult {\n edges: RuntimeEdge[];\n unresolved: RuntimeUnresolved[];\n queues: Record<string, RuntimeQueue>;\n}\n\n/**\n * The derived graph PLUS everything the derivation had to guess at. `warnings` is deliberately not\n * part of RuntimeGraph: it is not committed data, it is the report that stops a guessed edge from\n * passing for a derived one. Executors print it.\n */\nexport class RuntimeGraphReport {\n constructor(\n public readonly graph: RuntimeGraph,\n /** Human-readable lines naming every call site whose target the graph could not pin down. */\n public readonly warnings: string[],\n /**\n * Call sites that name a target the repo does not contain. Unlike a warning these FAIL the\n * build: the contract IS served in-repo, so the name is a typo or a stale rename, and the\n * only reason it stayed invisible is that the graph quietly fanned the edge out instead.\n * (A call to a service outside the repo never reaches here — nothing in-repo implements its\n * contract, so it is `unresolvedUses`.)\n */\n public readonly problems: string[] = [],\n /**\n * role:server nodes omitted from the DRAWING because they declare no webpieces runtime\n * package anywhere in their library closure and serve/call nothing in-repo. Neither a\n * warning nor a problem — this is intended behavior, and shouting on every clean run is how\n * warnings stop being read. Deliberately NOT persisted: a graph file that records its own\n * omissions gets committed and stops being read. Executors print it instead, so the\n * omission is always visible and never silent.\n */\n public readonly autoHidden: string[] = [],\n ) {}\n}\n\n/**\n * Derives the runtime microservice graph from architecture/dependencies.json `apiRelations`:\n * implementers × users per API, split by transport. An rpc edge is a direct call; a pubsub edge flows\n * through a queue (drawn producer → queue → consumer by the visualizer).\n *\n * Nodes are the runnable apps only — role:server / role:client. A library is NEVER a node; its\n * implements/uses (a shared client-factory or route-registration lib) are attributed to the\n * servers/clients that embed it, walked transitively over dependsOn (see collectDecls).\n */\nclass RuntimeGraphDeriver {\n /** apiClassName -> the api-lib project that owns the contract (from the apiRelations key). */\n private readonly apiOwners = new Map<string, string>();\n /** Addressable name -> the runtime node answering to it; how a targeted call resolves. */\n private readonly nodeByServiceName = new Map<string, string>();\n private readonly warnings: string[] = [];\n private readonly problems: string[] = [];\n /** role:server nodes hidden by isNonParticipantServer, in the order buildServices met them. */\n private readonly autoHidden: string[] = [];\n /** Uses aimed at a reviewed out-of-workspace service (#1203); built once the names are claimed. */\n private readonly remoteCalls: RemoteCallCollector;\n\n /**\n * False when NO project in the graph carries `webpiecesRuntime`, i.e. the file was written\n * before the field existed. Auto-hiding is then off ENTIRELY, so an old dependencies.json\n * renders exactly as it did — absence of the field must never be read as \"declares none\".\n * Any repo regenerated after this change has at least one webpieces project, so the guard\n * cannot wrongly suppress the feature.\n */\n private readonly markersKnown: boolean;\n\n constructor(\n private readonly projects: EnhancedGraph,\n /** Project names tagged drawOnGraph:false — kept in the JSON but flagged so the viz omits them. */\n private readonly hiddenProjects: Set<string>,\n /**\n * The per-contract method tables, read from the generated `architecture/apis/<Api>.json`\n * files (ApiContractFiles). A contract with no entry — no file, or no endpoints — makes every\n * pubsub edge through it fall back to one unnamed queue per service pair instead of failing.\n */\n private readonly apiContracts: ApiContracts = {},\n /**\n * Declared external systems from dependencies.json, keyed by identity. Empty means nothing\n * was declared, which renders exactly as it did before declarations existed.\n */\n private readonly externalSystemDecls: ExternalSystemDecls = {},\n /** Reviewed out-of-workspace services from dependencies.json `remoteServices` (#1203). */\n remoteServices: RemoteServices = {},\n ) {\n this.markersKnown = Object.values(projects).some(\n (entry: GraphEntry) => entry.webpiecesRuntime !== undefined,\n );\n // A node ALWAYS answers to its own module name, so a repo whose deployed names match its\n // project names needs no declaration at all — and no alias can ever redirect 'ai-chat' away\n // from the ai-chat module. Module names are therefore claimed FIRST and are unshadowable.\n for (const name of Object.keys(projects).sort()) {\n if (this.isNode(name)) this.nodeByServiceName.set(name, name);\n }\n // `serviceName` then adds the alias a repo needs when its deployed name is NOT its module\n // name (helper-svr serving 'helper-portal'). Colliding with a module is a misconfiguration,\n // not a precedence question: the alias is silently unreachable, so say so.\n for (const name of Object.keys(projects).sort()) {\n const declared = projects[name].serviceName;\n if (!this.isNode(name) || declared === undefined) continue;\n const claimant = this.nodeByServiceName.get(declared);\n if (claimant === undefined) {\n this.nodeByServiceName.set(declared, name);\n } else if (claimant !== name) {\n this.problems.push(\n `${name} declares serviceName '${declared}', but that is already the module name of ` +\n `${claimant} — the alias can never be reached. Rename one of them.`,\n );\n }\n }\n this.remoteCalls = new RemoteCallCollector(\n remoteServices,\n (name: string): boolean => this.nodeByServiceName.has(name),\n this.problems,\n );\n }\n\n assemble(): RuntimeGraphReport {\n const decls = this.collectDecls();\n const apis = this.buildApis(decls);\n const edgeResult = this.buildEdges(decls, apis);\n // Cuts are stamped BEFORE buildServices, which is where leveling reads the edges.\n this.problems.push(\n ...applyCycleCuts(edgeResult.edges, this.projects, this.nodeByServiceName),\n );\n const services = this.buildServices(decls, edgeResult.edges);\n const apisObj: Record<string, RuntimeApi> = {};\n for (const api of Array.from(apis.keys()).sort()) apisObj[api] = apis.get(api)!;\n const graph: RuntimeGraph = {\n services,\n apis: apisObj,\n runtimeEdges: edgeResult.edges,\n unresolvedUses: edgeResult.unresolved,\n queues: edgeResult.queues,\n triggers: this.buildTriggers(decls),\n };\n // #1179: each product's services — its tagged ones plus everything they reach at runtime.\n new RuntimeProductMembership().apply(graph, this.projects);\n // A destination whose address arrives at RUNTIME is declared on its CONTRACT\n // (`@externalSystem runtime partner-webhooks`), so it needs no branch of its own here: it is\n // resolved by the same call every other declared system is, converges on one node when two\n // services deliver over the same contract, and is watched by the same drift check.\n const systems = resolveExternalSystems(this.externalSystemDecls, services);\n attachExternalSystems(graph, systems);\n this.remoteCalls.attach(graph);\n return new RuntimeGraphReport(\n graph,\n this.warnings,\n this.problems,\n [...this.autoHidden].sort(),\n );\n }\n\n /**\n * The clock- and outside-driven entry points: for every contract a node IMPLEMENTS, each method\n * declared `cron` or `external` becomes a trigger pointing AT that node.\n *\n * Driven off `implements` rather than `uses` on purpose — these have no in-repo caller at all,\n * which is why they never produced an edge and stayed invisible.\n */\n private buildTriggers(decls: ScanDecl[]): RuntimeTrigger[] {\n const triggers: RuntimeTrigger[] = [];\n for (const decl of decls) {\n for (const ref of decl.implementsApis) {\n for (const method of this.methodsOf(ref.api)) {\n if (method.kind !== 'cron' && method.kind !== 'external') continue;\n const trigger: RuntimeTrigger = {\n kind: method.kind,\n api: ref.api,\n method: method.name,\n service: decl.name,\n };\n if (method.kind === 'cron') trigger.queueName = method.queueName;\n // ONLY for 'external' (a clock needs no vendor name), and only when declared —\n // a graph committed before callers were required has none and must still render.\n if (method.kind === 'external' && method.caller !== undefined)\n trigger.caller = method.caller;\n triggers.push(trigger);\n }\n }\n }\n return triggers.sort(\n (a: RuntimeTrigger, b: RuntimeTrigger) =>\n a.kind.localeCompare(b.kind) ||\n a.api.localeCompare(b.api) ||\n a.method.localeCompare(b.method) ||\n a.service.localeCompare(b.service),\n );\n }\n\n /** The committed method table for a contract, or [] when it declares none (e.g. a vendor seam). */\n private methodsOf(api: string): ApiMethodMeta[] {\n return this.apiContracts[api]?.methods ?? [];\n }\n\n /**\n * One ScanDecl per RUNTIME NODE (role:server / role:client). A node's effective\n * relations are its OWN apiRelations PLUS those of every library in its transitive\n * dependsOn closure: a lib that calls createRpcClient/addRoutes runs inside the\n * server/client that embeds it, so the relation is attributed to that node — the\n * lib is never a runtime node. Recursion stops at other nodes (each server/client\n * owns its own relations). dependsOn is transitively reduced, but reduction\n * preserves reachability, so the recursive walk still reaches every lib a node\n * embeds through libraries.\n */\n private collectDecls(): ScanDecl[] {\n const decls: ScanDecl[] = [];\n for (const name of Object.keys(this.projects).sort()) {\n if (!this.isNode(name)) continue;\n const sink = new RelationSink(name);\n this.collectEffectiveRelations(name, sink, new Set<string>([name]));\n // EVERY node gets a decl, including one with zero relations. Gating this on \"has at\n // least one implements/uses\" silently DELETED any deployed server whose work arrives\n // from outside the repo (a pull subscription): the diagram looked complete while missing\n // a running service — confidently wrong, not visibly incomplete. isNode() is the whole\n // test; drawOnGraph:false is the ONE opt-out, and such a node renders as an isolated box.\n decls.push({\n name,\n implementsApis: dedupApiRefs(sortApiRefs(sink.implementsApis)),\n usesApis: dedupApiRefs(sortApiRefs(sink.usesApis)),\n implementsVia: sink.implementsVia,\n markerVia: sink.markerVia,\n });\n }\n return decls;\n }\n\n /** True when a project is a runtime node — a server or client app (never a library). */\n private isNode(name: string): boolean {\n const role = this.projects[name]?.role;\n return role === 'server' || role === 'client';\n }\n\n /**\n * True for a role:server that speaks NO webpieces runtime package anywhere in its library\n * closure AND serves/calls no in-repo contract — a legacy Express/NestJS service sitting in the\n * same monorepo. This graph is built entirely out of webpieces contracts, so such a service can\n * only ever draw as a disconnected box: it has no edges by construction and never will.\n *\n * It stays a NODE and stays in runtime-dependencies.json (drawOnGraph:false), which is the whole\n * difference between hiding it and the silent deletion #542 removed — the data view still shows\n * a deployed role:server, only the picture drops it. Removing it from isNode() instead would\n * also drop it from nodeByServiceName, so a targeted ClientConfig('orders-manager') from a drawn\n * service would stop resolving and decay into an unresolved use: a graph that got quietly WORSE\n * while looking cleaner. The COMPILE-TIME graph (dependencies.html) still draws these projects;\n * they genuinely exist, and only the runtime drawing claims to show webpieces services.\n *\n * role:client is deliberately never auto-hidden: a browser app can legitimately declare no\n * marker at all, and nothing checks clients for presence the way checkServersPresent checks\n * servers, so there is no equivalent failure to prevent.\n */\n private isNonParticipantServer(decl: ScanDecl): boolean {\n if (!this.markersKnown) return false;\n if (this.projects[decl.name]?.role !== 'server') return false;\n if (decl.markerVia.size > 0) return false;\n // Belt-and-braces: serving or calling an in-repo contract IS participation, whatever the\n // package list says. This is what keeps a mechanism we did not anticipate from being blanked.\n return decl.implementsApis.length === 0 && decl.usesApis.length === 0;\n }\n\n /**\n * Accumulate `name`'s own api relations, then recurse through its LIBRARY deps\n * (skipping other nodes, which own their own relations). `visited` guards against\n * re-walking a lib reachable by more than one path (and any cycle).\n */\n private collectEffectiveRelations(\n name: string,\n sink: RelationSink,\n visited: Set<string>,\n includeRelations: boolean = true,\n ): void {\n const entry = this.projects[name];\n if (entry === undefined) return;\n sink.addMarkers(entry.webpiecesRuntime, name);\n const relations = entry.apiRelations;\n if (includeRelations && relations !== undefined) {\n for (const owner of Object.keys(relations).sort()) {\n for (const ref of relations[owner].implements) {\n this.apiOwners.set(ref.api, owner);\n sink.addImplements(ref, ref.declaredVia ?? name);\n }\n for (const ref of relations[owner].uses) {\n this.apiOwners.set(ref.api, owner);\n sink.addUses(ref);\n }\n }\n }\n for (const dep of entry.dependsOn) {\n if (visited.has(dep)) continue;\n visited.add(dep);\n if (this.isNode(dep)) continue; // another server/client owns its own relations\n this.collectEffectiveRelations(\n dep,\n sink,\n visited,\n includeRelations && entry.runtimeComposition !== true,\n );\n }\n }\n\n /** apiClassName -> { implementedBy, usedBy, type }. */\n private buildApis(decls: ScanDecl[]): Map<string, RuntimeApi> {\n const apis = new Map<string, RuntimeApi>();\n const ensure = (api: string, type: ApiTransport): RuntimeApi => {\n let entry = apis.get(api);\n if (!entry) {\n entry = { implementedBy: [], usedBy: [], type };\n apis.set(api, entry);\n }\n return entry;\n };\n for (const decl of decls) {\n for (const ref of decl.implementsApis)\n ensure(ref.api, ref.type).implementedBy.push(decl.name);\n for (const ref of decl.usesApis) ensure(ref.api, ref.type).usedBy.push(decl.name);\n }\n for (const api of apis.keys()) {\n const entry = apis.get(api)!;\n entry.implementedBy.sort();\n entry.usedBy = Array.from(new Set(entry.usedBy)).sort();\n const owner = this.apiOwners.get(api);\n if (owner !== undefined) entry.owner = owner;\n }\n return apis;\n }\n\n /** Inferred edges U -> I via api A, split by transport; plus uses with no implementer. */\n private buildEdges(decls: ScanDecl[], apis: Map<string, RuntimeApi>): EdgeResult {\n const viaByKey = new Map<string, Set<string>>();\n const unresolved: RuntimeUnresolved[] = [];\n const queues = new Map<string, RuntimeQueue>();\n for (const decl of decls) {\n for (const ref of decl.usesApis) {\n // A named target outside this workspace (#1203) is a remote service, not an implementer\n // to resolve among the nodes and not an unresolved vendor call.\n const wanted = ref.targetService ?? this.callsServiceFor(decl.name, ref.api);\n if (this.remoteCalls.claim(decl.name, ref, wanted)) continue;\n const implementers = apis.get(ref.api)?.implementedBy ?? [];\n if (implementers.length === 0) {\n // Nobody in-repo serves it. For a vendor contract that is the ANSWER, not a gap:\n // the call leaves the repo, and the viz terminates it at a dashed vendor node.\n unresolved.push({ service: decl.name, api: ref.api });\n continue;\n }\n for (const target of this.targetsFor(decl.name, ref, implementers)) {\n // A service calling ITSELF synchronously is noise; a service ENQUEUEING to\n // itself is a real, common topology (deferring its own work), and dropping it\n // was hiding the single most interesting thing about a queue.\n if (target === decl.name && ref.type !== 'pubsub') continue;\n if (ref.type === 'pubsub') {\n this.addQueuedEdges(decl.name, target, ref.api, viaByKey, queues);\n continue;\n }\n const key = `${decl.name} ${target} ${ref.type}`;\n if (!viaByKey.has(key)) viaByKey.set(key, new Set());\n viaByKey.get(key)!.add(ref.api);\n }\n }\n }\n return {\n edges: this.edgesFromKeys(viaByKey),\n unresolved: sortUnresolved(unresolved),\n queues: sortedQueues(queues),\n };\n }\n\n /**\n * One edge PER QUEUED METHOD of `api`, plus the queue each flows through.\n *\n * Per method rather than per service pair because that is the unit Cloud Tasks and Terraform\n * create: two services exchanging three queued methods run three independently-configured,\n * independently-backed-up queues, and collapsing them into one arrow hides which one is stuck.\n *\n * A contract with no method table (no `architecture/apis/<Api>.json` for it)\n * degrades to a single unnamed queue for the pair — the old behavior — rather than vanishing.\n */\n private addQueuedEdges(\n from: string,\n to: string,\n api: string,\n viaByKey: Map<string, Set<string>>,\n queues: Map<string, RuntimeQueue>,\n ): void {\n const queued = this.methodsOf(api).filter((m: ApiMethodMeta) => m.kind === 'cloudtasks');\n if (queued.length === 0) {\n const key = `${from} ${to} pubsub `;\n if (!viaByKey.has(key)) viaByKey.set(key, new Set());\n viaByKey.get(key)!.add(api);\n return;\n }\n for (const method of queued) {\n const queueKey = `${api}.${method.name}`;\n const key = `${from} ${to} pubsub ${queueKey}`;\n if (!viaByKey.has(key)) viaByKey.set(key, new Set());\n viaByKey.get(key)!.add(api);\n\n let queue = queues.get(queueKey);\n if (queue === undefined) {\n queue = {\n api,\n method: method.name,\n // Every cloudtasks method carries a queueName; the fallback covers a\n // dependencies.json written before queueName became kind-specific.\n queueName: method.queueName ?? `${api}-${method.name}`,\n producedBy: [],\n consumedBy: [],\n };\n queues.set(queueKey, queue);\n }\n if (!queue.producedBy.includes(from)) queue.producedBy.push(from);\n if (!queue.consumedBy.includes(to)) queue.consumedBy.push(to);\n }\n }\n\n /**\n * WHICH implementers this one `uses` reaches. Resolution order (most specific wins):\n * 1. a literal `ClientConfig` at the call site (`ref.targetService`) — names ONE node;\n * 2. else the calling project's declared `callsService` (project.json) — for the shared-library\n * case where the literal cannot sit at the call site, it lives one indirection away in the app;\n * 3. else the historical fan-out — the only safe superset — recording WHY, so a fanned-out (i.e.\n * possibly fictional) edge can never pass for a derived one.\n * A named target (1 or 2) that resolves to no module, or to a module that does not serve the\n * contract, is a PROBLEM (fails the build), never a silent drop.\n */\n private targetsFor(user: string, ref: ApiRef, implementers: string[]): string[] {\n const literal = ref.targetService;\n if (literal !== undefined)\n return this.resolveNamedTarget(user, ref, implementers, literal, 'literal');\n\n const declared = this.callsServiceFor(user, ref.api);\n if (declared !== undefined)\n return this.resolveNamedTarget(user, ref, implementers, declared, 'callsService');\n\n return this.untargetedFanOut(user, ref, implementers);\n }\n\n /**\n * The declared `callsService` target for this node's use of `api`, or undefined when none applies.\n * A string declaration aims every untargeted use at one service; a map aims per api-class.\n */\n private callsServiceFor(user: string, api: string): string | undefined {\n const declared = this.projects[user]?.callsService;\n if (declared === undefined) return undefined;\n if (typeof declared === 'string') return declared;\n return declared[api];\n }\n\n /**\n * Resolve a NAMED target (from a call-site literal or a project-level `callsService`) to the one\n * module that serves it. A name no module answers to, or a module that does not serve the\n * contract, fails the build — the wording names which declaration to fix, `source` deciding it.\n */\n private resolveNamedTarget(\n user: string,\n ref: ApiRef,\n implementers: string[],\n wanted: string,\n source: 'literal' | 'callsService',\n ): string[] {\n const node = this.nodeByServiceName.get(wanted);\n const served = `${implementers.length} module(s) serve this contract (${implementers.join(', ')})`;\n if (node === undefined) {\n this.problems.push(\n source === 'callsService'\n ? `${user} declares metadata.webpieces.callsService '${wanted}' in its project.json, but NO ` +\n `module answers to that name. ${served}. Point callsService at a module name, or declare ` +\n `metadata.webpieces.serviceName: '${wanted}' on the module that serves \"${ref.api}\".`\n : `${user} calls \"${ref.api}\" at service '${wanted}', but NO module answers to that name. ` +\n `${served}. Either use the module name, or declare metadata.webpieces.serviceName: ` +\n `'${wanted}' on the module that serves it (and translate any environment prefix in ` +\n `ClientRegistry.setDeriver, not here).`,\n );\n return implementers;\n }\n if (!implementers.includes(node)) {\n const via =\n source === 'callsService'\n ? `${user} declares callsService '${wanted}' (module ${node})`\n : `${user} calls \"${ref.api}\" at service '${wanted}' (module ${node})`;\n this.problems.push(\n `${via}, but ${node} does NOT serve \"${ref.api}\" — ${implementers.join(', ')} do. At runtime that ` +\n `call has nothing to answer it.`,\n );\n return implementers;\n }\n return [node];\n }\n\n /**\n * A use with no literal client config. One implementer is unambiguous, so it stays silent; more\n * than one means every edge but one is fiction — exactly the failure this mechanism exists to\n * stop — so it is reported even though the graph still (conservatively) draws them all.\n */\n private untargetedFanOut(user: string, ref: ApiRef, implementers: string[]): string[] {\n if (implementers.length > 1) {\n this.warnings.push(\n `${user} uses \"${ref.api}\" with no literal client config, and ${implementers.length} services ` +\n `implement it (${implementers.join(', ')}) — an edge is drawn to EVERY one, so all but one ` +\n `are fiction. Name the target: createRpcClient(${ref.api}, new ClientConfig('<serviceName>', ClientRole.SERVER)); ` +\n `or, when the client is built in a shared library (no literal can sit at the call site), ` +\n `declare metadata.webpieces.callsService: '<serviceName>' on ${user}'s project.json.`,\n );\n }\n return implementers;\n }\n\n /**\n * Rebuild edges from their `\"from to type queue\"` keys. The 4th part is the queue (\"Api.method\")\n * and is empty for every non-queued edge; it is part of the KEY so two queued methods between\n * the same pair stay two edges instead of collapsing into one.\n */\n private edgesFromKeys(viaByKey: Map<string, Set<string>>): RuntimeEdge[] {\n const edges: RuntimeEdge[] = [];\n for (const key of viaByKey.keys()) {\n const parts = key.split(' ');\n const edge: RuntimeEdge = {\n from: parts[0],\n to: parts[1],\n via: Array.from(viaByKey.get(key)!).sort(),\n type: parts[2] as ApiTransport,\n };\n if (parts[3] !== undefined && parts[3] !== '') edge.queue = parts[3];\n edges.push(edge);\n }\n edges.sort(\n (a: RuntimeEdge, b: RuntimeEdge) =>\n a.from.localeCompare(b.from) ||\n a.to.localeCompare(b.to) ||\n (a.type ?? '').localeCompare(b.type ?? '') ||\n (a.queue ?? '').localeCompare(b.queue ?? ''),\n );\n return edges;\n }\n\n private buildServices(decls: ScanDecl[], edges: RuntimeEdge[]): Record<string, RuntimeService> {\n const services: Record<string, RuntimeService> = {};\n for (const decl of decls) {\n // A queued hop depends on the QUEUE, not on the peer: the producer hands off and returns,\n // so naming the consumer here would assert a coupling that does not exist (and would make\n // a service that defers work to itself look self-dependent).\n const dependsOn = Array.from(\n new Set(\n edges\n .filter((e: RuntimeEdge) => e.from === decl.name)\n .map((e: RuntimeEdge) =>\n e.queue === undefined ? e.to : `queue:${e.queue}`,\n ),\n ),\n ).sort();\n // Keys are written in this order; an undefined value is omitted by JSON.stringify, so\n // the committed JSON stays clean AND deterministic without conditional assembly.\n const service: RuntimeService = {\n level: 0,\n role: this.projects[decl.name]?.role, // labels a relation-less node for what it IS\n serviceName: this.projects[decl.name]?.serviceName,\n callsService: this.projects[decl.name]?.callsService,\n implements: decl.implementsApis.map((r: ApiRef) => r.api),\n implementsVia:\n decl.implementsVia.size > 0 ? sortedRecord(decl.implementsVia) : undefined,\n // One api used against two services is two refs but ONE api in this list.\n uses: Array.from(new Set(decl.usesApis.map((r: ApiRef) => r.api))),\n dependsOn,\n wiringUses: decl.usesApis.some((ref) => ref.declaredVia !== undefined)\n ? decl.usesApis\n : undefined,\n wiringImplements: decl.implementsApis.some((ref) => ref.declaredVia !== undefined)\n ? decl.implementsApis\n : undefined,\n };\n services[decl.name] = service;\n // The explicit tag wins and is NOT reported as auto-hidden — somebody asked for it.\n if (this.hiddenProjects.has(decl.name)) {\n service.drawOnGraph = false;\n } else if (this.isNonParticipantServer(decl)) {\n service.drawOnGraph = false;\n this.autoHidden.push(decl.name);\n }\n }\n const levels = assignLevels(adjacencyFromEdges(Object.keys(services), edges));\n for (const name of Object.keys(services)) services[name].level = levels[name] ?? 0;\n return services;\n }\n}\n\n/**\n * Derive the runtime graph from dependencies.json's project `apiRelations` — the\n * single source of truth shared by generate + validate. `hiddenProjects`\n * (drawOnGraph:false, defaults to none) are kept in the graph but flagged so the\n * runtime visualizer omits their nodes + edges.\n */\n// webpieces-disable no-function-outside-class -- module entry point for the runtime graph derivation\nexport function deriveRuntimeGraph(\n projects: EnhancedGraph,\n hiddenProjects: Set<string> = new Set<string>(),\n apiContracts: ApiContracts = {},\n): RuntimeGraph {\n return deriveRuntimeGraphReport(projects, hiddenProjects, apiContracts).graph;\n}\n\n/**\n * The same derivation, plus the warnings it produced (every edge it had to GUESS at). Executors use\n * this form and print the warnings; `deriveRuntimeGraph` is the convenience form for callers that\n * only want the data. The warnings are deliberately kept OUT of runtime-dependencies.json — a graph\n * file that records its own doubts would just get committed and stop being read.\n */\n// webpieces-disable no-function-outside-class -- module entry point for the runtime graph derivation\nexport function deriveRuntimeGraphReport(\n projects: EnhancedGraph,\n hiddenProjects: Set<string> = new Set<string>(),\n apiContracts: ApiContracts = {},\n externalSystems: ExternalSystemDecls = {},\n remoteServices: RemoteServices = {},\n): RuntimeGraphReport {\n return new RuntimeGraphDeriver(\n projects,\n hiddenProjects,\n apiContracts,\n externalSystems,\n remoteServices,\n ).assemble();\n}\n\n// Levels + adjacency live in runtime-graph-levels.ts; re-exported for the same reason the model types\n// and the io helpers above are — one obvious place to import the runtime graph from.\nexport { runtimeAdjacency } from './runtime-graph-levels';\n"]}
|
|
1
|
+
{"version":3,"file":"runtime-graph.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-graph.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAsoBH,gDAMC;AASD,4DAcC;AAxpBD,6DAAwD;AACxD,+DAAqD;AAErD,mEAAmG;AACnG,mEAA6F;AAC7F,qDAA4D;AAC5D,iEAA6D;AA4B7D,iEAA0F;AAE1F,gGAAgG;AAChG,uDAM4B;AALxB,8HAAA,0BAA0B,OAAA;AAC1B,oHAAA,gBAAgB,OAAA;AAChB,0HAAA,sBAAsB,OAAA;AACtB,oHAAA,gBAAgB,OAAA;AAChB,yHAAA,qBAAqB,OAAA;AASzB;;;;GAIG;AACH,MAAa,kBAAkB;IAEP;IAEA;IAQA;IASA;IApBpB,YACoB,KAAmB;IACnC,6FAA6F;IAC7E,QAAkB;IAClC;;;;;;OAMG;IACa,WAAqB,EAAE;IACvC;;;;;;;OAOG;IACa,aAAuB,EAAE;QAnBzB,UAAK,GAAL,KAAK,CAAc;QAEnB,aAAQ,GAAR,QAAQ,CAAU;QAQlB,aAAQ,GAAR,QAAQ,CAAe;QASvB,eAAU,GAAV,UAAU,CAAe;IAC1C,CAAC;CACP;AAvBD,gDAuBC;AAED;;;;;;;;GAQG;AACH,MAAM,mBAAmB;IAsBA;IAEA;IAMA;IAKA;IAlCrB,8FAA8F;IAC7E,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvD,0FAA0F;IACzE,iBAAiB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9C,QAAQ,GAAa,EAAE,CAAC;IACxB,QAAQ,GAAa,EAAE,CAAC;IACzC,+FAA+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CAAC;QAC9E,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnF,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED;;;;;GAKG;AACH,qGAAqG;AACrG,SAAgB,kBAAkB,CAC9B,QAAuB,EACvB,iBAA8B,IAAI,GAAG,EAAU,EAC/C,eAA6B,EAAE;IAE/B,OAAO,wBAAwB,CAAC,QAAQ,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC;AAClF,CAAC;AAED;;;;;GAKG;AACH,qGAAqG;AACrG,SAAgB,wBAAwB,CACpC,QAAuB,EACvB,iBAA8B,IAAI,GAAG,EAAU,EAC/C,eAA6B,EAAE,EAC/B,kBAAuC,EAAE,EACzC,iBAAiC,EAAE;IAEnC,OAAO,IAAI,mBAAmB,CAC1B,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,CACjB,CAAC,QAAQ,EAAE,CAAC;AACjB,CAAC;AAED,sGAAsG;AACtG,qFAAqF;AACrF,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA","sourcesContent":["/**\n * Runtime Graph\n *\n * Derives the runtime microservice graph SOLELY from architecture/dependencies.json\n * (the single source of truth): each project's `apiRelations` carry which api\n * classes it implements/uses and their transport (rpc | pubsub). Both\n * `architecture:generate` and `architecture:validate-runtime-architecture` call\n * the SAME `deriveRuntimeGraph`, so the committed graph and the validated graph\n * can never diverge.\n *\n * The runtime edge Z -> X (Z depends on X at runtime) is INFERRED: Z `uses` api\n * Y and X `implements` api Y. This edge does not exist in the compile-time\n * dependencies.json (both Z and X only compile-depend on the api library Y).\n *\n * WHICH X is decided by the call site, not by \"everyone who implements Y\", in\n * priority order: (1) a literal at the call site —\n * `createRpcClient(Y, new ClientConfig('helper-fsdb'))` — kept as\n * `ApiRef.targetService`; else (2) the calling project's declared `callsService`\n * (project.json metadata.webpieces.callsService), the symmetric half of\n * `serviceName` for the shared-library case where the client is built once from a\n * config field so no literal can sit at the call site; else (3) fan-out. A named\n * target from (1) or (2) is matched against each node's DECLARED `serviceName`.\n * Fanning an edge out to every implementer is catastrophic for a company-wide\n * contract registered in a shared library — it manufactures calls that cannot\n * happen, and cycles that do not exist. When a target cannot be resolved the old\n * fan-out still happens, but a warning names the call site (see\n * RuntimeGraphReport.warnings): a wrong-but-green graph is worse than a failing\n * one, so it must never degrade silently.\n */\n\nimport { sortGraphTopologically } from './graph-sorter';\nimport type { EnhancedGraph, GraphEntry } from './graph-sorter';\nimport type {\n ApiContracts,\n ApiMethodMeta,\n ApiRef,\n ApiTransport,\n ExternalSystemDecls,\n} from './api-usage/api-relations';\nimport { sortApiRefs } from './api-usage/api-relations';\nimport { RelationSink } from './runtime-graph-decls';\nimport type { ScanDecl } from './runtime-graph-decls';\nimport { dedupApiRefs, sortedQueues, sortedRecord, sortUnresolved } from './runtime-graph-sorters';\nimport { attachExternalSystems, resolveExternalSystems } from './api-usage/external-systems';\nimport { RuntimeProductMembership } from './graph-products';\nimport { RemoteCallCollector } from './runtime-remote-calls';\nimport type { RemoteServices } from './remote-services';\nimport type {\n RuntimeApi,\n RuntimeEdge,\n RuntimeExternalSystem,\n RuntimeGraph,\n RuntimeQueue,\n RuntimeService,\n RuntimeTrigger,\n RuntimeUnresolved,\n} from './runtime-graph-model';\nimport { toError } from '../toError';\n\n// The committed data shape lives in runtime-graph-model.ts; re-exported here so every existing\n// `from './runtime-graph'` import keeps working and there is still one obvious place to import from.\nexport type {\n RuntimeApi,\n RuntimeEdge,\n RuntimeExternalSystem,\n RuntimeGraph,\n RuntimeQueue,\n RuntimeRemoteCall,\n RuntimeRemoteService,\n RuntimeService,\n RuntimeTrigger,\n RuntimeUnresolved,\n} from './runtime-graph-model';\nimport { adjacencyFromEdges, applyCycleCuts, assignLevels } from './runtime-graph-levels';\n\n// Persistence lives in runtime-graph-io.ts; re-exported for the same reason as the model types.\nexport {\n DEFAULT_RUNTIME_GRAPH_PATH,\n saveRuntimeGraph,\n runtimeGraphFileExists,\n loadRuntimeGraph,\n serializeRuntimeGraph,\n} from './runtime-graph-io';\n\ninterface EdgeResult {\n edges: RuntimeEdge[];\n unresolved: RuntimeUnresolved[];\n queues: Record<string, RuntimeQueue>;\n}\n\n/**\n * The derived graph PLUS everything the derivation had to guess at. `warnings` is deliberately not\n * part of RuntimeGraph: it is not committed data, it is the report that stops a guessed edge from\n * passing for a derived one. Executors print it.\n */\nexport class RuntimeGraphReport {\n constructor(\n public readonly graph: RuntimeGraph,\n /** Human-readable lines naming every call site whose target the graph could not pin down. */\n public readonly warnings: string[],\n /**\n * Call sites that name a target the repo does not contain. Unlike a warning these FAIL the\n * build: the contract IS served in-repo, so the name is a typo or a stale rename, and the\n * only reason it stayed invisible is that the graph quietly fanned the edge out instead.\n * (A call to a service outside the repo never reaches here — nothing in-repo implements its\n * contract, so it is `unresolvedUses`.)\n */\n public readonly problems: string[] = [],\n /**\n * role:server nodes omitted from the DRAWING because they declare no webpieces runtime\n * package anywhere in their library closure and serve/call nothing in-repo. Neither a\n * warning nor a problem — this is intended behavior, and shouting on every clean run is how\n * warnings stop being read. Deliberately NOT persisted: a graph file that records its own\n * omissions gets committed and stops being read. Executors print it instead, so the\n * omission is always visible and never silent.\n */\n public readonly autoHidden: string[] = [],\n ) {}\n}\n\n/**\n * Derives the runtime microservice graph from architecture/dependencies.json `apiRelations`:\n * implementers × users per API, split by transport. An rpc edge is a direct call; a pubsub edge flows\n * through a queue (drawn producer → queue → consumer by the visualizer).\n *\n * Nodes are the runnable apps only — role:server / role:client. A library is NEVER a node; its\n * implements/uses (a shared client-factory or route-registration lib) are attributed to the\n * servers/clients that embed it, walked transitively over dependsOn (see collectDecls).\n */\nclass RuntimeGraphDeriver {\n /** apiClassName -> the api-lib project that owns the contract (from the apiRelations key). */\n private readonly apiOwners = new Map<string, string>();\n /** Addressable name -> the runtime node answering to it; how a targeted call resolves. */\n private readonly nodeByServiceName = new Map<string, string>();\n private readonly warnings: string[] = [];\n private readonly problems: string[] = [];\n /** role:server nodes hidden by isNonParticipantServer, in the order buildServices met them. */\n private readonly autoHidden: string[] = [];\n /** Uses aimed at a reviewed out-of-workspace service (#1203); built once the names are claimed. */\n private readonly remoteCalls: RemoteCallCollector;\n\n /**\n * False when NO project in the graph carries `webpiecesRuntime`, i.e. the file was written\n * before the field existed. Auto-hiding is then off ENTIRELY, so an old dependencies.json\n * renders exactly as it did — absence of the field must never be read as \"declares none\".\n * Any repo regenerated after this change has at least one webpieces project, so the guard\n * cannot wrongly suppress the feature.\n */\n private readonly markersKnown: boolean;\n\n constructor(\n private readonly projects: EnhancedGraph,\n /** Project names tagged drawOnGraph:false — kept in the JSON but flagged so the viz omits them. */\n private readonly hiddenProjects: Set<string>,\n /**\n * The per-contract method tables, read from the generated `architecture/apis/<Api>.json`\n * files (ApiContractFiles). A contract with no entry — no file, or no endpoints — makes every\n * pubsub edge through it fall back to one unnamed queue per service pair instead of failing.\n */\n private readonly apiContracts: ApiContracts = {},\n /**\n * Declared external systems from dependencies.json, keyed by identity. Empty means nothing\n * was declared, which renders exactly as it did before declarations existed.\n */\n private readonly externalSystemDecls: ExternalSystemDecls = {},\n /** Reviewed out-of-workspace services from dependencies.json `remoteServices` (#1203). */\n remoteServices: RemoteServices = {},\n ) {\n this.markersKnown = Object.values(projects).some(\n (entry: GraphEntry) => entry.webpiecesRuntime !== undefined,\n );\n // A node ALWAYS answers to its own module name, so a repo whose deployed names match its\n // project names needs no declaration at all — and no alias can ever redirect 'ai-chat' away\n // from the ai-chat module. Module names are therefore claimed FIRST and are unshadowable.\n for (const name of Object.keys(projects).sort()) {\n if (this.isNode(name)) this.nodeByServiceName.set(name, name);\n }\n // `serviceName` then adds the alias a repo needs when its deployed name is NOT its module\n // name (helper-svr serving 'helper-portal'). Colliding with a module is a misconfiguration,\n // not a precedence question: the alias is silently unreachable, so say so.\n for (const name of Object.keys(projects).sort()) {\n const declared = projects[name].serviceName;\n if (!this.isNode(name) || declared === undefined) continue;\n const claimant = this.nodeByServiceName.get(declared);\n if (claimant === undefined) {\n this.nodeByServiceName.set(declared, name);\n } else if (claimant !== name) {\n this.problems.push(\n `${name} declares serviceName '${declared}', but that is already the module name of ` +\n `${claimant} — the alias can never be reached. Rename one of them.`,\n );\n }\n }\n this.remoteCalls = new RemoteCallCollector(\n remoteServices,\n (name: string): boolean => this.nodeByServiceName.has(name),\n this.problems,\n );\n }\n\n assemble(): RuntimeGraphReport {\n const decls = this.collectDecls();\n const apis = this.buildApis(decls);\n const edgeResult = this.buildEdges(decls, apis);\n // Cuts are stamped BEFORE buildServices, which is where leveling reads the edges.\n this.problems.push(\n ...applyCycleCuts(edgeResult.edges, this.projects, this.nodeByServiceName),\n );\n const services = this.buildServices(decls, edgeResult.edges);\n const apisObj: Record<string, RuntimeApi> = {};\n for (const api of Array.from(apis.keys()).sort()) apisObj[api] = apis.get(api)!;\n const graph: RuntimeGraph = {\n services,\n apis: apisObj,\n runtimeEdges: edgeResult.edges,\n unresolvedUses: edgeResult.unresolved,\n queues: edgeResult.queues,\n triggers: this.buildTriggers(decls),\n };\n // #1179/#1216: each service's products are exactly its project's declared product tags.\n new RuntimeProductMembership().apply(graph, this.projects);\n // A destination whose address arrives at RUNTIME is declared on its CONTRACT\n // (`@externalSystem runtime partner-webhooks`), so it needs no branch of its own here: it is\n // resolved by the same call every other declared system is, converges on one node when two\n // services deliver over the same contract, and is watched by the same drift check.\n const systems = resolveExternalSystems(this.externalSystemDecls, services);\n attachExternalSystems(graph, systems);\n this.remoteCalls.attach(graph);\n return new RuntimeGraphReport(\n graph,\n this.warnings,\n this.problems,\n [...this.autoHidden].sort(),\n );\n }\n\n /**\n * The clock- and outside-driven entry points: for every contract a node IMPLEMENTS, each method\n * declared `cron` or `external` becomes a trigger pointing AT that node.\n *\n * Driven off `implements` rather than `uses` on purpose — these have no in-repo caller at all,\n * which is why they never produced an edge and stayed invisible.\n */\n private buildTriggers(decls: ScanDecl[]): RuntimeTrigger[] {\n const triggers: RuntimeTrigger[] = [];\n for (const decl of decls) {\n for (const ref of decl.implementsApis) {\n for (const method of this.methodsOf(ref.api)) {\n if (method.kind !== 'cron' && method.kind !== 'external') continue;\n const trigger: RuntimeTrigger = {\n kind: method.kind,\n api: ref.api,\n method: method.name,\n service: decl.name,\n };\n if (method.kind === 'cron') trigger.queueName = method.queueName;\n // ONLY for 'external' (a clock needs no vendor name), and only when declared —\n // a graph committed before callers were required has none and must still render.\n if (method.kind === 'external' && method.caller !== undefined)\n trigger.caller = method.caller;\n triggers.push(trigger);\n }\n }\n }\n return triggers.sort(\n (a: RuntimeTrigger, b: RuntimeTrigger) =>\n a.kind.localeCompare(b.kind) ||\n a.api.localeCompare(b.api) ||\n a.method.localeCompare(b.method) ||\n a.service.localeCompare(b.service),\n );\n }\n\n /** The committed method table for a contract, or [] when it declares none (e.g. a vendor seam). */\n private methodsOf(api: string): ApiMethodMeta[] {\n return this.apiContracts[api]?.methods ?? [];\n }\n\n /**\n * One ScanDecl per RUNTIME NODE (role:server / role:client). A node's effective\n * relations are its OWN apiRelations PLUS those of every library in its transitive\n * dependsOn closure: a lib that calls createRpcClient/addRoutes runs inside the\n * server/client that embeds it, so the relation is attributed to that node — the\n * lib is never a runtime node. Recursion stops at other nodes (each server/client\n * owns its own relations). dependsOn is transitively reduced, but reduction\n * preserves reachability, so the recursive walk still reaches every lib a node\n * embeds through libraries.\n */\n private collectDecls(): ScanDecl[] {\n const decls: ScanDecl[] = [];\n for (const name of Object.keys(this.projects).sort()) {\n if (!this.isNode(name)) continue;\n const sink = new RelationSink(name);\n this.collectEffectiveRelations(name, sink, new Set<string>([name]));\n // EVERY node gets a decl, including one with zero relations. Gating this on \"has at\n // least one implements/uses\" silently DELETED any deployed server whose work arrives\n // from outside the repo (a pull subscription): the diagram looked complete while missing\n // a running service — confidently wrong, not visibly incomplete. isNode() is the whole\n // test; drawOnGraph:false is the ONE opt-out, and such a node renders as an isolated box.\n decls.push({\n name,\n implementsApis: dedupApiRefs(sortApiRefs(sink.implementsApis)),\n usesApis: dedupApiRefs(sortApiRefs(sink.usesApis)),\n implementsVia: sink.implementsVia,\n markerVia: sink.markerVia,\n });\n }\n return decls;\n }\n\n /** True when a project is a runtime node — a server or client app (never a library). */\n private isNode(name: string): boolean {\n const role = this.projects[name]?.role;\n return role === 'server' || role === 'client';\n }\n\n /**\n * True for a role:server that speaks NO webpieces runtime package anywhere in its library\n * closure AND serves/calls no in-repo contract — a legacy Express/NestJS service sitting in the\n * same monorepo. This graph is built entirely out of webpieces contracts, so such a service can\n * only ever draw as a disconnected box: it has no edges by construction and never will.\n *\n * It stays a NODE and stays in runtime-dependencies.json (drawOnGraph:false), which is the whole\n * difference between hiding it and the silent deletion #542 removed — the data view still shows\n * a deployed role:server, only the picture drops it. Removing it from isNode() instead would\n * also drop it from nodeByServiceName, so a targeted ClientConfig('orders-manager') from a drawn\n * service would stop resolving and decay into an unresolved use: a graph that got quietly WORSE\n * while looking cleaner. The COMPILE-TIME graph (dependencies.html) still draws these projects;\n * they genuinely exist, and only the runtime drawing claims to show webpieces services.\n *\n * role:client is deliberately never auto-hidden: a browser app can legitimately declare no\n * marker at all, and nothing checks clients for presence the way checkServersPresent checks\n * servers, so there is no equivalent failure to prevent.\n */\n private isNonParticipantServer(decl: ScanDecl): boolean {\n if (!this.markersKnown) return false;\n if (this.projects[decl.name]?.role !== 'server') return false;\n if (decl.markerVia.size > 0) return false;\n // Belt-and-braces: serving or calling an in-repo contract IS participation, whatever the\n // package list says. This is what keeps a mechanism we did not anticipate from being blanked.\n return decl.implementsApis.length === 0 && decl.usesApis.length === 0;\n }\n\n /**\n * Accumulate `name`'s own api relations, then recurse through its LIBRARY deps\n * (skipping other nodes, which own their own relations). `visited` guards against\n * re-walking a lib reachable by more than one path (and any cycle).\n */\n private collectEffectiveRelations(\n name: string,\n sink: RelationSink,\n visited: Set<string>,\n includeRelations: boolean = true,\n ): void {\n const entry = this.projects[name];\n if (entry === undefined) return;\n sink.addMarkers(entry.webpiecesRuntime, name);\n const relations = entry.apiRelations;\n if (includeRelations && relations !== undefined) {\n for (const owner of Object.keys(relations).sort()) {\n for (const ref of relations[owner].implements) {\n this.apiOwners.set(ref.api, owner);\n sink.addImplements(ref, ref.declaredVia ?? name);\n }\n for (const ref of relations[owner].uses) {\n this.apiOwners.set(ref.api, owner);\n sink.addUses(ref);\n }\n }\n }\n for (const dep of entry.dependsOn) {\n if (visited.has(dep)) continue;\n visited.add(dep);\n if (this.isNode(dep)) continue; // another server/client owns its own relations\n this.collectEffectiveRelations(\n dep,\n sink,\n visited,\n includeRelations && entry.runtimeComposition !== true,\n );\n }\n }\n\n /** apiClassName -> { implementedBy, usedBy, type }. */\n private buildApis(decls: ScanDecl[]): Map<string, RuntimeApi> {\n const apis = new Map<string, RuntimeApi>();\n const ensure = (api: string, type: ApiTransport): RuntimeApi => {\n let entry = apis.get(api);\n if (!entry) {\n entry = { implementedBy: [], usedBy: [], type };\n apis.set(api, entry);\n }\n return entry;\n };\n for (const decl of decls) {\n for (const ref of decl.implementsApis)\n ensure(ref.api, ref.type).implementedBy.push(decl.name);\n for (const ref of decl.usesApis) ensure(ref.api, ref.type).usedBy.push(decl.name);\n }\n for (const api of apis.keys()) {\n const entry = apis.get(api)!;\n entry.implementedBy.sort();\n entry.usedBy = Array.from(new Set(entry.usedBy)).sort();\n const owner = this.apiOwners.get(api);\n if (owner !== undefined) entry.owner = owner;\n }\n return apis;\n }\n\n /** Inferred edges U -> I via api A, split by transport; plus uses with no implementer. */\n private buildEdges(decls: ScanDecl[], apis: Map<string, RuntimeApi>): EdgeResult {\n const viaByKey = new Map<string, Set<string>>();\n const unresolved: RuntimeUnresolved[] = [];\n const queues = new Map<string, RuntimeQueue>();\n for (const decl of decls) {\n for (const ref of decl.usesApis) {\n // A named target outside this workspace (#1203) is a remote service, not an implementer\n // to resolve among the nodes and not an unresolved vendor call.\n const wanted = ref.targetService ?? this.callsServiceFor(decl.name, ref.api);\n if (this.remoteCalls.claim(decl.name, ref, wanted)) continue;\n const implementers = apis.get(ref.api)?.implementedBy ?? [];\n if (implementers.length === 0) {\n // Nobody in-repo serves it. For a vendor contract that is the ANSWER, not a gap:\n // the call leaves the repo, and the viz terminates it at a dashed vendor node.\n unresolved.push({ service: decl.name, api: ref.api });\n continue;\n }\n for (const target of this.targetsFor(decl.name, ref, implementers)) {\n // A service calling ITSELF synchronously is noise; a service ENQUEUEING to\n // itself is a real, common topology (deferring its own work), and dropping it\n // was hiding the single most interesting thing about a queue.\n if (target === decl.name && ref.type !== 'pubsub') continue;\n if (ref.type === 'pubsub') {\n this.addQueuedEdges(decl.name, target, ref.api, viaByKey, queues);\n continue;\n }\n const key = `${decl.name} ${target} ${ref.type}`;\n if (!viaByKey.has(key)) viaByKey.set(key, new Set());\n viaByKey.get(key)!.add(ref.api);\n }\n }\n }\n return {\n edges: this.edgesFromKeys(viaByKey),\n unresolved: sortUnresolved(unresolved),\n queues: sortedQueues(queues),\n };\n }\n\n /**\n * One edge PER QUEUED METHOD of `api`, plus the queue each flows through.\n *\n * Per method rather than per service pair because that is the unit Cloud Tasks and Terraform\n * create: two services exchanging three queued methods run three independently-configured,\n * independently-backed-up queues, and collapsing them into one arrow hides which one is stuck.\n *\n * A contract with no method table (no `architecture/apis/<Api>.json` for it)\n * degrades to a single unnamed queue for the pair — the old behavior — rather than vanishing.\n */\n private addQueuedEdges(\n from: string,\n to: string,\n api: string,\n viaByKey: Map<string, Set<string>>,\n queues: Map<string, RuntimeQueue>,\n ): void {\n const queued = this.methodsOf(api).filter((m: ApiMethodMeta) => m.kind === 'cloudtasks');\n if (queued.length === 0) {\n const key = `${from} ${to} pubsub `;\n if (!viaByKey.has(key)) viaByKey.set(key, new Set());\n viaByKey.get(key)!.add(api);\n return;\n }\n for (const method of queued) {\n const queueKey = `${api}.${method.name}`;\n const key = `${from} ${to} pubsub ${queueKey}`;\n if (!viaByKey.has(key)) viaByKey.set(key, new Set());\n viaByKey.get(key)!.add(api);\n\n let queue = queues.get(queueKey);\n if (queue === undefined) {\n queue = {\n api,\n method: method.name,\n // Every cloudtasks method carries a queueName; the fallback covers a\n // dependencies.json written before queueName became kind-specific.\n queueName: method.queueName ?? `${api}-${method.name}`,\n producedBy: [],\n consumedBy: [],\n };\n queues.set(queueKey, queue);\n }\n if (!queue.producedBy.includes(from)) queue.producedBy.push(from);\n if (!queue.consumedBy.includes(to)) queue.consumedBy.push(to);\n }\n }\n\n /**\n * WHICH implementers this one `uses` reaches. Resolution order (most specific wins):\n * 1. a literal `ClientConfig` at the call site (`ref.targetService`) — names ONE node;\n * 2. else the calling project's declared `callsService` (project.json) — for the shared-library\n * case where the literal cannot sit at the call site, it lives one indirection away in the app;\n * 3. else the historical fan-out — the only safe superset — recording WHY, so a fanned-out (i.e.\n * possibly fictional) edge can never pass for a derived one.\n * A named target (1 or 2) that resolves to no module, or to a module that does not serve the\n * contract, is a PROBLEM (fails the build), never a silent drop.\n */\n private targetsFor(user: string, ref: ApiRef, implementers: string[]): string[] {\n const literal = ref.targetService;\n if (literal !== undefined)\n return this.resolveNamedTarget(user, ref, implementers, literal, 'literal');\n\n const declared = this.callsServiceFor(user, ref.api);\n if (declared !== undefined)\n return this.resolveNamedTarget(user, ref, implementers, declared, 'callsService');\n\n return this.untargetedFanOut(user, ref, implementers);\n }\n\n /**\n * The declared `callsService` target for this node's use of `api`, or undefined when none applies.\n * A string declaration aims every untargeted use at one service; a map aims per api-class.\n */\n private callsServiceFor(user: string, api: string): string | undefined {\n const declared = this.projects[user]?.callsService;\n if (declared === undefined) return undefined;\n if (typeof declared === 'string') return declared;\n return declared[api];\n }\n\n /**\n * Resolve a NAMED target (from a call-site literal or a project-level `callsService`) to the one\n * module that serves it. A name no module answers to, or a module that does not serve the\n * contract, fails the build — the wording names which declaration to fix, `source` deciding it.\n */\n private resolveNamedTarget(\n user: string,\n ref: ApiRef,\n implementers: string[],\n wanted: string,\n source: 'literal' | 'callsService',\n ): string[] {\n const node = this.nodeByServiceName.get(wanted);\n const served = `${implementers.length} module(s) serve this contract (${implementers.join(', ')})`;\n if (node === undefined) {\n this.problems.push(\n source === 'callsService'\n ? `${user} declares metadata.webpieces.callsService '${wanted}' in its project.json, but NO ` +\n `module answers to that name. ${served}. Point callsService at a module name, or declare ` +\n `metadata.webpieces.serviceName: '${wanted}' on the module that serves \"${ref.api}\".`\n : `${user} calls \"${ref.api}\" at service '${wanted}', but NO module answers to that name. ` +\n `${served}. Either use the module name, or declare metadata.webpieces.serviceName: ` +\n `'${wanted}' on the module that serves it (and translate any environment prefix in ` +\n `ClientRegistry.setDeriver, not here).`,\n );\n return implementers;\n }\n if (!implementers.includes(node)) {\n const via =\n source === 'callsService'\n ? `${user} declares callsService '${wanted}' (module ${node})`\n : `${user} calls \"${ref.api}\" at service '${wanted}' (module ${node})`;\n this.problems.push(\n `${via}, but ${node} does NOT serve \"${ref.api}\" — ${implementers.join(', ')} do. At runtime that ` +\n `call has nothing to answer it.`,\n );\n return implementers;\n }\n return [node];\n }\n\n /**\n * A use with no literal client config. One implementer is unambiguous, so it stays silent; more\n * than one means every edge but one is fiction — exactly the failure this mechanism exists to\n * stop — so it is reported even though the graph still (conservatively) draws them all.\n */\n private untargetedFanOut(user: string, ref: ApiRef, implementers: string[]): string[] {\n if (implementers.length > 1) {\n this.warnings.push(\n `${user} uses \"${ref.api}\" with no literal client config, and ${implementers.length} services ` +\n `implement it (${implementers.join(', ')}) — an edge is drawn to EVERY one, so all but one ` +\n `are fiction. Name the target: createRpcClient(${ref.api}, new ClientConfig('<serviceName>', ClientRole.SERVER)); ` +\n `or, when the client is built in a shared library (no literal can sit at the call site), ` +\n `declare metadata.webpieces.callsService: '<serviceName>' on ${user}'s project.json.`,\n );\n }\n return implementers;\n }\n\n /**\n * Rebuild edges from their `\"from to type queue\"` keys. The 4th part is the queue (\"Api.method\")\n * and is empty for every non-queued edge; it is part of the KEY so two queued methods between\n * the same pair stay two edges instead of collapsing into one.\n */\n private edgesFromKeys(viaByKey: Map<string, Set<string>>): RuntimeEdge[] {\n const edges: RuntimeEdge[] = [];\n for (const key of viaByKey.keys()) {\n const parts = key.split(' ');\n const edge: RuntimeEdge = {\n from: parts[0],\n to: parts[1],\n via: Array.from(viaByKey.get(key)!).sort(),\n type: parts[2] as ApiTransport,\n };\n if (parts[3] !== undefined && parts[3] !== '') edge.queue = parts[3];\n edges.push(edge);\n }\n edges.sort(\n (a: RuntimeEdge, b: RuntimeEdge) =>\n a.from.localeCompare(b.from) ||\n a.to.localeCompare(b.to) ||\n (a.type ?? '').localeCompare(b.type ?? '') ||\n (a.queue ?? '').localeCompare(b.queue ?? ''),\n );\n return edges;\n }\n\n private buildServices(decls: ScanDecl[], edges: RuntimeEdge[]): Record<string, RuntimeService> {\n const services: Record<string, RuntimeService> = {};\n for (const decl of decls) {\n // A queued hop depends on the QUEUE, not on the peer: the producer hands off and returns,\n // so naming the consumer here would assert a coupling that does not exist (and would make\n // a service that defers work to itself look self-dependent).\n const dependsOn = Array.from(\n new Set(\n edges\n .filter((e: RuntimeEdge) => e.from === decl.name)\n .map((e: RuntimeEdge) =>\n e.queue === undefined ? e.to : `queue:${e.queue}`,\n ),\n ),\n ).sort();\n // Keys are written in this order; an undefined value is omitted by JSON.stringify, so\n // the committed JSON stays clean AND deterministic without conditional assembly.\n const service: RuntimeService = {\n level: 0,\n role: this.projects[decl.name]?.role, // labels a relation-less node for what it IS\n serviceName: this.projects[decl.name]?.serviceName,\n callsService: this.projects[decl.name]?.callsService,\n implements: decl.implementsApis.map((r: ApiRef) => r.api),\n implementsVia:\n decl.implementsVia.size > 0 ? sortedRecord(decl.implementsVia) : undefined,\n // One api used against two services is two refs but ONE api in this list.\n uses: Array.from(new Set(decl.usesApis.map((r: ApiRef) => r.api))),\n dependsOn,\n wiringUses: decl.usesApis.some((ref) => ref.declaredVia !== undefined)\n ? decl.usesApis\n : undefined,\n wiringImplements: decl.implementsApis.some((ref) => ref.declaredVia !== undefined)\n ? decl.implementsApis\n : undefined,\n };\n services[decl.name] = service;\n // The explicit tag wins and is NOT reported as auto-hidden — somebody asked for it.\n if (this.hiddenProjects.has(decl.name)) {\n service.drawOnGraph = false;\n } else if (this.isNonParticipantServer(decl)) {\n service.drawOnGraph = false;\n this.autoHidden.push(decl.name);\n }\n }\n const levels = assignLevels(adjacencyFromEdges(Object.keys(services), edges));\n for (const name of Object.keys(services)) services[name].level = levels[name] ?? 0;\n return services;\n }\n}\n\n/**\n * Derive the runtime graph from dependencies.json's project `apiRelations` — the\n * single source of truth shared by generate + validate. `hiddenProjects`\n * (drawOnGraph:false, defaults to none) are kept in the graph but flagged so the\n * runtime visualizer omits their nodes + edges.\n */\n// webpieces-disable no-function-outside-class -- module entry point for the runtime graph derivation\nexport function deriveRuntimeGraph(\n projects: EnhancedGraph,\n hiddenProjects: Set<string> = new Set<string>(),\n apiContracts: ApiContracts = {},\n): RuntimeGraph {\n return deriveRuntimeGraphReport(projects, hiddenProjects, apiContracts).graph;\n}\n\n/**\n * The same derivation, plus the warnings it produced (every edge it had to GUESS at). Executors use\n * this form and print the warnings; `deriveRuntimeGraph` is the convenience form for callers that\n * only want the data. The warnings are deliberately kept OUT of runtime-dependencies.json — a graph\n * file that records its own doubts would just get committed and stop being read.\n */\n// webpieces-disable no-function-outside-class -- module entry point for the runtime graph derivation\nexport function deriveRuntimeGraphReport(\n projects: EnhancedGraph,\n hiddenProjects: Set<string> = new Set<string>(),\n apiContracts: ApiContracts = {},\n externalSystems: ExternalSystemDecls = {},\n remoteServices: RemoteServices = {},\n): RuntimeGraphReport {\n return new RuntimeGraphDeriver(\n projects,\n hiddenProjects,\n apiContracts,\n externalSystems,\n remoteServices,\n ).assemble();\n}\n\n// Levels + adjacency live in runtime-graph-levels.ts; re-exported for the same reason the model types\n// and the io helpers above are — one obvious place to import the runtime graph from.\nexport { runtimeAdjacency } from './runtime-graph-levels';\n"]}
|
package/src/lib/tag-truth.d.ts
CHANGED
|
@@ -109,8 +109,8 @@ export declare class TagTruthValidator {
|
|
|
109
109
|
private declaredProducts;
|
|
110
110
|
/**
|
|
111
111
|
* #1179 — a project whose role the rule lists declares at least one well-formed `product:<name>`.
|
|
112
|
-
* The DECLARED tags are read
|
|
113
|
-
*
|
|
112
|
+
* The DECLARED tags are read straight from the project's tags, not from the graph's `products`
|
|
113
|
+
* field, so this check does not depend on enrichment order. A malformed tag is not counted here
|
|
114
114
|
* because enrichGraph already fails on it, naming the tag.
|
|
115
115
|
*/
|
|
116
116
|
private productTagProblems;
|
package/src/lib/tag-truth.js
CHANGED
|
@@ -216,8 +216,8 @@ class TagTruthValidator {
|
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* #1179 — a project whose role the rule lists declares at least one well-formed `product:<name>`.
|
|
219
|
-
* The DECLARED tags are read
|
|
220
|
-
*
|
|
219
|
+
* The DECLARED tags are read straight from the project's tags, not from the graph's `products`
|
|
220
|
+
* field, so this check does not depend on enrichment order. A malformed tag is not counted here
|
|
221
221
|
* because enrichGraph already fails on it, naming the tag.
|
|
222
222
|
*/
|
|
223
223
|
productTagProblems(info, root, entry, rule) {
|
package/src/lib/tag-truth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-truth.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/tag-truth.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAuF;AAGvF,qDAAsE;AAEtE,yDAAqD;AACrD,iEAAiE;AACjE,2CAAuC;AACvC,2DAAsD;AACtD,wCAAqC;AAKxB,QAAA,YAAY,GAAG,SAAS,CAAC;AACzB,QAAA,eAAe,GAAG,YAAY,CAAC;AAC5C,MAAM,SAAS,GAAsB,CAAC,oBAAY,EAAE,uBAAe,CAAC,CAAC;AAErE,qGAAqG;AACrG,MAAa,sBAAs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AAC,CAAC;QACnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,8DAA8D;QAC9D,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAmB,CAAC;YAC5E,OAAO,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,0DAA0D,EAAE;gBAC/F,KAAK,EAAE,KAAK;aACf,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ;AAnCD,sCAmCC","sourcesContent":["/**\n * Tag truth — the four GRAPH rules that make an nx `role:*` / `framework:*` / `product:*` tag true\n * (#1064, #1179):\n *\n * api-lib-dependencies (D2) — a `role:api-lib` depends only on other `role:api-lib` projects plus a\n * stated list of outside packages; a `role:api-client` may also import\n * the packages its own config entry names (its SDK, inversify, …).\n * api-lib-path (D10) — every api-lib / api-client lives under the configured api globs, and\n * everything under them carries one of those two roles.\n * framework-folder (D9) — the folder a library lives in and its framework set + role agree,\n * both directions.\n * product-tags (#1179) — every project whose role is listed (seed: server, client, app)\n * carries a well-formed `product:<name>` tag, the seed the product\n * filter and Product color mode derive membership from; and (#1204)\n * every dependency edge respects the product dependency matrix\n * (product-dependencies.ts), read on the RESOLVED membership.\n *\n * They run beside `library-types-match-client` and `role-dependency` (graph-metadata.ts), in\n * `architecture:generate` and `validate-architecture-unchanged`, AFTER enrichGraph has resolved every\n * project's framework set and role — so a tag is read exactly one way. Every problem across every\n * project is collected and thrown as one MetadataValidationError, before anything is written.\n *\n * There is NO default (`.claude/rules/no-rule-defaults.md`): each rule's fields come from\n * webpieces.config.json, which must state them or fail to load. `TagTruthRules.none()` is what a unit\n * test or a caller that configured nothing asked for — not a default.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { loadAndValidate, matchesAnyGlob, RuleOptions } from \"@webpieces/rules-config\";\nimport { ApiClientPackagesEntry, FrameworkFolderEntry, ProductDependencyEntry } from \"../configs/tag-truth-configs\";\nimport type { EnhancedGraph, GraphEntry } from './graph-sorter';\nimport { APP_ROLES, MetadataValidationError } from './graph-metadata';\nimport { ProjectInfo } from './project-info';\nimport { ProductResolver } from './product-resolver';\nimport { ProductDependencyMatrix } from './product-dependencies';\nimport { RuleGate } from './rule-gate';\nimport { DepUsageScanner } from './dep-usage-scanner';\nimport { toError } from '../toError';\n\n/** The only field of a package.json this check reads. */\ntype RawPackageJson = { name?: string };\n\nexport const API_LIB_ROLE = 'api-lib';\nexport const API_CLIENT_ROLE = 'api-client';\nconst API_ROLES: readonly string[] = [API_LIB_ROLE, API_CLIENT_ROLE];\n\n/** `api-lib-dependencies`, resolved: what an api library may import from outside the api-lib set. */\nexport class ApiLibDependenciesRule {\n constructor(\n /** Package / project names (globs allowed) every api-lib and api-client may depend on. */\n public readonly apiLibPackages: readonly string[],\n /** `role:api-client` project → the extra packages it may depend on. */\n public readonly apiClientPackages: ReadonlyMap<string, readonly string[]>,\n ) {}\n}\n\n/** `api-lib-path`, resolved: the globs every api project — and only api projects — lives under. */\nexport class ApiLibPathRule {\n constructor(public readonly paths: readonly string[]) {}\n}\n\n/** One `framework-folder` entry with its framework sets canonicalised (`a+b`, tokens sorted). */\nexport class FrameworkFolder {\n constructor(\n public readonly paths: readonly string[],\n public readonly frameworkSets: readonly string[],\n public readonly roles: readonly string[],\n ) {}\n\n /** A framework set written in any order, canonicalised: `node+browser` → `browser+node`. */\n // webpieces-disable no-function-outside-class -- static helper of this class\n static canonical(frameworks: readonly string[]): string {\n return [...new Set(frameworks.map((each: string) => each.trim()).filter((each: string) => each !== ''))]\n .sort()\n .join('+');\n }\n\n // webpieces-disable no-function-outside-class -- static factory of this class\n static fromEntry(entry: FrameworkFolderEntry): FrameworkFolder {\n return new FrameworkFolder(\n entry.paths,\n entry.frameworkSets.map((set: string) => FrameworkFolder.canonical(set.split('+'))),\n entry.roles,\n );\n }\n}\n\n/** `framework-folder`, resolved. Entry ORDER matters: the first entry whose glob matches governs. */\nexport class FrameworkFolderRule {\n constructor(public readonly folders: readonly FrameworkFolder[]) {}\n}\n\n/**\n * `product-tags`, resolved: the roles whose every project must declare a `product:<name>` tag, and the\n * product dependency matrix every dependency edge must respect (#1204).\n */\nexport class ProductTagsRule {\n constructor(\n public readonly roles: readonly string[],\n public readonly dependencies: ProductDependencyMatrix,\n ) {}\n}\n\n/**\n * The four rules' switches, read from webpieces.config.json once. A rule that is OFF (or time-boxed /\n * branch-scoped off) is `null`.\n */\nexport class TagTruthRules {\n constructor(\n public readonly apiLibDependencies: ApiLibDependenciesRule | null,\n public readonly apiLibPath: ApiLibPathRule | null,\n public readonly frameworkFolder: FrameworkFolderRule | null,\n public readonly productTags: ProductTagsRule | null,\n ) {}\n\n /** Every rule off — what a caller that configured nothing asked for. */\n // webpieces-disable no-function-outside-class -- static factory of this class\n static none(): TagTruthRules {\n return new TagTruthRules(null, null, null, null);\n }\n\n anyEnabled(): boolean {\n return (\n this.apiLibDependencies !== null ||\n this.apiLibPath !== null ||\n this.frameworkFolder !== null ||\n this.productTags !== null\n );\n }\n\n /** `mode: OFF` and both escape hatches come from RuleGate, so there is ONE reading of them. */\n // webpieces-disable no-function-outside-class -- static factory of this class\n static fromConfig(workspaceRoot: string): TagTruthRules {\n const gate = new RuleGate();\n const rules = loadAndValidate(workspaceRoot).resolved.rules;\n // webpieces-disable no-any-unknown -- a validated rule entry is still opaque JSON in the option bag\n const optionsOf = (name: string): RuleOptions | null =>\n gate.isDisabled(workspaceRoot, name, true) ? null : (rules.get(name)?.options ?? null);\n\n const deps = optionsOf(\"api-lib-dependencies\");\n const where = optionsOf(\"api-lib-path\");\n const folder = optionsOf(\"framework-folder\");\n const products = optionsOf(\"product-tags\");\n return new TagTruthRules(\n deps === null ? null : TagTruthRules.dependenciesRule(deps),\n where === null ? null : new ApiLibPathRule(where['paths'] as string[]),\n folder === null\n ? null\n : new FrameworkFolderRule((folder['entries'] as FrameworkFolderEntry[]).map(FrameworkFolder.fromEntry)),\n products === null\n ? null\n : new ProductTagsRule(\n products['roles'] as string[],\n new ProductDependencyMatrix(products['productDependencies'] as ProductDependencyEntry[]),\n ),\n );\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static dependenciesRule(options: RuleOptions): ApiLibDependenciesRule {\n const clients = new Map<string, readonly string[]>();\n for (const entry of options['apiClients'] as ApiClientPackagesEntry[]) clients.set(entry.project, entry.packages);\n return new ApiLibDependenciesRule(options['apiLibPackages'] as string[], clients);\n }\n}\n\n/** What ONE project imports from production source, and the package name others import it by. */\nexport class ProjectImports {\n constructor(\n /** The project's own `package.json` name, or null when it has none. */\n public readonly packageName: string | null,\n /** Bare package names its production (non-test) source imports. */\n public readonly prodPackages: ReadonlySet<string>,\n ) {}\n}\n\n/** The pure check: every tag-truth problem in a graph whose framework sets and roles are resolved. */\nexport class TagTruthValidator {\n constructor(private readonly rules: TagTruthRules) {}\n\n problems(\n graph: EnhancedGraph,\n infos: Map<string, ProjectInfo>,\n imports: ReadonlyMap<string, ProjectImports>,\n ): string[] {\n const problems: string[] = [];\n for (const name of Object.keys(graph).sort()) {\n const entry = graph[name];\n const info = infos.get(name);\n if (info === undefined || info.root === '' || info.root === '.') continue;\n const root = info.root.replace(/\\\\/g, '/').replace(/\\/+$/, '');\n if (this.rules.apiLibDependencies !== null) {\n problems.push(...this.dependencyProblems(name, entry, graph, imports, this.rules.apiLibDependencies));\n }\n if (this.rules.apiLibPath !== null) {\n problems.push(...this.pathProblems(name, root, entry, this.rules.apiLibPath));\n }\n if (this.rules.frameworkFolder !== null) {\n problems.push(...this.folderProblems(name, root, entry, this.rules.frameworkFolder));\n }\n if (this.rules.productTags !== null) {\n problems.push(...this.productTagProblems(info, root, entry, this.rules.productTags));\n }\n }\n if (this.rules.productTags !== null) {\n problems.push(...this.rules.productTags.dependencies.problems(graph, this.declaredProducts(infos)));\n }\n return problems;\n }\n\n /** Every product some project's `product:` tag names — what a matrix entry may refer to. */\n private declaredProducts(infos: Map<string, ProjectInfo>): Set<string> {\n const resolver = new ProductResolver();\n const declared = new Set<string>();\n for (const info of infos.values()) {\n for (const product of resolver.resolve(info).products) declared.add(product);\n }\n return declared;\n }\n\n /**\n * #1179 — a project whose role the rule lists declares at least one well-formed `product:<name>`.\n * The DECLARED tags are read, never the derived `products`: a server inheriting membership from an\n * orchestrator that depends on it still states its own product. A malformed tag is not counted here\n * because enrichGraph already fails on it, naming the tag.\n */\n private productTagProblems(info: ProjectInfo, root: string, entry: GraphEntry, rule: ProductTagsRule): string[] {\n const role = entry.role;\n if (role === undefined || !rule.roles.includes(role)) return [];\n if (new ProductResolver().resolve(info).products.length > 0) return [];\n return [\n `${\"product-tags\"}: '${info.name}' is role:${role} but carries no product tag — every ` +\n `${rule.roles.map((each: string) => `role:${each}`).join(' / ')} must name the product(s) it belongs ` +\n `to, so the architecture graphs can show one product. Add \"product:<name>\" (lowercase kebab, ` +\n `several allowed) to the \"tags\" in ${root}/project.json, e.g. \"tags\": [..., \"product:<name>\"].`,\n ];\n }\n\n /** D2 — the workspace edges and the outside packages of ONE api-lib / api-client. */\n private dependencyProblems(\n name: string,\n entry: GraphEntry,\n graph: EnhancedGraph,\n imports: ReadonlyMap<string, ProjectImports>,\n rule: ApiLibDependenciesRule,\n ): string[] {\n const role = entry.role;\n if (role === undefined || !API_ROLES.includes(role)) return [];\n const rulePrefix = `${\"api-lib-dependencies\"}: '${name}' (role:${role})`;\n const clientPackages = rule.apiClientPackages.get(name);\n if (role === API_CLIENT_ROLE && clientPackages === undefined) {\n return [\n `${rulePrefix} has no apiClients entry — what an api-client talks to is stated, never inferred. ` +\n `Add { \"project\": \"${name}\", \"packages\": [<its SDK, inversify, …>] } to ` +\n `${\"api-lib-dependencies\"}.apiClients in webpieces.config.json, or retag it role:api-lib ` +\n 'if it bundles no implementation.',\n ];\n }\n const allowed = [...rule.apiLibPackages, ...(clientPackages ?? [])];\n const listName =\n role === API_CLIENT_ROLE ? `apiLibPackages or its apiClients entry` : 'apiLibPackages';\n const problems: string[] = [];\n const workspaceNames = new Set<string>();\n for (const dep of entry.dependsOn) {\n const depImports = imports.get(dep);\n if (depImports?.packageName) workspaceNames.add(depImports.packageName);\n const depRole = graph[dep]?.role;\n if (depRole === API_LIB_ROLE) continue;\n if (matchesAnyGlob(dep, allowed)) continue;\n if (depImports?.packageName && matchesAnyGlob(depImports.packageName, allowed)) continue;\n problems.push(\n `${rulePrefix} must not depend on '${dep}' (role:${depRole ?? 'none'}) — an api library depends ` +\n `only on role:api-lib projects and the packages ${listName} lists. Move what it needs into a ` +\n `role:api-lib project, or add '${depImports?.packageName ?? dep}' to ${listName}.`,\n );\n }\n const own = imports.get(name);\n for (const pkg of [...(own?.prodPackages ?? [])].sort()) {\n if (pkg === own?.packageName || workspaceNames.has(pkg) || this.isWorkspacePackage(pkg, imports)) continue;\n if (matchesAnyGlob(pkg, allowed)) continue;\n problems.push(\n `${rulePrefix} imports '${pkg}', which ${listName} does not list — an api library's wire contract ` +\n `must not drag an outside runtime into every consumer. Remove the import, or add '${pkg}' ` +\n `to ${\"api-lib-dependencies\"}.${role === API_CLIENT_ROLE ? `apiClients[\"${name}\"].packages` : 'apiLibPackages'}.`,\n );\n }\n return problems;\n }\n\n /** A package some workspace project publishes — its edge is judged as a workspace dependency above. */\n private isWorkspacePackage(pkg: string, imports: ReadonlyMap<string, ProjectImports>): boolean {\n for (const each of imports.values()) if (each.packageName === pkg) return true;\n return false;\n }\n\n /** D10 — an api project lives under the api globs, and everything there is an api project. */\n private pathProblems(name: string, root: string, entry: GraphEntry, rule: ApiLibPathRule): string[] {\n const isApi = entry.role !== undefined && API_ROLES.includes(entry.role);\n const inPath = matchesAnyGlob(root, rule.paths);\n const globs = `[${rule.paths.join(', ')}]`;\n if (isApi && !inPath) {\n return [\n `${\"api-lib-path\"}: '${name}' is role:${entry.role} but lives at '${root}', outside ` +\n `${\"api-lib-path\"}.paths ${globs} — move it under one of them ` +\n '(nx g @nx/workspace:move), so every contract in the repo is found in one place.',\n ];\n }\n if (inPath && !isApi) {\n return [\n `${\"api-lib-path\"}: '${name}' lives at '${root}', under ${\"api-lib-path\"}.paths ` +\n `${globs}, but is role:${entry.role ?? 'none'} — everything there is a contract. Retag it ` +\n 'role:api-lib (a contract and/or its DTOs) or role:api-client (a contract plus its SDK ' +\n 'adapter), or move it out of the api tree.',\n ];\n }\n return [];\n }\n\n /** D9 — the folder and the tags agree, both directions. */\n private folderProblems(name: string, root: string, entry: GraphEntry, rule: FrameworkFolderRule): string[] {\n if (entry.framework === undefined || entry.role === undefined) return [];\n const set = FrameworkFolder.canonical(entry.framework);\n const role = entry.role;\n const governing = rule.folders.find((folder: FrameworkFolder) => matchesAnyGlob(root, folder.paths));\n const prefix = `${\"framework-folder\"}: '${name}' at '${root}'`;\n if (governing !== undefined) {\n const problems: string[] = [];\n const glob = governing.paths.join(', ');\n if (!governing.frameworkSets.includes(set)) {\n problems.push(\n `${prefix} carries framework set [${set}], but the folder ${glob} holds ` +\n `[${governing.frameworkSets.join(' | ')}] — retag it to the folder's set, or move it to ` +\n 'the folder that holds its set.',\n );\n }\n if (!governing.roles.includes(role)) {\n problems.push(\n `${prefix} is role:${role}, but the folder ${glob} holds role ` +\n `${governing.roles.map((each: string) => `role:${each}`).join(' | ')} — retag it, or move it.`,\n );\n }\n return problems;\n }\n if (APP_ROLES.includes(role) || role === 'bundle') return [];\n const homes = rule.folders.filter(\n (folder: FrameworkFolder) => folder.frameworkSets.includes(set) && folder.roles.includes(role),\n );\n if (homes.length === 0) return [];\n const globs = homes.map((folder: FrameworkFolder) => folder.paths.join(', ')).join(' | ');\n return [\n `${prefix} is a role:${role} carrying [${set}], which ${\"framework-folder\"} places under ` +\n `${globs} — move it there (nx g @nx/workspace:move), so the folder tells a reader what runs where.`,\n ];\n }\n}\n\n/** The executor-facing entry point: read the config and the imports, check, and throw before any write. */\nexport class TagTruthCheck {\n assertTrue(graph: EnhancedGraph, infos: Map<string, ProjectInfo>, workspaceRoot: string): void {\n const rules = TagTruthRules.fromConfig(workspaceRoot);\n if (!rules.anyEnabled()) return;\n const imports = rules.apiLibDependencies === null ? new Map<string, ProjectImports>() : this.importsOf(infos, workspaceRoot);\n const problems = new TagTruthValidator(rules).problems(graph, infos, imports);\n if (problems.length > 0) throw new MetadataValidationError(problems);\n }\n\n /** Every project's production imports and package name, read from its source and package.json. */\n importsOf(infos: Map<string, ProjectInfo>, workspaceRoot: string): Map<string, ProjectImports> {\n const scanner = new DepUsageScanner();\n const found = new Map<string, ProjectImports>();\n for (const info of infos.values()) {\n if (info.root === '' || info.root === '.') continue;\n const abs = path.resolve(workspaceRoot, info.root);\n found.set(info.name, new ProjectImports(this.packageNameOf(abs), scanner.scan(abs).prodPackages));\n }\n return found;\n }\n\n private packageNameOf(projectDir: string): string | null {\n const file = path.join(projectDir, 'package.json');\n if (!fs.existsSync(file)) return null;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const parsed = JSON.parse(fs.readFileSync(file, 'utf-8')) as RawPackageJson;\n return typeof parsed.name === 'string' ? parsed.name : null;\n } catch (err: unknown) {\n const error = toError(err);\n throw new Error(`Failed to parse ${file} while reading the package name tag-truth checks against`, {\n cause: error,\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tag-truth.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/tag-truth.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAuF;AAGvF,qDAAsE;AAEtE,yDAAqD;AACrD,iEAAiE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AC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;QACtG,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,aAAa,CAAC,UAAkB;QACpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,8DAA8D;QAC9D,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAmB,CAAC;YAC5E,OAAO,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,0DAA0D,EAAE;gBAC/F,KAAK,EAAE,KAAK;aACf,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ;AAnCD,sCAmCC","sourcesContent":["/**\n * Tag truth — the four GRAPH rules that make an nx `role:*` / `framework:*` / `product:*` tag true\n * (#1064, #1179):\n *\n * api-lib-dependencies (D2) — a `role:api-lib` depends only on other `role:api-lib` projects plus a\n * stated list of outside packages; a `role:api-client` may also import\n * the packages its own config entry names (its SDK, inversify, …).\n * api-lib-path (D10) — every api-lib / api-client lives under the configured api globs, and\n * everything under them carries one of those two roles.\n * framework-folder (D9) — the folder a library lives in and its framework set + role agree,\n * both directions.\n * product-tags (#1179) — every project whose role is listed (seed: server, client, app)\n * carries a well-formed `product:<name>` tag, the seed the product\n * filter and Product color mode derive membership from; and (#1204)\n * every dependency edge respects the product dependency matrix\n * (product-dependencies.ts), read on the RESOLVED membership.\n *\n * They run beside `library-types-match-client` and `role-dependency` (graph-metadata.ts), in\n * `architecture:generate` and `validate-architecture-unchanged`, AFTER enrichGraph has resolved every\n * project's framework set and role — so a tag is read exactly one way. Every problem across every\n * project is collected and thrown as one MetadataValidationError, before anything is written.\n *\n * There is NO default (`.claude/rules/no-rule-defaults.md`): each rule's fields come from\n * webpieces.config.json, which must state them or fail to load. `TagTruthRules.none()` is what a unit\n * test or a caller that configured nothing asked for — not a default.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { loadAndValidate, matchesAnyGlob, RuleOptions } from \"@webpieces/rules-config\";\nimport { ApiClientPackagesEntry, FrameworkFolderEntry, ProductDependencyEntry } from \"../configs/tag-truth-configs\";\nimport type { EnhancedGraph, GraphEntry } from './graph-sorter';\nimport { APP_ROLES, MetadataValidationError } from './graph-metadata';\nimport { ProjectInfo } from './project-info';\nimport { ProductResolver } from './product-resolver';\nimport { ProductDependencyMatrix } from './product-dependencies';\nimport { RuleGate } from './rule-gate';\nimport { DepUsageScanner } from './dep-usage-scanner';\nimport { toError } from '../toError';\n\n/** The only field of a package.json this check reads. */\ntype RawPackageJson = { name?: string };\n\nexport const API_LIB_ROLE = 'api-lib';\nexport const API_CLIENT_ROLE = 'api-client';\nconst API_ROLES: readonly string[] = [API_LIB_ROLE, API_CLIENT_ROLE];\n\n/** `api-lib-dependencies`, resolved: what an api library may import from outside the api-lib set. */\nexport class ApiLibDependenciesRule {\n constructor(\n /** Package / project names (globs allowed) every api-lib and api-client may depend on. */\n public readonly apiLibPackages: readonly string[],\n /** `role:api-client` project → the extra packages it may depend on. */\n public readonly apiClientPackages: ReadonlyMap<string, readonly string[]>,\n ) {}\n}\n\n/** `api-lib-path`, resolved: the globs every api project — and only api projects — lives under. */\nexport class ApiLibPathRule {\n constructor(public readonly paths: readonly string[]) {}\n}\n\n/** One `framework-folder` entry with its framework sets canonicalised (`a+b`, tokens sorted). */\nexport class FrameworkFolder {\n constructor(\n public readonly paths: readonly string[],\n public readonly frameworkSets: readonly string[],\n public readonly roles: readonly string[],\n ) {}\n\n /** A framework set written in any order, canonicalised: `node+browser` → `browser+node`. */\n // webpieces-disable no-function-outside-class -- static helper of this class\n static canonical(frameworks: readonly string[]): string {\n return [...new Set(frameworks.map((each: string) => each.trim()).filter((each: string) => each !== ''))]\n .sort()\n .join('+');\n }\n\n // webpieces-disable no-function-outside-class -- static factory of this class\n static fromEntry(entry: FrameworkFolderEntry): FrameworkFolder {\n return new FrameworkFolder(\n entry.paths,\n entry.frameworkSets.map((set: string) => FrameworkFolder.canonical(set.split('+'))),\n entry.roles,\n );\n }\n}\n\n/** `framework-folder`, resolved. Entry ORDER matters: the first entry whose glob matches governs. */\nexport class FrameworkFolderRule {\n constructor(public readonly folders: readonly FrameworkFolder[]) {}\n}\n\n/**\n * `product-tags`, resolved: the roles whose every project must declare a `product:<name>` tag, and the\n * product dependency matrix every dependency edge must respect (#1204).\n */\nexport class ProductTagsRule {\n constructor(\n public readonly roles: readonly string[],\n public readonly dependencies: ProductDependencyMatrix,\n ) {}\n}\n\n/**\n * The four rules' switches, read from webpieces.config.json once. A rule that is OFF (or time-boxed /\n * branch-scoped off) is `null`.\n */\nexport class TagTruthRules {\n constructor(\n public readonly apiLibDependencies: ApiLibDependenciesRule | null,\n public readonly apiLibPath: ApiLibPathRule | null,\n public readonly frameworkFolder: FrameworkFolderRule | null,\n public readonly productTags: ProductTagsRule | null,\n ) {}\n\n /** Every rule off — what a caller that configured nothing asked for. */\n // webpieces-disable no-function-outside-class -- static factory of this class\n static none(): TagTruthRules {\n return new TagTruthRules(null, null, null, null);\n }\n\n anyEnabled(): boolean {\n return (\n this.apiLibDependencies !== null ||\n this.apiLibPath !== null ||\n this.frameworkFolder !== null ||\n this.productTags !== null\n );\n }\n\n /** `mode: OFF` and both escape hatches come from RuleGate, so there is ONE reading of them. */\n // webpieces-disable no-function-outside-class -- static factory of this class\n static fromConfig(workspaceRoot: string): TagTruthRules {\n const gate = new RuleGate();\n const rules = loadAndValidate(workspaceRoot).resolved.rules;\n // webpieces-disable no-any-unknown -- a validated rule entry is still opaque JSON in the option bag\n const optionsOf = (name: string): RuleOptions | null =>\n gate.isDisabled(workspaceRoot, name, true) ? null : (rules.get(name)?.options ?? null);\n\n const deps = optionsOf(\"api-lib-dependencies\");\n const where = optionsOf(\"api-lib-path\");\n const folder = optionsOf(\"framework-folder\");\n const products = optionsOf(\"product-tags\");\n return new TagTruthRules(\n deps === null ? null : TagTruthRules.dependenciesRule(deps),\n where === null ? null : new ApiLibPathRule(where['paths'] as string[]),\n folder === null\n ? null\n : new FrameworkFolderRule((folder['entries'] as FrameworkFolderEntry[]).map(FrameworkFolder.fromEntry)),\n products === null\n ? null\n : new ProductTagsRule(\n products['roles'] as string[],\n new ProductDependencyMatrix(products['productDependencies'] as ProductDependencyEntry[]),\n ),\n );\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static dependenciesRule(options: RuleOptions): ApiLibDependenciesRule {\n const clients = new Map<string, readonly string[]>();\n for (const entry of options['apiClients'] as ApiClientPackagesEntry[]) clients.set(entry.project, entry.packages);\n return new ApiLibDependenciesRule(options['apiLibPackages'] as string[], clients);\n }\n}\n\n/** What ONE project imports from production source, and the package name others import it by. */\nexport class ProjectImports {\n constructor(\n /** The project's own `package.json` name, or null when it has none. */\n public readonly packageName: string | null,\n /** Bare package names its production (non-test) source imports. */\n public readonly prodPackages: ReadonlySet<string>,\n ) {}\n}\n\n/** The pure check: every tag-truth problem in a graph whose framework sets and roles are resolved. */\nexport class TagTruthValidator {\n constructor(private readonly rules: TagTruthRules) {}\n\n problems(\n graph: EnhancedGraph,\n infos: Map<string, ProjectInfo>,\n imports: ReadonlyMap<string, ProjectImports>,\n ): string[] {\n const problems: string[] = [];\n for (const name of Object.keys(graph).sort()) {\n const entry = graph[name];\n const info = infos.get(name);\n if (info === undefined || info.root === '' || info.root === '.') continue;\n const root = info.root.replace(/\\\\/g, '/').replace(/\\/+$/, '');\n if (this.rules.apiLibDependencies !== null) {\n problems.push(...this.dependencyProblems(name, entry, graph, imports, this.rules.apiLibDependencies));\n }\n if (this.rules.apiLibPath !== null) {\n problems.push(...this.pathProblems(name, root, entry, this.rules.apiLibPath));\n }\n if (this.rules.frameworkFolder !== null) {\n problems.push(...this.folderProblems(name, root, entry, this.rules.frameworkFolder));\n }\n if (this.rules.productTags !== null) {\n problems.push(...this.productTagProblems(info, root, entry, this.rules.productTags));\n }\n }\n if (this.rules.productTags !== null) {\n problems.push(...this.rules.productTags.dependencies.problems(graph, this.declaredProducts(infos)));\n }\n return problems;\n }\n\n /** Every product some project's `product:` tag names — what a matrix entry may refer to. */\n private declaredProducts(infos: Map<string, ProjectInfo>): Set<string> {\n const resolver = new ProductResolver();\n const declared = new Set<string>();\n for (const info of infos.values()) {\n for (const product of resolver.resolve(info).products) declared.add(product);\n }\n return declared;\n }\n\n /**\n * #1179 — a project whose role the rule lists declares at least one well-formed `product:<name>`.\n * The DECLARED tags are read straight from the project's tags, not from the graph's `products`\n * field, so this check does not depend on enrichment order. A malformed tag is not counted here\n * because enrichGraph already fails on it, naming the tag.\n */\n private productTagProblems(info: ProjectInfo, root: string, entry: GraphEntry, rule: ProductTagsRule): string[] {\n const role = entry.role;\n if (role === undefined || !rule.roles.includes(role)) return [];\n if (new ProductResolver().resolve(info).products.length > 0) return [];\n return [\n `${\"product-tags\"}: '${info.name}' is role:${role} but carries no product tag — every ` +\n `${rule.roles.map((each: string) => `role:${each}`).join(' / ')} must name the product(s) it belongs ` +\n `to, so the architecture graphs can show one product. Add \"product:<name>\" (lowercase kebab, ` +\n `several allowed) to the \"tags\" in ${root}/project.json, e.g. \"tags\": [..., \"product:<name>\"].`,\n ];\n }\n\n /** D2 — the workspace edges and the outside packages of ONE api-lib / api-client. */\n private dependencyProblems(\n name: string,\n entry: GraphEntry,\n graph: EnhancedGraph,\n imports: ReadonlyMap<string, ProjectImports>,\n rule: ApiLibDependenciesRule,\n ): string[] {\n const role = entry.role;\n if (role === undefined || !API_ROLES.includes(role)) return [];\n const rulePrefix = `${\"api-lib-dependencies\"}: '${name}' (role:${role})`;\n const clientPackages = rule.apiClientPackages.get(name);\n if (role === API_CLIENT_ROLE && clientPackages === undefined) {\n return [\n `${rulePrefix} has no apiClients entry — what an api-client talks to is stated, never inferred. ` +\n `Add { \"project\": \"${name}\", \"packages\": [<its SDK, inversify, …>] } to ` +\n `${\"api-lib-dependencies\"}.apiClients in webpieces.config.json, or retag it role:api-lib ` +\n 'if it bundles no implementation.',\n ];\n }\n const allowed = [...rule.apiLibPackages, ...(clientPackages ?? [])];\n const listName =\n role === API_CLIENT_ROLE ? `apiLibPackages or its apiClients entry` : 'apiLibPackages';\n const problems: string[] = [];\n const workspaceNames = new Set<string>();\n for (const dep of entry.dependsOn) {\n const depImports = imports.get(dep);\n if (depImports?.packageName) workspaceNames.add(depImports.packageName);\n const depRole = graph[dep]?.role;\n if (depRole === API_LIB_ROLE) continue;\n if (matchesAnyGlob(dep, allowed)) continue;\n if (depImports?.packageName && matchesAnyGlob(depImports.packageName, allowed)) continue;\n problems.push(\n `${rulePrefix} must not depend on '${dep}' (role:${depRole ?? 'none'}) — an api library depends ` +\n `only on role:api-lib projects and the packages ${listName} lists. Move what it needs into a ` +\n `role:api-lib project, or add '${depImports?.packageName ?? dep}' to ${listName}.`,\n );\n }\n const own = imports.get(name);\n for (const pkg of [...(own?.prodPackages ?? [])].sort()) {\n if (pkg === own?.packageName || workspaceNames.has(pkg) || this.isWorkspacePackage(pkg, imports)) continue;\n if (matchesAnyGlob(pkg, allowed)) continue;\n problems.push(\n `${rulePrefix} imports '${pkg}', which ${listName} does not list — an api library's wire contract ` +\n `must not drag an outside runtime into every consumer. Remove the import, or add '${pkg}' ` +\n `to ${\"api-lib-dependencies\"}.${role === API_CLIENT_ROLE ? `apiClients[\"${name}\"].packages` : 'apiLibPackages'}.`,\n );\n }\n return problems;\n }\n\n /** A package some workspace project publishes — its edge is judged as a workspace dependency above. */\n private isWorkspacePackage(pkg: string, imports: ReadonlyMap<string, ProjectImports>): boolean {\n for (const each of imports.values()) if (each.packageName === pkg) return true;\n return false;\n }\n\n /** D10 — an api project lives under the api globs, and everything there is an api project. */\n private pathProblems(name: string, root: string, entry: GraphEntry, rule: ApiLibPathRule): string[] {\n const isApi = entry.role !== undefined && API_ROLES.includes(entry.role);\n const inPath = matchesAnyGlob(root, rule.paths);\n const globs = `[${rule.paths.join(', ')}]`;\n if (isApi && !inPath) {\n return [\n `${\"api-lib-path\"}: '${name}' is role:${entry.role} but lives at '${root}', outside ` +\n `${\"api-lib-path\"}.paths ${globs} — move it under one of them ` +\n '(nx g @nx/workspace:move), so every contract in the repo is found in one place.',\n ];\n }\n if (inPath && !isApi) {\n return [\n `${\"api-lib-path\"}: '${name}' lives at '${root}', under ${\"api-lib-path\"}.paths ` +\n `${globs}, but is role:${entry.role ?? 'none'} — everything there is a contract. Retag it ` +\n 'role:api-lib (a contract and/or its DTOs) or role:api-client (a contract plus its SDK ' +\n 'adapter), or move it out of the api tree.',\n ];\n }\n return [];\n }\n\n /** D9 — the folder and the tags agree, both directions. */\n private folderProblems(name: string, root: string, entry: GraphEntry, rule: FrameworkFolderRule): string[] {\n if (entry.framework === undefined || entry.role === undefined) return [];\n const set = FrameworkFolder.canonical(entry.framework);\n const role = entry.role;\n const governing = rule.folders.find((folder: FrameworkFolder) => matchesAnyGlob(root, folder.paths));\n const prefix = `${\"framework-folder\"}: '${name}' at '${root}'`;\n if (governing !== undefined) {\n const problems: string[] = [];\n const glob = governing.paths.join(', ');\n if (!governing.frameworkSets.includes(set)) {\n problems.push(\n `${prefix} carries framework set [${set}], but the folder ${glob} holds ` +\n `[${governing.frameworkSets.join(' | ')}] — retag it to the folder's set, or move it to ` +\n 'the folder that holds its set.',\n );\n }\n if (!governing.roles.includes(role)) {\n problems.push(\n `${prefix} is role:${role}, but the folder ${glob} holds role ` +\n `${governing.roles.map((each: string) => `role:${each}`).join(' | ')} — retag it, or move it.`,\n );\n }\n return problems;\n }\n if (APP_ROLES.includes(role) || role === 'bundle') return [];\n const homes = rule.folders.filter(\n (folder: FrameworkFolder) => folder.frameworkSets.includes(set) && folder.roles.includes(role),\n );\n if (homes.length === 0) return [];\n const globs = homes.map((folder: FrameworkFolder) => folder.paths.join(', ')).join(' | ');\n return [\n `${prefix} is a role:${role} carrying [${set}], which ${\"framework-folder\"} places under ` +\n `${globs} — move it there (nx g @nx/workspace:move), so the folder tells a reader what runs where.`,\n ];\n }\n}\n\n/** The executor-facing entry point: read the config and the imports, check, and throw before any write. */\nexport class TagTruthCheck {\n assertTrue(graph: EnhancedGraph, infos: Map<string, ProjectInfo>, workspaceRoot: string): void {\n const rules = TagTruthRules.fromConfig(workspaceRoot);\n if (!rules.anyEnabled()) return;\n const imports = rules.apiLibDependencies === null ? new Map<string, ProjectImports>() : this.importsOf(infos, workspaceRoot);\n const problems = new TagTruthValidator(rules).problems(graph, infos, imports);\n if (problems.length > 0) throw new MetadataValidationError(problems);\n }\n\n /** Every project's production imports and package name, read from its source and package.json. */\n importsOf(infos: Map<string, ProjectInfo>, workspaceRoot: string): Map<string, ProjectImports> {\n const scanner = new DepUsageScanner();\n const found = new Map<string, ProjectImports>();\n for (const info of infos.values()) {\n if (info.root === '' || info.root === '.') continue;\n const abs = path.resolve(workspaceRoot, info.root);\n found.set(info.name, new ProjectImports(this.packageNameOf(abs), scanner.scan(abs).prodPackages));\n }\n return found;\n }\n\n private packageNameOf(projectDir: string): string | null {\n const file = path.join(projectDir, 'package.json');\n if (!fs.existsSync(file)) return null;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const parsed = JSON.parse(fs.readFileSync(file, 'utf-8')) as RawPackageJson;\n return typeof parsed.name === 'string' ? parsed.name : null;\n } catch (err: unknown) {\n const error = toError(err);\n throw new Error(`Failed to parse ${file} while reading the package name tag-truth checks against`, {\n cause: error,\n });\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visible Transitive Reduction (#1215)
|
|
3
|
+
*
|
|
4
|
+
* The plain transitive reduction drops a direct edge A → C whenever a longer path A → B → C exists.
|
|
5
|
+
* That is correct on the FULL graph, but the rendered graphs then omit every project tagged
|
|
6
|
+
* `drawOnGraph:false`. When B is such a hidden project, hiding it removes the only path the
|
|
7
|
+
* reduction kept, and A → C vanishes from the picture although A really depends on C directly.
|
|
8
|
+
* That is exactly how `rules-sdk` rendered as an orphan: every rules package reaches it through the
|
|
9
|
+
* hidden, test-only `tooling-testkit`, so every direct edge into it was reduced away.
|
|
10
|
+
*
|
|
11
|
+
* So the reduction is computed TWICE and unioned:
|
|
12
|
+
* - over the full graph, which keeps every edge that touches a hidden project (the JSON stays a
|
|
13
|
+
* complete data view, hidden projects included);
|
|
14
|
+
* - over the VISIBLE graph only (hidden projects and their edges removed first), which decides
|
|
15
|
+
* which visible → visible edges are drawn. A path through a hidden project never makes a visible
|
|
16
|
+
* edge redundant.
|
|
17
|
+
*
|
|
18
|
+
* Every visible → visible edge the full reduction keeps is also kept by the visible reduction (no
|
|
19
|
+
* sibling reaches its target in the full graph, so none does in a subgraph), so the union only ADDS
|
|
20
|
+
* the edges that were wrongly removed through a hidden project. Both halves are subsets of the full
|
|
21
|
+
* graph and the full reduction alone already preserves reachability, so the union does too — and
|
|
22
|
+
* every added edge is implied by a longer existing path, so no dependency level changes.
|
|
23
|
+
*/
|
|
24
|
+
export declare class VisibleTransitiveReduction {
|
|
25
|
+
/**
|
|
26
|
+
* @param full - Full DAG as { project: [directChildren] }
|
|
27
|
+
* @param hidden - Projects tagged `drawOnGraph:false`
|
|
28
|
+
* @returns Reduced graph { project: [children] } (children sorted)
|
|
29
|
+
*/
|
|
30
|
+
reduce(full: Record<string, string[]>, hidden: ReadonlySet<string>): Record<string, string[]>;
|
|
31
|
+
/** The full graph with every hidden project, and every edge touching one, removed. */
|
|
32
|
+
private visibleSubgraph;
|
|
33
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Visible Transitive Reduction (#1215)
|
|
4
|
+
*
|
|
5
|
+
* The plain transitive reduction drops a direct edge A → C whenever a longer path A → B → C exists.
|
|
6
|
+
* That is correct on the FULL graph, but the rendered graphs then omit every project tagged
|
|
7
|
+
* `drawOnGraph:false`. When B is such a hidden project, hiding it removes the only path the
|
|
8
|
+
* reduction kept, and A → C vanishes from the picture although A really depends on C directly.
|
|
9
|
+
* That is exactly how `rules-sdk` rendered as an orphan: every rules package reaches it through the
|
|
10
|
+
* hidden, test-only `tooling-testkit`, so every direct edge into it was reduced away.
|
|
11
|
+
*
|
|
12
|
+
* So the reduction is computed TWICE and unioned:
|
|
13
|
+
* - over the full graph, which keeps every edge that touches a hidden project (the JSON stays a
|
|
14
|
+
* complete data view, hidden projects included);
|
|
15
|
+
* - over the VISIBLE graph only (hidden projects and their edges removed first), which decides
|
|
16
|
+
* which visible → visible edges are drawn. A path through a hidden project never makes a visible
|
|
17
|
+
* edge redundant.
|
|
18
|
+
*
|
|
19
|
+
* Every visible → visible edge the full reduction keeps is also kept by the visible reduction (no
|
|
20
|
+
* sibling reaches its target in the full graph, so none does in a subgraph), so the union only ADDS
|
|
21
|
+
* the edges that were wrongly removed through a hidden project. Both halves are subsets of the full
|
|
22
|
+
* graph and the full reduction alone already preserves reachability, so the union does too — and
|
|
23
|
+
* every added edge is implied by a longer existing path, so no dependency level changes.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.VisibleTransitiveReduction = void 0;
|
|
27
|
+
const transitive_reduction_1 = require("./transitive-reduction");
|
|
28
|
+
class VisibleTransitiveReduction {
|
|
29
|
+
/**
|
|
30
|
+
* @param full - Full DAG as { project: [directChildren] }
|
|
31
|
+
* @param hidden - Projects tagged `drawOnGraph:false`
|
|
32
|
+
* @returns Reduced graph { project: [children] } (children sorted)
|
|
33
|
+
*/
|
|
34
|
+
reduce(full, hidden) {
|
|
35
|
+
const reduced = (0, transitive_reduction_1.transitiveReduction)(full);
|
|
36
|
+
if (hidden.size === 0)
|
|
37
|
+
return reduced;
|
|
38
|
+
const visibleReduced = (0, transitive_reduction_1.transitiveReduction)(this.visibleSubgraph(full, hidden));
|
|
39
|
+
const result = {};
|
|
40
|
+
for (const project of Object.keys(reduced)) {
|
|
41
|
+
const children = new Set(reduced[project]);
|
|
42
|
+
for (const child of visibleReduced[project] ?? [])
|
|
43
|
+
children.add(child);
|
|
44
|
+
result[project] = Array.from(children).sort();
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
/** The full graph with every hidden project, and every edge touching one, removed. */
|
|
49
|
+
visibleSubgraph(full, hidden) {
|
|
50
|
+
const visible = {};
|
|
51
|
+
for (const project of Object.keys(full)) {
|
|
52
|
+
if (hidden.has(project))
|
|
53
|
+
continue;
|
|
54
|
+
visible[project] = (full[project] ?? []).filter((dep) => !hidden.has(dep));
|
|
55
|
+
}
|
|
56
|
+
return visible;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.VisibleTransitiveReduction = VisibleTransitiveReduction;
|
|
60
|
+
//# sourceMappingURL=visible-transitive-reduction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visible-transitive-reduction.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/visible-transitive-reduction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAEH,iEAA6D;AAE7D,MAAa,0BAA0B;IACnC;;;;OAIG;IACH,MAAM,CAAC,IAA8B,EAAE,MAA2B;QAC9D,MAAM,OAAO,GAAG,IAAA,0CAAmB,EAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,OAAO,CAAC;QAEtC,MAAM,cAAc,GAAG,IAAA,0CAAmB,EAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/E,MAAM,MAAM,GAA6B,EAAE,CAAC;QAC5C,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACzC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACnD,KAAK,MAAM,KAAK,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE;gBAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACvE,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QAClD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,sFAAsF;IAC9E,eAAe,CACnB,IAA8B,EAC9B,MAA2B;QAE3B,MAAM,OAAO,GAA6B,EAAE,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;gBAAE,SAAS;YAClC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAW,EAAW,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAhCD,gEAgCC","sourcesContent":["/**\n * Visible Transitive Reduction (#1215)\n *\n * The plain transitive reduction drops a direct edge A → C whenever a longer path A → B → C exists.\n * That is correct on the FULL graph, but the rendered graphs then omit every project tagged\n * `drawOnGraph:false`. When B is such a hidden project, hiding it removes the only path the\n * reduction kept, and A → C vanishes from the picture although A really depends on C directly.\n * That is exactly how `rules-sdk` rendered as an orphan: every rules package reaches it through the\n * hidden, test-only `tooling-testkit`, so every direct edge into it was reduced away.\n *\n * So the reduction is computed TWICE and unioned:\n * - over the full graph, which keeps every edge that touches a hidden project (the JSON stays a\n * complete data view, hidden projects included);\n * - over the VISIBLE graph only (hidden projects and their edges removed first), which decides\n * which visible → visible edges are drawn. A path through a hidden project never makes a visible\n * edge redundant.\n *\n * Every visible → visible edge the full reduction keeps is also kept by the visible reduction (no\n * sibling reaches its target in the full graph, so none does in a subgraph), so the union only ADDS\n * the edges that were wrongly removed through a hidden project. Both halves are subsets of the full\n * graph and the full reduction alone already preserves reachability, so the union does too — and\n * every added edge is implied by a longer existing path, so no dependency level changes.\n */\n\nimport { transitiveReduction } from './transitive-reduction';\n\nexport class VisibleTransitiveReduction {\n /**\n * @param full - Full DAG as { project: [directChildren] }\n * @param hidden - Projects tagged `drawOnGraph:false`\n * @returns Reduced graph { project: [children] } (children sorted)\n */\n reduce(full: Record<string, string[]>, hidden: ReadonlySet<string>): Record<string, string[]> {\n const reduced = transitiveReduction(full);\n if (hidden.size === 0) return reduced;\n\n const visibleReduced = transitiveReduction(this.visibleSubgraph(full, hidden));\n const result: Record<string, string[]> = {};\n for (const project of Object.keys(reduced)) {\n const children = new Set<string>(reduced[project]);\n for (const child of visibleReduced[project] ?? []) children.add(child);\n result[project] = Array.from(children).sort();\n }\n return result;\n }\n\n /** The full graph with every hidden project, and every edge touching one, removed. */\n private visibleSubgraph(\n full: Record<string, string[]>,\n hidden: ReadonlySet<string>,\n ): Record<string, string[]> {\n const visible: Record<string, string[]> = {};\n for (const project of Object.keys(full)) {\n if (hidden.has(project)) continue;\n visible[project] = (full[project] ?? []).filter((dep: string): boolean => !hidden.has(dep));\n }\n return visible;\n }\n}\n"]}
|