@webpieces/nx-webpieces-rules 0.4.971 → 0.4.973

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.
Files changed (52) hide show
  1. package/README.md +8 -8
  2. package/executors.json +1 -6
  3. package/package.json +7 -7
  4. package/src/executors/help/executor.js +1 -3
  5. package/src/executors/help/executor.js.map +1 -1
  6. package/src/executors/visualize-runtime/executor.d.ts +22 -3
  7. package/src/executors/visualize-runtime/executor.js +55 -8
  8. package/src/executors/visualize-runtime/executor.js.map +1 -1
  9. package/src/executors/visualize-runtime/schema.json +7 -2
  10. package/src/lib/graph-color-modes.d.ts +10 -0
  11. package/src/lib/graph-color-modes.js +16 -1
  12. package/src/lib/graph-color-modes.js.map +1 -1
  13. package/src/lib/graph-mode-state.client.d.ts +6 -1
  14. package/src/lib/graph-mode-state.client.js +9 -1
  15. package/src/lib/graph-mode-state.client.js.map +1 -1
  16. package/src/lib/graph-page-shell.d.ts +10 -2
  17. package/src/lib/graph-page-shell.js +20 -8
  18. package/src/lib/graph-page-shell.js.map +1 -1
  19. package/src/lib/graph-render-model.d.ts +10 -0
  20. package/src/lib/graph-render-model.js +7 -0
  21. package/src/lib/graph-render-model.js.map +1 -1
  22. package/src/lib/graph-visualizer.client.js +2 -2
  23. package/src/lib/graph-visualizer.client.js.map +1 -1
  24. package/src/lib/runtime-goal-comparison.js +1 -1
  25. package/src/lib/runtime-goal-comparison.js.map +1 -1
  26. package/src/lib/runtime-goal-file.d.ts +6 -11
  27. package/src/lib/runtime-goal-file.js +7 -23
  28. package/src/lib/runtime-goal-file.js.map +1 -1
  29. package/src/lib/runtime-goal-validator.d.ts +4 -4
  30. package/src/lib/runtime-goal-validator.js +4 -4
  31. package/src/lib/runtime-goal-validator.js.map +1 -1
  32. package/src/lib/runtime-goal-view.d.ts +18 -11
  33. package/src/lib/runtime-goal-view.js +27 -27
  34. package/src/lib/runtime-goal-view.js.map +1 -1
  35. package/src/lib/runtime-html-page.d.ts +2 -0
  36. package/src/lib/runtime-html-page.js +8 -2
  37. package/src/lib/runtime-html-page.js.map +1 -1
  38. package/src/lib/runtime-visualizer.d.ts +2 -3
  39. package/src/lib/runtime-visualizer.js +3 -4
  40. package/src/lib/runtime-visualizer.js.map +1 -1
  41. package/src/lib/runtime-viz-options.d.ts +3 -5
  42. package/src/lib/runtime-viz-options.js +3 -7
  43. package/src/lib/runtime-viz-options.js.map +1 -1
  44. package/src/plugin.js +0 -1
  45. package/src/plugin.js.map +1 -1
  46. package/src/runtime-targets.d.ts +0 -6
  47. package/src/runtime-targets.js +1 -18
  48. package/src/runtime-targets.js.map +1 -1
  49. package/src/executors/visualize-runtime-goal/executor.d.ts +0 -27
  50. package/src/executors/visualize-runtime-goal/executor.js +0 -99
  51. package/src/executors/visualize-runtime-goal/executor.js.map +0 -1
  52. package/src/executors/visualize-runtime-goal/schema.json +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-goal-comparison.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-goal-comparison.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,6CAAuE;AACvE,6DAAuG;AAEvG,6DAAsH;AACtH,+DAA0D;AAC1D,+DAA2E;AAC3E,6DAAkE;AAClE,qDAAiD;AACjD,qEAA+D;AAC/D,2EAAsE;AACtE,+DAAoD;AAEpD,qEAAqE;AACrE,MAAa,oBAAoB;IAIA;IAHZ,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IACrC,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5D,YAA6B,KAAmB;QAAnB,UAAK,GAAL,KAAK,CAAc;QAC5C,MAAM,IAAI,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;QACzE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ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AC,EAAE,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,cAAc,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;QACjI,OAAO,GAAG,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,OAAO,cAAc,MAAM,CAAC,OAAO,cAAc,MAAM,CAAC,SAAS,aAAa,MAAM,EAAE,CAAC;IACpI,CAAC;IAEO,IAAI,CAAC,MAAyB;QAClC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,sCAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1G,OAAO,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC;IACxD,CAAC;CACJ;AApED,sDAoEC","sourcesContent":["/**\n * Goal vs Current (#1239): turns the semantic diff of the two saved runtime files into the overlay the\n * runtime viewer's \"Goal vs Current\" color mode draws.\n *\n * The overlay is rendered by the SAME shared runtime renderer as both pages (generateRuntimeRenderModel\n * over RuntimeUnionGraph), so queue boxes, self-queue sub-rows, level bands and non-constraining\n * feedback edges behave exactly as on the normal pages. Only the statements are restyled afterwards:\n *\n * added in goal green\n * removed from goal red, dashed box / dotted arrow — still drawn, never dropped\n * changed amber; a moved level reads `L4 → L2`\n * unchanged subdued grey, kept for context\n *\n * Every drawn box and arrow maps back to the diff's FACT identities (never to display names or edge\n * ids), and its before/after lines travel in the page for the details panel.\n */\n\nimport { dotValue, htmlLabelText, assertValidDot } from './dot-syntax';\nimport { GraphRenderModel, RenderEdge, RenderNode, RuntimeComparisonView } from './graph-render-model';\nimport type { RuntimeGraph, RuntimeUnresolved } from './runtime-graph-model';\nimport { RuntimeGraphDiff, RuntimeDiffStatus, RuntimeFactChange, RuntimeGraphDiffResult } from './runtime-graph-diff';\nimport { RuntimeUnionGraph } from './runtime-union-graph';\nimport { RuntimeVizOptions, RuntimePageKind } from './runtime-viz-options';\nimport { generateRuntimeRenderModel } from './runtime-visualizer';\nimport { RuntimeLayout } from './runtime-layout';\nimport { RemoteServiceNodeId } from './remote-service-node-id';\nimport { RuntimeExternalTriggers } from './runtime-external-triggers';\nimport { DIFF_STYLES } from './runtime-goal-styles';\n\n/** Render-node / render-edge → the diff fact identities it draws. */\nexport class RuntimeComparisonIds {\n private readonly byNode = new Map<string, string[]>();\n private readonly triggerService = new Map<string, string>();\n\n constructor(private readonly graph: RuntimeGraph) {\n const safe = (raw: string): string => raw.replace(/[^A-Za-z0-9_]/g, '_');\n for (const name of Object.keys(graph.services)) this.put(name, `service:${name}`);\n for (const id of Object.keys(graph.externalSystems ?? {})) this.put(`system__${safe(id)}`, `external-system:${id}`);\n for (const name of Object.keys(graph.remoteServices ?? {})) this.put(new RemoteServiceNodeId().of(name), `remote-service:${name}`);\n for (const use of graph.unresolvedUses) {\n const owner = graph.apis[use.api]?.owner ?? use.api;\n if (graph.apis[use.api]?.externalSystem === undefined) this.put(`external__${owner}`, `external-library:${owner}`);\n }\n for (const trigger of graph.triggers) {\n const id = `trigger:${trigger.kind}:${trigger.api}.${trigger.method}@${trigger.service}`;\n this.triggerService.set(id, trigger.service);\n if (trigger.kind === 'cron') this.put(`cron__${safe(`${trigger.api}_${trigger.method}`)}`, id);\n }\n for (const group of new RuntimeExternalTriggers(graph.triggers).groups) {\n for (const trigger of group.triggers) this.put(group.from, `trigger:external:${trigger.api}.${trigger.method}@${trigger.service}`);\n }\n }\n\n node(node: RenderNode): string[] {\n if (node.queueKeys.length > 0) return this.queues(node);\n return this.byNode.get(node.id) ?? [];\n }\n\n edge(edge: RenderEdge, nodes: Map<string, RenderNode>): string[] {\n const from = nodes.get(edge.from);\n const to = nodes.get(edge.to);\n if (from !== undefined && from.queueKeys.length > 0) return this.queues(from).map((queue: string) => `deliver:${queue}->${edge.to}`);\n if (to !== undefined && to.queueKeys.length > 0) return this.queues(to).map((queue: string) => `enqueue:${edge.from}->${queue}`);\n if (this.graph.services[edge.from] === undefined)\n return (this.byNode.get(edge.from) ?? []).filter((id: string) => this.triggerService.get(id) === edge.to);\n if (this.graph.services[edge.to] !== undefined) return [`rpc:${edge.from}->${edge.to}`];\n return (this.byNode.get(edge.to) ?? []).flatMap((target: string) => this.towards(edge, target));\n }\n\n /** A service's arrow into a context node: an external system, a remote service or a vendor library. */\n private towards(edge: RenderEdge, target: string): string[] {\n if (target.startsWith('external-system:')) return [`external-use:${edge.from}->${target}`];\n if (target.startsWith('remote-service:'))\n return [`remote-call:${edge.from}->${target}#${edge.dot.includes('enqueue') ? 'pubsub' : 'rpc'}`];\n const owner = target.slice('external-library:'.length);\n return this.graph.unresolvedUses\n .filter((use: RuntimeUnresolved) => use.service === edge.from && (this.graph.apis[use.api]?.owner ?? use.api) === owner)\n .map((use: RuntimeUnresolved) => `unresolved-use:${use.service}->${use.api}`);\n }\n\n private queues(node: RenderNode): string[] {\n return node.queueKeys.map((key: string) => (key.startsWith('queue:') ? `contract-queue:${key.slice(6)}` : `queue:${key}`));\n }\n\n private put(renderId: string, factId: string): void {\n if (!this.byNode.has(renderId)) this.byNode.set(renderId, []);\n if (!this.byNode.get(renderId)!.includes(factId)) this.byNode.get(renderId)!.push(factId);\n }\n}\n\n/** Restyles one rendered statement for its diff status. */\nexport class RuntimeComparisonStyler {\n status(changes: RuntimeFactChange[]): RuntimeDiffStatus {\n const statuses = new Set(changes.map((change: RuntimeFactChange) => change.status));\n if (statuses.size === 0) return RuntimeDiffStatus.UNCHANGED;\n if (statuses.size === 1) return [...statuses][0];\n return RuntimeDiffStatus.CHANGED;\n }\n\n /** A service box: rebuilt (its HTML label carries the level badge and the status in words). */\n service(node: RenderNode, status: RuntimeDiffStatus, changes: RuntimeFactChange[]): string {\n const style = DIFF_STYLES[status];\n const change = changes[0];\n const level = this.levels(change);\n const changed = status === RuntimeDiffStatus.CHANGED && change !== undefined ? `: ${change.changedFields.join(', ')}` : '';\n const label =\n `<FONT COLOR=\"${style.text}99\">${htmlLabelText(level)}</FONT>&#160;&#160;<B>${htmlLabelText(node.id.split('/').pop() ?? node.id)}</B>` +\n `<BR/>${htmlLabelText(node.tags?.role ?? 'unknown')}<BR/>${htmlLabelText(`${style.word}${changed}`)}`;\n const boxStyle = status === RuntimeDiffStatus.REMOVED ? 'filled,rounded,dashed' : 'filled,rounded';\n return (\n ` \"${dotValue(node.id)}\" [style=\"${boxStyle}\", fillcolor=\"${style.fill}\", color=\"${style.border}\", ` +\n `penwidth=2, fontcolor=\"${style.text}\", label=<${label}>];\\n`\n );\n }\n\n /** A context box (queue, datastore, clock, vendor): kind shape kept, status colors laid over it. */\n context(node: RenderNode, status: RuntimeDiffStatus, changes: RuntimeFactChange[]): string {\n const style = DIFF_STYLES[status];\n let dot = node.dot;\n const moved = changes.find((change: RuntimeFactChange) => change.changedFields.includes('level'));\n if (node.queueKeys.length > 0 && moved !== undefined)\n dot = dot.replace(/(label=\" \\|)L\\d+ {2}/, `$1${this.levels(moved).replace(/>/g, '\\\\>')} `);\n const base = /style=\"([^\"]*)\"/.exec(dot)?.[1] ?? 'filled';\n const boxStyle = status === RuntimeDiffStatus.REMOVED && !base.includes('dashed') ? `${base},dashed` : base;\n return `${dot.slice(0, -2)} [style=\"${boxStyle}\", fillcolor=\"${style.fill}\", color=\"${style.border}\", penwidth=2, fontcolor=\"${style.text}\"];\\n`;\n }\n\n /** An arrow: its line style says rpc/event as always; color (and dots for a removal) says the diff. */\n edge(dot: string, status: RuntimeDiffStatus): string {\n const style = DIFF_STYLES[status];\n const removed = status === RuntimeDiffStatus.REMOVED ? ', style=dotted' : '';\n const width = status === RuntimeDiffStatus.UNCHANGED ? 1 : 2.2;\n return `${dot.slice(0, -2)} [color=\"${style.border}\", fontcolor=\"${style.border}\", penwidth=${width}${removed}];\\n`;\n }\n\n /** `L4`, or `L4 → L2` when the level moved. */\n levels(change: RuntimeFactChange | undefined): string {\n const before = change?.before?.['level'];\n const after = change?.after?.['level'];\n if (before !== undefined && after !== undefined && before !== after) return `${before} → ${after}`;\n return after ?? before ?? '';\n }\n}\n\n/** Builds the Goal vs Current view both runtime pages carry. */\nexport class RuntimeGoalComparison {\n private readonly styler = new RuntimeComparisonStyler();\n\n build(current: RuntimeGraph, goal: RuntimeGraph, options: RuntimeVizOptions): RuntimeComparisonView {\n const diff = new RuntimeGraphDiff().compare(current, goal);\n const union = new RuntimeUnionGraph().build(current, goal);\n const tags: Record<string, string> = {};\n for (const key of Object.keys(union.queues)) tags[key] = diff.get(`queue:${key}`)?.status ?? '';\n const model = generateRuntimeRenderModel(union, 'Goal vs Current', options.withPage(RuntimePageKind.COMPARISON, tags));\n const nodeDetails: Record<string, string[]> = {};\n const edgeDetails: Record<string, string[]> = {};\n const ids = new RuntimeComparisonIds(union);\n this.restyleNodes(model, ids, diff, nodeDetails);\n this.restyleEdges(model, ids, diff, edgeDetails);\n model.fullDot = new RuntimeLayout().assemble(model);\n assertValidDot(model.fullDot, 'runtime-architecture goal comparison');\n return new RuntimeComparisonView(\n true,\n '',\n 'Current → Goal',\n this.summary(diff),\n model,\n nodeDetails,\n edgeDetails,\n diff.differences().map((change: RuntimeFactChange) => this.line(change)),\n );\n }\n\n private restyleNodes(model: GraphRenderModel, ids: RuntimeComparisonIds, diff: RuntimeGraphDiffResult, details: Record<string, string[]>): void {\n for (let index = 0; index < model.nodes.length; index++) {\n const node = model.nodes[index];\n const changes = this.changes(ids.node(node), diff);\n const status = this.styler.status(changes);\n const dot = node.tags !== null ? this.styler.service(node, status, changes) : this.styler.context(node, status, changes);\n model.nodes[index] = new RenderNode(node.id, dot, null, node.tags, node.products, node.queueKeys);\n details[node.id] = changes.flatMap((change: RuntimeFactChange) => change.lines());\n }\n }\n\n private restyleEdges(model: GraphRenderModel, ids: RuntimeComparisonIds, diff: RuntimeGraphDiffResult, details: Record<string, string[]>): void {\n const nodes = new Map<string, RenderNode>();\n for (const node of model.nodes) nodes.set(node.id, node);\n for (let index = 0; index < model.edges.length; index++) {\n const edge = model.edges[index];\n const changes = this.changes(ids.edge(edge, nodes), diff);\n const status = this.styler.status(changes);\n model.edges[index] = new RenderEdge(edge.from, edge.to, this.styler.edge(edge.dot, status), edge.id, []);\n details[edge.id] = [`${edge.from} → ${edge.to}`, ...changes.flatMap((change: RuntimeFactChange) => change.lines())];\n }\n }\n\n private changes(factIds: string[], diff: RuntimeGraphDiffResult): RuntimeFactChange[] {\n return factIds\n .map((id: string) => diff.get(id))\n .filter((change: RuntimeFactChange | undefined): change is RuntimeFactChange => change !== undefined);\n }\n\n private summary(diff: RuntimeGraphDiffResult): string {\n if (diff.identical()) return 'No differences: the goal matches the current runtime graph.';\n const counts = diff.counts();\n const levels = diff.maxLevelBefore === diff.maxLevelAfter ? '' : ` · max level L${diff.maxLevelBefore} → L${diff.maxLevelAfter}`;\n return `${counts.added} added · ${counts.removed} removed · ${counts.changed} changed · ${counts.unchanged} unchanged${levels}`;\n }\n\n private line(change: RuntimeFactChange): string {\n const fields = change.status === RuntimeDiffStatus.CHANGED ? ` (${change.changedFields.join(', ')})` : '';\n return `${change.status}: ${change.label}${fields}`;\n }\n}\n"]}
1
+ {"version":3,"file":"runtime-goal-comparison.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-goal-comparison.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,6CAAuE;AACvE,6DAAuG;AAEvG,6DAAsH;AACtH,+DAA0D;AAC1D,+DAA2E;AAC3E,6DAAkE;AAClE,qDAAiD;AACjD,qEAA+D;AAC/D,2EAAsE;AACtE,+DAAoD;AAEpD,qEAAqE;AACrE,MAAa,oBAAoB;IAIA;IAHZ,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IACrC,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5D,YAA6B,KAAmB;QAAnB,UAAK,GAAL,KAAK,CAAc;QAC5C,MAAM,IAAI,GAAG,CAAC,GAAW,EAAU,EAAE,CAA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AAC;QAC3F,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,cAAc,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;QACjI,OAAO,GAAG,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,OAAO,cAAc,MAAM,CAAC,OAAO,cAAc,MAAM,CAAC,SAAS,aAAa,MAAM,EAAE,CAAC;IACpI,CAAC;IAEO,IAAI,CAAC,MAAyB;QAClC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,sCAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1G,OAAO,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC;IACxD,CAAC;CACJ;AArED,sDAqEC","sourcesContent":["/**\n * Goal vs Current (#1239): turns the semantic diff of the two saved runtime files into the overlay the\n * runtime viewer's \"Goal vs Current\" color mode draws.\n *\n * The overlay is rendered by the SAME shared runtime renderer as both pages (generateRuntimeRenderModel\n * over RuntimeUnionGraph), so queue boxes, self-queue sub-rows, level bands and non-constraining\n * feedback edges behave exactly as on the normal pages. Only the statements are restyled afterwards:\n *\n * added in goal green\n * removed from goal red, dashed box / dotted arrow — still drawn, never dropped\n * changed amber; a moved level reads `L4 → L2`\n * unchanged subdued grey, kept for context\n *\n * Every drawn box and arrow maps back to the diff's FACT identities (never to display names or edge\n * ids), and its before/after lines travel in the page for the details panel.\n */\n\nimport { dotValue, htmlLabelText, assertValidDot } from './dot-syntax';\nimport { GraphRenderModel, RenderEdge, RenderNode, RuntimeComparisonView } from './graph-render-model';\nimport type { RuntimeGraph, RuntimeUnresolved } from './runtime-graph-model';\nimport { RuntimeGraphDiff, RuntimeDiffStatus, RuntimeFactChange, RuntimeGraphDiffResult } from './runtime-graph-diff';\nimport { RuntimeUnionGraph } from './runtime-union-graph';\nimport { RuntimeVizOptions, RuntimePageKind } from './runtime-viz-options';\nimport { generateRuntimeRenderModel } from './runtime-visualizer';\nimport { RuntimeLayout } from './runtime-layout';\nimport { RemoteServiceNodeId } from './remote-service-node-id';\nimport { RuntimeExternalTriggers } from './runtime-external-triggers';\nimport { DIFF_STYLES } from './runtime-goal-styles';\n\n/** Render-node / render-edge → the diff fact identities it draws. */\nexport class RuntimeComparisonIds {\n private readonly byNode = new Map<string, string[]>();\n private readonly triggerService = new Map<string, string>();\n\n constructor(private readonly graph: RuntimeGraph) {\n const safe = (raw: string): string => raw.replace(/[^A-Za-z0-9_]/g, '_');\n for (const name of Object.keys(graph.services)) this.put(name, `service:${name}`);\n for (const id of Object.keys(graph.externalSystems ?? {})) this.put(`system__${safe(id)}`, `external-system:${id}`);\n for (const name of Object.keys(graph.remoteServices ?? {})) this.put(new RemoteServiceNodeId().of(name), `remote-service:${name}`);\n for (const use of graph.unresolvedUses) {\n const owner = graph.apis[use.api]?.owner ?? use.api;\n if (graph.apis[use.api]?.externalSystem === undefined) this.put(`external__${owner}`, `external-library:${owner}`);\n }\n for (const trigger of graph.triggers) {\n const id = `trigger:${trigger.kind}:${trigger.api}.${trigger.method}@${trigger.service}`;\n this.triggerService.set(id, trigger.service);\n if (trigger.kind === 'cron') this.put(`cron__${safe(`${trigger.api}_${trigger.method}`)}`, id);\n }\n for (const group of new RuntimeExternalTriggers(graph.triggers).groups) {\n for (const trigger of group.triggers) this.put(group.from, `trigger:external:${trigger.api}.${trigger.method}@${trigger.service}`);\n }\n }\n\n node(node: RenderNode): string[] {\n if (node.queueKeys.length > 0) return this.queues(node);\n return this.byNode.get(node.id) ?? [];\n }\n\n edge(edge: RenderEdge, nodes: Map<string, RenderNode>): string[] {\n const from = nodes.get(edge.from);\n const to = nodes.get(edge.to);\n if (from !== undefined && from.queueKeys.length > 0) return this.queues(from).map((queue: string) => `deliver:${queue}->${edge.to}`);\n if (to !== undefined && to.queueKeys.length > 0) return this.queues(to).map((queue: string) => `enqueue:${edge.from}->${queue}`);\n if (this.graph.services[edge.from] === undefined)\n return (this.byNode.get(edge.from) ?? []).filter((id: string) => this.triggerService.get(id) === edge.to);\n if (this.graph.services[edge.to] !== undefined) return [`rpc:${edge.from}->${edge.to}`];\n return (this.byNode.get(edge.to) ?? []).flatMap((target: string) => this.towards(edge, target));\n }\n\n /** A service's arrow into a context node: an external system, a remote service or a vendor library. */\n private towards(edge: RenderEdge, target: string): string[] {\n if (target.startsWith('external-system:')) return [`external-use:${edge.from}->${target}`];\n if (target.startsWith('remote-service:'))\n return [`remote-call:${edge.from}->${target}#${edge.dot.includes('enqueue') ? 'pubsub' : 'rpc'}`];\n const owner = target.slice('external-library:'.length);\n return this.graph.unresolvedUses\n .filter((use: RuntimeUnresolved) => use.service === edge.from && (this.graph.apis[use.api]?.owner ?? use.api) === owner)\n .map((use: RuntimeUnresolved) => `unresolved-use:${use.service}->${use.api}`);\n }\n\n private queues(node: RenderNode): string[] {\n return node.queueKeys.map((key: string) => (key.startsWith('queue:') ? `contract-queue:${key.slice(6)}` : `queue:${key}`));\n }\n\n private put(renderId: string, factId: string): void {\n if (!this.byNode.has(renderId)) this.byNode.set(renderId, []);\n if (!this.byNode.get(renderId)!.includes(factId)) this.byNode.get(renderId)!.push(factId);\n }\n}\n\n/** Restyles one rendered statement for its diff status. */\nexport class RuntimeComparisonStyler {\n status(changes: RuntimeFactChange[]): RuntimeDiffStatus {\n const statuses = new Set(changes.map((change: RuntimeFactChange) => change.status));\n if (statuses.size === 0) return RuntimeDiffStatus.UNCHANGED;\n if (statuses.size === 1) return [...statuses][0];\n return RuntimeDiffStatus.CHANGED;\n }\n\n /** A service box: rebuilt (its HTML label carries the level badge and the status in words). */\n service(node: RenderNode, status: RuntimeDiffStatus, changes: RuntimeFactChange[]): string {\n const style = DIFF_STYLES[status];\n const change = changes[0];\n const level = this.levels(change);\n const changed = status === RuntimeDiffStatus.CHANGED && change !== undefined ? `: ${change.changedFields.join(', ')}` : '';\n const label =\n `<FONT COLOR=\"${style.text}99\">${htmlLabelText(level)}</FONT>&#160;&#160;<B>${htmlLabelText(node.id.split('/').pop() ?? node.id)}</B>` +\n `<BR/>${htmlLabelText(node.tags?.role ?? 'unknown')}<BR/>${htmlLabelText(`${style.word}${changed}`)}`;\n const boxStyle = status === RuntimeDiffStatus.REMOVED ? 'filled,rounded,dashed' : 'filled,rounded';\n return (\n ` \"${dotValue(node.id)}\" [style=\"${boxStyle}\", fillcolor=\"${style.fill}\", color=\"${style.border}\", ` +\n `penwidth=2, fontcolor=\"${style.text}\", label=<${label}>];\\n`\n );\n }\n\n /** A context box (queue, datastore, clock, vendor): kind shape kept, status colors laid over it. */\n context(node: RenderNode, status: RuntimeDiffStatus, changes: RuntimeFactChange[]): string {\n const style = DIFF_STYLES[status];\n let dot = node.dot;\n const moved = changes.find((change: RuntimeFactChange) => change.changedFields.includes('level'));\n if (node.queueKeys.length > 0 && moved !== undefined)\n dot = dot.replace(/(label=\" \\|)L\\d+ {2}/, `$1${this.levels(moved).replace(/>/g, '\\\\>')} `);\n const base = /style=\"([^\"]*)\"/.exec(dot)?.[1] ?? 'filled';\n const boxStyle = status === RuntimeDiffStatus.REMOVED && !base.includes('dashed') ? `${base},dashed` : base;\n return `${dot.slice(0, -2)} [style=\"${boxStyle}\", fillcolor=\"${style.fill}\", color=\"${style.border}\", penwidth=2, fontcolor=\"${style.text}\"];\\n`;\n }\n\n /** An arrow: its line style says rpc/event as always; color (and dots for a removal) says the diff. */\n edge(dot: string, status: RuntimeDiffStatus): string {\n const style = DIFF_STYLES[status];\n const removed = status === RuntimeDiffStatus.REMOVED ? ', style=dotted' : '';\n const width = status === RuntimeDiffStatus.UNCHANGED ? 1 : 2.2;\n return `${dot.slice(0, -2)} [color=\"${style.border}\", fontcolor=\"${style.border}\", penwidth=${width}${removed}];\\n`;\n }\n\n /** `L4`, or `L4 → L2` when the level moved. */\n levels(change: RuntimeFactChange | undefined): string {\n const before = change?.before?.['level'];\n const after = change?.after?.['level'];\n if (before !== undefined && after !== undefined && before !== after) return `${before} → ${after}`;\n return after ?? before ?? '';\n }\n}\n\n/** Builds the Goal vs Current view both runtime pages carry. */\nexport class RuntimeGoalComparison {\n private readonly styler = new RuntimeComparisonStyler();\n\n build(current: RuntimeGraph, goal: RuntimeGraph, options: RuntimeVizOptions): RuntimeComparisonView {\n const diff = new RuntimeGraphDiff().compare(current, goal);\n const union = new RuntimeUnionGraph().build(current, goal);\n const tags: Record<string, string> = {};\n for (const key of Object.keys(union.queues)) tags[key] = diff.get(`queue:${key}`)?.status ?? '';\n const model = generateRuntimeRenderModel(union, 'Goal vs Current', options.withPage(RuntimePageKind.COMPARISON, tags));\n const nodeDetails: Record<string, string[]> = {};\n const edgeDetails: Record<string, string[]> = {};\n const ids = new RuntimeComparisonIds(union);\n this.restyleNodes(model, ids, diff, nodeDetails);\n this.restyleEdges(model, ids, diff, edgeDetails);\n model.fullDot = new RuntimeLayout().assemble(model);\n assertValidDot(model.fullDot, 'runtime-architecture goal comparison');\n return new RuntimeComparisonView(\n true,\n '',\n '',\n 'Current → Goal',\n this.summary(diff),\n model,\n nodeDetails,\n edgeDetails,\n diff.differences().map((change: RuntimeFactChange) => this.line(change)),\n );\n }\n\n private restyleNodes(model: GraphRenderModel, ids: RuntimeComparisonIds, diff: RuntimeGraphDiffResult, details: Record<string, string[]>): void {\n for (let index = 0; index < model.nodes.length; index++) {\n const node = model.nodes[index];\n const changes = this.changes(ids.node(node), diff);\n const status = this.styler.status(changes);\n const dot = node.tags !== null ? this.styler.service(node, status, changes) : this.styler.context(node, status, changes);\n model.nodes[index] = new RenderNode(node.id, dot, null, node.tags, node.products, node.queueKeys);\n details[node.id] = changes.flatMap((change: RuntimeFactChange) => change.lines());\n }\n }\n\n private restyleEdges(model: GraphRenderModel, ids: RuntimeComparisonIds, diff: RuntimeGraphDiffResult, details: Record<string, string[]>): void {\n const nodes = new Map<string, RenderNode>();\n for (const node of model.nodes) nodes.set(node.id, node);\n for (let index = 0; index < model.edges.length; index++) {\n const edge = model.edges[index];\n const changes = this.changes(ids.edge(edge, nodes), diff);\n const status = this.styler.status(changes);\n model.edges[index] = new RenderEdge(edge.from, edge.to, this.styler.edge(edge.dot, status), edge.id, []);\n details[edge.id] = [`${edge.from} → ${edge.to}`, ...changes.flatMap((change: RuntimeFactChange) => change.lines())];\n }\n }\n\n private changes(factIds: string[], diff: RuntimeGraphDiffResult): RuntimeFactChange[] {\n return factIds\n .map((id: string) => diff.get(id))\n .filter((change: RuntimeFactChange | undefined): change is RuntimeFactChange => change !== undefined);\n }\n\n private summary(diff: RuntimeGraphDiffResult): string {\n if (diff.identical()) return 'No differences: the goal matches the current runtime graph.';\n const counts = diff.counts();\n const levels = diff.maxLevelBefore === diff.maxLevelAfter ? '' : ` · max level L${diff.maxLevelBefore} → L${diff.maxLevelAfter}`;\n return `${counts.added} added · ${counts.removed} removed · ${counts.changed} changed · ${counts.unchanged} unchanged${levels}`;\n }\n\n private line(change: RuntimeFactChange): string {\n const fields = change.status === RuntimeDiffStatus.CHANGED ? ` (${change.changedFields.join(', ')})` : '';\n return `${change.status}: ${change.label}${fields}`;\n }\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * A proposal, not a fact. `architecture/runtime-dependencies.json` is GENERATED from source and its
5
5
  * unchanged-validator rightly treats any hand edit as drift, so a proposal needs its own durable,
6
6
  * reviewable file in the same RuntimeGraph shape. Nothing in the generator reads, writes or deletes
7
- * this file: only a person (or an AI) edits it, and only the explicit `--prepare` step below rewrites
7
+ * this file: only a person (or an AI) edits it, and only the explicit `--prepare-goal` step below rewrites
8
8
  * its derived fields.
9
9
  *
10
10
  * Errors here never tell anyone to regenerate from source — a goal has no source. They name the goal
@@ -14,9 +14,9 @@ import { Option } from '@webpieces/rules-config';
14
14
  import type { RuntimeGraph } from './runtime-graph-model';
15
15
  export declare const DEFAULT_RUNTIME_GOAL_PATH = "architecture/runtime-dependencies-goal.json";
16
16
  export declare const RUNTIME_GOAL_RULE_NAME = "runtime-architecture-goal";
17
- export declare const RUNTIME_GOAL_PREPARE_COMMAND = "pnpm nx run architecture:visualize-runtime-goal --prepare";
17
+ export declare const RUNTIME_GOAL_PREPARE_COMMAND = "pnpm nx run architecture:visualize-runtime --prepare-goal";
18
18
  export declare const RUNTIME_GOAL_INIT_COMMAND = "cp architecture/runtime-dependencies.json architecture/runtime-dependencies-goal.json";
19
- /** The derived fields `--prepare` rewrote, as `field: before → after` lines; empty when none moved. */
19
+ /** The derived fields `--prepare-goal` rewrote, as `field: before → after` lines; empty when none moved. */
20
20
  export declare class RuntimeGoalPreparation {
21
21
  readonly graph: RuntimeGraph;
22
22
  readonly changes: string[];
@@ -28,7 +28,7 @@ export declare class RuntimeGoalPreparation {
28
28
  }
29
29
  /**
30
30
  * What viewing found about the goal's derived facts: a CYCLE (only an edit of runtimeEdges fixes it,
31
- * `--prepare` refuses it too) or field DIFFERENCES that `--prepare` would rewrite.
31
+ * `--prepare-goal` refuses it too) or field DIFFERENCES that `--prepare-goal` would rewrite.
32
32
  */
33
33
  export declare class RuntimeGoalDrift {
34
34
  readonly cycle: string | null;
@@ -46,7 +46,7 @@ export declare class RuntimeGoalFile {
46
46
  /**
47
47
  * Where the saved derived facts disagree with what the existing runtime level machinery
48
48
  * (RuntimeNodeLevels — the generator's own) computes from the goal's relationships. Reported, not
49
- * fixed: viewing is read-only, and `--prepare` is the explicit step that rewrites them.
49
+ * fixed: viewing is read-only, and `--prepare-goal` is the explicit step that rewrites them.
50
50
  */
51
51
  drift(graph: RuntimeGraph): RuntimeGoalDrift;
52
52
  /**
@@ -54,7 +54,7 @@ export declare class RuntimeGoalFile {
54
54
  * STRUCTURAL problems only: missing or stale derived facts are exactly what this step computes.
55
55
  */
56
56
  prepare(workspaceRoot: string): RuntimeGoalPreparation;
57
- /** The edit that clears a cycle verdict — `--prepare` cannot. */
57
+ /** The edit that clears a cycle verdict — `--prepare-goal` cannot. */
58
58
  cycleOption(): Option;
59
59
  private structurallyValid;
60
60
  /** A deep copy with the generator's level machinery applied, or the cycle it refused. */
@@ -65,8 +65,3 @@ export declare class RuntimeGoalFile {
65
65
  private editOption;
66
66
  private failure;
67
67
  }
68
- /** What a goal page says it is: a hand-authored proposal, not a generated snapshot (#1239). */
69
- export declare class RuntimeGoalProvenance {
70
- message(): string;
71
- html(): string;
72
- }
@@ -5,14 +5,14 @@
5
5
  * A proposal, not a fact. `architecture/runtime-dependencies.json` is GENERATED from source and its
6
6
  * unchanged-validator rightly treats any hand edit as drift, so a proposal needs its own durable,
7
7
  * reviewable file in the same RuntimeGraph shape. Nothing in the generator reads, writes or deletes
8
- * this file: only a person (or an AI) edits it, and only the explicit `--prepare` step below rewrites
8
+ * this file: only a person (or an AI) edits it, and only the explicit `--prepare-goal` step below rewrites
9
9
  * its derived fields.
10
10
  *
11
11
  * Errors here never tell anyone to regenerate from source — a goal has no source. They name the goal
12
12
  * path, the broken element, and the edit or the explicit preparation command that repairs it.
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.RuntimeGoalProvenance = exports.RuntimeGoalFile = exports.RuntimeGoalDrift = exports.RuntimeGoalPreparation = exports.RUNTIME_GOAL_INIT_COMMAND = exports.RUNTIME_GOAL_PREPARE_COMMAND = exports.RUNTIME_GOAL_RULE_NAME = exports.DEFAULT_RUNTIME_GOAL_PATH = void 0;
15
+ exports.RuntimeGoalFile = exports.RuntimeGoalDrift = exports.RuntimeGoalPreparation = exports.RUNTIME_GOAL_INIT_COMMAND = exports.RUNTIME_GOAL_PREPARE_COMMAND = exports.RUNTIME_GOAL_RULE_NAME = exports.DEFAULT_RUNTIME_GOAL_PATH = void 0;
16
16
  const tslib_1 = require("tslib");
17
17
  const fs = tslib_1.__importStar(require("fs"));
18
18
  const path = tslib_1.__importStar(require("path"));
@@ -24,9 +24,9 @@ const runtime_goal_validator_1 = require("./runtime-goal-validator");
24
24
  const toError_1 = require("../toError");
25
25
  exports.DEFAULT_RUNTIME_GOAL_PATH = 'architecture/runtime-dependencies-goal.json';
26
26
  exports.RUNTIME_GOAL_RULE_NAME = 'runtime-architecture-goal';
27
- exports.RUNTIME_GOAL_PREPARE_COMMAND = 'pnpm nx run architecture:visualize-runtime-goal --prepare';
27
+ exports.RUNTIME_GOAL_PREPARE_COMMAND = 'pnpm nx run architecture:visualize-runtime --prepare-goal';
28
28
  exports.RUNTIME_GOAL_INIT_COMMAND = `cp ${runtime_graph_io_1.DEFAULT_RUNTIME_GRAPH_PATH} ${exports.DEFAULT_RUNTIME_GOAL_PATH}`;
29
- /** The derived fields `--prepare` rewrote, as `field: before → after` lines; empty when none moved. */
29
+ /** The derived fields `--prepare-goal` rewrote, as `field: before → after` lines; empty when none moved. */
30
30
  class RuntimeGoalPreparation {
31
31
  graph;
32
32
  changes;
@@ -42,7 +42,7 @@ class RuntimeGoalPreparation {
42
42
  exports.RuntimeGoalPreparation = RuntimeGoalPreparation;
43
43
  /**
44
44
  * What viewing found about the goal's derived facts: a CYCLE (only an edit of runtimeEdges fixes it,
45
- * `--prepare` refuses it too) or field DIFFERENCES that `--prepare` would rewrite.
45
+ * `--prepare-goal` refuses it too) or field DIFFERENCES that `--prepare-goal` would rewrite.
46
46
  */
47
47
  class RuntimeGoalDrift {
48
48
  cycle;
@@ -78,7 +78,7 @@ class RuntimeGoalFile {
78
78
  /**
79
79
  * Where the saved derived facts disagree with what the existing runtime level machinery
80
80
  * (RuntimeNodeLevels — the generator's own) computes from the goal's relationships. Reported, not
81
- * fixed: viewing is read-only, and `--prepare` is the explicit step that rewrites them.
81
+ * fixed: viewing is read-only, and `--prepare-goal` is the explicit step that rewrites them.
82
82
  */
83
83
  drift(graph) {
84
84
  const recomputed = this.recompute(graph);
@@ -101,7 +101,7 @@ class RuntimeGoalFile {
101
101
  (0, runtime_graph_io_1.saveRuntimeGraph)(recomputed, workspaceRoot, this.goalPath);
102
102
  return new RuntimeGoalPreparation(recomputed, changes, written);
103
103
  }
104
- /** The edit that clears a cycle verdict — `--prepare` cannot. */
104
+ /** The edit that clears a cycle verdict — `--prepare-goal` cannot. */
105
105
  cycleOption() {
106
106
  return new rules_config_1.Option(`Break the cycle by editing "runtimeEdges" (or the queues it flows through) in ${this.goalPath}.`, true);
107
107
  }
@@ -185,20 +185,4 @@ class RuntimeGoalFile {
185
185
  }
186
186
  }
187
187
  exports.RuntimeGoalFile = RuntimeGoalFile;
188
- /** What a goal page says it is: a hand-authored proposal, not a generated snapshot (#1239). */
189
- class RuntimeGoalProvenance {
190
- message() {
191
- return (`Goal / Proposed runtime architecture from ${exports.DEFAULT_RUNTIME_GOAL_PATH}. Hand-authored; not generated from source, ` +
192
- 'and never written by architecture:generate. Viewing changes no file. ' +
193
- `After editing relationships, recompute derived levels explicitly: ${exports.RUNTIME_GOAL_PREPARE_COMMAND}`);
194
- }
195
- html() {
196
- return (`<p class="hint"><strong>Goal / Proposed runtime architecture.</strong> Hand-authored proposal read from ` +
197
- `<code>${exports.DEFAULT_RUNTIME_GOAL_PATH}</code>; not generated from source and never written by ` +
198
- `<code>architecture:generate</code>. Viewing changes no file. After editing relationships, recompute derived ` +
199
- `levels explicitly: <code>${exports.RUNTIME_GOAL_PREPARE_COMMAND}</code>. Compare with the saved current graph ` +
200
- `(<code>${runtime_graph_io_1.DEFAULT_RUNTIME_GRAPH_PATH}</code>) in Color by → Goal vs Current.</p>`);
201
- }
202
- }
203
- exports.RuntimeGoalProvenance = RuntimeGoalProvenance;
204
188
  //# sourceMappingURL=runtime-goal-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-goal-file.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-goal-file.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAgE;A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,8CAA8C;YACpH,uEAAuE;YACvE,qEAAqE,oCAA4B,EAAE,CACtG,CAAC;IACN,CAAC;IAED,IAAI;QACA,OAAO,CACH,0GAA0G;YAC1G,SAAS,iCAAyB,0DAA0D;YAC5F,8GAA8G;YAC9G,4BAA4B,oCAA4B,gDAAgD;YACxG,UAAU,6CAA0B,6CAA6C,CACpF,CAAC;IACN,CAAC;CACJ;AAlBD,sDAkBC","sourcesContent":["/**\n * The runtime architecture GOAL (#1239): `architecture/runtime-dependencies-goal.json`.\n *\n * A proposal, not a fact. `architecture/runtime-dependencies.json` is GENERATED from source and its\n * unchanged-validator rightly treats any hand edit as drift, so a proposal needs its own durable,\n * reviewable file in the same RuntimeGraph shape. Nothing in the generator reads, writes or deletes\n * this file: only a person (or an AI) edits it, and only the explicit `--prepare` step below rewrites\n * its derived fields.\n *\n * Errors here never tell anyone to regenerate from source — a goal has no source. They name the goal\n * path, the broken element, and the edit or the explicit preparation command that repairs it.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { RuleFailError, Option } from '@webpieces/rules-config';\nimport type { RuntimeGraph, RuntimeQueueFlow, RuntimeTrigger } from './runtime-graph-model';\nimport { DEFAULT_RUNTIME_GRAPH_PATH, saveRuntimeGraph } from './runtime-graph-io';\nimport { RuntimeNodeLevels } from './runtime-node-levels';\nimport { RuntimeEdgeMerge } from './runtime-edge-merge';\nimport { RuntimeGoalValidator } from './runtime-goal-validator';\nimport { toError } from '../toError';\n\nexport const DEFAULT_RUNTIME_GOAL_PATH = 'architecture/runtime-dependencies-goal.json';\nexport const RUNTIME_GOAL_RULE_NAME = 'runtime-architecture-goal';\nexport const RUNTIME_GOAL_PREPARE_COMMAND = 'pnpm nx run architecture:visualize-runtime-goal --prepare';\nexport const RUNTIME_GOAL_INIT_COMMAND = `cp ${DEFAULT_RUNTIME_GRAPH_PATH} ${DEFAULT_RUNTIME_GOAL_PATH}`;\n\n/** The derived fields `--prepare` rewrote, as `field: before → after` lines; empty when none moved. */\nexport class RuntimeGoalPreparation {\n constructor(\n public readonly graph: RuntimeGraph,\n public readonly changes: string[],\n /** Whether the goal file was rewritten (also true when only explanatory levelBecause text moved). */\n public readonly written: boolean,\n ) {}\n}\n\n/**\n * What viewing found about the goal's derived facts: a CYCLE (only an edit of runtimeEdges fixes it,\n * `--prepare` refuses it too) or field DIFFERENCES that `--prepare` would rewrite.\n */\nexport class RuntimeGoalDrift {\n constructor(\n public readonly cycle: string | null,\n public readonly differences: string[],\n ) {}\n}\n\n/** Loads, checks and (only on request) prepares the hand-authored runtime goal. */\nexport class RuntimeGoalFile {\n private readonly validator: RuntimeGoalValidator;\n\n constructor(public readonly goalPath: string = DEFAULT_RUNTIME_GOAL_PATH) {\n this.validator = new RuntimeGoalValidator(goalPath);\n }\n\n exists(workspaceRoot: string): boolean {\n return fs.existsSync(path.join(workspaceRoot, this.goalPath));\n }\n\n /** The goal as saved, after its shape, references and derived facts check out. Never writes anything. */\n load(workspaceRoot: string): RuntimeGraph {\n const parsed = this.structurallyValid(workspaceRoot);\n const derived = this.validator.derived(parsed);\n if (derived.length > 0)\n throw this.failure(`${this.goalPath} lacks derived facts the viewer needs:\\n ${derived.join('\\n ')}`, [\n new Option(`Compute them from the goal's relationships: ${RUNTIME_GOAL_PREPARE_COMMAND}`, true),\n this.editOption(false),\n ]);\n return parsed;\n }\n\n /**\n * Where the saved derived facts disagree with what the existing runtime level machinery\n * (RuntimeNodeLevels — the generator's own) computes from the goal's relationships. Reported, not\n * fixed: viewing is read-only, and `--prepare` is the explicit step that rewrites them.\n */\n drift(graph: RuntimeGraph): RuntimeGoalDrift {\n const recomputed = this.recompute(graph);\n if (typeof recomputed === 'string') return new RuntimeGoalDrift(recomputed, []);\n return new RuntimeGoalDrift(null, this.differences(graph, recomputed));\n }\n\n /**\n * Recompute levels, self-queue flags, contract queues and maxLevel, and WRITE the goal. Gated on\n * STRUCTURAL problems only: missing or stale derived facts are exactly what this step computes.\n */\n prepare(workspaceRoot: string): RuntimeGoalPreparation {\n const saved = this.structurallyValid(workspaceRoot);\n const recomputed = this.recompute(saved);\n if (typeof recomputed === 'string') throw this.failure(recomputed, [this.cycleOption()]);\n const changes = this.differences(saved, recomputed);\n const written = JSON.stringify(saved) !== JSON.stringify(recomputed);\n if (written) saveRuntimeGraph(recomputed, workspaceRoot, this.goalPath);\n return new RuntimeGoalPreparation(recomputed, changes, written);\n }\n\n /** The edit that clears a cycle verdict — `--prepare` cannot. */\n cycleOption(): Option {\n return new Option(`Break the cycle by editing \"runtimeEdges\" (or the queues it flows through) in ${this.goalPath}.`, true);\n }\n\n private structurallyValid(workspaceRoot: string): RuntimeGraph {\n if (!this.exists(workspaceRoot)) throw this.missing();\n let parsed: RuntimeGraph;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- hand-authored JSON decoding boundary adds the goal path and repair while preserving the cause\n try {\n parsed = JSON.parse(fs.readFileSync(path.join(workspaceRoot, this.goalPath), 'utf-8')) as RuntimeGraph;\n } catch (err: unknown) {\n const error = toError(err);\n throw this.failure(`${this.goalPath} is not valid JSON: ${error.message}`, [this.editOption(true)], error);\n }\n const problems = this.validator.structural(parsed);\n if (problems.length > 0)\n throw this.failure(`${this.goalPath} is not a usable runtime goal:\\n ${problems.join('\\n ')}`, [this.editOption(true)]);\n // A goal is hand-authored, so it may list one pair once per contract; every view draws ONE arrow per pair.\n parsed.runtimeEdges = new RuntimeEdgeMerge().merge(parsed.runtimeEdges);\n return parsed;\n }\n\n /** A deep copy with the generator's level machinery applied, or the cycle it refused. */\n private recompute(graph: RuntimeGraph): RuntimeGraph | string {\n const copy = JSON.parse(JSON.stringify(graph)) as RuntimeGraph;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the shared level machinery throws its cycle verdict; the goal reports it against its own path\n try {\n new RuntimeNodeLevels().apply(copy);\n return copy;\n } catch (err: unknown) {\n const error = toError(err);\n if (!(error instanceof RuleFailError)) throw error;\n return `${this.goalPath} describes a runtime graph the level machinery cannot order: ${error.message}`;\n }\n }\n\n private differences(saved: RuntimeGraph, recomputed: RuntimeGraph): string[] {\n const lines: string[] = [];\n const level = (where: string, before: number | undefined, after: number): void => {\n if (before !== after) lines.push(`${where} level: L${before ?? '?'} → L${after}`);\n };\n for (const [name, service] of Object.entries(recomputed.services)) level(`services[\"${name}\"]`, saved.services[name].level, service.level);\n for (const [key, queue] of Object.entries(recomputed.queues)) {\n level(`queues[\"${key}\"]`, saved.queues[key].level, queue.level);\n if (saved.queues[key].selfQueue !== queue.selfQueue)\n lines.push(`queues[\"${key}\"] selfQueue: ${saved.queues[key].selfQueue} → ${queue.selfQueue}`);\n }\n lines.push(...this.contractDifferences(saved.contractQueues ?? {}, recomputed.contractQueues));\n recomputed.triggers.forEach((trigger: RuntimeTrigger, index: number) =>\n level(`triggers[${index}]`, saved.triggers[index].level, trigger.level),\n );\n if (saved.maxLevel !== recomputed.maxLevel) lines.push(`maxLevel: ${saved.maxLevel} → ${recomputed.maxLevel}`);\n return lines;\n }\n\n private contractDifferences(saved: Record<string, RuntimeQueueFlow>, recomputed: Record<string, RuntimeQueueFlow>): string[] {\n const lines: string[] = [];\n const fields = (flow: RuntimeQueueFlow | undefined): string =>\n flow === undefined\n ? '(absent)'\n : `L${flow.level} self=${flow.selfQueue} producers=[${flow.producedBy.join(', ')}] consumers=[${flow.consumedBy.join(', ')}]`;\n for (const api of [...new Set([...Object.keys(saved), ...Object.keys(recomputed)])].sort()) {\n const before = fields(saved[api]);\n const after = fields(recomputed[api]);\n if (before !== after) lines.push(`contractQueues[\"${api}\"]: ${before} → ${after}`);\n }\n return lines;\n }\n\n private missing(): RuleFailError {\n return this.failure(\n `No runtime goal at ${this.goalPath}. Viewing never creates or replaces the goal, and never renders the current graph in its place.`,\n [\n new Option(`Start a proposal from the saved current runtime graph: ${RUNTIME_GOAL_INIT_COMMAND} — then edit the copy and commit it.`, true),\n new Option(`Write ${this.goalPath} by hand in the RuntimeGraph shape of ${DEFAULT_RUNTIME_GRAPH_PATH}.`),\n ],\n );\n }\n\n private editOption(preferred: boolean): Option {\n return new Option(`Edit ${this.goalPath} by hand — it is a hand-authored proposal, so the fix is in the file, not in source.`, preferred);\n }\n\n private failure(message: string, options: Option[], cause?: Error): RuleFailError {\n return new RuleFailError(RUNTIME_GOAL_RULE_NAME, message, undefined, undefined, options, undefined, cause);\n }\n}\n\n/** What a goal page says it is: a hand-authored proposal, not a generated snapshot (#1239). */\nexport class RuntimeGoalProvenance {\n message(): string {\n return (\n `Goal / Proposed runtime architecture from ${DEFAULT_RUNTIME_GOAL_PATH}. Hand-authored; not generated from source, ` +\n 'and never written by architecture:generate. Viewing changes no file. ' +\n `After editing relationships, recompute derived levels explicitly: ${RUNTIME_GOAL_PREPARE_COMMAND}`\n );\n }\n\n html(): string {\n return (\n `<p class=\"hint\"><strong>Goal / Proposed runtime architecture.</strong> Hand-authored proposal read from ` +\n `<code>${DEFAULT_RUNTIME_GOAL_PATH}</code>; not generated from source and never written by ` +\n `<code>architecture:generate</code>. Viewing changes no file. After editing relationships, recompute derived ` +\n `levels explicitly: <code>${RUNTIME_GOAL_PREPARE_COMMAND}</code>. Compare with the saved current graph ` +\n `(<code>${DEFAULT_RUNTIME_GRAPH_PATH}</code>) in Color by → Goal vs Current.</p>`\n );\n }\n}\n"]}
1
+ {"version":3,"file":"runtime-goal-file.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-goal-file.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAgE;AAEhE,yDAAkF;AAClF,+DAA0D;AAC1D,6DAAwD;AACxD,qEAAgE;AAChE,wCAAqC;AAExB,QAAA,yBAAyB,GAAG,6CAA6C,CAAC;AAC1E,QAAA,sBAAsB,GAAG,2BAA2B,CAAC;AACrD,QAAA,4BAA4B,GAAG,2DAA2D,CAAC;AAC3F,QAAA,yBAAyB,GAAG,MAAM,6CAA0B,IAAI,iCAAyB,EAAE,C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AAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YAClC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,IAAI,MAAM,KAAK,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,GAAG,OAAO,MAAM,MAAM,KAAK,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,OAAO;QACX,OAAO,IAAI,CAAC,OAAO,CACf,sBAAsB,IAAI,CAAC,QAAQ,iGAAiG,EACpI;YACI,IAAI,qBAAM,CAAC,0DAA0D,iCAAyB,sCAAsC,EAAE,IAAI,CAAC;YAC3I,IAAI,qBAAM,CAAC,SAAS,IAAI,CAAC,QAAQ,yCAAyC,6CAA0B,GAAG,CAAC;SAC3G,CACJ,CAAC;IACN,CAAC;IAEO,UAAU,CAAC,SAAkB;QACjC,OAAO,IAAI,qBAAM,CAAC,QAAQ,IAAI,CAAC,QAAQ,sFAAsF,EAAE,SAAS,CAAC,CAAC;IAC9I,CAAC;IAEO,OAAO,CAAC,OAAe,EAAE,OAAiB,EAAE,KAAa;QAC7D,OAAO,IAAI,4BAAa,CAAC,8BAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC/G,CAAC;CACJ;AAvID,0CAuIC","sourcesContent":["/**\n * The runtime architecture GOAL (#1239): `architecture/runtime-dependencies-goal.json`.\n *\n * A proposal, not a fact. `architecture/runtime-dependencies.json` is GENERATED from source and its\n * unchanged-validator rightly treats any hand edit as drift, so a proposal needs its own durable,\n * reviewable file in the same RuntimeGraph shape. Nothing in the generator reads, writes or deletes\n * this file: only a person (or an AI) edits it, and only the explicit `--prepare-goal` step below rewrites\n * its derived fields.\n *\n * Errors here never tell anyone to regenerate from source — a goal has no source. They name the goal\n * path, the broken element, and the edit or the explicit preparation command that repairs it.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { RuleFailError, Option } from '@webpieces/rules-config';\nimport type { RuntimeGraph, RuntimeQueueFlow, RuntimeTrigger } from './runtime-graph-model';\nimport { DEFAULT_RUNTIME_GRAPH_PATH, saveRuntimeGraph } from './runtime-graph-io';\nimport { RuntimeNodeLevels } from './runtime-node-levels';\nimport { RuntimeEdgeMerge } from './runtime-edge-merge';\nimport { RuntimeGoalValidator } from './runtime-goal-validator';\nimport { toError } from '../toError';\n\nexport const DEFAULT_RUNTIME_GOAL_PATH = 'architecture/runtime-dependencies-goal.json';\nexport const RUNTIME_GOAL_RULE_NAME = 'runtime-architecture-goal';\nexport const RUNTIME_GOAL_PREPARE_COMMAND = 'pnpm nx run architecture:visualize-runtime --prepare-goal';\nexport const RUNTIME_GOAL_INIT_COMMAND = `cp ${DEFAULT_RUNTIME_GRAPH_PATH} ${DEFAULT_RUNTIME_GOAL_PATH}`;\n\n/** The derived fields `--prepare-goal` rewrote, as `field: before → after` lines; empty when none moved. */\nexport class RuntimeGoalPreparation {\n constructor(\n public readonly graph: RuntimeGraph,\n public readonly changes: string[],\n /** Whether the goal file was rewritten (also true when only explanatory levelBecause text moved). */\n public readonly written: boolean,\n ) {}\n}\n\n/**\n * What viewing found about the goal's derived facts: a CYCLE (only an edit of runtimeEdges fixes it,\n * `--prepare-goal` refuses it too) or field DIFFERENCES that `--prepare-goal` would rewrite.\n */\nexport class RuntimeGoalDrift {\n constructor(\n public readonly cycle: string | null,\n public readonly differences: string[],\n ) {}\n}\n\n/** Loads, checks and (only on request) prepares the hand-authored runtime goal. */\nexport class RuntimeGoalFile {\n private readonly validator: RuntimeGoalValidator;\n\n constructor(public readonly goalPath: string = DEFAULT_RUNTIME_GOAL_PATH) {\n this.validator = new RuntimeGoalValidator(goalPath);\n }\n\n exists(workspaceRoot: string): boolean {\n return fs.existsSync(path.join(workspaceRoot, this.goalPath));\n }\n\n /** The goal as saved, after its shape, references and derived facts check out. Never writes anything. */\n load(workspaceRoot: string): RuntimeGraph {\n const parsed = this.structurallyValid(workspaceRoot);\n const derived = this.validator.derived(parsed);\n if (derived.length > 0)\n throw this.failure(`${this.goalPath} lacks derived facts the viewer needs:\\n ${derived.join('\\n ')}`, [\n new Option(`Compute them from the goal's relationships: ${RUNTIME_GOAL_PREPARE_COMMAND}`, true),\n this.editOption(false),\n ]);\n return parsed;\n }\n\n /**\n * Where the saved derived facts disagree with what the existing runtime level machinery\n * (RuntimeNodeLevels — the generator's own) computes from the goal's relationships. Reported, not\n * fixed: viewing is read-only, and `--prepare-goal` is the explicit step that rewrites them.\n */\n drift(graph: RuntimeGraph): RuntimeGoalDrift {\n const recomputed = this.recompute(graph);\n if (typeof recomputed === 'string') return new RuntimeGoalDrift(recomputed, []);\n return new RuntimeGoalDrift(null, this.differences(graph, recomputed));\n }\n\n /**\n * Recompute levels, self-queue flags, contract queues and maxLevel, and WRITE the goal. Gated on\n * STRUCTURAL problems only: missing or stale derived facts are exactly what this step computes.\n */\n prepare(workspaceRoot: string): RuntimeGoalPreparation {\n const saved = this.structurallyValid(workspaceRoot);\n const recomputed = this.recompute(saved);\n if (typeof recomputed === 'string') throw this.failure(recomputed, [this.cycleOption()]);\n const changes = this.differences(saved, recomputed);\n const written = JSON.stringify(saved) !== JSON.stringify(recomputed);\n if (written) saveRuntimeGraph(recomputed, workspaceRoot, this.goalPath);\n return new RuntimeGoalPreparation(recomputed, changes, written);\n }\n\n /** The edit that clears a cycle verdict — `--prepare-goal` cannot. */\n cycleOption(): Option {\n return new Option(`Break the cycle by editing \"runtimeEdges\" (or the queues it flows through) in ${this.goalPath}.`, true);\n }\n\n private structurallyValid(workspaceRoot: string): RuntimeGraph {\n if (!this.exists(workspaceRoot)) throw this.missing();\n let parsed: RuntimeGraph;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- hand-authored JSON decoding boundary adds the goal path and repair while preserving the cause\n try {\n parsed = JSON.parse(fs.readFileSync(path.join(workspaceRoot, this.goalPath), 'utf-8')) as RuntimeGraph;\n } catch (err: unknown) {\n const error = toError(err);\n throw this.failure(`${this.goalPath} is not valid JSON: ${error.message}`, [this.editOption(true)], error);\n }\n const problems = this.validator.structural(parsed);\n if (problems.length > 0)\n throw this.failure(`${this.goalPath} is not a usable runtime goal:\\n ${problems.join('\\n ')}`, [this.editOption(true)]);\n // A goal is hand-authored, so it may list one pair once per contract; every view draws ONE arrow per pair.\n parsed.runtimeEdges = new RuntimeEdgeMerge().merge(parsed.runtimeEdges);\n return parsed;\n }\n\n /** A deep copy with the generator's level machinery applied, or the cycle it refused. */\n private recompute(graph: RuntimeGraph): RuntimeGraph | string {\n const copy = JSON.parse(JSON.stringify(graph)) as RuntimeGraph;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the shared level machinery throws its cycle verdict; the goal reports it against its own path\n try {\n new RuntimeNodeLevels().apply(copy);\n return copy;\n } catch (err: unknown) {\n const error = toError(err);\n if (!(error instanceof RuleFailError)) throw error;\n return `${this.goalPath} describes a runtime graph the level machinery cannot order: ${error.message}`;\n }\n }\n\n private differences(saved: RuntimeGraph, recomputed: RuntimeGraph): string[] {\n const lines: string[] = [];\n const level = (where: string, before: number | undefined, after: number): void => {\n if (before !== after) lines.push(`${where} level: L${before ?? '?'} → L${after}`);\n };\n for (const [name, service] of Object.entries(recomputed.services)) level(`services[\"${name}\"]`, saved.services[name].level, service.level);\n for (const [key, queue] of Object.entries(recomputed.queues)) {\n level(`queues[\"${key}\"]`, saved.queues[key].level, queue.level);\n if (saved.queues[key].selfQueue !== queue.selfQueue)\n lines.push(`queues[\"${key}\"] selfQueue: ${saved.queues[key].selfQueue} → ${queue.selfQueue}`);\n }\n lines.push(...this.contractDifferences(saved.contractQueues ?? {}, recomputed.contractQueues));\n recomputed.triggers.forEach((trigger: RuntimeTrigger, index: number) =>\n level(`triggers[${index}]`, saved.triggers[index].level, trigger.level),\n );\n if (saved.maxLevel !== recomputed.maxLevel) lines.push(`maxLevel: ${saved.maxLevel} → ${recomputed.maxLevel}`);\n return lines;\n }\n\n private contractDifferences(saved: Record<string, RuntimeQueueFlow>, recomputed: Record<string, RuntimeQueueFlow>): string[] {\n const lines: string[] = [];\n const fields = (flow: RuntimeQueueFlow | undefined): string =>\n flow === undefined\n ? '(absent)'\n : `L${flow.level} self=${flow.selfQueue} producers=[${flow.producedBy.join(', ')}] consumers=[${flow.consumedBy.join(', ')}]`;\n for (const api of [...new Set([...Object.keys(saved), ...Object.keys(recomputed)])].sort()) {\n const before = fields(saved[api]);\n const after = fields(recomputed[api]);\n if (before !== after) lines.push(`contractQueues[\"${api}\"]: ${before} → ${after}`);\n }\n return lines;\n }\n\n private missing(): RuleFailError {\n return this.failure(\n `No runtime goal at ${this.goalPath}. Viewing never creates or replaces the goal, and never renders the current graph in its place.`,\n [\n new Option(`Start a proposal from the saved current runtime graph: ${RUNTIME_GOAL_INIT_COMMAND} — then edit the copy and commit it.`, true),\n new Option(`Write ${this.goalPath} by hand in the RuntimeGraph shape of ${DEFAULT_RUNTIME_GRAPH_PATH}.`),\n ],\n );\n }\n\n private editOption(preferred: boolean): Option {\n return new Option(`Edit ${this.goalPath} by hand — it is a hand-authored proposal, so the fix is in the file, not in source.`, preferred);\n }\n\n private failure(message: string, options: Option[], cause?: Error): RuleFailError {\n return new RuleFailError(RUNTIME_GOAL_RULE_NAME, message, undefined, undefined, options, undefined, cause);\n }\n}\n"]}
@@ -10,16 +10,16 @@ import type { RuntimeGraph } from './runtime-graph-model';
10
10
  * Two kinds of problem, because they have different cures:
11
11
  * - STRUCTURAL (shape, dangling references): only an edit of the goal file fixes them.
12
12
  * - DERIVED (a missing or invalid level, a missing contract queue, maxLevel): the explicit
13
- * `--prepare` step computes them from the relationships, so it must accept a goal that has them.
13
+ * `--prepare-goal` step computes them from the relationships, so it must accept a goal that has them.
14
14
  * Facts that are present but merely disagree with the relationships are drift, reported by
15
15
  * RuntimeGoalFile.drift().
16
16
  */
17
17
  export declare class RuntimeGoalValidator {
18
18
  private readonly goalPath;
19
19
  constructor(goalPath: string);
20
- /** Problems only an edit of the goal file can fix; empty when `--prepare` can run. */
20
+ /** Problems only an edit of the goal file can fix; empty when `--prepare-goal` can run. */
21
21
  structural(graph: unknown): string[];
22
- /** Derived facts `--prepare` computes; call only on a structurally valid goal. */
22
+ /** Derived facts `--prepare-goal` computes; call only on a structurally valid goal. */
23
23
  derived(graph: RuntimeGraph): string[];
24
24
  private shape;
25
25
  /** The renderer places every node by its saved level, so each needs one. */
@@ -28,7 +28,7 @@ export declare class RuntimeGoalValidator {
28
28
  private services;
29
29
  private edges;
30
30
  private edge;
31
- /** Every contract-level pubsub edge needs its contract queue, which `--prepare` derives. */
31
+ /** Every contract-level pubsub edge needs its contract queue, which `--prepare-goal` derives. */
32
32
  private contractQueues;
33
33
  private queues;
34
34
  private triggers;
@@ -21,7 +21,7 @@ class NamedFlow {
21
21
  * Two kinds of problem, because they have different cures:
22
22
  * - STRUCTURAL (shape, dangling references): only an edit of the goal file fixes them.
23
23
  * - DERIVED (a missing or invalid level, a missing contract queue, maxLevel): the explicit
24
- * `--prepare` step computes them from the relationships, so it must accept a goal that has them.
24
+ * `--prepare-goal` step computes them from the relationships, so it must accept a goal that has them.
25
25
  * Facts that are present but merely disagree with the relationships are drift, reported by
26
26
  * RuntimeGoalFile.drift().
27
27
  */
@@ -30,7 +30,7 @@ class RuntimeGoalValidator {
30
30
  constructor(goalPath) {
31
31
  this.goalPath = goalPath;
32
32
  }
33
- /** Problems only an edit of the goal file can fix; empty when `--prepare` can run. */
33
+ /** Problems only an edit of the goal file can fix; empty when `--prepare-goal` can run. */
34
34
  // webpieces-disable no-any-unknown -- hand-authored JSON is untrusted until its shape has been checked
35
35
  structural(graph) {
36
36
  if (!this.isMap(graph))
@@ -41,7 +41,7 @@ class RuntimeGoalValidator {
41
41
  return shape;
42
42
  return this.references(typed);
43
43
  }
44
- /** Derived facts `--prepare` computes; call only on a structurally valid goal. */
44
+ /** Derived facts `--prepare-goal` computes; call only on a structurally valid goal. */
45
45
  derived(graph) {
46
46
  const problems = [];
47
47
  if (!Number.isInteger(graph.maxLevel))
@@ -129,7 +129,7 @@ class RuntimeGoalValidator {
129
129
  problems.push(`${where} flows through queue '${edge.queue}', which is not in "queues". Add queues["${edge.queue}"] or drop "queue" for a contract-level edge.`);
130
130
  return problems;
131
131
  }
132
- /** Every contract-level pubsub edge needs its contract queue, which `--prepare` derives. */
132
+ /** Every contract-level pubsub edge needs its contract queue, which `--prepare-goal` derives. */
133
133
  contractQueues(graph) {
134
134
  const problems = [];
135
135
  graph.runtimeEdges.forEach((edge, index) => {
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-goal-validator.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-goal-validator.ts"],"names":[],"mappings":";;;AAUA,8DAA8D;AAC9D,MAAM,SAAS;IAES;IACA;IAFpB,YACoB,KAAa,EACb,IAAsB;QADtB,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAkB;IACvC,CAAC;CACP;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAa,oBAAoB;IACA;IAA7B,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEjD,sFAAsF;IACtF,uGAAuG;IACvG,UAAU,CAAC,KAAc;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,+CAA+C,CAAC,CAAC;QACjG,MAAM,KAAK,GAAG,KAAqB,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,kFAAkF;IAClF,OAAO,CAAC,KAAmB;QACvB,MAAM,QAA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O,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,KAAgD,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC;IAChI,CAAC;IAED,uGAAuG;IAC/F,KAAK,CAAC,KAAc;QACxB,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChF,CAAC;CACJ;AA1MD,oDA0MC","sourcesContent":["import type {\n RuntimeEdge,\n RuntimeGraph,\n RuntimeLevel,\n RuntimeQueueFlow,\n RuntimeRemoteCall,\n RuntimeTrigger,\n RuntimeUnresolved,\n} from './runtime-graph-model';\n\n/** One queue flow and the goal path segment that names it. */\nclass NamedFlow {\n constructor(\n public readonly where: string,\n public readonly flow: RuntimeQueueFlow,\n ) {}\n}\n\n/**\n * Shape and internal-reference checks for a HAND-AUTHORED runtime goal (#1239).\n *\n * The generated current graph is validated by regenerating it from source; a goal has no source to\n * regenerate from, so every problem is named against the goal file itself, with the element that is\n * wrong and the edit that fixes it. Problems are collected, never thrown one at a time, so one run\n * names every broken reference.\n *\n * Two kinds of problem, because they have different cures:\n * - STRUCTURAL (shape, dangling references): only an edit of the goal file fixes them.\n * - DERIVED (a missing or invalid level, a missing contract queue, maxLevel): the explicit\n * `--prepare` step computes them from the relationships, so it must accept a goal that has them.\n * Facts that are present but merely disagree with the relationships are drift, reported by\n * RuntimeGoalFile.drift().\n */\nexport class RuntimeGoalValidator {\n constructor(private readonly goalPath: string) {}\n\n /** Problems only an edit of the goal file can fix; empty when `--prepare` can run. */\n // webpieces-disable no-any-unknown -- hand-authored JSON is untrusted until its shape has been checked\n structural(graph: unknown): string[] {\n if (!this.isMap(graph)) return [`${this.goalPath} must contain a JSON object (a RuntimeGraph).`];\n const typed = graph as RuntimeGraph;\n const shape = this.shape(typed);\n if (shape.length > 0) return shape;\n return this.references(typed);\n }\n\n /** Derived facts `--prepare` computes; call only on a structurally valid goal. */\n derived(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n if (!Number.isInteger(graph.maxLevel)) problems.push(`${this.goalPath}: \"maxLevel\" must be an integer.`);\n if (graph.contractQueues === undefined) problems.push(`${this.goalPath}: \"contractQueues\" is missing.`);\n return [...problems, ...this.levels(graph), ...this.contractQueues(graph)];\n }\n\n private shape(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const key of ['services', 'apis', 'queues'] as const) {\n if (!this.isMap(graph[key])) problems.push(`${this.goalPath}: \"${key}\" must be an object keyed by identity.`);\n }\n for (const key of ['runtimeEdges', 'unresolvedUses', 'triggers'] as const) {\n if (!Array.isArray(graph[key])) problems.push(`${this.goalPath}: \"${key}\" must be an array.`);\n }\n for (const key of ['externalSystems', 'remoteServices', 'contractQueues'] as const) {\n if (graph[key] !== undefined && !this.isMap(graph[key]))\n problems.push(`${this.goalPath}: \"${key}\" must be an object when present.`);\n }\n return problems;\n }\n\n /** The renderer places every node by its saved level, so each needs one. */\n private levels(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n const check = (where: string, node: RuntimeLevel): void => {\n if (!this.isMap(node) || !Number.isInteger(node.level) || node.level < 0 || typeof node.levelBecause !== 'string')\n problems.push(`${this.goalPath}: ${where} needs an integer \"level\" >= 0 and a string \"levelBecause\".`);\n };\n for (const [name, service] of Object.entries(graph.services)) check(`services[\"${name}\"]`, service);\n for (const [key, queue] of Object.entries(graph.queues)) check(`queues[\"${key}\"]`, queue);\n for (const [api, queue] of Object.entries(graph.contractQueues ?? {})) check(`contractQueues[\"${api}\"]`, queue);\n graph.triggers.forEach((trigger: RuntimeTrigger, index: number) => check(`triggers[${index}]`, trigger));\n graph.unresolvedUses.forEach((use: RuntimeUnresolved, index: number) => check(`unresolvedUses[${index}]`, use));\n for (const [id, system] of Object.entries(graph.externalSystems ?? {})) check(`externalSystems[\"${id}\"]`, system);\n for (const [name, remote] of Object.entries(graph.remoteServices ?? {})) check(`remoteServices[\"${name}\"]`, remote);\n return problems;\n }\n\n private references(graph: RuntimeGraph): string[] {\n return [\n ...this.services(graph),\n ...this.edges(graph),\n ...this.queues(graph),\n ...this.triggers(graph),\n ...this.externals(graph),\n ...this.remotes(graph),\n ];\n }\n\n private services(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const [name, service] of Object.entries(graph.services)) {\n for (const key of ['implements', 'uses', 'dependsOn'] as const) {\n if (!this.strings(service[key]))\n problems.push(`${this.goalPath}: services[\"${name}\"].${key} must be an array of strings (use [] for none).`);\n }\n if (service.products !== undefined && !this.strings(service.products))\n problems.push(`${this.goalPath}: services[\"${name}\"].products must be an array of strings when present.`);\n }\n return problems;\n }\n\n private edges(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n graph.runtimeEdges.forEach((edge: RuntimeEdge, index: number) => problems.push(...this.edge(graph, edge, index)));\n return problems;\n }\n\n private edge(graph: RuntimeGraph, edge: RuntimeEdge, index: number): string[] {\n const where = `${this.goalPath}: runtimeEdges[${index}] (${edge?.from} -> ${edge?.to})`;\n if (!this.isMap(edge) || !this.strings(edge.via) || edge.via.length === 0)\n return [`${where} needs \"from\", \"to\" and a non-empty \"via\" contract list.`];\n const problems: string[] = [];\n for (const end of [edge.from, edge.to]) {\n if (graph.services[end] === undefined)\n problems.push(`${where} names '${end}', which is not in \"services\". Add services[\"${end}\"] or remove the edge.`);\n }\n if (edge.type !== undefined && edge.type !== 'rpc' && edge.type !== 'pubsub')\n problems.push(`${where} has type '${edge.type}'; use \"rpc\" or \"pubsub\".`);\n if (edge.type === 'pubsub' && edge.queue !== undefined && graph.queues[edge.queue] === undefined)\n problems.push(`${where} flows through queue '${edge.queue}', which is not in \"queues\". Add queues[\"${edge.queue}\"] or drop \"queue\" for a contract-level edge.`);\n return problems;\n }\n\n /** Every contract-level pubsub edge needs its contract queue, which `--prepare` derives. */\n private contractQueues(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n graph.runtimeEdges.forEach((edge: RuntimeEdge, index: number) => {\n if (edge.type !== 'pubsub' || edge.queue !== undefined) return;\n for (const api of edge.via) {\n if (graph.contractQueues?.[api] === undefined)\n problems.push(`${this.goalPath}: runtimeEdges[${index}] (${edge.from} -> ${edge.to}) is a contract-level pubsub edge over ${api}, but contractQueues[\"${api}\"] is missing.`);\n }\n });\n return problems;\n }\n\n private queues(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n const flows: NamedFlow[] = [];\n for (const key of Object.keys(graph.queues)) flows.push(new NamedFlow(`queues[\"${key}\"]`, graph.queues[key]));\n const contracts = graph.contractQueues ?? {};\n for (const api of Object.keys(contracts)) flows.push(new NamedFlow(`contractQueues[\"${api}\"]`, contracts[api]));\n for (const named of flows) {\n const where = named.where;\n const flow = named.flow;\n for (const key of ['producedBy', 'consumedBy'] as const) {\n if (!this.strings(flow[key])) {\n problems.push(`${this.goalPath}: ${where}.${key} must be an array of service names.`);\n continue;\n }\n for (const name of flow[key]) {\n if (graph.services[name] === undefined)\n problems.push(`${this.goalPath}: ${where}.${key} names '${name}', which is not in \"services\".`);\n }\n }\n }\n for (const [key, queue] of Object.entries(graph.queues)) {\n if (typeof queue.api !== 'string' || typeof queue.method !== 'string' || typeof queue.queueName !== 'string')\n problems.push(`${this.goalPath}: queues[\"${key}\"] needs string \"api\", \"method\" and \"queueName\".`);\n }\n return problems;\n }\n\n private triggers(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n graph.triggers.forEach((trigger: RuntimeTrigger, index: number) => {\n const where = `${this.goalPath}: triggers[${index}]`;\n if (trigger.kind !== 'cron' && trigger.kind !== 'external')\n problems.push(`${where} has kind '${trigger.kind}'; use \"cron\" or \"external\".`);\n if (typeof trigger.api !== 'string' || typeof trigger.method !== 'string')\n problems.push(`${where} needs string \"api\" and \"method\".`);\n if (graph.services[trigger.service] === undefined)\n problems.push(`${where} targets '${trigger.service}', which is not in \"services\".`);\n });\n graph.unresolvedUses.forEach((use: RuntimeUnresolved, index: number) => {\n if (graph.services[use.service] === undefined)\n problems.push(`${this.goalPath}: unresolvedUses[${index}] names '${use.service}', which is not in \"services\".`);\n if (typeof use.api !== 'string') problems.push(`${this.goalPath}: unresolvedUses[${index}] needs a string \"api\".`);\n });\n return problems;\n }\n\n private externals(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const [id, system] of Object.entries(graph.externalSystems ?? {})) {\n const where = `${this.goalPath}: externalSystems[\"${id}\"]`;\n if (typeof system.kind !== 'string' || typeof system.label !== 'string' || !this.strings(system.apis))\n problems.push(`${where} needs string \"kind\" and \"label\" and an \"apis\" string array.`);\n if (!this.strings(system.usedBy)) {\n problems.push(`${where}.usedBy must be an array of service names.`);\n continue;\n }\n for (const name of system.usedBy) {\n if (graph.services[name] === undefined) problems.push(`${where}.usedBy names '${name}', which is not in \"services\".`);\n }\n }\n return problems;\n }\n\n private remotes(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const [name, remote] of Object.entries(graph.remoteServices ?? {})) {\n const where = `${this.goalPath}: remoteServices[\"${name}\"]`;\n if (!this.strings(remote.implements) || !Array.isArray(remote.calledBy)) {\n problems.push(`${where} needs an \"implements\" string array and a \"calledBy\" array.`);\n continue;\n }\n remote.calledBy.forEach((call: RuntimeRemoteCall, index: number) => {\n if (!this.isMap(call) || !this.strings(call.via) || (call.type !== 'rpc' && call.type !== 'pubsub'))\n problems.push(`${where}.calledBy[${index}] needs \"from\", a \"via\" string array and type \"rpc\" or \"pubsub\".`);\n else if (graph.services[call.from] === undefined)\n problems.push(`${where}.calledBy[${index}] names '${call.from}', which is not in \"services\".`);\n });\n }\n return problems;\n }\n\n // webpieces-disable no-any-unknown -- hand-authored JSON is untrusted until its shape has been checked\n private strings(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((entry: string | number | boolean | object | null) => typeof entry === 'string');\n }\n\n // webpieces-disable no-any-unknown -- hand-authored JSON is untrusted until its shape has been checked\n private isMap(value: unknown): boolean {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n }\n}\n"]}
1
+ {"version":3,"file":"runtime-goal-validator.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-goal-validator.ts"],"names":[],"mappings":";;;AAUA,8DAA8D;AAC9D,MAAM,SAAS;IAES;IACA;IAFpB,YACoB,KAAa,EACb,IAAsB;QADtB,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAkB;IACvC,CAAC;CACP;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAa,oBAAoB;IACA;IAA7B,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEjD,2FAA2F;IAC3F,uGAAuG;IACvG,UAAU,CAAC,KAAc;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,+CAA+C,CAAC,CAAC;QACjG,MAAM,KAAK,GAAG,KAAqB,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,uFAAuF;IACvF,OAAO,CAAC,KAAmB;QACvB,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,kCAAkC,CAAC,CAAC;QACzG,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,gCAAgC,CAAC,CAAC;QACxG,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK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Edge,\n RuntimeGraph,\n RuntimeLevel,\n RuntimeQueueFlow,\n RuntimeRemoteCall,\n RuntimeTrigger,\n RuntimeUnresolved,\n} from './runtime-graph-model';\n\n/** One queue flow and the goal path segment that names it. */\nclass NamedFlow {\n constructor(\n public readonly where: string,\n public readonly flow: RuntimeQueueFlow,\n ) {}\n}\n\n/**\n * Shape and internal-reference checks for a HAND-AUTHORED runtime goal (#1239).\n *\n * The generated current graph is validated by regenerating it from source; a goal has no source to\n * regenerate from, so every problem is named against the goal file itself, with the element that is\n * wrong and the edit that fixes it. Problems are collected, never thrown one at a time, so one run\n * names every broken reference.\n *\n * Two kinds of problem, because they have different cures:\n * - STRUCTURAL (shape, dangling references): only an edit of the goal file fixes them.\n * - DERIVED (a missing or invalid level, a missing contract queue, maxLevel): the explicit\n * `--prepare-goal` step computes them from the relationships, so it must accept a goal that has them.\n * Facts that are present but merely disagree with the relationships are drift, reported by\n * RuntimeGoalFile.drift().\n */\nexport class RuntimeGoalValidator {\n constructor(private readonly goalPath: string) {}\n\n /** Problems only an edit of the goal file can fix; empty when `--prepare-goal` can run. */\n // webpieces-disable no-any-unknown -- hand-authored JSON is untrusted until its shape has been checked\n structural(graph: unknown): string[] {\n if (!this.isMap(graph)) return [`${this.goalPath} must contain a JSON object (a RuntimeGraph).`];\n const typed = graph as RuntimeGraph;\n const shape = this.shape(typed);\n if (shape.length > 0) return shape;\n return this.references(typed);\n }\n\n /** Derived facts `--prepare-goal` computes; call only on a structurally valid goal. */\n derived(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n if (!Number.isInteger(graph.maxLevel)) problems.push(`${this.goalPath}: \"maxLevel\" must be an integer.`);\n if (graph.contractQueues === undefined) problems.push(`${this.goalPath}: \"contractQueues\" is missing.`);\n return [...problems, ...this.levels(graph), ...this.contractQueues(graph)];\n }\n\n private shape(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const key of ['services', 'apis', 'queues'] as const) {\n if (!this.isMap(graph[key])) problems.push(`${this.goalPath}: \"${key}\" must be an object keyed by identity.`);\n }\n for (const key of ['runtimeEdges', 'unresolvedUses', 'triggers'] as const) {\n if (!Array.isArray(graph[key])) problems.push(`${this.goalPath}: \"${key}\" must be an array.`);\n }\n for (const key of ['externalSystems', 'remoteServices', 'contractQueues'] as const) {\n if (graph[key] !== undefined && !this.isMap(graph[key]))\n problems.push(`${this.goalPath}: \"${key}\" must be an object when present.`);\n }\n return problems;\n }\n\n /** The renderer places every node by its saved level, so each needs one. */\n private levels(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n const check = (where: string, node: RuntimeLevel): void => {\n if (!this.isMap(node) || !Number.isInteger(node.level) || node.level < 0 || typeof node.levelBecause !== 'string')\n problems.push(`${this.goalPath}: ${where} needs an integer \"level\" >= 0 and a string \"levelBecause\".`);\n };\n for (const [name, service] of Object.entries(graph.services)) check(`services[\"${name}\"]`, service);\n for (const [key, queue] of Object.entries(graph.queues)) check(`queues[\"${key}\"]`, queue);\n for (const [api, queue] of Object.entries(graph.contractQueues ?? {})) check(`contractQueues[\"${api}\"]`, queue);\n graph.triggers.forEach((trigger: RuntimeTrigger, index: number) => check(`triggers[${index}]`, trigger));\n graph.unresolvedUses.forEach((use: RuntimeUnresolved, index: number) => check(`unresolvedUses[${index}]`, use));\n for (const [id, system] of Object.entries(graph.externalSystems ?? {})) check(`externalSystems[\"${id}\"]`, system);\n for (const [name, remote] of Object.entries(graph.remoteServices ?? {})) check(`remoteServices[\"${name}\"]`, remote);\n return problems;\n }\n\n private references(graph: RuntimeGraph): string[] {\n return [\n ...this.services(graph),\n ...this.edges(graph),\n ...this.queues(graph),\n ...this.triggers(graph),\n ...this.externals(graph),\n ...this.remotes(graph),\n ];\n }\n\n private services(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const [name, service] of Object.entries(graph.services)) {\n for (const key of ['implements', 'uses', 'dependsOn'] as const) {\n if (!this.strings(service[key]))\n problems.push(`${this.goalPath}: services[\"${name}\"].${key} must be an array of strings (use [] for none).`);\n }\n if (service.products !== undefined && !this.strings(service.products))\n problems.push(`${this.goalPath}: services[\"${name}\"].products must be an array of strings when present.`);\n }\n return problems;\n }\n\n private edges(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n graph.runtimeEdges.forEach((edge: RuntimeEdge, index: number) => problems.push(...this.edge(graph, edge, index)));\n return problems;\n }\n\n private edge(graph: RuntimeGraph, edge: RuntimeEdge, index: number): string[] {\n const where = `${this.goalPath}: runtimeEdges[${index}] (${edge?.from} -> ${edge?.to})`;\n if (!this.isMap(edge) || !this.strings(edge.via) || edge.via.length === 0)\n return [`${where} needs \"from\", \"to\" and a non-empty \"via\" contract list.`];\n const problems: string[] = [];\n for (const end of [edge.from, edge.to]) {\n if (graph.services[end] === undefined)\n problems.push(`${where} names '${end}', which is not in \"services\". Add services[\"${end}\"] or remove the edge.`);\n }\n if (edge.type !== undefined && edge.type !== 'rpc' && edge.type !== 'pubsub')\n problems.push(`${where} has type '${edge.type}'; use \"rpc\" or \"pubsub\".`);\n if (edge.type === 'pubsub' && edge.queue !== undefined && graph.queues[edge.queue] === undefined)\n problems.push(`${where} flows through queue '${edge.queue}', which is not in \"queues\". Add queues[\"${edge.queue}\"] or drop \"queue\" for a contract-level edge.`);\n return problems;\n }\n\n /** Every contract-level pubsub edge needs its contract queue, which `--prepare-goal` derives. */\n private contractQueues(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n graph.runtimeEdges.forEach((edge: RuntimeEdge, index: number) => {\n if (edge.type !== 'pubsub' || edge.queue !== undefined) return;\n for (const api of edge.via) {\n if (graph.contractQueues?.[api] === undefined)\n problems.push(`${this.goalPath}: runtimeEdges[${index}] (${edge.from} -> ${edge.to}) is a contract-level pubsub edge over ${api}, but contractQueues[\"${api}\"] is missing.`);\n }\n });\n return problems;\n }\n\n private queues(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n const flows: NamedFlow[] = [];\n for (const key of Object.keys(graph.queues)) flows.push(new NamedFlow(`queues[\"${key}\"]`, graph.queues[key]));\n const contracts = graph.contractQueues ?? {};\n for (const api of Object.keys(contracts)) flows.push(new NamedFlow(`contractQueues[\"${api}\"]`, contracts[api]));\n for (const named of flows) {\n const where = named.where;\n const flow = named.flow;\n for (const key of ['producedBy', 'consumedBy'] as const) {\n if (!this.strings(flow[key])) {\n problems.push(`${this.goalPath}: ${where}.${key} must be an array of service names.`);\n continue;\n }\n for (const name of flow[key]) {\n if (graph.services[name] === undefined)\n problems.push(`${this.goalPath}: ${where}.${key} names '${name}', which is not in \"services\".`);\n }\n }\n }\n for (const [key, queue] of Object.entries(graph.queues)) {\n if (typeof queue.api !== 'string' || typeof queue.method !== 'string' || typeof queue.queueName !== 'string')\n problems.push(`${this.goalPath}: queues[\"${key}\"] needs string \"api\", \"method\" and \"queueName\".`);\n }\n return problems;\n }\n\n private triggers(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n graph.triggers.forEach((trigger: RuntimeTrigger, index: number) => {\n const where = `${this.goalPath}: triggers[${index}]`;\n if (trigger.kind !== 'cron' && trigger.kind !== 'external')\n problems.push(`${where} has kind '${trigger.kind}'; use \"cron\" or \"external\".`);\n if (typeof trigger.api !== 'string' || typeof trigger.method !== 'string')\n problems.push(`${where} needs string \"api\" and \"method\".`);\n if (graph.services[trigger.service] === undefined)\n problems.push(`${where} targets '${trigger.service}', which is not in \"services\".`);\n });\n graph.unresolvedUses.forEach((use: RuntimeUnresolved, index: number) => {\n if (graph.services[use.service] === undefined)\n problems.push(`${this.goalPath}: unresolvedUses[${index}] names '${use.service}', which is not in \"services\".`);\n if (typeof use.api !== 'string') problems.push(`${this.goalPath}: unresolvedUses[${index}] needs a string \"api\".`);\n });\n return problems;\n }\n\n private externals(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const [id, system] of Object.entries(graph.externalSystems ?? {})) {\n const where = `${this.goalPath}: externalSystems[\"${id}\"]`;\n if (typeof system.kind !== 'string' || typeof system.label !== 'string' || !this.strings(system.apis))\n problems.push(`${where} needs string \"kind\" and \"label\" and an \"apis\" string array.`);\n if (!this.strings(system.usedBy)) {\n problems.push(`${where}.usedBy must be an array of service names.`);\n continue;\n }\n for (const name of system.usedBy) {\n if (graph.services[name] === undefined) problems.push(`${where}.usedBy names '${name}', which is not in \"services\".`);\n }\n }\n return problems;\n }\n\n private remotes(graph: RuntimeGraph): string[] {\n const problems: string[] = [];\n for (const [name, remote] of Object.entries(graph.remoteServices ?? {})) {\n const where = `${this.goalPath}: remoteServices[\"${name}\"]`;\n if (!this.strings(remote.implements) || !Array.isArray(remote.calledBy)) {\n problems.push(`${where} needs an \"implements\" string array and a \"calledBy\" array.`);\n continue;\n }\n remote.calledBy.forEach((call: RuntimeRemoteCall, index: number) => {\n if (!this.isMap(call) || !this.strings(call.via) || (call.type !== 'rpc' && call.type !== 'pubsub'))\n problems.push(`${where}.calledBy[${index}] needs \"from\", a \"via\" string array and type \"rpc\" or \"pubsub\".`);\n else if (graph.services[call.from] === undefined)\n problems.push(`${where}.calledBy[${index}] names '${call.from}', which is not in \"services\".`);\n });\n }\n return problems;\n }\n\n // webpieces-disable no-any-unknown -- hand-authored JSON is untrusted until its shape has been checked\n private strings(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((entry: string | number | boolean | object | null) => typeof entry === 'string');\n }\n\n // webpieces-disable no-any-unknown -- hand-authored JSON is untrusted until its shape has been checked\n private isMap(value: unknown): boolean {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n }\n}\n"]}
@@ -1,22 +1,29 @@
1
1
  import type { RuntimeGraph } from './runtime-graph-model';
2
- import { SavedSnapshot } from './saved-snapshot';
3
2
  import { RuntimeGoalFile } from './runtime-goal-file';
4
3
  import { RuntimeComparisonView } from './graph-render-model';
5
4
  import type { RuntimeVizOptions } from './runtime-viz-options';
6
5
  /**
7
- * Loads either saved runtime file for the OTHER page's comparison, turning a missing or unusable file
8
- * into the reason Goal vs Current is unavailable — never into "no differences".
6
+ * Why Goal vs Current cannot be drawn (#1239, #1373): the full `reason` (console, tooltip, legend —
7
+ * with its path and repair) and the short `menuNote` the Color-by menu shows under the dimmed item.
8
+ */
9
+ export declare class RuntimeComparisonGap {
10
+ readonly reason: string;
11
+ readonly menuNote: string;
12
+ constructor(reason: string, menuNote?: string);
13
+ }
14
+ /** The menu line under the dimmed Goal vs Current item when the goal file is absent (#1373). */
15
+ export declare const MISSING_GOAL_MENU_NOTE: string;
16
+ /**
17
+ * Loads the saved goal for the runtime page's comparison, turning a missing or unusable file into
18
+ * the reason Goal vs Current is unavailable — never into "no differences".
9
19
  */
10
20
  export declare class RuntimeComparisonInputs {
11
- private readonly snapshot;
12
21
  private readonly goalFile;
13
- constructor(snapshot?: SavedSnapshot, goalFile?: RuntimeGoalFile);
14
- /** The saved current graph, or why it cannot be compared. */
15
- current(workspaceRoot: string): RuntimeGraph | string;
22
+ constructor(goalFile?: RuntimeGoalFile);
16
23
  /** The saved goal, or why it cannot be compared (missing: how to start one). */
17
- goal(workspaceRoot: string): RuntimeGraph | string;
18
- view(current: RuntimeGraph | string, goal: RuntimeGraph | string, options: RuntimeVizOptions): RuntimeComparisonView;
19
- /** Goal vs Current with no overlay: the mode is disabled and says `reason` instead. */
20
- unavailable(reason: string): RuntimeComparisonView;
24
+ goal(workspaceRoot: string): RuntimeGraph | RuntimeComparisonGap;
25
+ view(current: RuntimeGraph, goal: RuntimeGraph | RuntimeComparisonGap, options: RuntimeVizOptions): RuntimeComparisonView;
26
+ /** Goal vs Current with no overlay: the mode is dimmed and says `gap` instead. */
27
+ unavailable(gap: RuntimeComparisonGap): RuntimeComparisonView;
21
28
  private text;
22
29
  }