@radicaltools/mcp 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +41 -23
  2. package/dist/{chunk-OGN3UW2D.js → chunk-2SZDTOYJ.js} +727 -89
  3. package/dist/{elkLayout-S62RLGTO.js → elkLayout-VYJDCCIT.js} +1 -1
  4. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  5. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  6. package/dist/hub-catalogue/concern/concern-api-evolution.radical +1174 -0
  7. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  8. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  9. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  10. package/dist/hub-catalogue/concern/concern-architecture-style.radical +1268 -0
  11. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  12. package/dist/hub-catalogue/concern/concern-authentication.radical +895 -0
  13. package/dist/hub-catalogue/concern/concern-authorization.radical +1686 -0
  14. package/dist/hub-catalogue/concern/concern-availability.radical +1028 -0
  15. package/dist/hub-catalogue/concern/concern-backend-stack.radical +1037 -0
  16. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1560 -0
  17. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  18. package/dist/hub-catalogue/concern/concern-capacity.radical +915 -0
  19. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  20. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  21. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  22. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  23. package/dist/hub-catalogue/concern/concern-communication-style.radical +1508 -0
  24. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  25. package/dist/hub-catalogue/concern/concern-data-consistency.radical +1112 -0
  26. package/dist/hub-catalogue/concern/concern-data-store.radical +1282 -0
  27. package/dist/hub-catalogue/concern/concern-decomposition.radical +1318 -0
  28. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  29. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  30. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  31. package/dist/hub-catalogue/concern/concern-deployment.radical +1203 -0
  32. package/dist/hub-catalogue/concern/concern-encryption.radical +1318 -0
  33. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  34. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  35. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1647 -0
  36. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  37. package/dist/hub-catalogue/concern/concern-infrastructure.radical +2183 -0
  38. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1116 -0
  39. package/dist/hub-catalogue/concern/concern-messaging.radical +973 -0
  40. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +867 -0
  41. package/dist/hub-catalogue/concern/concern-observability.radical +997 -0
  42. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  43. package/dist/hub-catalogue/concern/concern-personal-data.radical +1949 -0
  44. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  45. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1445 -0
  46. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  47. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  48. package/dist/hub-catalogue/concern/concern-secrets.radical +1284 -0
  49. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  50. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  51. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  52. package/dist/hub-catalogue/concern/concern-supply-chain.radical +1386 -0
  53. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  54. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  55. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1440 -0
  56. package/dist/hub-catalogue/concern/concern-test-strategy.radical +1212 -0
  57. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  58. package/dist/index.js +10321 -3964
  59. package/package.json +1 -1
  60. package/dist/hub-catalogue/adr/adr-api-versioning.radical +0 -53
  61. package/dist/hub-catalogue/adr/adr-auth-strategy.radical +0 -53
  62. package/dist/hub-catalogue/adr/adr-caching-strategy.radical +0 -59
  63. package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +0 -40
  64. package/dist/hub-catalogue/adr/adr-data-store.radical +0 -47
  65. package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +0 -53
  66. package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +0 -53
  67. package/dist/hub-catalogue/adr/adr-integration-style.radical +0 -50
  68. package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +0 -38
  69. package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +0 -40
  70. package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +0 -39
  71. package/dist/hub-catalogue/adr/adr-multi-region.radical +0 -60
  72. package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +0 -41
  73. package/dist/hub-catalogue/adr/adr-observability.radical +0 -59
  74. package/dist/hub-catalogue/adr/adr-realtime-transport.radical +0 -38
  75. package/dist/hub-catalogue/adr/adr-tech-stack.radical +0 -45
  76. package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +0 -40
  77. package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +0 -1641
  78. package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +0 -1428
  79. package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +0 -1989
  80. package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +0 -1701
  81. package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +0 -1792
  82. package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +0 -1421
  83. package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +0 -1713
  84. package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +0 -34
  85. package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +0 -52
  86. package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +0 -36
  87. package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +0 -67
  88. package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +0 -62
  89. package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +0 -45
  90. package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +0 -53
  91. package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +0 -64
  92. package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +0 -45
  93. package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +0 -51
  94. package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +0 -43
  95. package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +0 -37
  96. package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +0 -46
  97. package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +0 -52
  98. package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +0 -53
  99. package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +0 -59
  100. package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +0 -34
  101. package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +0 -34
  102. package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +0 -59
  103. package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +0 -44
  104. package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +0 -45
  105. package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +0 -43
  106. package/dist/hub-catalogue/fitness-function/ff-mttr.radical +0 -45
  107. package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +0 -66
  108. package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +0 -35
  109. package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +0 -66
  110. package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +0 -45
  111. package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +0 -66
  112. package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +0 -45
  113. package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +0 -43
  114. package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +0 -57
  115. package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +0 -88
  116. package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +0 -168
  117. package/dist/hub-catalogue/pattern/pattern-bff.radical +0 -179
  118. package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +0 -114
  119. package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +0 -219
  120. package/dist/hub-catalogue/pattern/pattern-cqrs.radical +0 -195
  121. package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +0 -200
  122. package/dist/hub-catalogue/pattern/pattern-event-driven.radical +0 -210
  123. package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +0 -211
  124. package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +0 -196
  125. package/dist/hub-catalogue/pattern/pattern-microservices.radical +0 -262
  126. package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +0 -213
  127. package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +0 -114
  128. package/dist/hub-catalogue/pattern/pattern-saga.radical +0 -208
  129. package/dist/hub-catalogue/pattern/pattern-sidecar.radical +0 -123
  130. package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +0 -227
  131. package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +0 -209
  132. package/dist/hub-catalogue/requirement/req-accessibility.radical +0 -48
  133. package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +0 -51
  134. package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +0 -45
  135. package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +0 -46
  136. package/dist/hub-catalogue/requirement/req-alerting.radical +0 -52
  137. package/dist/hub-catalogue/requirement/req-api-response-time.radical +0 -51
  138. package/dist/hub-catalogue/requirement/req-api-standard.radical +0 -45
  139. package/dist/hub-catalogue/requirement/req-audit-logging.radical +0 -43
  140. package/dist/hub-catalogue/requirement/req-auth-response-time.radical +0 -45
  141. package/dist/hub-catalogue/requirement/req-auth.radical +0 -43
  142. package/dist/hub-catalogue/requirement/req-autoscaling.radical +0 -62
  143. package/dist/hub-catalogue/requirement/req-availability.radical +0 -50
  144. package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +0 -46
  145. package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +0 -50
  146. package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +0 -64
  147. package/dist/hub-catalogue/requirement/req-centralised-logging.radical +0 -45
  148. package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +0 -43
  149. package/dist/hub-catalogue/requirement/req-code-complexity.radical +0 -43
  150. package/dist/hub-catalogue/requirement/req-config-propagation.radical +0 -45
  151. package/dist/hub-catalogue/requirement/req-data-integrity.radical +0 -35
  152. package/dist/hub-catalogue/requirement/req-data-retention.radical +0 -44
  153. package/dist/hub-catalogue/requirement/req-db-query-response.radical +0 -44
  154. package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +0 -59
  155. package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +0 -45
  156. package/dist/hub-catalogue/requirement/req-encryption.radical +0 -49
  157. package/dist/hub-catalogue/requirement/req-error-rate.radical +0 -45
  158. package/dist/hub-catalogue/requirement/req-error-recovery.radical +0 -34
  159. package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +0 -37
  160. package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +0 -55
  161. package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +0 -69
  162. package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +0 -44
  163. package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +0 -39
  164. package/dist/hub-catalogue/requirement/req-health-checks.radical +0 -43
  165. package/dist/hub-catalogue/requirement/req-iac.radical +0 -36
  166. package/dist/hub-catalogue/requirement/req-idempotency.radical +0 -47
  167. package/dist/hub-catalogue/requirement/req-input-validation.radical +0 -37
  168. package/dist/hub-catalogue/requirement/req-least-privilege.radical +0 -47
  169. package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +0 -38
  170. package/dist/hub-catalogue/requirement/req-mfa.radical +0 -36
  171. package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +0 -42
  172. package/dist/hub-catalogue/requirement/req-onboarding-time.radical +0 -42
  173. package/dist/hub-catalogue/requirement/req-page-load-time.radical +0 -59
  174. package/dist/hub-catalogue/requirement/req-payout-latency.radical +0 -46
  175. package/dist/hub-catalogue/requirement/req-presence-latency.radical +0 -46
  176. package/dist/hub-catalogue/requirement/req-rate-limiting.radical +0 -45
  177. package/dist/hub-catalogue/requirement/req-report-generation.radical +0 -44
  178. package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +0 -64
  179. package/dist/hub-catalogue/requirement/req-resource-headroom.radical +0 -53
  180. package/dist/hub-catalogue/requirement/req-resource-isolation.radical +0 -37
  181. package/dist/hub-catalogue/requirement/req-search-response-time.radical +0 -44
  182. package/dist/hub-catalogue/requirement/req-secrets-management.radical +0 -45
  183. package/dist/hub-catalogue/requirement/req-task-success-rate.radical +0 -42
  184. package/dist/hub-catalogue/requirement/req-test-coverage.radical +0 -42
  185. package/dist/hub-catalogue/requirement/req-throughput.radical +0 -55
  186. package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +0 -52
  187. package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +0 -39
