ab3a9a8548
VERIFY: structural — 2 modules extracted + re-export shim (G-113); behavioral — 16 tests + CLI + CI PASS; quality — behavior unchanged. ---ci--- project: acdl phase: 12 milestone: v1.16 status: complete phase_role: execution requirements: covered: [REQ-176] partial: [] ---/ci---
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""Nova Decommission Transform — zero counts + disable deletion protection (REQ-92).
|
|
|
|
Extracted from core/contract_resolver.py (P12, REQ-176).
|
|
|
|
G-113 import direction: this module imports only stdlib. The re-export
|
|
shim core/contract_resolver.py imports this module. Nothing imports the
|
|
shim except external callers.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
def decommission_transform(stack_instance):
|
|
"""REQ-92: Transform a resolved stack instance for decommission.
|
|
|
|
Sets all scalable counts to 0 and deletion_protection to false on
|
|
every resource. Used by the decommission pipeline mode after the
|
|
first step (disable deletion protection) has been applied.
|
|
"""
|
|
for res in stack_instance.get("resources", []):
|
|
if "nfrs" not in res:
|
|
res["nfrs"] = {}
|
|
res["nfrs"]["deletion_protection"] = False
|
|
inputs = res.get("inputs", {})
|
|
if "desired_count" in inputs:
|
|
inputs["desired_count"] = 0
|
|
if "min_capacity" in inputs:
|
|
inputs["min_capacity"] = 0
|
|
if "max_capacity" in inputs:
|
|
inputs["max_capacity"] = 0
|
|
return stack_instance |