Coverage for scripts / live_release_validation / registry.py: 100.00%
16 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-28 16:19 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-28 16:19 +0000
1"""The ordered live-validation action registry.
3This is the single source of truth for which actions exist, what each one
4promises, the order they run in, and which actions must precede them. The
5runner derives selection, dependency expansion, and ``--actions all`` from
6this mapping alone, and ``tests/test_live_release_validation_structure.py``
7holds it in lockstep with the contract table in
8``docs/LIVE_RELEASE_VALIDATION.md``.
10Registering a new action is one entry here plus one module under
11``actions/``; see ``scripts/live_release_validation/README.md``.
12"""
14from __future__ import annotations
16from collections.abc import Callable
17from dataclasses import dataclass
18from typing import Any
20from .actions import (
21 action_api_lifecycle,
22 action_baseline,
23 action_central_queue_lifecycle,
24 action_convergence,
25 action_deploy,
26 action_destroy,
27 action_eks_capabilities,
28 action_final_inventory,
29 action_inference,
30 action_network_posture,
31 action_opencost,
32 action_platform_workloads,
33 action_policy,
34 action_preflight,
35 action_schedulers,
36 action_sqs_lifecycle,
37 action_topology,
38 action_tracing,
39)
40from .models import RunContext
42ActionHandler = Callable[[RunContext], dict[str, Any]]
45@dataclass(frozen=True)
46class ActionDefinition:
47 """One selectable action and its safety dependencies."""
49 name: str
50 description: str
51 dependencies: tuple[str, ...]
52 handler: ActionHandler
55def build_action_registry() -> dict[str, ActionDefinition]:
56 """Return actions in dependency-safe execution order."""
57 definitions = (
58 ActionDefinition(
59 "preflight",
60 "Verify exact git, account, configuration, and ownership identity",
61 (),
62 action_preflight,
63 ),
64 ActionDefinition(
65 "baseline",
66 "Capture protected CloudFormation, ECR, and Transaction Search baselines",
67 ("preflight",),
68 action_baseline,
69 ),
70 ActionDefinition(
71 "deploy",
72 "Deploy the configured GCO topology",
73 ("baseline",),
74 action_deploy,
75 ),
76 ActionDefinition(
77 "topology",
78 "Verify stacks, EKS, API endpoints, queues, and DynamoDB",
79 ("deploy",),
80 action_topology,
81 ),
82 ActionDefinition(
83 "inference",
84 "Run the vLLM/SGLang/Triton matrix (incl. the Mooncake store), then prove stable absence",
85 ("topology",),
86 action_inference,
87 ),
88 ActionDefinition(
89 "policy",
90 "Require all three admission layers to be readable per Region",
91 ("topology",),
92 action_policy,
93 ),
94 ActionDefinition(
95 "api",
96 "Run the authenticated API Job lifecycle",
97 ("topology",),
98 action_api_lifecycle,
99 ),
100 ActionDefinition(
101 "sqs",
102 "Run the direct regional SQS Job lifecycle",
103 ("topology",),
104 action_sqs_lifecycle,
105 ),
106 ActionDefinition(
107 "central-queue",
108 "Run the idempotent DynamoDB-backed queue lifecycle",
109 ("topology",),
110 action_central_queue_lifecycle,
111 ),
112 ActionDefinition(
113 "schedulers",
114 "Prove every enabled batch scheduler against a scheduling-gated workload",
115 ("topology",),
116 action_schedulers,
117 ),
118 ActionDefinition(
119 "opencost",
120 "Require healthy, data-returning OpenCost and a working cost report pipeline",
121 ("topology",),
122 action_opencost,
123 ),
124 ActionDefinition(
125 "convergence",
126 "Require stable SQS/DLQ and DynamoDB convergence",
127 ("topology",),
128 action_convergence,
129 ),
130 ActionDefinition(
131 "tracing",
132 "Require every traced service's spans in Transaction Search, with a joined "
133 "cost-monitor span",
134 ("topology",),
135 action_tracing,
136 ),
137 # The two cluster-facing checks run after every workload action on
138 # purpose: a zero restart count and an intact policy posture mean more
139 # once the services have carried real Job, queue, and inference traffic.
140 ActionDefinition(
141 "platform-workloads",
142 "Require converged, restart-free, drain-safe platform services with the "
143 "configured autoscalers",
144 ("topology",),
145 action_platform_workloads,
146 ),
147 ActionDefinition(
148 "network-posture",
149 "Prove the shipped NetworkPolicies decide traffic on the live cluster",
150 ("topology",),
151 action_network_posture,
152 ),
153 ActionDefinition(
154 "eks-capabilities",
155 "Require every configured EKS Capability (ACK, kro) attached, ACTIVE and drift-free",
156 ("topology",),
157 action_eks_capabilities,
158 ),
159 ActionDefinition(
160 "destroy",
161 "Destroy all run-owned infrastructure in dependency order",
162 ("deploy",),
163 action_destroy,
164 ),
165 ActionDefinition(
166 "final-inventory",
167 "Verify zero residual resources and exact baseline preservation",
168 ("destroy",),
169 action_final_inventory,
170 ),
171 )
172 return {definition.name: definition for definition in definitions}