Coverage for scripts / upgrade_validation / registry.py: 100.00%

7 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-10-28 16:19 +0000

1"""The upgrade-validation action registry. 

2 

3Reuses the live-release-validation handlers verbatim for ``baseline``, 

4``topology``, ``destroy`` and ``final-inventory``; the other actions live in 

5``actions.py``. The runner requires the names ``deploy``, ``destroy`` and 

6``final-inventory``. ``tests/test_upgrade_validation.py`` holds this registry 

7in lockstep with the contract table in ``docs/UPGRADE_VALIDATION.md``. 

8""" 

9 

10from __future__ import annotations 

11 

12from scripts.live_release_validation.actions import ( 

13 action_baseline, 

14 action_destroy, 

15 action_final_inventory, 

16 action_topology, 

17) 

18from scripts.live_release_validation.registry import ActionDefinition 

19 

20from .actions import ( 

21 action_base_deploy, 

22 action_prepare, 

23 action_sentinels, 

24 action_upgrade, 

25 action_upgrade_preflight, 

26 action_verify_upgrade, 

27) 

28 

29 

30def build_action_registry() -> dict[str, ActionDefinition]: 

31 """Return actions in dependency-safe execution order.""" 

32 definitions = ( 

33 ActionDefinition( 

34 "preflight", 

35 "Verify the release preflight, then pin the base release, tools, and workspace", 

36 (), 

37 action_upgrade_preflight, 

38 ), 

39 ActionDefinition( 

40 "baseline", 

41 "Capture protected CloudFormation and ECR baselines", 

42 ("preflight",), 

43 action_baseline, 

44 ), 

45 ActionDefinition( 

46 "prepare", 

47 "Clone the base release privately, install its gco, and synthesize its app", 

48 ("preflight",), 

49 action_prepare, 

50 ), 

51 ActionDefinition( 

52 "deploy", 

53 "Deploy the base release with its own gco and adopt its stacks by run tag", 

54 ("baseline", "prepare"), 

55 action_base_deploy, 

56 ), 

57 ActionDefinition( 

58 "sentinels", 

59 "Write a job template through the base release's API for the upgrade to keep", 

60 ("deploy",), 

61 action_sentinels, 

62 ), 

63 ActionDefinition( 

64 "upgrade", 

65 "Run the base release's gco upgrade to this commit and adopt the recreated stacks", 

66 ("sentinels",), 

67 action_upgrade, 

68 ), 

69 ActionDefinition( 

70 "topology", 

71 "Verify the upgraded stacks, EKS, HTTPS ALB targets, APIs, queues, and DynamoDB", 

72 ("upgrade",), 

73 action_topology, 

74 ), 

75 ActionDefinition( 

76 "verify-upgrade", 

77 "Verify the upgraded checkout, the stack generations, and the sentinel", 

78 ("topology",), 

79 action_verify_upgrade, 

80 ), 

81 ActionDefinition( 

82 "destroy", 

83 "Destroy all run-owned infrastructure in dependency order", 

84 ("deploy",), 

85 action_destroy, 

86 ), 

87 ActionDefinition( 

88 "final-inventory", 

89 "Verify zero residual resources and exact baseline preservation", 

90 ("destroy",), 

91 action_final_inventory, 

92 ), 

93 ) 

94 return {definition.name: definition for definition in definitions}