# 0021. A live run's applications and asset owners are grouped in code: CMDB, then tag, then container, then a judged model proposal | | | |---|---| | Status | Accepted | | Date | 2026-11-05 | | Decided by | Product owner, 2026-11-05: "CMDB→tag→RG, review model" (code groups by CMDB business service, then the application tag, then resource group; the model proposes groups only for what's left, code judges them, and model-proposed groups are flagged for the Engagement Lead's review). Plan: [../discovery-value-plan.md](../discovery-value-plan.md), phase 3 | | Requirements changed | ALZ-DSC-03 and ALZ-F02 ASM-01 ("inventory (applications and assets)"): a live run lists applications, from the dependency step rather than the inventory. ALZ-DSC-04: each CI's result carries its owner, business service and support group. ALZ-DSC-06: the dependency step groups applications and names owners | ## Context - **F02 needs applications.** Its planner groups by the Discovery `applications` list, else by `facts.business_service`, and live runs had neither, so every asset was a gap (review of 2026-11-04, item 5). The value scorecard's baseline ([ADR 0020](0020.md)) showed application and owner missing on all 10 records of the CMDB case. - **The evidence was there but never reached Assessment.** The uploaded CMDB names each CI's `owned_by` and `business_service`, but the CMDB step's per-CI results dropped them. Every resource carries an `Application` tag. - **The dependency step is the right place:** it runs after the CMDB step, already joins records to CIs (ADR 0019), and is answered in code. ## Decision 1. **The CMDB step's `cis`** carry each CI's `owner`, `business_service` and `support_group`, verbatim (0.7.0). 2. **The dependency step groups each record, once,** in this order (`app/applications.py`, 0.6.0): 1. the matched CI's business service (`basis: cmdb_business_service`); 2. the resource's application tag (`Application`, `app`, `application_name`, `app_name`, `business_service`, `service`, any case; `basis: tag`). **Tag alias:** when every CMDB-grouped member of one application carries the same application tag, a tag-only record with that tag joins that application, flagged for review. A tag two applications claim is no alias; 3. its resource group or project (`basis: container`), flagged for review; 4. for what's left only, the `propose_application_groups` sub-agent, from names, types and environments. Code rejects the whole reply if any group names an asset not asked about, places an asset twice, or has an empty, over-long or instruction-like name. Every model group is flagged for review; a rejected or failed reply leaves its assets ungrouped, which the note says. 3. **Owners:** from the matched CI (`owner`, else `support_group`), else an owner tag. An application's owner is set only when its members' owners agree (`owners_disagree` otherwise). No owner is inferred. 4. **Outputs:** `applications` (id, name, basis, members, owner, business service, evidence, `review_required` and reasons), `asset_owners`, `ungrouped_assets` and `applications_note`. The report shows them after the inventory and lists the groups to review (0.9.0); the package carries them as its `applications` part, and the scorecard reads a record's application and owner from it (package 0.2.0, scorecard version 2). ## Consequences - **Expected on the CMDB case:** one application, "KAB Platform", of 10 assets: 8 by the CMDB, 2 (the DNS zone and the Event Grid topic, which have no CI) by the `Application: AppName1` tag every CMDB-grouped member shares, flagged for review. Owner "Platform Engineering" for the 8 matched assets; the 2 orphans have none, correctly. Scorecard: F02 fields filled from 24% to about 46%; run checks 7 of 7; findings with an owner from 0% to about 33% (the stale attributes on owned assets; orphans and ghosts have none). - **Without a CMDB:** one application, "AppName1", by tag, needing no review, and no owners: the CMDB gap declares them. - **The model is rarely asked:** on Azure and Google Cloud every resource has a resource group or project, so step 4 runs only for estates with no container. Its tests use a stand-in model. - **Applications are not graph nodes.** They're a separate list, so no edge or node enum changed and no other step's input schema had to. Membership edges can be added later if a consumer needs them in the graph. - **The review is the Engagement Lead's,** at the report's review point. Assessment reads `review_required` and can decide how to treat a group the lead didn't change. - **Live, 2026-11-05:** `exec_58ba6a71d00b` (`azure-crucible-kab-dev-cmdb`) passed 56 of 56 checks: one application, KAB Platform, of 10 assets, flagged for review; 8 owners; 46% of F02's fields filled; 7 of 7 run checks. `exec_925194d79c47` (`azure-crucible-kab-dev`) passed 21 of 21: AppName1 by tag, no owners, 37% filled. Neither run asked the grouping model.