@@ -0,0 +1,1203 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-deployment",
4
+ "category": "concern",
5
+ "name": "Deployment and rollback",
6
+ "description": "How a change reaches production and how it is undone: the rollout strategy and its automatic checks, database migrations that keep rollback possible, feature flags and their removal, the time to roll back, and the release cadence measured with the DORA metrics.",
7
+ "tags": [
8
+ "operations",
9
+ "deployment",
10
+ "rollback",
11
+ "canary",
12
+ "blue-green",
13
+ "migrations",
14
+ "feature-flags",
15
+ "dora"
16
+ ],
17
+ "requiredMetamodel": "c4-ddd-governance-builtin",
18
+ "concern": {
19
+ "id": "deployment",
20
+ "trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
21
+ "why": "these elements are deployed and changed in production, so how a change rolls out, and how it is taken back, has to be decided.",
22
+ "group": "sdlc"
23
+ },
24
+ "sources": [
25
+ {
26
+ "title": "DORA: DevOps Research and Assessment",
27
+ "url": "https://dora.dev/"
28
+ },
29
+ {
30
+ "title": "Google SRE workbook: Canarying Releases",
31
+ "url": "https://sre.google/workbook/canarying-releases/"
32
+ },
33
+ {
34
+ "title": "Martin Fowler: Parallel Change (expand and contract)",
35
+ "url": "https://martinfowler.com/bliki/ParallelChange.html"
36
+ },
37
+ {
38
+ "title": "Martin Fowler: Blue Green Deployment",
39
+ "url": "https://martinfowler.com/bliki/BlueGreenDeployment.html"
40
+ },
41
+ {
42
+ "title": "Pete Hodgson: Feature Toggles (aka Feature Flags)",
43
+ "url": "https://martinfowler.com/articles/feature-toggles.html"
44
+ },
45
+ {
46
+ "title": "The Twelve-Factor App, V. Build, release, run",
47
+ "url": "https://12factor.net/build-release-run"
48
+ },
49
+ {
50
+ "title": "Argo Rollouts documentation",
51
+ "url": "https://argo-rollouts.readthedocs.io/en/stable/"
52
+ },
53
+ {
54
+ "title": "Kubernetes documentation: Deployments",
55
+ "url": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"
56
+ },
57
+ {
58
+ "title": "Kubernetes documentation: Pod Lifecycle (termination of pods)",
59
+ "url": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/"
60
+ },
61
+ {
62
+ "title": "AWS Well-Architected Framework, Reliability Pillar",
63
+ "url": "https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/welcome.html"
64
+ },
65
+ {
66
+ "title": "flagd: flag definitions",
67
+ "url": "https://flagd.dev/reference/flag-definitions/"
68
+ }
69
+ ],
70
+ "templateParams": [
71
+ {
72
+ "key": "STRATEGY",
73
+ "title": "Rollout",
74
+ "label": "How does a new version roll out?",
75
+ "hint": "This decides how many users a bad version reaches before it is stopped, and how fast it is undone.",
76
+ "defaultValue": "canary",
77
+ "options": [
78
+ {
79
+ "value": "rolling",
80
+ "label": "a rolling update",
81
+ "description": "Instances are replaced a few at a time; old and new versions serve together for minutes. Pick it for small teams and internal services, when both versions can run side by side and the error rate is watched during the rollout."
82
+ },
83
+ {
84
+ "value": "bluegreen",
85
+ "label": "blue-green",
86
+ "description": "The new version starts beside the old one, is smoke-tested, and all traffic switches at once; switching back takes seconds. Pick it when versions must not serve together, or rollback must be instant, and double capacity during a release is affordable."
87
+ },
88
+ {
89
+ "value": "canary",
90
+ "label": "a canary with automatic analysis",
91
+ "description": "The new version gets 5 %, then 25 %, then 50 % of traffic; at each step its success rate and latency are compared with the stable version and a worse canary is rolled back by itself. Pick it with enough traffic to judge a step (about 100 requests per step or more) and metrics per version."
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "key": "MIGRATIONS",
97
+ "title": "Schema changes",
98
+ "label": "How do database schema changes ship?",
99
+ "hint": "During a rollout and after a rollback, the previous version runs against the new schema. A change it cannot read makes rollback impossible. The migration tool itself is decided in the Data store pack.",
100
+ "defaultValue": "expand",
101
+ "options": [
102
+ {
103
+ "value": "expand",
104
+ "label": "expand and contract",
105
+ "description": "Every change is backward compatible for one release: add, migrate data, switch the code, and remove the old only a release later. Pick it whenever the element owns a schema and versions run side by side, which a rolling update and a canary always do."
106
+ },
107
+ {
108
+ "value": "window",
109
+ "label": "a maintenance window",
110
+ "description": "Changes that cannot be made online run with the element stopped, in an announced window, after a rehearsal on a copy of production. Pick it only for a large one-off change (a type change on a huge table, a database upgrade) and when downtime is acceptable."
111
+ },
112
+ {
113
+ "value": "none",
114
+ "label": "no schema of its own",
115
+ "description": "The element keeps no database schema; any state lives in services that own their migrations. Pick it for web front ends, gateways and stateless workers."
116
+ }
117
+ ]
118
+ },
119
+ {
120
+ "key": "FLAGS",
121
+ "title": "Feature flags",
122
+ "label": "Is deploying separate from releasing?",
123
+ "hint": "With feature flags, code reaches production switched off and is turned on for some users, then all, without a deploy; turning it off is the fastest rollback. A flag left behind after its rollout is a debt item, removed by a deadline.",
124
+ "defaultValue": "yes",
125
+ "options": [
126
+ {
127
+ "value": "yes",
128
+ "label": "feature flags",
129
+ "description": "Unfinished or risky features ship switched off and are turned on per environment or share of users through OpenFeature with a provider (LaunchDarkly, Unleash, flagd, ConfigCat). Pick it with trunk-based development, several changes in flight, or features released at a business date."
130
+ },
131
+ {
132
+ "value": "no",
133
+ "label": "no flags: a deploy is a release",
134
+ "description": "What is merged and deployed is live for everyone. Pick it for small teams with fast rollback and features small enough to finish in one change; it avoids the cost of flags and their clean-up."
135
+ }
136
+ ]
137
+ },
138
+ {
139
+ "key": "CADENCE",
140
+ "title": "Cadence",
141
+ "label": "How often does it release?",
142
+ "hint": "Smaller, more frequent releases fail less often and are easier to undo (DORA). The cadence sets the targets for the DORA metrics.",
143
+ "defaultValue": "continuous",
144
+ "options": [
145
+ {
146
+ "value": "continuous",
147
+ "label": "continuous deployment of every merge",
148
+ "description": "Every change merged to the main branch goes to production through the pipeline, the same day. Pick it with a test suite and rollout checks the team trusts, and a product where small changes can reach users at any time."
149
+ },
150
+ {
151
+ "value": "train",
152
+ "label": "a weekly release train",
153
+ "description": "Changes merged before a weekly cut-off are released together. Pick it when releases need coordination (app stores, customers told in advance, a regulated sign-off), or while the pipeline's checks are not yet trusted."
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "key": "ROLLBACK_MINUTES",
159
+ "label": "How fast must a bad release be undone (minutes)?",
160
+ "defaultValue": "15",
161
+ "type": "number"
162
+ },
163
+ {
164
+ "key": "CANARY_SUCCESS_PERCENT",
165
+ "label": "Lowest success rate a canary step may show (%); at or above the availability objective decided in the Availability pack",
166
+ "defaultValue": "99",
167
+ "type": "number"
168
+ },
169
+ {
170
+ "key": "WINDOW_MINUTES",
171
+ "label": "How long is a maintenance window for an offline migration (minutes)? Only with migrations in a maintenance window",
172
+ "defaultValue": "120",
173
+ "type": "number"
174
+ },
175
+ {
176
+ "key": "FLAG_AGE_DAYS",
177
+ "label": "Most days a flag may stay after its feature reached all users. Only with feature flags",
178
+ "defaultValue": "90",
179
+ "type": "number"
180
+ }
181
+ ]
182
+ },
183
+ "nodes": [
184
+ {
185
+ "id": "need",
186
+ "type": "need",
187
+ "label": "Changes ship safely and undo quickly",
188
+ "x": 0,
189
+ "y": 0,
190
+ "kind": "brief",
191
+ "source": "Hub concern pack: Deployment and rollback",
192
+ "description": "The team changes this element often while people use it. A change must reach production without an outage, a bad change must be stopped before it reaches most users and be undone within minutes, the database must never block a rollback, a feature must be switchable without a deploy where the team decides so, and the team must know how often it ships and how long a change takes to reach users."
193
+ },
194
+ {
195
+ "id": "req-rollback",
196
+ "type": "requirement",
197
+ "label": "Bad release undone fast",
198
+ "x": 260,
199
+ "y": 0,
200
+ "ears_type": "event-driven",
201
+ "trigger": "a release raises the error rate or latency above its service level, or a person decides to roll it back",
202
+ "action": "restore the previous version within {{ROLLBACK_MINUTES}} minutes with one action, using the artifact already built for it and no rebuild",
203
+ "rationale": "Most outages start with a change; how long they last is how long the change takes to undo (DORA, failed deployment recovery time; The Twelve-Factor App, V)."
204
+ },
205
+ {
206
+ "id": "req-graceful",
207
+ "type": "requirement",
208
+ "label": "Deploys drop no requests",
209
+ "x": 260,
210
+ "y": 130,
211
+ "ears_type": "ubiquitous",
212
+ "action": "leave the load balancer and let its requests in flight finish, for up to 30 seconds, before an instance stops, and receive traffic on a new instance only once its readiness check (decided in the Observability pack) passes, so that a deployment under steady load fails 0 requests",
213
+ "rationale": "Requests cut off at shutdown and traffic sent to instances still starting are the errors every deployment causes unless they are designed out (Kubernetes documentation, Pod Lifecycle: termination of pods)."
214
+ },
215
+ {
216
+ "id": "req-rolling",
217
+ "type": "requirement",
218
+ "label": "Rolling update keeps capacity",
219
+ "x": 260,
220
+ "y": 260,
221
+ "ears_type": "event-driven",
222
+ "trigger": "a new version rolls out",
223
+ "action": "replace instances one at a time, starting each new one before an old one stops, and halt the rollout when new instances fail to become ready for 5 minutes or the error rate rises above its service level",
224
+ "rationale": "A rolling update that removes capacity first, or carries on past failing instances, turns a bad version into an outage (Kubernetes documentation, Deployments: rolling update strategy and progress deadline).",
225
+ "hubWhen": {
226
+ "STRATEGY": [
227
+ "rolling"
228
+ ]
229
+ }
230
+ },
231
+ {
232
+ "id": "req-bluegreen",
233
+ "type": "requirement",
234
+ "label": "Switch after smoke tests",
235
+ "x": 260,
236
+ "y": 390,
237
+ "ears_type": "event-driven",
238
+ "trigger": "a new version is deployed beside the live one",
239
+ "action": "run smoke tests against it before any user traffic reaches it, switch all traffic at once only when they pass, and keep the previous version running for 60 minutes to switch back to",
240
+ "rationale": "Blue-green buys an instant rollback by keeping the old version warm; the smoke tests decide the switch (Martin Fowler, Blue Green Deployment).",
241
+ "hubWhen": {
242
+ "STRATEGY": [
243
+ "bluegreen"
244
+ ]
245
+ }
246
+ },
247
+ {
248
+ "id": "req-canary",
249
+ "type": "requirement",
250
+ "label": "Canary judged automatically",
251
+ "x": 260,
252
+ "y": 520,
253
+ "ears_type": "event-driven",
254
+ "trigger": "a new version rolls out",
255
+ "action": "send it 5 %, 25 % and 50 % of traffic in turn for 10 minutes each, measure its success rate and 95th percentile latency at every step, and roll back automatically when the success rate drops below {{CANARY_SUCCESS_PERCENT}} % or the 95th percentile is more than 20 % above the stable version's",
256
+ "rationale": "A canary limits a bad version to a small share of users, and an automatic judgement stops it faster than a person watching dashboards (Google SRE workbook, Canarying Releases).",
257
+ "hubWhen": {
258
+ "STRATEGY": [
259
+ "canary"
260
+ ]
261
+ }
262
+ },
263
+ {
264
+ "id": "req-expand-contract",
265
+ "type": "requirement",
266
+ "label": "Schema changes stay compatible",
267
+ "x": 260,
268
+ "y": 650,
269
+ "ears_type": "ubiquitous",
270
+ "action": "change the schema only in backward-compatible steps (add, migrate data, switch the code, and remove the old at least one release later), so that the previous version keeps working against the new schema",
271
+ "rationale": "During a rollout and after a rollback, the previous version runs against the new schema; a rename or a drop in one step breaks it (Martin Fowler, Parallel Change).",
272
+ "hubWhen": {
273
+ "MIGRATIONS": [
274
+ "expand"
275
+ ]
276
+ }
277
+ },
278
+ {
279
+ "id": "req-migration-window",
280
+ "type": "requirement",
281
+ "label": "Offline migrations rehearsed",
282
+ "x": 260,
283
+ "y": 780,
284
+ "ears_type": "state-driven",
285
+ "precondition": "a schema change cannot run while the element serves",
286
+ "action": "run it only in the announced maintenance window of {{WINDOW_MINUTES}} minutes, after a rehearsal on a restored copy of production in which the migration and the way back (the restore) each finished within half the window, and with a backup taken just before it",
287
+ "rationale": "An offline migration that overruns its window, or cannot be undone, is an outage without an end; the rehearsal tells how long each takes (AWS Well-Architected Reliability Pillar, REL 8: implement change).",
288
+ "hubWhen": {
289
+ "MIGRATIONS": [
290
+ "window"
291
+ ]
292
+ }
293
+ },
294
+ {
295
+ "id": "req-no-schema",
296
+ "type": "requirement",
297
+ "label": "No schema of its own",
298
+ "x": 260,
299
+ "y": 910,
300
+ "ears_type": "ubiquitous",
301
+ "action": "keep no database schema of its own and depend on no database client or migration tool, leaving every stored state to services that own their migrations",
302
+ "rationale": "An element without a schema can always be rolled back; this keeps it that way until the decision changes.",
303
+ "hubWhen": {
304
+ "MIGRATIONS": [
305
+ "none"
306
+ ]
307
+ }
308
+ },
309
+ {
310
+ "id": "req-flags",
311
+ "type": "requirement",
312
+ "label": "Features behind flags",
313
+ "x": 260,
314
+ "y": 1040,
315
+ "ears_type": "ubiquitous",
316
+ "action": "ship unfinished or risky features switched off behind a flag that can be turned on and off per environment and per share of users without a deploy, apply a changed flag within 60 seconds, and remove each flag within {{FLAG_AGE_DAYS}} days of its feature reaching all users",
317
+ "rationale": "Flags separate deploying from releasing and make switching a feature off the fastest rollback; flags left behind become untested branches (Pete Hodgson, Feature Toggles).",
318
+ "hubWhen": {
319
+ "FLAGS": [
320
+ "yes"
321
+ ]
322
+ }
323
+ },
324
+ {
325
+ "id": "req-no-flags",
326
+ "type": "requirement",
327
+ "label": "No flags: deploys are releases",
328
+ "x": 260,
329
+ "y": 1170,
330
+ "ears_type": "ubiquitous",
331
+ "action": "make every deployed change live for everyone at once, depend on no feature flag SDK or provider, and keep work too large to finish in one change on its branch until it is",
332
+ "rationale": "Without flags, a flag SDK that arrives unnoticed is a release process nobody decided; this keeps the decision true until it is superseded.",
333
+ "hubWhen": {
334
+ "FLAGS": [
335
+ "no"
336
+ ]
337
+ }
338
+ },
339
+ {
340
+ "id": "req-continuous",
341
+ "type": "requirement",
342
+ "label": "Every merge deployed",
343
+ "x": 260,
344
+ "y": 1300,
345
+ "ears_type": "ubiquitous",
346
+ "action": "deploy every change merged to the main branch to production through the automated pipeline within 1 day, and recover from a failed deployment within {{ROLLBACK_MINUTES}} minutes by rolling back",
347
+ "rationale": "DORA's research ties on-demand deployment and lead times under a day to fewer failed changes and faster recovery (DORA, the four key metrics).",
348
+ "hubWhen": {
349
+ "CADENCE": [
350
+ "continuous"
351
+ ]
352
+ }
353
+ },
354
+ {
355
+ "id": "req-train",
356
+ "type": "requirement",
357
+ "label": "Weekly release train",
358
+ "x": 260,
359
+ "y": 1430,
360
+ "ears_type": "event-driven",
361
+ "trigger": "the weekly cut-off passes",
362
+ "action": "release every change merged before it to production within 2 working days, keeping the lead time from merge to production under 7 days, and recover from a failed deployment within {{ROLLBACK_MINUTES}} minutes by rolling back",
363
+ "rationale": "A fixed weekly train keeps batches small enough to undo; DORA's metrics show whether it is getting slower or failing more (DORA, the four key metrics).",
364
+ "hubWhen": {
365
+ "CADENCE": [
366
+ "train"
367
+ ]
368
+ }
369
+ },
370
+ {
371
+ "id": "sc-rollback",
372
+ "type": "scenario",
373
+ "label": "Rollback timed",
374
+ "x": 520,
375
+ "y": 0,
376
+ "given": "a release that raises the error rate",
377
+ "when": "the rollback is started",
378
+ "then": "the previous version serves all traffic within {{ROLLBACK_MINUTES}} minutes and nothing was rebuilt"
379
+ },
380
+ {
381
+ "id": "sc-graceful",
382
+ "type": "scenario",
383
+ "label": "Release under load",
384
+ "x": 520,
385
+ "y": 130,
386
+ "given": "steady traffic at the usual rate against staging",
387
+ "when": "a new version is deployed",
388
+ "then": "no request fails because of the deployment"
389
+ },
390
+ {
391
+ "id": "sc-rolling",
392
+ "type": "scenario",
393
+ "label": "Broken version halts",
394
+ "x": 520,
395
+ "y": 260,
396
+ "given": "a version whose instances never become ready",
397
+ "when": "it rolls out",
398
+ "then": "the rollout stops after 5 minutes with the old instances still serving",
399
+ "hubWhen": {
400
+ "STRATEGY": [
401
+ "rolling"
402
+ ]
403
+ }
404
+ },
405
+ {
406
+ "id": "sc-bluegreen",
407
+ "type": "scenario",
408
+ "label": "Failed smoke test",
409
+ "x": 520,
410
+ "y": 390,
411
+ "given": "a new version whose checkout smoke test fails",
412
+ "when": "it is deployed beside the live one",
413
+ "then": "no user traffic reaches it and the live version keeps serving",
414
+ "hubWhen": {
415
+ "STRATEGY": [
416
+ "bluegreen"
417
+ ]
418
+ }
419
+ },
420
+ {
421
+ "id": "sc-canary",
422
+ "type": "scenario",
423
+ "label": "Bad canary rolled back",
424
+ "x": 520,
425
+ "y": 520,
426
+ "given": "a version that fails more than 100 minus {{CANARY_SUCCESS_PERCENT}} % of requests",
427
+ "when": "it reaches the 5 % step",
428
+ "then": "the analysis fails and all traffic returns to the stable version within {{ROLLBACK_MINUTES}} minutes",
429
+ "hubWhen": {
430
+ "STRATEGY": [
431
+ "canary"
432
+ ]
433
+ }
434
+ },
435
+ {
436
+ "id": "sc-expand-contract",
437
+ "type": "scenario",
438
+ "label": "Rollback after migration",
439
+ "x": 520,
440
+ "y": 650,
441
+ "given": "a release that added a column and a migration that filled it",
442
+ "when": "the release is rolled back",
443
+ "then": "the previous version runs against the new schema without errors",
444
+ "hubWhen": {
445
+ "MIGRATIONS": [
446
+ "expand"
447
+ ]
448
+ }
449
+ },
450
+ {
451
+ "id": "sc-migration-window",
452
+ "type": "scenario",
453
+ "label": "Rehearsal decides",
454
+ "x": 520,
455
+ "y": 780,
456
+ "given": "an offline migration planned for the {{WINDOW_MINUTES}}-minute window",
457
+ "when": "its rehearsal on a copy of production takes longer than half the window",
458
+ "then": "it is not run in that window until it is made faster or the window longer",
459
+ "hubWhen": {
460
+ "MIGRATIONS": [
461
+ "window"
462
+ ]
463
+ }
464
+ },
465
+ {
466
+ "id": "sc-no-schema",
467
+ "type": "scenario",
468
+ "label": "Nothing to migrate",
469
+ "x": 520,
470
+ "y": 910,
471
+ "given": "the element's repository",
472
+ "when": "its dependencies are searched for database clients and migration tools, and its tree for a migrations directory",
473
+ "then": "there are none",
474
+ "hubWhen": {
475
+ "MIGRATIONS": [
476
+ "none"
477
+ ]
478
+ }
479
+ },
480
+ {
481
+ "id": "sc-flags",
482
+ "type": "scenario",
483
+ "label": "Feature switched off",
484
+ "x": 520,
485
+ "y": 1040,
486
+ "given": "a feature turned on for 10 % of users",
487
+ "when": "its flag is turned off",
488
+ "then": "within 60 seconds no user sees it, and nothing was deployed",
489
+ "hubWhen": {
490
+ "FLAGS": [
491
+ "yes"
492
+ ]
493
+ }
494
+ },
495
+ {
496
+ "id": "sc-no-flags",
497
+ "type": "scenario",
498
+ "label": "No flag SDK",
499
+ "x": 520,
500
+ "y": 1170,
501
+ "given": "the element's repository",
502
+ "when": "its dependencies are searched for feature flag SDKs and providers",
503
+ "then": "there are none",
504
+ "hubWhen": {
505
+ "FLAGS": [
506
+ "no"
507
+ ]
508
+ }
509
+ },
510
+ {
511
+ "id": "sc-continuous",
512
+ "type": "scenario",
513
+ "label": "Merge reaches production",
514
+ "x": 520,
515
+ "y": 1300,
516
+ "given": "a change merged to the main branch in the morning",
517
+ "when": "the day ends",
518
+ "then": "it is in production, deployed by the pipeline",
519
+ "hubWhen": {
520
+ "CADENCE": [
521
+ "continuous"
522
+ ]
523
+ }
524
+ },
525
+ {
526
+ "id": "sc-train",
527
+ "type": "scenario",
528
+ "label": "Train leaves on time",
529
+ "x": 520,
530
+ "y": 1430,
531
+ "given": "changes merged before Tuesday's cut-off",
532
+ "when": "the release train runs",
533
+ "then": "they are in production by Thursday",
534
+ "hubWhen": {
535
+ "CADENCE": [
536
+ "train"
537
+ ]
538
+ }
539
+ },
540
+ {
541
+ "id": "adr-rolling",
542
+ "type": "adr",
543
+ "label": "Rolling updates",
544
+ "x": 780,
545
+ "y": 0,
546
+ "concern": "deployment",
547
+ "status": "accepted",
548
+ "date": "",
549
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
550
+ "decision": "New versions roll out as a rolling update: on Kubernetes a Deployment with maxUnavailable 0 and maxSurge 1, a preStop delay, a progress deadline of 5 minutes and the readiness probes decided in the Observability pack; on other platforms the equivalent (ECS rolling deployments with the deployment circuit breaker, Azure App Service or Cloud Run revisions). The pipeline watches the error rate during the rollout and runs kubectl rollout undo (or the platform's rollback) when it rises. The previous version's image stays in the registry, so rollback takes {{ROLLBACK_MINUTES}} minutes at most. Schema changes: {{MIGRATIONS}}. Feature flags: {{FLAGS}}. Cadence: {{CADENCE}}.",
551
+ "consequences": "• Nothing to install beyond the platform; the cheapest strategy.\n• Old and new versions serve together for minutes: both must work with the same schema and messages.\n• A bad version reaches a growing share of users until someone or something notices.\n• Rollback is another rolling update, minutes rather than seconds.",
552
+ "alternatives": "1. Canary with automatic analysis: limits a bad version to 5 % of traffic, but needs Argo Rollouts or Flagger and metrics per version.\n2. Blue-green: instant switch back, at double capacity during each release.",
553
+ "hubWhen": {
554
+ "STRATEGY": [
555
+ "rolling"
556
+ ]
557
+ }
558
+ },
559
+ {
560
+ "id": "adr-bluegreen",
561
+ "type": "adr",
562
+ "label": "Blue-green deployments",
563
+ "x": 780,
564
+ "y": 130,
565
+ "concern": "deployment",
566
+ "status": "accepted",
567
+ "date": "",
568
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
569
+ "decision": "New versions deploy beside the live one and take traffic all at once after their smoke tests pass: on Kubernetes with Argo Rollouts (blueGreen strategy with pre-promotion analysis), elsewhere with AWS CodeDeploy blue/green, Azure App Service deployment slots or two target groups behind the load balancer. The previous version keeps running for 60 minutes after the switch, so switching back takes seconds and always within {{ROLLBACK_MINUTES}} minutes. Schema changes: {{MIGRATIONS}}. Feature flags: {{FLAGS}}. Cadence: {{CADENCE}}. Choose the tool by the platform the element runs on.",
570
+ "consequences": "• Rollback is a switch: seconds, not a redeploy.\n• Users never see two versions at once, but the database does: the schema must still suit both.\n• Double the capacity during each release, and a full environment to warm up.\n• All users get the new version at once; smoke tests are the only gate before them.",
571
+ "alternatives": "1. Canary: exposes a bad version to a few users first, with gradual traffic shifting.\n2. Rolling update: no extra capacity, but rollback is slower and versions mix.",
572
+ "hubWhen": {
573
+ "STRATEGY": [
574
+ "bluegreen"
575
+ ]
576
+ }
577
+ },
578
+ {
579
+ "id": "adr-canary",
580
+ "type": "adr",
581
+ "label": "Canary with automatic analysis",
582
+ "x": 780,
583
+ "y": 260,
584
+ "concern": "deployment",
585
+ "status": "accepted",
586
+ "date": "",
587
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
588
+ "decision": "New versions roll out as a canary: 5 %, 25 %, 50 %, then 100 % of traffic, 10 minutes per step, with an automatic analysis at every step from Prometheus (or the metrics backend): the canary's success rate must stay at or above {{CANARY_SUCCESS_PERCENT}} % and its 95th percentile latency within 20 % of the stable version's, or the rollout aborts. Tooling: Argo Rollouts or Flagger on Kubernetes, with traffic split by the ingress or service mesh (NGINX, Istio, Linkerd, Gateway API); AWS CodeDeploy or App Mesh canaries on ECS and Lambda. Choose Argo Rollouts when the team already uses Argo CD, Flagger when it uses Flux. An abort returns all traffic to the stable version within {{ROLLBACK_MINUTES}} minutes. Schema changes: {{MIGRATIONS}}. Feature flags: {{FLAGS}}. Cadence: {{CADENCE}}.",
589
+ "consequences": "• A bad version reaches 5 % of users for minutes, not everyone.\n• Rollback is automatic and does not wait for a person.\n• Needs metrics per version and enough traffic for the analysis to be meaningful; at low traffic the steps judge noise.\n• A rollout takes 30 minutes or more; urgent fixes need a documented fast path.",
590
+ "alternatives": "1. Rolling update with a person watching: simpler, but slower to notice and a bad version reaches everyone.\n2. Blue-green: instant switch back, but everyone gets the new version at once.",
591
+ "hubWhen": {
592
+ "STRATEGY": [
593
+ "canary"
594
+ ]
595
+ }
596
+ },
597
+ {
598
+ "id": "adr-expand-contract",
599
+ "type": "adr",
600
+ "label": "Expand and contract migrations",
601
+ "x": 780,
602
+ "y": 390,
603
+ "concern": "deployment",
604
+ "status": "accepted",
605
+ "date": "",
606
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
607
+ "decision": "Schema changes ship as expand and contract: a migration only adds (columns, tables, indexes built concurrently), data is backfilled in batches, the code switches over in a later release, and removals come at least one release after nothing reads the old shape. Migrations run as a separate pipeline step before the new version rolls out, with the migration tool decided in the Data store pack (Flyway, Liquibase, Atlas, or the framework's own), which records what ran. A linter in CI refuses destructive or backward-incompatible changes (Atlas migrate lint, or Squawk for PostgreSQL).",
608
+ "consequences": "• The previous version always runs against the current schema, so rollback never waits on the database.\n• A rename or type change takes two or three releases instead of one.\n• Old columns linger until the contract step; someone has to schedule it.\n• Backfills on large tables run in batches, outside the deployment.",
609
+ "alternatives": "1. Migrations in a maintenance window: one step, but downtime and no quick rollback.\n2. Migrations that run on application start: simple, but every instance races to migrate and a failure blocks the rollout.",
610
+ "hubWhen": {
611
+ "MIGRATIONS": [
612
+ "expand"
613
+ ]
614
+ }
615
+ },
616
+ {
617
+ "id": "adr-migration-window",
618
+ "type": "adr",
619
+ "label": "Offline migrations in a window",
620
+ "x": 780,
621
+ "y": 520,
622
+ "concern": "deployment",
623
+ "status": "accepted",
624
+ "date": "",
625
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
626
+ "decision": "Schema changes that cannot run online are made in an announced maintenance window of {{WINDOW_MINUTES}} minutes with the element stopped. Before the window, the migration is rehearsed on a copy of production restored from the latest backup, and it runs only if the migration and the way back (restoring that backup) each finished within half the window in the rehearsal. Just before the window a fresh backup is taken. Changes that can run online still ship as expand and contract. Migrations run with the tool decided in the Data store pack (Flyway, Liquibase, Atlas or the framework's own), from the pipeline, never by hand.",
627
+ "consequences": "• Large or awkward changes can be done in one step.\n• Each window is downtime, announced in advance and counted by users if not by the target.\n• Rollback after the window means restoring the backup and losing what was written since.\n• A copy of production for the rehearsal must be kept safe like production.",
628
+ "alternatives": "1. Expand and contract only: no downtime, but some changes take several releases.\n2. Online schema change tools (gh-ost, pt-online-schema-change, pg_repack): big changes without downtime, with tooling to learn.",
629
+ "hubWhen": {
630
+ "MIGRATIONS": [
631
+ "window"
632
+ ]
633
+ }
634
+ },
635
+ {
636
+ "id": "adr-no-schema",
637
+ "type": "adr",
638
+ "label": "No schema of its own",
639
+ "x": 780,
640
+ "y": 650,
641
+ "concern": "deployment",
642
+ "status": "accepted",
643
+ "date": "",
644
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours. Here the element stores nothing of its own: every state it touches lives in a service that owns its migrations.",
645
+ "decision": "The element keeps no database schema and depends on no database client or migration tool; a dependency rule in CI fails the build when one arrives. State it needs lives in services that own their migrations and are reached through their APIs. Adding a store of its own supersedes this decision and brings the schema change question back.",
646
+ "consequences": "• Rollback never waits on a database: the previous version always runs.\n• A feature that needs state of its own has to supersede this decision first, or put the state in a service that owns it.\n• Nothing to migrate, back up or rehearse for this element.",
647
+ "alternatives": "1. Expand and contract migrations: for when the element gets a store of its own.\n2. A cache or local file as hidden state: works until a second instance or a rollback shows it was a schema after all.",
648
+ "hubWhen": {
649
+ "MIGRATIONS": [
650
+ "none"
651
+ ]
652
+ }
653
+ },
654
+ {
655
+ "id": "adr-flags",
656
+ "type": "adr",
657
+ "label": "Features released behind flags",
658
+ "x": 780,
659
+ "y": 780,
660
+ "concern": "deployment",
661
+ "status": "accepted",
662
+ "date": "",
663
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
664
+ "decision": "Deploying is separate from releasing: unfinished or risky features ship switched off behind a feature flag and are turned on per environment and per share of users without a deploy. Flags are read through the OpenFeature SDK with one provider for the organisation (LaunchDarkly, Unleash, ConfigCat, or flagd with the flag definitions in the repository); choose by whether a hosted provider is allowed to hold the targeting data, and by cost per seat. A changed flag takes effect within 60 seconds on every instance. A flag whose feature has reached all users is a debt item: it is removed, with the code path behind it, within {{FLAG_AGE_DAYS}} days, and a test fails the build on an older one. Turning a flag off is the first rollback for a released feature; the deployment rollback is the second.",
665
+ "consequences": "• Code reaches production continuously; releases are business decisions, made in the flag tool.\n• Every flag doubles the paths to test until it is removed; the {{FLAG_AGE_DAYS}}-day removal is what keeps the count down.\n• The provider is on the request path or in the SDK's cache: its outage must leave the element on the last known flags.\n• Who may flip a flag in production is an access decision, written down next to the flags.",
666
+ "alternatives": "1. No flags, a deploy is a release: simpler, but every merge is visible to everyone at once.\n2. Flags in configuration files or environment variables: no provider, but changing one is a deploy.",
667
+ "hubWhen": {
668
+ "FLAGS": [
669
+ "yes"
670
+ ]
671
+ }
672
+ },
673
+ {
674
+ "id": "adr-no-flags",
675
+ "type": "adr",
676
+ "label": "A deploy is a release",
677
+ "x": 780,
678
+ "y": 910,
679
+ "concern": "deployment",
680
+ "status": "accepted",
681
+ "date": "",
682
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours. Here the team keeps changes small enough to finish in one change and trusts the rollback, so it does without flags.",
683
+ "decision": "There are no feature flags: what is merged and deployed is live for everyone. Unfinished work stays on a branch until it is small enough to ship whole, or ships dark behind a route nobody links to. Rolling back a release is the only way to take a feature back, within {{ROLLBACK_MINUTES}} minutes. This decision is superseded when a feature has to reach some users before others, or be released at a business date apart from its deploy.",
684
+ "consequences": "• No flag provider, no flag clean-up, one path to test.\n• A feature cannot be switched off without rolling back everything deployed with it.\n• Features that take weeks need long-lived branches or dark routes, both of which hide integration problems.",
685
+ "alternatives": "1. Feature flags through OpenFeature with a provider: releases apart from deploys, at the cost of flags and their removal.\n2. Flags in configuration: a half-way that still needs a deploy to flip.",
686
+ "hubWhen": {
687
+ "FLAGS": [
688
+ "no"
689
+ ]
690
+ }
691
+ },
692
+ {
693
+ "id": "adr-continuous",
694
+ "type": "adr",
695
+ "label": "Continuous deployment",
696
+ "x": 780,
697
+ "y": 1040,
698
+ "concern": "deployment",
699
+ "status": "accepted",
700
+ "date": "",
701
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
702
+ "decision": "Every change merged to the main branch goes to production through the pipeline without a manual step, the same day: trunk-based development with short-lived branches and the rollout strategy above as the safety net. Feature flags: {{FLAGS}}; what is not ready for users either ships switched off behind a flag or stays small enough to finish in one change. The DORA metrics: a weekly job checks deployment frequency (a production deployment on at least 5 days a week) and lead time (every merge in production within 1 day); the change failure rate and the recovery time ({{ROLLBACK_MINUTES}} minutes by rollback) come from the incident tracker and the rollback drill, and all four are reviewed every month (Apache DevLake, Sleuth, LinearB or the CI system's own reports).",
703
+ "consequences": "• Small batches: each release is easy to understand and to undo.\n• The pipeline's tests and rollout checks are the only gate; their quality is the release process.\n• Users see changes continuously; announcements are tied to flags or to dark routes, not to deploys.",
704
+ "alternatives": "1. A weekly release train: more coordination, larger batches.\n2. Manual approval of each production deploy: a person as the gate, slower without being safer.",
705
+ "hubWhen": {
706
+ "CADENCE": [
707
+ "continuous"
708
+ ]
709
+ }
710
+ },
711
+ {
712
+ "id": "adr-release-train",
713
+ "type": "adr",
714
+ "label": "Weekly release train",
715
+ "x": 780,
716
+ "y": 1170,
717
+ "concern": "deployment",
718
+ "status": "accepted",
719
+ "date": "",
720
+ "context": "This element is changed and deployed while people use it. The forces: most outages start with a change, so how a change reaches production decides much of the availability; a release that cannot be undone quickly turns a small mistake into a long outage; old and new versions run side by side during most deployments and both must work against the same database; a schema change that the previous version cannot read makes rollback impossible; small, frequent changes fail less often and are easier to undo than large, rare ones (DORA); and deploying is not the same as releasing: code can be in production without users seeing it. The snippets of this pack assume the element is deployed to the shop namespace as order-api; rename them for yours.",
721
+ "decision": "Changes merged before a weekly cut-off are released together within 2 working days, through the same automated pipeline and rollout strategy; urgent fixes can leave outside the train. Feature flags: {{FLAGS}}. The DORA metrics: a weekly job checks deployment frequency (at least one production release every 7 days) and lead time (every merge in production within 7 days); the change failure rate and the recovery time ({{ROLLBACK_MINUTES}} minutes by rollback) come from the incident tracker and the rollback drill, and all four are reviewed every month (Apache DevLake, Sleuth, LinearB or the CI system's own reports).",
722
+ "consequences": "• Releases are predictable for customers, support and app stores.\n• Batches are a week of changes: a failure is harder to pin on one change.\n• Lead time is up to a week by design; moving to continuous deployment later is a change of policy, not of tooling.",
723
+ "alternatives": "1. Continuous deployment: smaller batches and shorter lead time, with full trust in the pipeline.\n2. Monthly or quarterly releases: big batches that fail more often and are hard to undo (DORA).",
724
+ "hubWhen": {
725
+ "CADENCE": [
726
+ "train"
727
+ ]
728
+ }
729
+ },
730
+ {
731
+ "id": "ff-rollback-drill",
732
+ "type": "fitness-fn",
733
+ "label": "Rollback drilled",
734
+ "x": 1040,
735
+ "y": 0,
736
+ "characteristic": "reliability",
737
+ "scope": "holistic",
738
+ "cadence": "triggered",
739
+ "trigger": "weekly",
740
+ "invocation": "automated",
741
+ "description": "A scheduled pipeline rolls the staging deployment back to the previous version and forward again, timing each, and fails past {{ROLLBACK_MINUTES}} minutes. With Argo Rollouts use kubectl argo rollouts undo and status instead; on a managed runtime, the platform's rollback command (az webapp deployment slot swap, gcloud run services update-traffic).\n\nThreshold: Rollback of the staging deployment to the previous version completes within {{ROLLBACK_MINUTES}} minutes, every week\n\nTool: GitHub Actions scheduled workflow with kubectl\n\n```yaml\nname: rollback-drill\non:\n schedule: [{ cron: '0 9 * * 1' }] # Mondays 09:00\njobs:\n drill:\n runs-on: ubuntu-latest\n environment: staging\n steps:\n - name: Roll back and time it\n run: |\n start=$(date +%s)\n kubectl -n shop-staging rollout undo deployment/order-api\n kubectl -n shop-staging rollout status deployment/order-api --timeout={{ROLLBACK_MINUTES}}m\n echo \"Rolled back in $(( $(date +%s) - start )) s\"\n - name: Roll forward again\n if: always()\n run: |\n kubectl -n shop-staging rollout undo deployment/order-api\n kubectl -n shop-staging rollout status deployment/order-api --timeout={{ROLLBACK_MINUTES}}m\n```"
742
+ },
743
+ {
744
+ "id": "ff-graceful",
745
+ "type": "fitness-fn",
746
+ "label": "Deploy under load drops nothing",
747
+ "x": 1040,
748
+ "y": 130,
749
+ "characteristic": "reliability",
750
+ "scope": "holistic",
751
+ "cadence": "triggered",
752
+ "trigger": "deploy",
753
+ "invocation": "automated",
754
+ "description": "The staging pipeline starts a k6 run at a steady rate, deploys the new version while it runs, and lets the run end two minutes after the rollout finished; the threshold fails the run, and the pipeline, on any failed request. It catches instances stopped with requests in flight and traffic routed before readiness.\n\nThreshold: 0 failed requests (connection errors, 502, 503, 504) in a k6 run that spans a staging deployment at a steady rate\n\nTool: Grafana k6, started by the staging deploy job\n\n```js\n// k6 run --env BASE_URL=https://staging.shop.example deploy-under-load.js &\n// then, in the same job: kubectl -n shop-staging set image deployment/order-api order-api=$IMAGE\n// && kubectl -n shop-staging rollout status deployment/order-api --timeout=4m; wait (the k6 exit code fails the job)\nimport http from 'k6/http'\n\nexport const options = {\n scenarios: {\n steady: { executor: 'constant-arrival-rate', rate: 50, timeUnit: '1s', duration: '6m', preAllocatedVUs: 100, maxVUs: 500 },\n },\n thresholds: {\n http_req_failed: ['rate==0'], // one connection reset or 5xx during the rollout fails the run\n },\n}\n\nexport default function () {\n http.get(`${__ENV.BASE_URL}/orders?page=1`)\n}\n```"
755
+ },
756
+ {
757
+ "id": "ff-rolling",
758
+ "type": "fitness-fn",
759
+ "label": "Rolling update keeps capacity",
760
+ "x": 1040,
761
+ "y": 260,
762
+ "characteristic": "reliability",
763
+ "scope": "atomic",
764
+ "cadence": "triggered",
765
+ "trigger": "pull-request",
766
+ "invocation": "automated",
767
+ "description": "A policy over the Kubernetes manifests fails the pipeline when a Deployment could remove capacity during a rollout, stop an instance without a preStop delay, or carry on forever past failing instances. Liveness and readiness probes are checked by the Observability pack's policy.\n\nThreshold: 0 Deployments with a Recreate strategy, maxUnavailable above 0, maxSurge of 0, a progress deadline above 300 s, or a container without a preStop hook\n\nTool: Conftest (Open Policy Agent)\n\n```rego\npackage main\n\nimport rego.v1\n\ndeny contains msg if {\n input.kind == \"Deployment\"\n input.spec.strategy.type == \"Recreate\"\n msg := sprintf(\"%s: strategy Recreate stops every instance first; use RollingUpdate\", [input.metadata.name])\n}\n\ndeny contains msg if {\n input.kind == \"Deployment\"\n unavailable := object.get(input.spec, [\"strategy\", \"rollingUpdate\", \"maxUnavailable\"], \"25%\")\n not unavailable in {0, \"0\", \"0%\"}\n msg := sprintf(\"%s: set strategy.rollingUpdate.maxUnavailable to 0 (is %v)\", [input.metadata.name, unavailable])\n}\n\ndeny contains msg if {\n input.kind == \"Deployment\"\n surge := object.get(input.spec, [\"strategy\", \"rollingUpdate\", \"maxSurge\"], \"25%\")\n surge in {0, \"0\", \"0%\"}\n msg := sprintf(\"%s: set strategy.rollingUpdate.maxSurge to 1 or more\", [input.metadata.name])\n}\n\ndeny contains msg if {\n input.kind == \"Deployment\"\n object.get(input.spec, \"progressDeadlineSeconds\", 600) > 300\n msg := sprintf(\"%s: set progressDeadlineSeconds to 300 or less\", [input.metadata.name])\n}\n\ndeny contains msg if {\n input.kind == \"Deployment\"\n some c in input.spec.template.spec.containers\n not c.lifecycle.preStop\n msg := sprintf(\"%s: container %s has no lifecycle.preStop (a sleep that lets the load balancer drain it)\", [input.metadata.name, c.name])\n}\n```",
768
+ "hubWhen": {
769
+ "STRATEGY": [
770
+ "rolling"
771
+ ]
772
+ }
773
+ },
774
+ {
775
+ "id": "ff-bluegreen",
776
+ "type": "fitness-fn",
777
+ "label": "Switch gated by smoke tests",
778
+ "x": 1040,
779
+ "y": 390,
780
+ "characteristic": "reliability",
781
+ "scope": "holistic",
782
+ "cadence": "triggered",
783
+ "trigger": "deploy",
784
+ "invocation": "automated",
785
+ "description": "The Rollout runs a k6 smoke-test job against the preview service before promotion; a failed job aborts the release with the live version untouched. The script comes from a ConfigMap mounted into the job. The previous version is scaled down only an hour after the switch.\n\nThreshold: Traffic switches only after the smoke-test job passes against the preview service; the previous version is kept for 3600 s after the switch\n\nTool: Argo Rollouts (blueGreen strategy, pre-promotion analysis)\n\n```yaml\napiVersion: argoproj.io/v1alpha1\nkind: Rollout\nmetadata: { name: order-api, namespace: shop }\nspec:\n strategy:\n blueGreen:\n activeService: order-api\n previewService: order-api-preview\n autoPromotionEnabled: true\n scaleDownDelaySeconds: 3600\n prePromotionAnalysis:\n templates: [{ templateName: smoke-tests }]\n---\napiVersion: v1\nkind: ConfigMap\nmetadata: { name: smoke-tests, namespace: shop }\ndata:\n smoke.js: |\n import http from 'k6/http'\n import { check } from 'k6'\n export const options = { vus: 1, iterations: 10, thresholds: { checks: ['rate==1'] } }\n export default function () {\n const res = http.get(`${__ENV.BASE_URL}/orders?page=1`)\n check(res, { 'orders answer 200': (r) => r.status === 200 })\n }\n---\napiVersion: argoproj.io/v1alpha1\nkind: AnalysisTemplate\nmetadata: { name: smoke-tests, namespace: shop }\nspec:\n metrics:\n - name: smoke\n provider:\n job:\n spec:\n backoffLimit: 0\n template:\n spec:\n restartPolicy: Never\n volumes: [{ name: tests, configMap: { name: smoke-tests } }]\n containers:\n - name: k6\n image: grafana/k6:0.54.0\n args: [run, --env, BASE_URL=http://order-api-preview, /tests/smoke.js]\n volumeMounts: [{ name: tests, mountPath: /tests }]\n```",
786
+ "hubWhen": {
787
+ "STRATEGY": [
788
+ "bluegreen"
789
+ ]
790
+ }
791
+ },
792
+ {
793
+ "id": "ff-canary",
794
+ "type": "fitness-fn",
795
+ "label": "Canary analysis aborts bad versions",
796
+ "x": 1040,
797
+ "y": 520,
798
+ "characteristic": "reliability",
799
+ "scope": "holistic",
800
+ "cadence": "triggered",
801
+ "trigger": "deploy",
802
+ "invocation": "automated",
803
+ "description": "The Rollout shifts traffic in steps and runs an analysis from the first step on, measured every minute: the canary's success rate against {{CANARY_SUCCESS_PERCENT}} %, and the ratio of the canary's 95th percentile to the stable version's against 1.2. A second failed measurement of either aborts the rollout and returns all traffic to the stable version. Flagger's Canary resource with metric templates does the same.\n\nThreshold: A canary step fails at a success rate below {{CANARY_SUCCESS_PERCENT}} % or a 95th percentile more than 20 % above the stable version's; a second failed measurement aborts the rollout\n\nTool: Argo Rollouts (canary strategy with a Prometheus AnalysisTemplate)\n\n```yaml\napiVersion: argoproj.io/v1alpha1\nkind: Rollout\nmetadata: { name: order-api, namespace: shop }\nspec:\n strategy:\n canary:\n canaryService: order-api-canary\n stableService: order-api\n trafficRouting: { nginx: { stableIngress: order-api } }\n analysis:\n templates: [{ templateName: canary-health }]\n startingStep: 1\n args:\n - { name: canary, value: order-api-canary }\n - { name: stable, value: order-api }\n steps:\n - setWeight: 5\n - pause: { duration: 10m }\n - setWeight: 25\n - pause: { duration: 10m }\n - setWeight: 50\n - pause: { duration: 10m }\n---\napiVersion: argoproj.io/v1alpha1\nkind: AnalysisTemplate\nmetadata: { name: canary-health, namespace: shop }\nspec:\n args: [{ name: canary }, { name: stable }]\n metrics:\n - name: success-rate\n interval: 1m\n failureLimit: 1 # a second failed measurement fails the analysis\n successCondition: result[0] * 100 >= {{CANARY_SUCCESS_PERCENT}}\n provider:\n prometheus:\n address: http://prometheus.monitoring:9090\n query: |\n sum(rate(http_server_request_duration_seconds_count{service=\"{{args.canary}}\",http_response_status_code!~\"5..\"}[2m]))\n / sum(rate(http_server_request_duration_seconds_count{service=\"{{args.canary}}\"}[2m]))\n - name: p95-vs-stable\n interval: 1m\n failureLimit: 1\n successCondition: result[0] <= 1.2 # canary p95 at most 20 % above the stable p95\n provider:\n prometheus:\n address: http://prometheus.monitoring:9090\n query: |\n histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{service=\"{{args.canary}}\"}[2m])))\n / histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{service=\"{{args.stable}}\"}[2m])))\n```",
804
+ "hubWhen": {
805
+ "STRATEGY": [
806
+ "canary"
807
+ ]
808
+ }
809
+ },
810
+ {
811
+ "id": "ff-migration-lint",
812
+ "type": "fitness-fn",
813
+ "label": "Migrations stay compatible",
814
+ "x": 1040,
815
+ "y": 650,
816
+ "characteristic": "compatibility",
817
+ "scope": "atomic",
818
+ "cadence": "triggered",
819
+ "trigger": "pull-request",
820
+ "invocation": "automated",
821
+ "description": "Every pull request that adds a migration is linted against the main branch; dropping or renaming a column or table fails the build unless the migration is the contract step of an earlier expand, marked with a lint directive and reviewed.\n\nThreshold: 0 destructive or backward-incompatible statements (drop, rename, type change) in a migration that is not a marked contract step\n\nTool: Atlas (atlas migrate lint); Squawk does the same for PostgreSQL\n\n```hcl\n# atlas.hcl\nlint {\n destructive {\n error = true\n }\n incompatible {\n error = true\n }\n}\n\nenv \"ci\" {\n dev = \"docker://postgres/16/dev\"\n migration {\n dir = \"file://migrations\"\n }\n}\n\n# CI step:\n# atlas migrate lint --env ci --git-base origin/main\n# A reviewed contract step opts out per statement with:\n# -- atlas:nolint destructive\n```",
822
+ "hubWhen": {
823
+ "MIGRATIONS": [
824
+ "expand"
825
+ ]
826
+ }
827
+ },
828
+ {
829
+ "id": "ff-migration-rehearsal",
830
+ "type": "fitness-fn",
831
+ "label": "Offline migration rehearsed",
832
+ "x": 1040,
833
+ "y": 780,
834
+ "characteristic": "reliability",
835
+ "scope": "atomic",
836
+ "cadence": "triggered",
837
+ "trigger": "deploy",
838
+ "invocation": "automated",
839
+ "description": "A pipeline job restores the latest backup into a rehearsal database, runs the pending migrations against it and times them, then restores the backup again (the way back) and times that; it fails when either took longer than half the window. The production job runs only after an approval in a protected environment, takes a backup first, and only follows a passed rehearsal.\n\nThreshold: In the rehearsal on a restored copy of production, the migration and the restore each finish within half of {{WINDOW_MINUTES}} minutes; the production run needs an approved environment\n\nTool: GitHub Actions (protected environment) with pg_restore and Flyway\n\n```yaml\njobs:\n rehearse:\n runs-on: ubuntu-latest\n steps:\n - run: |\n half=$(( {{WINDOW_MINUTES}} * 30 )) # seconds: half of {{WINDOW_MINUTES}} minutes\n pg_restore --clean --no-owner -d \"$REHEARSAL_DB_URL\" backups/latest.dump\n start=$(date +%s)\n flyway -url=\"$REHEARSAL_JDBC_URL\" -locations=filesystem:migrations migrate\n took=$(( $(date +%s) - start ))\n echo \"Migration took $took s\"\n test \"$took\" -le \"$half\" || { echo \"::error::Migration longer than half the window\"; exit 1; }\n start=$(date +%s)\n pg_restore --clean --no-owner -d \"$REHEARSAL_DB_URL\" backups/latest.dump\n took=$(( $(date +%s) - start ))\n echo \"The way back (restore) took $took s\"\n test \"$took\" -le \"$half\" || { echo \"::error::Restore longer than half the window\"; exit 1; }\n migrate:\n needs: rehearse\n runs-on: ubuntu-latest\n environment: production-maintenance # required reviewers; the window is announced\n steps:\n - run: |\n ./scripts/backup-now.sh\n flyway -url=\"$PROD_JDBC_URL\" -locations=filesystem:migrations migrate\n```",
840
+ "hubWhen": {
841
+ "MIGRATIONS": [
842
+ "window"
843
+ ]
844
+ }
845
+ },
846
+ {
847
+ "id": "ff-no-schema",
848
+ "type": "fitness-fn",
849
+ "label": "No database client arrives",
850
+ "x": 1040,
851
+ "y": 910,
852
+ "characteristic": "maintainability",
853
+ "scope": "atomic",
854
+ "cadence": "triggered",
855
+ "trigger": "pull-request",
856
+ "invocation": "automated",
857
+ "description": "A dependency rule fails the build when a database driver, ORM or migration tool is added, which would mean a schema arrived without its decision; a pipeline step fails on a migrations directory. For Python, Go or the JVM, the same rule goes in the dependency allow-list of the build (pip-audit --require-hashes with a constraints file, go.mod review, a Gradle dependency verification).\n\nThreshold: 0 dependencies on a database client or migration tool, and no migrations directory in the repository\n\nTool: dependency-cruiser; for Python: a constraints file reviewed in CI; for Go: go.mod reviewed in CI\n\n```js\n// .dependency-cruiser.cjs\nmodule.exports = {\n forbidden: [{\n name: 'no-schema-of-its-own',\n comment: 'ADR No schema of its own: supersede it before adding a database client or a migration tool',\n severity: 'error',\n from: {},\n to: { path: 'node_modules/(pg|mysql2|mongodb|mongoose|@prisma/client|prisma|knex|typeorm|sequelize|drizzle-orm|node-pg-migrate|umzug)(/|$)' },\n }],\n}\n// CI, after depcruise: test ! -e migrations -a ! -e prisma/migrations -a ! -e db/migrate\n```",
858
+ "hubWhen": {
859
+ "MIGRATIONS": [
860
+ "none"
861
+ ]
862
+ }
863
+ },
864
+ {
865
+ "id": "ff-flag-age",
866
+ "type": "fitness-fn",
867
+ "label": "Stale flags removed",
868
+ "x": 1040,
869
+ "y": 1040,
870
+ "characteristic": "maintainability",
871
+ "scope": "atomic",
872
+ "cadence": "triggered",
873
+ "trigger": "pull-request",
874
+ "invocation": "automated",
875
+ "description": "A test reads the flagd flag definitions kept in the repository, treats a flag as fully released when it is enabled with defaultVariant on and no targeting, takes the date its defaultVariant line last changed from git blame, and fails for every flag released longer than {{FLAG_AGE_DAYS}} days ago, so that it is removed with the code path behind it. The checkout needs the history (fetch-depth: 0). With a hosted provider, read the flags and their last change from its API instead.\n\nThreshold: 0 flags on for everyone for more than {{FLAG_AGE_DAYS}} days\n\nTool: Vitest over flagd (OpenFeature) flag definitions, with git blame\n\n```ts\nimport { execFileSync } from 'node:child_process'\nimport { readFileSync } from 'node:fs'\n\nconst FILE = 'flags/flags.flagd.json'\nconst text = readFileSync(FILE, 'utf8')\nconst lines = text.split('\\n')\nconst { flags } = JSON.parse(text) as {\n flags: Record<string, { state: 'ENABLED' | 'DISABLED'; defaultVariant?: string; targeting?: unknown }>\n}\nconst MAX_DAYS = {{FLAG_AGE_DAYS}}\n\n/** When the given line of the file last changed, from git blame. */\nconst changedAt = (line: number): number => {\n const blame = execFileSync('git', ['blame', '--porcelain', `-L${line},${line}`, '--', FILE], { encoding: 'utf8' })\n return Number(/^committer-time (\\d+)$/m.exec(blame)![1]) * 1000\n}\n\nit.each(Object.entries(flags))('flag %s is removed in time after its full release', (key, flag) => {\n const released = flag.state === 'ENABLED' && flag.defaultVariant === 'on' && !flag.targeting\n if (!released) return\n const start = lines.findIndex((l) => l.includes(`\"${key}\"`))\n const line = lines.findIndex((l, i) => i > start && l.includes('\"defaultVariant\"')) + 1\n const days = (Date.now() - changedAt(line)) / 86_400_000\n expect(days, `remove flag ${key}: on for everyone for ${Math.floor(days)} days`).toBeLessThanOrEqual(MAX_DAYS)\n})\n```",
876
+ "hubWhen": {
877
+ "FLAGS": [
878
+ "yes"
879
+ ]
880
+ }
881
+ },
882
+ {
883
+ "id": "ff-flag-propagation",
884
+ "type": "fitness-fn",
885
+ "label": "Flag changes take effect in time",
886
+ "x": 1040,
887
+ "y": 1170,
888
+ "characteristic": "flexibility",
889
+ "scope": "holistic",
890
+ "cadence": "triggered",
891
+ "trigger": "deploy",
892
+ "invocation": "automated",
893
+ "description": "An integration test against the staging element turns a flag on and then off at its source (the flag definitions file flagd watches, or the provider's API with a hosted provider) and polls the element until its answer changes, failing past 60 seconds.\n\nThreshold: A flag turned off reaches the element within 60 seconds, with no deployment\n\nTool: Vitest against staging, writing the flagd flag definitions (or the provider's API)\n\n```ts\nimport { readFileSync, writeFileSync } from 'node:fs'\n\nconst FLAGS = process.env.FLAGS_FILE ?? 'flags/flags.flagd.json' // the file flagd syncs from\nconst BASE_URL = process.env.BASE_URL!\nconst FLAG = 'new-checkout'\n\nconst setDefault = (variant: 'on' | 'off'): void => {\n const doc = JSON.parse(readFileSync(FLAGS, 'utf8'))\n doc.flags[FLAG].defaultVariant = variant\n writeFileSync(FLAGS, JSON.stringify(doc, null, 2))\n}\nconst until = async (ok: () => Promise<boolean>, ms: number): Promise<void> => {\n const end = Date.now() + ms\n while (!(await ok())) {\n if (Date.now() > end) throw new Error(`not applied within ${ms} ms`)\n await new Promise((r) => setTimeout(r, 1000))\n }\n}\nconst seen = async (): Promise<string | null> => (await fetch(`${BASE_URL}/checkout`)).headers.get('x-feature-new-checkout')\n\nit('a flag turned off reaches the element within 60 seconds', async () => {\n setDefault('on')\n await until(async () => (await seen()) === 'on', 60_000)\n const started = Date.now()\n setDefault('off')\n await until(async () => (await seen()) === 'off', 60_000)\n expect(Date.now() - started).toBeLessThanOrEqual(60_000)\n})\n```",
894
+ "hubWhen": {
895
+ "FLAGS": [
896
+ "yes"
897
+ ]
898
+ }
899
+ },
900
+ {
901
+ "id": "ff-no-flags",
902
+ "type": "fitness-fn",
903
+ "label": "No flag SDK arrives",
904
+ "x": 1040,
905
+ "y": 1300,
906
+ "characteristic": "maintainability",
907
+ "scope": "atomic",
908
+ "cadence": "triggered",
909
+ "trigger": "pull-request",
910
+ "invocation": "automated",
911
+ "description": "A dependency rule fails the build when a feature flag SDK or a provider's client is added, which would mean releases became separate from deploys without the decision being superseded. For Python, Go or the JVM, the same rule goes in the dependency review of the build.\n\nThreshold: 0 dependencies on a feature flag SDK or provider client\n\nTool: dependency-cruiser; for Python: a constraints file reviewed in CI; for Go: go.mod reviewed in CI\n\n```js\n// .dependency-cruiser.cjs\nmodule.exports = {\n forbidden: [{\n name: 'no-feature-flags',\n comment: 'ADR A deploy is a release: supersede it before adding feature flags',\n severity: 'error',\n from: {},\n to: { path: 'node_modules/(@openfeature/|launchdarkly-node-server-sdk|@launchdarkly/|unleash-client|configcat-node|flagsmith-nodejs|@growthbook/)' },\n }],\n}\n```",
912
+ "hubWhen": {
913
+ "FLAGS": [
914
+ "no"
915
+ ]
916
+ }
917
+ },
918
+ {
919
+ "id": "ff-dora-continuous",
920
+ "type": "fitness-fn",
921
+ "label": "Deploys daily, merges live within a day",
922
+ "x": 1040,
923
+ "y": 1430,
924
+ "characteristic": "maintainability",
925
+ "scope": "atomic",
926
+ "cadence": "triggered",
927
+ "trigger": "weekly",
928
+ "invocation": "automated",
929
+ "description": "A weekly job reads the repository's production deployments and merged pull requests of the last 7 days: it fails below 5 deployment days, and when any merge waited more than 24 hours for the first production deployment after it. Change failure rate and recovery come from the incident tracker and the rollback drill, reviewed monthly.\n\nThreshold: Production deployments on at least 5 days of every week; the longest lead time from merge to production in the last 7 days at most 24 hours\n\nTool: GitHub CLI and jq in a scheduled GitHub Actions job\n\n```yaml\nname: dora-weekly\non:\n schedule: [{ cron: '0 7 * * 1' }]\njobs:\n frequency-and-lead-time:\n runs-on: ubuntu-latest\n steps:\n - env:\n GH_TOKEN: ${{ github.token }}\n run: |\n since=$(date -u -d '-7 days' +%FT%TZ)\n gh api \"repos/${{ github.repository }}/deployments?environment=production&per_page=100\" \\\n --jq \"[.[] | select(.created_at > \\\"$since\\\") | .created_at]\" > deploys.json\n days=$(jq 'map(.[0:10]) | unique | length' deploys.json)\n echo \"Days with a production deployment in the last 7: $days\"\n test \"$days\" -ge 5\n # lead time: from each merge of the last 7 days to the first production deployment after it\n gh pr list --state merged --search \"merged:>=$(date -u -d '-7 days' +%F)\" --limit 200 --json mergedAt \\\n | jq -e --slurpfile deploys deploys.json '\n [.[] | .mergedAt as $m | ($deploys[0] | map(select(. >= $m)) | min) as $d\n | select($d != null) | (($d | fromdateiso8601) - ($m | fromdateiso8601)) / 3600]\n | (max // 0) as $worst | \"Longest lead time: \\($worst | floor) h\" | stderr | $worst <= 24'\n```",
930
+ "hubWhen": {
931
+ "CADENCE": [
932
+ "continuous"
933
+ ]
934
+ }
935
+ },
936
+ {
937
+ "id": "ff-dora-train",
938
+ "type": "fitness-fn",
939
+ "label": "Train leaves weekly, merges live within a week",
940
+ "x": 1040,
941
+ "y": 1560,
942
+ "characteristic": "maintainability",
943
+ "scope": "atomic",
944
+ "cadence": "triggered",
945
+ "trigger": "weekly",
946
+ "invocation": "automated",
947
+ "description": "A weekly job reads the repository's production deployments and merged pull requests: it fails when no production deployment happened in the last 7 days, and when any merge of the last 14 days waited more than 7 days for the first production deployment after it. Change failure rate and recovery come from the incident tracker and the rollback drill, reviewed monthly.\n\nThreshold: At least 1 production deployment in every 7 days; the longest lead time from merge to production in the last 14 days at most 7 days\n\nTool: GitHub CLI and jq in a scheduled GitHub Actions job\n\n```yaml\nname: dora-weekly\non:\n schedule: [{ cron: '0 7 * * 1' }]\njobs:\n train:\n runs-on: ubuntu-latest\n steps:\n - env:\n GH_TOKEN: ${{ github.token }}\n run: |\n since=$(date -u -d '-14 days' +%FT%TZ)\n gh api \"repos/${{ github.repository }}/deployments?environment=production&per_page=100\" \\\n --jq \"[.[] | select(.created_at > \\\"$since\\\") | .created_at]\" > deploys.json\n week=$(date -u -d '-7 days' +%FT%TZ)\n n=$(jq --arg week \"$week\" 'map(select(. > $week)) | length' deploys.json)\n echo \"Production deployments in the last 7 days: $n\"\n test \"$n\" -ge 1\n gh pr list --state merged --search \"merged:>=$(date -u -d '-14 days' +%F)\" --limit 300 --json mergedAt \\\n | jq -e --slurpfile deploys deploys.json '\n [.[] | .mergedAt as $m | ($deploys[0] | map(select(. >= $m)) | min) as $d\n | select($d != null) | (($d | fromdateiso8601) - ($m | fromdateiso8601)) / 86400]\n | (max // 0) as $worst | \"Longest lead time: \\($worst | floor) days\" | stderr | $worst <= 7'\n```",
948
+ "hubWhen": {
949
+ "CADENCE": [
950
+ "train"
951
+ ]
952
+ }
953
+ }
954
+ ],
955
+ "relations": [
956
+ {
957
+ "id": "req-rollback--derives--need",
958
+ "sourceId": "req-rollback",
959
+ "targetId": "need",
960
+ "relationType": "derives"
961
+ },
962
+ {
963
+ "id": "req-graceful--derives--need",
964
+ "sourceId": "req-graceful",
965
+ "targetId": "need",
966
+ "relationType": "derives"
967
+ },
968
+ {
969
+ "id": "req-rolling--derives--need",
970
+ "sourceId": "req-rolling",
971
+ "targetId": "need",
972
+ "relationType": "derives"
973
+ },
974
+ {
975
+ "id": "req-bluegreen--derives--need",
976
+ "sourceId": "req-bluegreen",
977
+ "targetId": "need",
978
+ "relationType": "derives"
979
+ },
980
+ {
981
+ "id": "req-canary--derives--need",
982
+ "sourceId": "req-canary",
983
+ "targetId": "need",
984
+ "relationType": "derives"
985
+ },
986
+ {
987
+ "id": "req-expand-contract--derives--need",
988
+ "sourceId": "req-expand-contract",
989
+ "targetId": "need",
990
+ "relationType": "derives"
991
+ },
992
+ {
993
+ "id": "req-migration-window--derives--need",
994
+ "sourceId": "req-migration-window",
995
+ "targetId": "need",
996
+ "relationType": "derives"
997
+ },
998
+ {
999
+ "id": "req-no-schema--derives--need",
1000
+ "sourceId": "req-no-schema",
1001
+ "targetId": "need",
1002
+ "relationType": "derives"
1003
+ },
1004
+ {
1005
+ "id": "req-flags--derives--need",
1006
+ "sourceId": "req-flags",
1007
+ "targetId": "need",
1008
+ "relationType": "derives"
1009
+ },
1010
+ {
1011
+ "id": "req-no-flags--derives--need",
1012
+ "sourceId": "req-no-flags",
1013
+ "targetId": "need",
1014
+ "relationType": "derives"
1015
+ },
1016
+ {
1017
+ "id": "req-continuous--derives--need",
1018
+ "sourceId": "req-continuous",
1019
+ "targetId": "need",
1020
+ "relationType": "derives"
1021
+ },
1022
+ {
1023
+ "id": "req-train--derives--need",
1024
+ "sourceId": "req-train",
1025
+ "targetId": "need",
1026
+ "relationType": "derives"
1027
+ },
1028
+ {
1029
+ "id": "sc-rollback--verifies--req-rollback",
1030
+ "sourceId": "sc-rollback",
1031
+ "targetId": "req-rollback",
1032
+ "relationType": "verifies"
1033
+ },
1034
+ {
1035
+ "id": "sc-graceful--verifies--req-graceful",
1036
+ "sourceId": "sc-graceful",
1037
+ "targetId": "req-graceful",
1038
+ "relationType": "verifies"
1039
+ },
1040
+ {
1041
+ "id": "sc-rolling--verifies--req-rolling",
1042
+ "sourceId": "sc-rolling",
1043
+ "targetId": "req-rolling",
1044
+ "relationType": "verifies"
1045
+ },
1046
+ {
1047
+ "id": "sc-bluegreen--verifies--req-bluegreen",
1048
+ "sourceId": "sc-bluegreen",
1049
+ "targetId": "req-bluegreen",
1050
+ "relationType": "verifies"
1051
+ },
1052
+ {
1053
+ "id": "sc-canary--verifies--req-canary",
1054
+ "sourceId": "sc-canary",
1055
+ "targetId": "req-canary",
1056
+ "relationType": "verifies"
1057
+ },
1058
+ {
1059
+ "id": "sc-expand-contract--verifies--req-expand-contract",
1060
+ "sourceId": "sc-expand-contract",
1061
+ "targetId": "req-expand-contract",
1062
+ "relationType": "verifies"
1063
+ },
1064
+ {
1065
+ "id": "sc-migration-window--verifies--req-migration-window",
1066
+ "sourceId": "sc-migration-window",
1067
+ "targetId": "req-migration-window",
1068
+ "relationType": "verifies"
1069
+ },
1070
+ {
1071
+ "id": "sc-no-schema--verifies--req-no-schema",
1072
+ "sourceId": "sc-no-schema",
1073
+ "targetId": "req-no-schema",
1074
+ "relationType": "verifies"
1075
+ },
1076
+ {
1077
+ "id": "sc-flags--verifies--req-flags",
1078
+ "sourceId": "sc-flags",
1079
+ "targetId": "req-flags",
1080
+ "relationType": "verifies"
1081
+ },
1082
+ {
1083
+ "id": "sc-no-flags--verifies--req-no-flags",
1084
+ "sourceId": "sc-no-flags",
1085
+ "targetId": "req-no-flags",
1086
+ "relationType": "verifies"
1087
+ },
1088
+ {
1089
+ "id": "sc-continuous--verifies--req-continuous",
1090
+ "sourceId": "sc-continuous",
1091
+ "targetId": "req-continuous",
1092
+ "relationType": "verifies"
1093
+ },
1094
+ {
1095
+ "id": "sc-train--verifies--req-train",
1096
+ "sourceId": "sc-train",
1097
+ "targetId": "req-train",
1098
+ "relationType": "verifies"
1099
+ },
1100
+ {
1101
+ "id": "ff-rollback-drill--implements--adr-rolling",
1102
+ "sourceId": "ff-rollback-drill",
1103
+ "targetId": "adr-rolling",
1104
+ "relationType": "implements"
1105
+ },
1106
+ {
1107
+ "id": "ff-rollback-drill--implements--adr-bluegreen",
1108
+ "sourceId": "ff-rollback-drill",
1109
+ "targetId": "adr-bluegreen",
1110
+ "relationType": "implements"
1111
+ },
1112
+ {
1113
+ "id": "ff-rollback-drill--implements--adr-canary",
1114
+ "sourceId": "ff-rollback-drill",
1115
+ "targetId": "adr-canary",
1116
+ "relationType": "implements"
1117
+ },
1118
+ {
1119
+ "id": "ff-graceful--implements--adr-rolling",
1120
+ "sourceId": "ff-graceful",
1121
+ "targetId": "adr-rolling",
1122
+ "relationType": "implements"
1123
+ },
1124
+ {
1125
+ "id": "ff-graceful--implements--adr-bluegreen",
1126
+ "sourceId": "ff-graceful",
1127
+ "targetId": "adr-bluegreen",
1128
+ "relationType": "implements"
1129
+ },
1130
+ {
1131
+ "id": "ff-graceful--implements--adr-canary",
1132
+ "sourceId": "ff-graceful",
1133
+ "targetId": "adr-canary",
1134
+ "relationType": "implements"
1135
+ },
1136
+ {
1137
+ "id": "ff-rolling--implements--adr-rolling",
1138
+ "sourceId": "ff-rolling",
1139
+ "targetId": "adr-rolling",
1140
+ "relationType": "implements"
1141
+ },
1142
+ {
1143
+ "id": "ff-bluegreen--implements--adr-bluegreen",
1144
+ "sourceId": "ff-bluegreen",
1145
+ "targetId": "adr-bluegreen",
1146
+ "relationType": "implements"
1147
+ },
1148
+ {
1149
+ "id": "ff-canary--implements--adr-canary",
1150
+ "sourceId": "ff-canary",
1151
+ "targetId": "adr-canary",
1152
+ "relationType": "implements"
1153
+ },
1154
+ {
1155
+ "id": "ff-migration-lint--implements--adr-expand-contract",
1156
+ "sourceId": "ff-migration-lint",
1157
+ "targetId": "adr-expand-contract",
1158
+ "relationType": "implements"
1159
+ },
1160
+ {
1161
+ "id": "ff-migration-rehearsal--implements--adr-migration-window",
1162
+ "sourceId": "ff-migration-rehearsal",
1163
+ "targetId": "adr-migration-window",
1164
+ "relationType": "implements"
1165
+ },
1166
+ {
1167
+ "id": "ff-no-schema--implements--adr-no-schema",
1168
+ "sourceId": "ff-no-schema",
1169
+ "targetId": "adr-no-schema",
1170
+ "relationType": "implements"
1171
+ },
1172
+ {
1173
+ "id": "ff-flag-age--implements--adr-flags",
1174
+ "sourceId": "ff-flag-age",
1175
+ "targetId": "adr-flags",
1176
+ "relationType": "implements"
1177
+ },
1178
+ {
1179
+ "id": "ff-flag-propagation--implements--adr-flags",
1180
+ "sourceId": "ff-flag-propagation",
1181
+ "targetId": "adr-flags",
1182
+ "relationType": "implements"
1183
+ },
1184
+ {
1185
+ "id": "ff-no-flags--implements--adr-no-flags",
1186
+ "sourceId": "ff-no-flags",
1187
+ "targetId": "adr-no-flags",
1188
+ "relationType": "implements"
1189
+ },
1190
+ {
1191
+ "id": "ff-dora-continuous--implements--adr-continuous",
1192
+ "sourceId": "ff-dora-continuous",
1193
+ "targetId": "adr-continuous",
1194
+ "relationType": "implements"
1195
+ },
1196
+ {
1197
+ "id": "ff-dora-train--implements--adr-release-train",
1198
+ "sourceId": "ff-dora-train",
1199
+ "targetId": "adr-release-train",
1200
+ "relationType": "implements"
1201
+ }
1202
+ ]
1203
+ }