# 0019. A live run's dependency graph is built in code: one graph of resource, external and CMDB CI nodes | | | |---|---| | Status | Accepted | | Date | 2026-11-05 | | Decided by | Product owner, 2026-11-05: "the cmdb nodes should be separate from the hyperscaler but still be built in an equivalent way with children and parents at an edge"; "it's the same graph but different edge nodes". Plan and decisions D1–D7: `engineering_hub_responsiblities/reports/cp1/live-dependency-map-plan-2026-11-05.md` | | Requirements changed | ALZ-DSC-06 (dependency mapping): a live run's graph comes from the scan's recorded dependencies and the CMDB's relationships. ALZ-DSC-04: CMDB relationships are read. ALZ-DSC-08: the critic checks dependencies in code | ## Context Run `exec_93742bdd7e29` (case `azure-crucible-kab-dev-cmdb`) passed all 19 checks, and the critic failed it. - **The dependency step never received the scan's findings.** The scan recorded 7 dependencies. The step rebuilt edges from each record's network attributes, dropped 4 of them and added 2 VNet edges the scan never recorded. - **Out-of-scope targets were bare names.** Dependencies outside the scope root (subnets in `crucible-net-dev`, a public IP in `crucible-kab-dev-nodes`) came through as names, so the critic reported them as unsupported. - **The critic was inconsistent.** It passed the same estate the day before, so the verdict depended on the model's judgment that day. - **The CMDB's own relationships were never read.** ## Decision - **One graph, three kinds of node** (`app/graph.py` in the dependency agent, from `pre_process`, with no model call): - `resource`: a scope entry, i.e. its inventory record; - `external`: a dependency target outside the scope root or not inventoried, with its container and what depends on it (D1); - `ci`: a judged CMDB CI, with its reconciliation result. - **Every edge runs parent (`source`) to child (`target`):** - **resource → resource or external:** one edge per entry in a finding's `dependencies`. They're typed by the target's resource type, with confidence 0.8 and `auto_approved`, since they're the provider's own record (D3). - **ci → ci:** a CMDB relationship. Confidence 0.7 and `sme_review_recommended`. - **ci → resource, `represents`:** the reconciliation's match. `auto_approved` when matched by cloud id; `sme_review_recommended` when matched by name. - **Folded components:** a dependency on a resource's own child component (a NIC, a disk) is a `folded_dependencies` entry, not an edge (D2). - **Relationships are judged like CIs** (ADR 0018). A relationship export (`source: cmdb_relationships` in the context's `uploads:`, D6), or a CI row's own parent or child columns (`related`), is normalised by the model to `schemas/cmdb_relationship.json`. It's typed with the graph's edge types (D7), and every value is checked in code against its row. An end that resolves to no CI (by `ci_ref`, or by unique name) is dangling, never a node. This is done in the CMDB step (D5). - **The comparison is a walk over the one graph.** For each ci → ci edge whose two CIs both represent resources: - the cloud has the same resource → resource edge, in the same direction: `confirmed`. The cloud edge gains the CMDB evidence, and its confidence becomes 0.95; - otherwise: `cmdb_only`. A cloud edge between two represented resources that no ci → ci edge matches is `discovered_only`. A relationship with an end that has no resource is `not_comparable`. - **The critic counts dependencies in code** (`live_dependencies`): every recorded dependency must be an edge (to a record, or to an external node) or a folded dependency. It also treats `external`, `represents` and ci → ci edges as supported by their own evidence. - **The report:** - one diagram, with each node drawn by kind: a resource as a box, external with a dashed outline, a CI as a hexagon, and `represents` as dotted; - tables of dependencies outside this discovery (with where to widen the scope, D4), the CMDB comparison, and dangling relationships. ## Consequences - No recorded dependency is dropped and none is invented. The critic's dependency verdict is the same on every run. - An assessment sees what a landing zone depends on outside the scope, for example the shared VNet in `crucible-net-dev`, and which resource group to add to discover it. - The CMDB's picture and the cloud's are in one graph, so a CI's dependents, and an asset's dependents in either source, are one walk. - `discovered_only` is reported in the dependency step and the report. It doesn't add a drift item, because the CMDB step (s4) runs before the graph (s7). - Folding is a fixed list, so a dependency on another asset's child component (another VM's disk) is still folded, not redirected to its parent: the listing doesn't say which parent owns it.