@radicaltools/cli 0.3.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 (57) hide show
  1. package/README.md +121 -16
  2. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  3. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  4. package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
  5. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  6. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  7. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  8. package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
  9. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  10. package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
  11. package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
  12. package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
  13. package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
  14. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
  15. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  16. package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
  17. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  18. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  19. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  20. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  21. package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
  22. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  23. package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
  24. package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
  25. package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
  26. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  27. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  28. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  29. package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
  30. package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
  31. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  32. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  33. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
  34. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  35. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
  36. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
  37. package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
  38. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
  39. package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
  40. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  41. package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
  42. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  43. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
  44. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  45. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  46. package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
  47. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  48. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  49. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  50. package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
  51. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  52. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  53. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
  54. package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
  55. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  56. package/dist/index.js +3680 -2074
  57. package/package.json +1 -1
@@ -0,0 +1,966 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-delivery-metrics",
4
+ "category": "concern",
5
+ "name": "Delivery metrics",
6
+ "description": "How fast and how safely changes reach production: the five DORA software delivery metrics, where they come from, exactly what they count, the team's targets, and what happens when a target is missed for weeks. The snippets are for GitHub (the Deployments API and Actions) and, with a platform, GitLab's DORA metrics API.",
7
+ "tags": [
8
+ "dora",
9
+ "delivery metrics",
10
+ "lead time",
11
+ "deployment frequency",
12
+ "change fail rate",
13
+ "continuous improvement"
14
+ ],
15
+ "requiredMetamodel": "c4-ddd-governance-builtin",
16
+ "concern": {
17
+ "id": "delivery-metrics",
18
+ "trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
19
+ "why": "code in these elements is changed and deployed, so how the team measures its delivery, and what it does about the figures, has to be decided.",
20
+ "group": "sdlc"
21
+ },
22
+ "sources": [
23
+ {
24
+ "title": "DORA: DORA's software delivery performance metrics (guide)",
25
+ "url": "https://dora.dev/guides/dora-metrics/"
26
+ },
27
+ {
28
+ "title": "DORA: A history of DORA's software delivery metrics",
29
+ "url": "https://dora.dev/insights/dora-metrics-history/"
30
+ },
31
+ {
32
+ "title": "DORA: Accelerate State of DevOps Report 2024",
33
+ "url": "https://dora.dev/research/2024/dora-report/"
34
+ },
35
+ {
36
+ "title": "Nicole Forsgren, Jez Humble, Gene Kim: Accelerate (IT Revolution)",
37
+ "url": "https://itrevolution.com/product/accelerate/"
38
+ },
39
+ {
40
+ "title": "GitHub REST API: Deployments",
41
+ "url": "https://docs.github.com/en/rest/deployments/deployments"
42
+ },
43
+ {
44
+ "title": "GitHub REST API: Deployment statuses",
45
+ "url": "https://docs.github.com/en/rest/deployments/statuses"
46
+ },
47
+ {
48
+ "title": "GitLab: DORA metrics",
49
+ "url": "https://docs.gitlab.com/user/analytics/dora_metrics/"
50
+ },
51
+ {
52
+ "title": "GitLab: DORA API",
53
+ "url": "https://docs.gitlab.com/api/dora/metrics/"
54
+ }
55
+ ],
56
+ "templateParams": [
57
+ {
58
+ "key": "SOURCE",
59
+ "title": "Source",
60
+ "label": "Where do the delivery metrics come from?",
61
+ "hint": "This decides what the numbers mean: the same deployment can count differently in two tools. The exact definitions of a deployment, a change's start, a failure and a recovery come with the answer.",
62
+ "defaultValue": "script",
63
+ "options": [
64
+ {
65
+ "value": "script",
66
+ "label": "our own job over the GitHub deployment records",
67
+ "description": "The deploy job records every production deployment through the GitHub Deployments API, rollbacks and hotfixes name the deployment they repair, and a weekly job of about fifty lines computes all five DORA metrics from those records. Pick it when the code is on GitHub and the team wants the definitions to be exactly its own, at no licence cost."
68
+ },
69
+ {
70
+ "value": "platform",
71
+ "label": "a delivery-insights platform",
72
+ "description": "A product computes the metrics from the repository, the pipeline and the incidents: GitLab's DORA metrics (GitLab Ultimate), LinearB, Swarmia, DX or Sleuth. Pick it when the organisation already runs one, or when several teams want the same dashboards without each keeping a script; its definitions are the vendor's, not exactly DORA's."
73
+ },
74
+ {
75
+ "value": "review",
76
+ "label": "a quarterly team review, not measured",
77
+ "description": "No tool computes anything; once a quarter the team answers the same five questions from its records and memory and compares the answers with its targets. Pick it when the team deploys only a few times a month, so a rate over a handful of events says little, or while the pipeline does not yet record deployments; the decision records that the figures are estimates."
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "key": "SCOPE",
83
+ "title": "Scope",
84
+ "label": "What is measured as one unit?",
85
+ "hint": "DORA applies the metrics to one application or service; blended across teams they hide more than they show. Whichever you pick, the figures are never broken down per person.",
86
+ "defaultValue": "element",
87
+ "options": [
88
+ {
89
+ "value": "element",
90
+ "label": "each deployable element on its own",
91
+ "description": "The figures cover this element alone, from the deployments that name it. Pick it by default: it is the level DORA intends, and one element's risks and pace are not averaged away by another's."
92
+ },
93
+ {
94
+ "value": "team",
95
+ "label": "each team, over the elements it owns",
96
+ "description": "The figures cover every element the owning team deploys, counted together. Pick it when a team deploys several small elements that change together, or when each alone deploys too rarely for its rates to mean anything."
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ "key": "RESPONSE",
102
+ "title": "Response",
103
+ "label": "What happens when a metric stays off its target?",
104
+ "hint": "One bad week is noise; a metric off target for several weekly measurements in a row is a trend worth work. With a quarterly review instead of measurement, the review applies the answer to each figure worse than its target. Time for repaying technical debt is the Technical debt pack's budget, not this.",
105
+ "defaultValue": "retro",
106
+ "options": [
107
+ {
108
+ "value": "retro",
109
+ "label": "an improvement item for the next retrospective",
110
+ "description": "An item labelled delivery-improvement is opened for the metric, the next retrospective picks what to try, and the item stays open until the metric is back on target. Pick it when the team holds retrospectives and the causes are usually in its own way of working."
111
+ },
112
+ {
113
+ "value": "reserve",
114
+ "label": "a reserved share of the next iteration",
115
+ "description": "Besides the item, a fixed share of the next iteration's capacity (15% by default) goes to work on that metric, such as speeding up the pipeline or automating a rollback. Pick it when misses keep coming back because improvement work always loses to features in planning."
116
+ },
117
+ {
118
+ "value": "report",
119
+ "label": "a line in the weekly report only",
120
+ "description": "The miss and how many weeks it has lasted are shown in the weekly report; nothing else starts by itself. Pick it while the targets are new and the team is still learning its baseline, or when another forum decides the work; the decision records that a missed target obliges nobody."
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "key": "WINDOW_DAYS",
126
+ "label": "Over how many days is each weekly measurement taken? GitHub deletes deployment statuses after 90 days, so twice this plus 7 days for each week of a streak must stay under 90. Only with measured metrics",
127
+ "defaultValue": "28",
128
+ "type": "number"
129
+ },
130
+ {
131
+ "key": "DEPLOYS_PER_WEEK",
132
+ "label": "Fewest production deployments a week (1 with a weekly release train; the cadence is decided in the Deployment pack)",
133
+ "defaultValue": "5",
134
+ "type": "number"
135
+ },
136
+ {
137
+ "key": "LEAD_TIME_HOURS",
138
+ "label": "Longest median change lead time to production (hours)",
139
+ "defaultValue": "24",
140
+ "type": "number"
141
+ },
142
+ {
143
+ "key": "CHANGE_FAIL_PCT",
144
+ "label": "Highest change fail rate (% of production deployments)",
145
+ "defaultValue": "15",
146
+ "type": "number"
147
+ },
148
+ {
149
+ "key": "RECOVERY_HOURS",
150
+ "label": "Longest median failed deployment recovery time (hours)",
151
+ "defaultValue": "4",
152
+ "type": "number"
153
+ },
154
+ {
155
+ "key": "REWORK_PCT",
156
+ "label": "Highest deployment rework rate (% of production deployments). Not with a platform that does not report it (GitLab)",
157
+ "defaultValue": "10",
158
+ "type": "number"
159
+ },
160
+ {
161
+ "key": "MISS_WEEKS",
162
+ "label": "After how many weekly measurements in a row off target does the response start? Only with measured metrics",
163
+ "defaultValue": "3",
164
+ "type": "number"
165
+ },
166
+ {
167
+ "key": "RESERVED_PCT",
168
+ "label": "What share of the next iteration is reserved for a metric off target (%)? Only with a reserved share",
169
+ "defaultValue": "15",
170
+ "type": "number"
171
+ }
172
+ ]
173
+ },
174
+ "nodes": [
175
+ {
176
+ "id": "need",
177
+ "type": "need",
178
+ "label": "Delivery performance is known and improved",
179
+ "x": 0,
180
+ "y": 0,
181
+ "kind": "brief",
182
+ "source": "Hub concern pack: Delivery metrics",
183
+ "description": "The team needs to know how often and how fast its changes reach production, how often a change breaks something and how long the break lasts, and whether that is getting better, so that improvement work goes where it pays. The figures must count the same things every week, be read against the team's own targets rather than other teams, and lead to action when they stay off target. The snippets assume the code on GitHub with GitHub Actions: the deploy job records each production deployment through the GitHub Deployments API, scripts/delivery-metrics.sh runs the measurement (scripts/delivery-flow.mjs and scripts/delivery-failures.mjs, or the platform query) and writes reports/delivery-*.json, improvement items are issues labelled delivery-improvement, and quarterly reviews are kept under docs/delivery-reviews/; the platform snippets use GitLab's DORA API, with glab in place of gh."
184
+ },
185
+ {
186
+ "id": "req-deploy-recorded",
187
+ "type": "requirement",
188
+ "label": "Every deployment is recorded",
189
+ "x": 260,
190
+ "y": 0,
191
+ "ears_type": "event-driven",
192
+ "trigger": "the pipeline deploys the element to production",
193
+ "action": "create a GitHub deployment of the deployed commit with environment production and a payload naming the service, the owning team and the kind (planned, hotfix or rollback, with the id of the repaired deployment for a hotfix or rollback), and post its success status only once the new version serves all production traffic",
194
+ "rationale": "The metrics are only as good as the record of deployments; a deployment that is not recorded, or recorded before it is live, shifts every figure (DORA metrics guide; GitHub REST API: Deployments, Deployment statuses).",
195
+ "hubWhen": {
196
+ "SOURCE": [
197
+ "script"
198
+ ]
199
+ }
200
+ },
201
+ {
202
+ "id": "req-failure-marked",
203
+ "type": "requirement",
204
+ "label": "Failed deployments are marked",
205
+ "x": 260,
206
+ "y": 130,
207
+ "ears_type": "event-driven",
208
+ "trigger": "a production deployment of the element needs immediate intervention: a rollback, a hotfix, or a feature or setting switched off because of what it changed",
209
+ "action": "post a failure status on that deployment when service is recovered, naming the intervention in its description; a rollback or hotfix deploy job posts it itself, and the incident process posts it for any other intervention within 1 working day",
210
+ "rationale": "DORA counts a deployment as failed when it needs immediate intervention, and measures recovery from it; marking the deployment itself keeps both figures computable from one record (DORA metrics guide; A history of DORA's software delivery metrics: failed deployment recovery time).",
211
+ "hubWhen": {
212
+ "SOURCE": [
213
+ "script"
214
+ ]
215
+ }
216
+ },
217
+ {
218
+ "id": "req-flow-targets",
219
+ "type": "requirement",
220
+ "label": "Frequent, fast delivery",
221
+ "x": 260,
222
+ "y": 260,
223
+ "ears_type": "ubiquitous",
224
+ "action": "deploy to production at least {{DEPLOYS_PER_WEEK}} times a week and keep the median change lead time to production at or under {{LEAD_TIME_HOURS}} hours, both measured every week over the last {{WINDOW_DAYS}} days",
225
+ "rationale": "Deployment frequency and change lead time are DORA's throughput measures; small batches delivered often are easier to test, release and undo (DORA metrics guide; Accelerate, chapter 2).",
226
+ "hubWhen": {
227
+ "SOURCE": [
228
+ "script",
229
+ "platform"
230
+ ]
231
+ }
232
+ },
233
+ {
234
+ "id": "req-stability-targets",
235
+ "type": "requirement",
236
+ "label": "Few failures, quickly recovered",
237
+ "x": 260,
238
+ "y": 390,
239
+ "ears_type": "ubiquitous",
240
+ "action": "keep the change fail rate at or under {{CHANGE_FAIL_PCT}}% of production deployments and the median failed deployment recovery time at or under {{RECOVERY_HOURS}} hours, both measured every week over the last {{WINDOW_DAYS}} days",
241
+ "rationale": "Speed bought with broken releases is no gain; DORA reads the failure measures beside the throughput ones, and since 2023 measures recovery only from failures a deployment caused (DORA metrics guide; A history of DORA's software delivery metrics).",
242
+ "hubWhen": {
243
+ "SOURCE": [
244
+ "script",
245
+ "platform"
246
+ ]
247
+ }
248
+ },
249
+ {
250
+ "id": "req-rework",
251
+ "type": "requirement",
252
+ "label": "Little unplanned rework",
253
+ "x": 260,
254
+ "y": 520,
255
+ "ears_type": "ubiquitous",
256
+ "action": "keep the deployment rework rate, the share of production deployments that are hotfixes or rollbacks, at or under {{REWORK_PCT}}%, measured every week over the last {{WINDOW_DAYS}} days",
257
+ "rationale": "DORA added the deployment rework rate in 2024 to measure directly the unplanned deployments that production incidents force, which the change fail rate only approximates (A history of DORA's software delivery metrics; Accelerate State of DevOps Report 2024).",
258
+ "hubWhen": {
259
+ "SOURCE": [
260
+ "script"
261
+ ]
262
+ }
263
+ },
264
+ {
265
+ "id": "req-platform-data",
266
+ "type": "requirement",
267
+ "label": "The platform sees production",
268
+ "x": 260,
269
+ "y": 650,
270
+ "ears_type": "ubiquitous",
271
+ "action": "report every production deployment of the element to the platform with its environment marked as production (in GitLab, environment:deployment_tier production on the deploy job), mark every other deploying job with its own tier, and record each incident a production deployment causes as an incident the platform reads, closed when service is recovered",
272
+ "rationale": "A platform counts what its data says is production: GitLab counts only successful deployments to environments of the production tier or named production, and computes failures and recovery from its incidents (GitLab: DORA metrics).",
273
+ "hubWhen": {
274
+ "SOURCE": [
275
+ "platform"
276
+ ]
277
+ }
278
+ },
279
+ {
280
+ "id": "req-response-retro",
281
+ "type": "requirement",
282
+ "label": "Lasting misses reach the retrospective",
283
+ "x": 260,
284
+ "y": 780,
285
+ "ears_type": "event-driven",
286
+ "trigger": "a metric misses its target in {{MISS_WEEKS}} weekly measurements in a row",
287
+ "action": "open an improvement item labelled delivery-improvement with the metric's name in its title before the next retrospective, decide there what to try, and keep the item open until the metric meets its target again",
288
+ "rationale": "A figure nobody acts on is decoration; the improvement belongs to the team that does the work, not to a mandate from outside (DORA metrics guide: improve over time, avoid metrics as goals; Accelerate, chapter 2).",
289
+ "hubWhen": {
290
+ "SOURCE": [
291
+ "script",
292
+ "platform"
293
+ ],
294
+ "RESPONSE": [
295
+ "retro"
296
+ ]
297
+ }
298
+ },
299
+ {
300
+ "id": "req-response-reserve",
301
+ "type": "requirement",
302
+ "label": "Lasting misses get capacity",
303
+ "x": 260,
304
+ "y": 910,
305
+ "ears_type": "event-driven",
306
+ "trigger": "a metric misses its target in {{MISS_WEEKS}} weekly measurements in a row",
307
+ "action": "open an improvement item labelled delivery-improvement with the metric's name in its title and reserve {{RESERVED_PCT}}% of the next iteration's capacity for work on it, apart from any budget for technical debt",
308
+ "rationale": "Improvement work that has to win every planning against features rarely does; reserved capacity makes the trade explicit (Accelerate, chapter 2; DORA metrics guide).",
309
+ "hubWhen": {
310
+ "SOURCE": [
311
+ "script",
312
+ "platform"
313
+ ],
314
+ "RESPONSE": [
315
+ "reserve"
316
+ ]
317
+ }
318
+ },
319
+ {
320
+ "id": "req-response-report",
321
+ "type": "requirement",
322
+ "label": "Lasting misses are reported",
323
+ "x": 260,
324
+ "y": 1040,
325
+ "ears_type": "event-driven",
326
+ "trigger": "a metric misses its target in {{MISS_WEEKS}} weekly measurements in a row",
327
+ "action": "list the metric in the weekly report as off target for {{MISS_WEEKS}} weeks in a row, and start no work item by itself",
328
+ "rationale": "While a baseline is being learnt, a visible trend is enough; the decision says so, so that nobody reads a missed target as an obligation (DORA metrics guide).",
329
+ "hubWhen": {
330
+ "SOURCE": [
331
+ "script",
332
+ "platform"
333
+ ],
334
+ "RESPONSE": [
335
+ "report"
336
+ ]
337
+ }
338
+ },
339
+ {
340
+ "id": "req-review",
341
+ "type": "requirement",
342
+ "label": "Quarterly delivery review",
343
+ "x": 260,
344
+ "y": 1170,
345
+ "ears_type": "event-driven",
346
+ "trigger": "a calendar quarter ends",
347
+ "action": "hold a team review within 14 days that estimates the deployments a week, the change lead time, the change fail rate, the failed deployment recovery time and the deployment rework rate of the quarter, compares each with its target, and records the answers, the targets and the actions in docs/delivery-reviews/<year>-Q<n>.md",
348
+ "rationale": "DORA's research measured delivery performance by asking teams these questions; a team without the data can still ask them every quarter and act on the answers (Accelerate, chapter 2; DORA metrics guide).",
349
+ "hubWhen": {
350
+ "SOURCE": [
351
+ "review"
352
+ ]
353
+ }
354
+ },
355
+ {
356
+ "id": "req-no-ranking",
357
+ "type": "requirement",
358
+ "label": "Figures are not a ranking",
359
+ "x": 260,
360
+ "y": 1300,
361
+ "ears_type": "ubiquitous",
362
+ "action": "report the delivery figures only for the unit decided (an element or a team), never per person, and compare each unit only with its own past, never rank teams by them",
363
+ "rationale": "DORA warns that metrics made into goals or used to compare unlike teams get gamed and lose their meaning; they serve a team improving over time (DORA metrics guide).",
364
+ "unchecked": "The engineering manager, whenever the figures leave the team: no tool can tell how a number is used once it is shown."
365
+ },
366
+ {
367
+ "id": "sc-deploy-recorded",
368
+ "type": "scenario",
369
+ "label": "Hotfix is recorded",
370
+ "x": 520,
371
+ "y": 0,
372
+ "given": "a hotfix for deployment 41 merged to the main branch",
373
+ "when": "the deploy job takes it to production",
374
+ "then": "the Deployments API shows a deployment of its commit with environment production, payload kind hotfix, fixes 41, service and team, and a success status created after the rollout ended",
375
+ "hubWhen": {
376
+ "SOURCE": [
377
+ "script"
378
+ ]
379
+ }
380
+ },
381
+ {
382
+ "id": "sc-failure-marked",
383
+ "type": "scenario",
384
+ "label": "Rollback marks the failure",
385
+ "x": 520,
386
+ "y": 130,
387
+ "given": "deployment 41 in production",
388
+ "when": "the rollback job redeploys the previous version with fixes 41 and that rollback reaches its success status",
389
+ "then": "deployment 41 carries a failure status, created after its success status, whose description names the rollback",
390
+ "hubWhen": {
391
+ "SOURCE": [
392
+ "script"
393
+ ]
394
+ }
395
+ },
396
+ {
397
+ "id": "sc-flow-targets",
398
+ "type": "scenario",
399
+ "label": "Slow week reported",
400
+ "x": 520,
401
+ "y": 260,
402
+ "given": "a window of {{WINDOW_DAYS}} days with fewer than {{DEPLOYS_PER_WEEK}} deployments a week, or a median lead time above {{LEAD_TIME_HOURS}} hours",
403
+ "when": "the weekly measurement runs",
404
+ "then": "its report lists deployment_frequency or change_lead_time among the missed targets and the job fails",
405
+ "hubWhen": {
406
+ "SOURCE": [
407
+ "script",
408
+ "platform"
409
+ ]
410
+ }
411
+ },
412
+ {
413
+ "id": "sc-stability-targets",
414
+ "type": "scenario",
415
+ "label": "Unstable week reported",
416
+ "x": 520,
417
+ "y": 390,
418
+ "given": "a window of {{WINDOW_DAYS}} days in which more than {{CHANGE_FAIL_PCT}}% of deployments failed, or the median recovery took longer than {{RECOVERY_HOURS}} hours",
419
+ "when": "the weekly measurement runs",
420
+ "then": "its report lists change_fail_rate or failed_deployment_recovery_time among the missed targets and the job fails",
421
+ "hubWhen": {
422
+ "SOURCE": [
423
+ "script",
424
+ "platform"
425
+ ]
426
+ }
427
+ },
428
+ {
429
+ "id": "sc-rework",
430
+ "type": "scenario",
431
+ "label": "Rework reported",
432
+ "x": 520,
433
+ "y": 520,
434
+ "given": "a window of {{WINDOW_DAYS}} days in which more than {{REWORK_PCT}}% of production deployments have kind hotfix or rollback",
435
+ "when": "the weekly measurement runs",
436
+ "then": "its report lists deployment_rework_rate among the missed targets and the job fails",
437
+ "hubWhen": {
438
+ "SOURCE": [
439
+ "script"
440
+ ]
441
+ }
442
+ },
443
+ {
444
+ "id": "sc-platform-data",
445
+ "type": "scenario",
446
+ "label": "Production deploy job is tiered",
447
+ "x": 520,
448
+ "y": 650,
449
+ "given": "a .gitlab-ci.yml whose production deploy job uses an environment named eu-live",
450
+ "when": "the tier check runs",
451
+ "then": "it fails until the job declares deployment_tier production, and passes when every deploying job declares a tier",
452
+ "hubWhen": {
453
+ "SOURCE": [
454
+ "platform"
455
+ ]
456
+ }
457
+ },
458
+ {
459
+ "id": "sc-response-retro",
460
+ "type": "scenario",
461
+ "label": "Lasting miss opens an item",
462
+ "x": 520,
463
+ "y": 780,
464
+ "given": "change_fail_rate off target in {{MISS_WEEKS}} weekly measurements in a row",
465
+ "when": "the improvement check runs",
466
+ "then": "it fails until an open issue labelled delivery-improvement names change_fail_rate in its title",
467
+ "hubWhen": {
468
+ "SOURCE": [
469
+ "script",
470
+ "platform"
471
+ ],
472
+ "RESPONSE": [
473
+ "retro"
474
+ ]
475
+ }
476
+ },
477
+ {
478
+ "id": "sc-response-reserve",
479
+ "type": "scenario",
480
+ "label": "Lasting miss gets capacity",
481
+ "x": 520,
482
+ "y": 910,
483
+ "given": "change_lead_time off target in {{MISS_WEEKS}} weekly measurements in a row",
484
+ "when": "the improvement check runs before the next iteration is planned",
485
+ "then": "it fails until an open issue labelled delivery-improvement names change_lead_time in its title",
486
+ "hubWhen": {
487
+ "SOURCE": [
488
+ "script",
489
+ "platform"
490
+ ],
491
+ "RESPONSE": [
492
+ "reserve"
493
+ ]
494
+ }
495
+ },
496
+ {
497
+ "id": "sc-response-report",
498
+ "type": "scenario",
499
+ "label": "Lasting miss is listed",
500
+ "x": 520,
501
+ "y": 1040,
502
+ "given": "deployment_frequency off target in {{MISS_WEEKS}} weekly measurements in a row",
503
+ "when": "the weekly job runs",
504
+ "then": "its summary lists deployment_frequency as off target in each of the last {{MISS_WEEKS}} weekly measurements",
505
+ "hubWhen": {
506
+ "SOURCE": [
507
+ "script",
508
+ "platform"
509
+ ],
510
+ "RESPONSE": [
511
+ "report"
512
+ ]
513
+ }
514
+ },
515
+ {
516
+ "id": "sc-review",
517
+ "type": "scenario",
518
+ "label": "Review is on record",
519
+ "x": 520,
520
+ "y": 1170,
521
+ "given": "the end of a quarter",
522
+ "when": "CI runs on the main branch 100 days later",
523
+ "then": "it passes only if docs/delivery-reviews holds that quarter's review with an answer and a target for each of the five figures and an Actions section",
524
+ "hubWhen": {
525
+ "SOURCE": [
526
+ "review"
527
+ ]
528
+ }
529
+ },
530
+ {
531
+ "id": "sc-no-ranking",
532
+ "type": "scenario",
533
+ "label": "No per-person figures",
534
+ "x": 520,
535
+ "y": 1300,
536
+ "given": "the weekly report or the quarterly review",
537
+ "when": "it is shared outside the team",
538
+ "then": "it shows figures for the element or team and its own earlier weeks only, with no breakdown per person and no league table of teams"
539
+ },
540
+ {
541
+ "id": "adr-script",
542
+ "type": "adr",
543
+ "label": "Delivery metrics from our own job",
544
+ "x": 780,
545
+ "y": 0,
546
+ "concern": "delivery-metrics",
547
+ "status": "accepted",
548
+ "date": "",
549
+ "context": "This element is changed and deployed week after week, and the team wants to know whether it is getting faster and safer at it, not to guess. The forces: what is not measured is argued from anecdote, while a metric turned into a goal gets gamed (DORA warns of Goodhart's law): counting deployments rewards splitting them, counting failures rewards not calling them failures; throughput and instability have to be read together, because either can be bought with the other; the metrics mean something for one application or service, and blended across teams they hide more than they show; the definitions decide the numbers (what is a deployment, when a change starts, what is a failure, when it is recovered) and tools disagree on them; a team that deploys a few times a month has too few events for a rate to mean much; and a number nobody acts on is decoration. How a release rolls out, how fast it rolls back and how often the element releases are decided in the Deployment pack; the availability objective and the error budget in the Availability pack; the time for repaying technical debt in the Technical debt pack; who responds to an incident, and how, is the incident process.",
550
+ "decision": "Our own job computes the five DORA software delivery metrics for {{SCOPE}} from the GitHub Deployments API, every Monday over the last {{WINDOW_DAYS}} days (scripts/delivery-flow.mjs and scripts/delivery-failures.mjs, run by scripts/delivery-metrics.sh in a scheduled GitHub Actions workflow that keeps reports/ as an artifact for 90 days). Definitions: a deployment is a GitHub deployment to environment production whose payload names the service and team and that has a success status, posted once the new version serves all production traffic; a rollout that never got there is not a deployment (the Deployment pack's rollback handles it). A change starts at the committer date of its commit on the main branch (with squash merges, the merge) and ends at the success status of the first production deployment that brings it. A deployment failed when it needed immediate intervention (a rollback, a hotfix, or a feature or setting switched off because of it) and carries a failure status posted after its success status: rollback and hotfix deploy jobs post it on the deployment they repair, the incident process posts it for any other intervention. It recovered at that failure status, so recovery time runs from going live to recovery and includes the time to notice. A deployment is rework when its kind is hotfix or rollback. Targets: at least {{DEPLOYS_PER_WEEK}} deployments a week; median change lead time at most {{LEAD_TIME_HOURS}} hours; change fail rate at most {{CHANGE_FAIL_PCT}}%; median failed deployment recovery time at most {{RECOVERY_HOURS}} hours; deployment rework rate at most {{REWORK_PCT}}%. The targets are the team's own, set from its baseline, not DORA's performance clusters. A metric off target in {{MISS_WEEKS}} weekly measurements in a row gets: {{RESPONSE}}.",
551
+ "consequences": "• The definitions are exactly ours and written down; every figure can be traced to deployments and statuses.\n• The pipeline must record deployments faithfully: a deploy job that skips the record, or posts success before the rollout ends, distorts every figure; a weekly check catches the first.\n• Failures that need no deployment to fix (a flag switched off) count only if the incident process remembers to mark them.\n• Recovery time includes the time to notice, so a failure found days later shows as a long recovery; that is intended.\n• GitHub deletes deployment statuses after 90 days, so the window and the streak have to fit in 90 days, and longer history lives only in the kept reports.\n• About fifty lines of script to keep, and API calls in proportion to the number of deployments.",
552
+ "alternatives": "1. A delivery-insights platform: dashboards without a script, but the vendor's definitions and a licence.\n2. A quarterly review without measurement: no tooling at all, but estimates instead of figures.\n3. Google's Four Keys project: archived by its owners in 2024, so no longer a base to build on.",
553
+ "hubWhen": {
554
+ "SOURCE": [
555
+ "script"
556
+ ]
557
+ }
558
+ },
559
+ {
560
+ "id": "adr-platform",
561
+ "type": "adr",
562
+ "label": "Delivery metrics from a platform",
563
+ "x": 780,
564
+ "y": 130,
565
+ "concern": "delivery-metrics",
566
+ "status": "accepted",
567
+ "date": "",
568
+ "context": "This element is changed and deployed week after week, and the team wants to know whether it is getting faster and safer at it, not to guess. The forces: what is not measured is argued from anecdote, while a metric turned into a goal gets gamed (DORA warns of Goodhart's law): counting deployments rewards splitting them, counting failures rewards not calling them failures; throughput and instability have to be read together, because either can be bought with the other; the metrics mean something for one application or service, and blended across teams they hide more than they show; the definitions decide the numbers (what is a deployment, when a change starts, what is a failure, when it is recovered) and tools disagree on them; a team that deploys a few times a month has too few events for a rate to mean much; and a number nobody acts on is decoration. How a release rolls out, how fast it rolls back and how often the element releases are decided in the Deployment pack; the availability objective and the error budget in the Availability pack; the time for repaying technical debt in the Technical debt pack; who responds to an incident, and how, is the incident process.",
569
+ "decision": "A delivery-insights platform computes the DORA metrics for {{SCOPE}}: GitLab's DORA metrics (GitLab Ultimate) when the code is on GitLab, for one element per project or for a team per group; otherwise the platform the organisation runs (LinearB, Swarmia, DX or Sleuth), fed with the pipeline's production deployments and the incidents. We take the platform's definitions and record where they differ from DORA's guide: GitLab counts successful deployments to environments of the production tier, starts lead time when the merge request is merged rather than at the commit, counts a failure as a GitLab incident and recovery as the time the incident was open, and reports no deployment rework rate. Every deploy job declares its environment's tier. A weekly job reads the figures over the last {{WINDOW_DAYS}} days from the platform's API and compares them with the targets: at least {{DEPLOYS_PER_WEEK}} deployments a week; median change lead time at most {{LEAD_TIME_HOURS}} hours; change fail rate at most {{CHANGE_FAIL_PCT}}%; median recovery time at most {{RECOVERY_HOURS}} hours; and, where the platform reports it, deployment rework rate at most {{REWORK_PCT}}%. The targets are the team's own, not DORA's performance clusters. A metric off target in {{MISS_WEEKS}} weekly measurements in a row gets: {{RESPONSE}}.",
570
+ "consequences": "• Dashboards, history and drill-down without a script of our own; several teams see their figures the same way.\n• The definitions are the vendor's: GitLab's lead time leaves out the time before the merge, and its failure figures are only as good as the incidents opened in GitLab.\n• A licence (GitLab Ultimate, or the platform's per-developer price) and one more system with access to the code.\n• Platforms tempt managers to compare teams and people; the figures stay at the decided unit and never per person.\n• The deployment rework rate is missing where the platform does not report it.",
571
+ "alternatives": "1. Our own job over the GitHub deployment records: exact definitions and no licence, but a script to keep.\n2. A quarterly review without measurement: no tooling, but estimates instead of figures.",
572
+ "hubWhen": {
573
+ "SOURCE": [
574
+ "platform"
575
+ ]
576
+ }
577
+ },
578
+ {
579
+ "id": "adr-review",
580
+ "type": "adr",
581
+ "label": "Delivery reviewed quarterly, not measured",
582
+ "x": 780,
583
+ "y": 260,
584
+ "concern": "delivery-metrics",
585
+ "status": "accepted",
586
+ "date": "",
587
+ "context": "This element is changed and deployed week after week, and the team wants to know whether it is getting faster and safer at it, not to guess. The forces: what is not measured is argued from anecdote, while a metric turned into a goal gets gamed (DORA warns of Goodhart's law): counting deployments rewards splitting them, counting failures rewards not calling them failures; throughput and instability have to be read together, because either can be bought with the other; the metrics mean something for one application or service, and blended across teams they hide more than they show; the definitions decide the numbers (what is a deployment, when a change starts, what is a failure, when it is recovered) and tools disagree on them; a team that deploys a few times a month has too few events for a rate to mean much; and a number nobody acts on is decoration. How a release rolls out, how fast it rolls back and how often the element releases are decided in the Deployment pack; the availability objective and the error budget in the Availability pack; the time for repaying technical debt in the Technical debt pack; who responds to an incident, and how, is the incident process.",
588
+ "decision": "Delivery performance of {{SCOPE}} is not measured by a tool. Within 14 days after each quarter the team holds a review that estimates, from its records and memory, the deployments a week, the change lead time from commit to production, the change fail rate (deployments that needed immediate intervention), the failed deployment recovery time and the deployment rework rate (deployments that were hotfixes or rollbacks), and compares each with its target: at least {{DEPLOYS_PER_WEEK}} deployments a week; lead time at most {{LEAD_TIME_HOURS}} hours; change fail rate at most {{CHANGE_FAIL_PCT}}%; recovery at most {{RECOVERY_HOURS}} hours; rework at most {{REWORK_PCT}}%. The review is kept in docs/delivery-reviews/<year>-Q<n>.md, one section per figure with an Answer: and a Target: line, and an Actions section. A figure worse than its target gets: {{RESPONSE}}. We revisit this decision when the team deploys more than once a week.",
589
+ "consequences": "• No tooling and no recording discipline in the pipeline; an hour a quarter.\n• The figures are estimates: memory flatters, and a slow drift goes unnoticed for up to three months.\n• Nothing checks a target between reviews; a bad month is seen at the end of the quarter.\n• The same five questions keep the team ready to measure later without changing what it talks about.",
590
+ "alternatives": "1. Our own job over the GitHub deployment records: real figures every week, once the pipeline records deployments.\n2. A delivery-insights platform: figures without a script, at a licence cost.\n3. No review at all: delivery performance becomes a matter of impression.",
591
+ "hubWhen": {
592
+ "SOURCE": [
593
+ "review"
594
+ ]
595
+ }
596
+ },
597
+ {
598
+ "id": "ff-deploy-record",
599
+ "type": "fitness-fn",
600
+ "label": "Deployments carry their record",
601
+ "x": 1040,
602
+ "y": 0,
603
+ "characteristic": "maintainability",
604
+ "scope": "atomic",
605
+ "cadence": "triggered",
606
+ "trigger": "weekly",
607
+ "invocation": "automated",
608
+ "description": "A weekly step lists the production deployments through the Deployments API and fails on any whose payload lacks the service, the team or a valid kind. The comment shows how the deploy job creates the record and posts success after the rollout.\n\nThreshold: 0 production deployments of the last {{WINDOW_DAYS}} days without a payload naming service, team and a kind of planned, hotfix or rollback\n\nTool: GitHub CLI (gh api --paginate) with jq, in the weekly GitHub Actions workflow (ubuntu runner, GNU date)\n\n```bash\n# weekly: every production deployment of the last {{WINDOW_DAYS}} days names its service, team and kind\n# the deploy job records each one; DEPLOY_KIND is planned, hotfix or rollback, FIXES the id of the deployment a hotfix or rollback repairs:\n# id=$(jq -n --arg sha \"$GITHUB_SHA\" --arg kind \"$DEPLOY_KIND\" --arg fixes \"${FIXES:-}\" '{ ref: $sha, environment: \"production\",\n# auto_merge: false, required_contexts: [], payload: ({ service: \"order-api\", team: \"checkout\", kind: $kind }\n# + if $fixes == \"\" then {} else { fixes: ($fixes | tonumber) } end) }' | gh api \"repos/$GITHUB_REPOSITORY/deployments\" --input - --jq .id)\n# ...the rollout...\n# gh api \"repos/$GITHUB_REPOSITORY/deployments/$id/statuses\" -f state=success # only once the new version serves all production traffic\nset -euo pipefail\nsince=$(date -u -d \"-{{WINDOW_DAYS}} days\" +%FT%TZ)\ngh api --paginate \"repos/$GITHUB_REPOSITORY/deployments?environment=production&per_page=100\" | jq -s --arg since \"$since\" '\n [ .[][] | select(.created_at >= $since)\n | select((.payload | type) != \"object\" or (.payload.service | type) != \"string\" or (.payload.team | type) != \"string\"\n or ((.payload.kind // \"\") | IN(\"planned\", \"hotfix\", \"rollback\") | not))\n | { id, sha, created_at } ]' > reports/unrecorded.json\njq -e 'length == 0' reports/unrecorded.json > /dev/null || { echo \"production deployments without service, team or kind:\"; cat reports/unrecorded.json; exit 1; }\n```",
609
+ "hubWhen": {
610
+ "SOURCE": [
611
+ "script"
612
+ ]
613
+ }
614
+ },
615
+ {
616
+ "id": "ff-failure-marked",
617
+ "type": "fitness-fn",
618
+ "label": "Repaired deployments are marked failed",
619
+ "x": 1040,
620
+ "y": 130,
621
+ "characteristic": "maintainability",
622
+ "scope": "atomic",
623
+ "cadence": "triggered",
624
+ "trigger": "weekly",
625
+ "invocation": "automated",
626
+ "description": "A weekly step takes every rollback and hotfix deployment, reads the deployment it names as repaired and fails when that one has no failure status. Interventions without a deployment (a flag switched off) are marked by the incident process and are not seen by this check.\n\nThreshold: 0 rollbacks or hotfixes of the last {{WINDOW_DAYS}} days that name no repaired deployment, or whose repaired deployment carries no failure status\n\nTool: GitHub CLI (gh api) with jq, in the weekly GitHub Actions workflow\n\n```bash\n# weekly: every rollback or hotfix of the last {{WINDOW_DAYS}} days names the deployment it repairs, and that deployment carries a failure status\n# a rollback or hotfix deploy job, after its own success status, marks the deployment it repaired:\n# gh api \"repos/$GITHUB_REPOSITORY/deployments/$FIXES/statuses\" -f state=failure -f description=\"recovered by $DEPLOY_KIND, deployment $id\"\n# any other intervention (a feature flag or a setting switched off) is marked the same way by the incident process, by hand\nset -euo pipefail\nsince=$(date -u -d \"-{{WINDOW_DAYS}} days\" +%FT%TZ); status=0\nwhile read -r id fixes; do\n if [ \"$fixes\" = none ]; then echo \"deployment $id is a rollback or hotfix but names no deployment it repairs\"; status=1; continue; fi\n gh api \"repos/$GITHUB_REPOSITORY/deployments/$fixes/statuses?per_page=100\" | jq -e 'any(.[]; .state == \"failure\")' > /dev/null \\\n || { echo \"deployment $fixes was repaired by deployment $id but carries no failure status\"; status=1; }\ndone < <(gh api --paginate \"repos/$GITHUB_REPOSITORY/deployments?environment=production&per_page=100\" | jq -rs --arg since \"$since\" '\n .[][] | select(.created_at >= $since and (.payload | type) == \"object\" and (.payload.kind == \"rollback\" or .payload.kind == \"hotfix\"))\n | \"\\(.id) \\(.payload.fixes // \"none\")\"')\nexit $status\n```",
627
+ "hubWhen": {
628
+ "SOURCE": [
629
+ "script"
630
+ ]
631
+ }
632
+ },
633
+ {
634
+ "id": "ff-change-flow",
635
+ "type": "fitness-fn",
636
+ "label": "Deployment frequency and lead time",
637
+ "x": 1040,
638
+ "y": 260,
639
+ "characteristic": "maintainability",
640
+ "scope": "holistic",
641
+ "cadence": "triggered",
642
+ "trigger": "weekly",
643
+ "invocation": "automated",
644
+ "description": "The script reads the production deployments of the unit (SCOPE=service:<name> or team:<name>), keeps those with a success status, and for each takes the commits it brought (the compare API between the previous live deployment and it); a commit's lead time runs from its committer date to the first deployment that brought it. It writes reports/delivery-flow.json and fails when a target is missed. UNTIL moves the window back for the streak check.\n\nThreshold: At least {{DEPLOYS_PER_WEEK}} production deployments a week and a median change lead time of at most {{LEAD_TIME_HOURS}} hours over the last {{WINDOW_DAYS}} days\n\nTool: Node 20 (fetch) over the GitHub REST API: deployments, deployment statuses, compare two commits; run by the weekly GitHub Actions workflow\n\n```js\n// scripts/delivery-flow.mjs: deployment frequency and change lead time over the {{WINDOW_DAYS}} days up to UNTIL (default now)\nimport { writeFileSync } from 'node:fs'\nconst api = (path) => fetch(`https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/${path}`, { headers: {\n authorization: `Bearer ${process.env.GITHUB_TOKEN}`, accept: 'application/vnd.github+json' } }).then((r) => r.json())\nconst all = async (path) => { const out = []; for (let page = 1; ; page++) { const xs = await api(`${path}&per_page=100&page=${page}`); out.push(...xs); if (xs.length < 100) return out } }\nconst median = (xs) => { const s = [...xs].sort((a, b) => a - b); return s.length ? (s[(s.length - 1) >> 1] + s[s.length >> 1]) / 2 : 0 }\nconst [field, name] = process.env.SCOPE.split(':') // service:order-api, or team:checkout\nconst until = process.env.UNTIL ? Date.parse(process.env.UNTIL) : Date.now(), since = until - {{WINDOW_DAYS}} * 86_400_000\nconst live = [] // the deployments that reached production: a success status\nfor (const d of await all('deployments?environment=production')) {\n if (d.payload?.[field] !== name || Date.parse(d.created_at) > until || Date.parse(d.created_at) < since - {{WINDOW_DAYS}} * 86_400_000) continue\n const ok = (await all(`deployments/${d.id}/statuses?`)).find((s) => s.state === 'success')\n if (ok && Date.parse(ok.created_at) <= until) live.push({ sha: d.sha, at: Date.parse(ok.created_at) })\n}\nlive.sort((a, b) => a.at - b.at)\nconst seen = new Set(), hours = [], inWindow = live.filter((d) => d.at >= since)\nfor (const [i, d] of live.entries()) { // a commit's lead time ends at the first deployment that brought it\n const { commits = [] } = i ? await api(`compare/${live[i - 1].sha}...${d.sha}?per_page=100`) : {} // past 100 commits, page on\n for (const c of commits) if (!seen.has(c.sha) && seen.add(c.sha) && d.at >= since) hours.push((d.at - Date.parse(c.commit.committer.date)) / 3_600_000)\n}\nconst values = { deploys_per_week: inWindow.length / ({{WINDOW_DAYS}} / 7), lead_time_hours: median(hours) }\nconst misses = [values.deploys_per_week < {{DEPLOYS_PER_WEEK}} && 'deployment_frequency', values.lead_time_hours > {{LEAD_TIME_HOURS}} && 'change_lead_time'].filter(Boolean)\nwriteFileSync('reports/delivery-flow.json', JSON.stringify({ until: new Date(until).toISOString(), values, misses }, null, 2))\nif (misses.length) { console.error(`missed targets: ${misses.join(', ')}`); process.exitCode = 1 }\n```",
645
+ "hubWhen": {
646
+ "SOURCE": [
647
+ "script"
648
+ ]
649
+ }
650
+ },
651
+ {
652
+ "id": "ff-failures",
653
+ "type": "fitness-fn",
654
+ "label": "Change fail rate, recovery and rework",
655
+ "x": 1040,
656
+ "y": 390,
657
+ "characteristic": "reliability",
658
+ "scope": "holistic",
659
+ "cadence": "triggered",
660
+ "trigger": "weekly",
661
+ "invocation": "automated",
662
+ "description": "The script reads the production deployments of the unit that went live in the window; a deployment failed when a failure status follows its success status, and its recovery time runs from the one to the other; it is rework when its kind is hotfix or rollback. It writes reports/delivery-failures.json and fails when a target is missed.\n\nThreshold: Change fail rate at most {{CHANGE_FAIL_PCT}}%, median failed deployment recovery time at most {{RECOVERY_HOURS}} hours and deployment rework rate at most {{REWORK_PCT}}% over the last {{WINDOW_DAYS}} days\n\nTool: Node 20 (fetch) over the GitHub REST API: deployments and deployment statuses; run by the weekly GitHub Actions workflow\n\n```js\n// scripts/delivery-failures.mjs: change fail rate, failed deployment recovery time and deployment rework rate over the {{WINDOW_DAYS}} days up to UNTIL\nimport { writeFileSync } from 'node:fs'\nconst api = (path) => fetch(`https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/${path}`, { headers: {\n authorization: `Bearer ${process.env.GITHUB_TOKEN}`, accept: 'application/vnd.github+json' } }).then((r) => r.json())\nconst all = async (path) => { const out = []; for (let page = 1; ; page++) { const xs = await api(`${path}&per_page=100&page=${page}`); out.push(...xs); if (xs.length < 100) return out } }\nconst median = (xs) => { const s = [...xs].sort((a, b) => a - b); return s.length ? (s[(s.length - 1) >> 1] + s[s.length >> 1]) / 2 : 0 }\nconst [field, name] = process.env.SCOPE.split(':') // service:order-api, or team:checkout\nconst until = process.env.UNTIL ? Date.parse(process.env.UNTIL) : Date.now(), since = until - {{WINDOW_DAYS}} * 86_400_000\nconst live = []\nfor (const d of await all('deployments?environment=production')) {\n if (d.payload?.[field] !== name || Date.parse(d.created_at) > until || Date.parse(d.created_at) < since - 86_400_000) continue\n const statuses = await all(`deployments/${d.id}/statuses?`)\n const ok = statuses.find((s) => s.state === 'success') // reached production: counts as a deployment\n if (!ok || Date.parse(ok.created_at) < since || Date.parse(ok.created_at) > until) continue\n const failed = statuses.find((s) => s.state === 'failure' && Date.parse(s.created_at) > Date.parse(ok.created_at)) // posted when service was recovered\n live.push({ kind: d.payload.kind, recovered: failed && Date.parse(failed.created_at) <= until ? (Date.parse(failed.created_at) - Date.parse(ok.created_at)) / 3_600_000 : null })\n}\nconst failed = live.filter((d) => d.recovered !== null), pct = (n) => (100 * n) / (live.length || 1)\nconst values = { change_fail_pct: pct(failed.length), recovery_hours: median(failed.map((d) => d.recovered)), rework_pct: pct(live.filter((d) => d.kind !== 'planned').length) }\nconst misses = [values.change_fail_pct > {{CHANGE_FAIL_PCT}} && 'change_fail_rate', values.recovery_hours > {{RECOVERY_HOURS}} && 'failed_deployment_recovery_time',\n values.rework_pct > {{REWORK_PCT}} && 'deployment_rework_rate'].filter(Boolean)\nwriteFileSync('reports/delivery-failures.json', JSON.stringify({ until: new Date(until).toISOString(), values, misses }, null, 2))\nif (misses.length) { console.error(`missed targets: ${misses.join(', ')}`); process.exitCode = 1 }\n```",
663
+ "hubWhen": {
664
+ "SOURCE": [
665
+ "script"
666
+ ]
667
+ }
668
+ },
669
+ {
670
+ "id": "ff-platform-metrics",
671
+ "type": "fitness-fn",
672
+ "label": "Platform figures against the targets",
673
+ "x": 1040,
674
+ "y": 520,
675
+ "characteristic": "maintainability",
676
+ "scope": "holistic",
677
+ "cadence": "triggered",
678
+ "trigger": "weekly",
679
+ "invocation": "automated",
680
+ "description": "A scheduled GitLab pipeline reads the four figures GitLab computes (deployment_frequency is a count for the period, lead time and time to restore are seconds, change failure rate is a ratio), converts them, writes reports/delivery-platform.json and fails when a target is missed. With interval=all GitLab returns the median of daily medians. With LinearB, Swarmia, DX or Sleuth, the same comparison runs over their export.\n\nThreshold: At least {{DEPLOYS_PER_WEEK}} deployments a week, median lead time at most {{LEAD_TIME_HOURS}} hours, change fail rate at most {{CHANGE_FAIL_PCT}}% and median time to restore at most {{RECOVERY_HOURS}} hours over the last {{WINDOW_DAYS}} days, as GitLab reports them\n\nTool: GitLab DORA API (GET /projects/:id/dora/metrics or /groups/:id/dora/metrics, GitLab Ultimate) with curl and jq in a scheduled pipeline\n\n```bash\n# scripts/delivery-metrics.sh with a platform: GitLab's DORA metrics over the {{WINDOW_DAYS}} days up to UNTIL, against the targets\n# DORA_SCOPE is projects/<id> for one element or groups/<id> for a team's group; GITLAB_TOKEN with read_api, role Reporter or above\nset -euo pipefail\nend=${UNTIL:-$(date -u +%F)}; start=$(date -u -d \"$end -{{WINDOW_DAYS}} days\" +%F)\ndora() { curl -fsS --header \"PRIVATE-TOKEN: $GITLAB_TOKEN\" \\\n \"$CI_API_V4_URL/$DORA_SCOPE/dora/metrics?metric=$1&start_date=$start&end_date=$end&interval=all\" | jq '.[0].value // 0'; }\njq -n --arg until \"$end\" --argjson deploys \"$(dora deployment_frequency)\" --argjson lead \"$(dora lead_time_for_changes)\" \\\n --argjson restore \"$(dora time_to_restore_service)\" --argjson cfr \"$(dora change_failure_rate)\" '\n { until: $until, values: { deploys_per_week: ($deploys / ({{WINDOW_DAYS}} / 7)), lead_time_hours: ($lead / 3600),\n change_fail_pct: ($cfr * 100), recovery_hours: ($restore / 3600) } }\n | .misses = [ if .values.deploys_per_week < {{DEPLOYS_PER_WEEK}} then \"deployment_frequency\" else empty end,\n if .values.lead_time_hours > {{LEAD_TIME_HOURS}} then \"change_lead_time\" else empty end,\n if .values.change_fail_pct > {{CHANGE_FAIL_PCT}} then \"change_fail_rate\" else empty end,\n if .values.recovery_hours > {{RECOVERY_HOURS}} then \"failed_deployment_recovery_time\" else empty end ]' > reports/delivery-platform.json\njq -e '.misses == []' reports/delivery-platform.json > /dev/null || { jq -r '\"missed targets: \\(.misses | join(\", \"))\"' reports/delivery-platform.json; exit 1; }\n```",
681
+ "hubWhen": {
682
+ "SOURCE": [
683
+ "platform"
684
+ ]
685
+ }
686
+ },
687
+ {
688
+ "id": "ff-platform-tiers",
689
+ "type": "fitness-fn",
690
+ "label": "Deploy jobs declare their tier",
691
+ "x": 1040,
692
+ "y": 650,
693
+ "characteristic": "maintainability",
694
+ "scope": "atomic",
695
+ "cadence": "triggered",
696
+ "trigger": "pull-request",
697
+ "invocation": "automated",
698
+ "description": "A check in the pipeline reads .gitlab-ci.yml and fails when a job with an environment does not declare its tier (GitLab would infer it from the name, and count an oddly named production environment as something else), or when no job deploys to production. It reads the file as written: with include: or extends:, point it at the merged YAML that GitLab's CI Lint shows.\n\nThreshold: 0 jobs in .gitlab-ci.yml that deploy without environment:deployment_tier, and at least 1 that deploys to the production tier\n\nTool: Node 20 with the yaml package, in a GitLab CI job\n\n```js\n// scripts/check-deploy-tiers.mjs: every GitLab job that deploys names its environment's tier, and one deploys to production\nimport { readFileSync } from 'node:fs'\nimport { parse } from 'yaml'\n\nconst ci = parse(readFileSync(process.argv[2] ?? '.gitlab-ci.yml', 'utf8'))\nconst deploying = Object.entries(ci).filter(([name, job]) => !name.startsWith('.') && job?.environment)\nconst tier = ([, job]) => (typeof job.environment === 'object' ? job.environment.deployment_tier : undefined)\nconst untiered = deploying.filter((job) => !tier(job)).map(([name]) => name)\nif (untiered.length) throw new Error(`jobs that deploy without environment:deployment_tier, so GitLab guesses it from the name: ${untiered.join(', ')}`)\nif (!deploying.some((job) => tier(job) === 'production')) throw new Error('no job deploys to an environment of the production tier, so GitLab counts no deployment')\nconsole.log(`${deploying.length} deploy jobs, each with its tier`)\n```",
699
+ "hubWhen": {
700
+ "SOURCE": [
701
+ "platform"
702
+ ]
703
+ }
704
+ },
705
+ {
706
+ "id": "ff-miss-streak",
707
+ "type": "fitness-fn",
708
+ "label": "Lasting misses are found",
709
+ "x": 1040,
710
+ "y": 780,
711
+ "characteristic": "maintainability",
712
+ "scope": "atomic",
713
+ "cadence": "triggered",
714
+ "trigger": "weekly",
715
+ "invocation": "automated",
716
+ "description": "After the weekly measurement, the job runs scripts/delivery-metrics.sh again with UNTIL moved back a week at a time, takes the targets missed in every one of the last {{MISS_WEEKS}} windows, writes them to reports/streak.json and lists them in the job summary. The improvement check reads the same file.\n\nThreshold: Every metric off target in each of the last {{MISS_WEEKS}} weekly measurements is listed in the job summary\n\nTool: bash with jq and GNU date, in the weekly GitHub Actions workflow (or the scheduled GitLab pipeline)\n\n```bash\n# weekly, after the measurement: the targets missed in each of the last {{MISS_WEEKS}} weekly measurements\nset -euo pipefail\nrm -f reports/misses-*.json\nfor k in $(seq 0 $(({{MISS_WEEKS}} - 1))); do\n export UNTIL; UNTIL=$(date -u -d \"-$((7 * k)) days\" +%F)\n rm -f reports/delivery-*.json\n ./scripts/delivery-metrics.sh || true # writes reports/delivery-*.json, each with the targets it missed\n jq -s '[.[].misses[]] | unique' reports/delivery-*.json > \"reports/misses-$k.json\"\ndone\njq -s 'reduce .[1:][] as $week (.[0]; map(select(IN($week[]))))' reports/misses-*.json > reports/streak.json\njq -r '.[] | \"\\(.): off target in each of the last {{MISS_WEEKS}} weekly measurements\"' reports/streak.json \\\n | tee -a \"${GITHUB_STEP_SUMMARY:-/dev/null}\"\n```",
717
+ "hubWhen": {
718
+ "SOURCE": [
719
+ "script",
720
+ "platform"
721
+ ]
722
+ }
723
+ },
724
+ {
725
+ "id": "ff-improvement-item",
726
+ "type": "fitness-fn",
727
+ "label": "Lasting misses have an item",
728
+ "x": 1040,
729
+ "y": 910,
730
+ "characteristic": "maintainability",
731
+ "scope": "atomic",
732
+ "cadence": "triggered",
733
+ "trigger": "weekly",
734
+ "invocation": "automated",
735
+ "description": "After the streak step, the job looks for an open improvement item for each metric in reports/streak.json and fails until one exists, so the weekly workflow stays red until the team has taken the miss up.\n\nThreshold: 0 metrics off target in {{MISS_WEEKS}} weekly measurements in a row without an open issue labelled delivery-improvement that names the metric in its title\n\nTool: GitHub CLI (gh issue list); on GitLab: glab issue list --label delivery-improvement --search <metric> --output json\n\n```bash\n# after the streak: each metric off target {{MISS_WEEKS}} weeks in a row has an open improvement item\nset -euo pipefail\nstatus=0\nfor metric in $(jq -r '.[]' reports/streak.json); do\n open=$(gh issue list --label delivery-improvement --state open --search \"$metric in:title\" --json number --jq length)\n [ \"$open\" -gt 0 ] || { echo \"$metric has been off target {{MISS_WEEKS}} weeks in a row and has no open delivery-improvement item\"; status=1; }\ndone\nexit $status\n```",
736
+ "hubWhen": {
737
+ "SOURCE": [
738
+ "script",
739
+ "platform"
740
+ ],
741
+ "RESPONSE": [
742
+ "retro",
743
+ "reserve"
744
+ ]
745
+ }
746
+ },
747
+ {
748
+ "id": "ff-review-record",
749
+ "type": "fitness-fn",
750
+ "label": "The quarterly review is on record",
751
+ "x": 1040,
752
+ "y": 1040,
753
+ "characteristic": "maintainability",
754
+ "scope": "atomic",
755
+ "cadence": "temporal",
756
+ "every": "90d",
757
+ "invocation": "manual",
758
+ "description": "A CI step on the main branch finds the latest review by its quarter in the file name, takes its age from the last commit that touched it, and checks each of the five sections for an answer and a target, and that the review records its actions.\n\nThreshold: The latest file in docs/delivery-reviews is at most 100 days old and has an Answer: and a Target: line for each of the five figures, and an Actions section\n\nTool: bash with git, awk and grep, in CI on the main branch\n\n```bash\n# CI on the main branch: the latest quarterly delivery review is at most 100 days old and answers the five questions against their targets\nset -euo pipefail\nlatest=$(ls docs/delivery-reviews/*-Q[1-4].md | sort | tail -n 1) # docs/delivery-reviews/2026-Q3.md\nage=$(( ( $(date +%s) - $(git log -1 --format=%ct -- \"$latest\") ) / 86400 ))\n[ \"$age\" -le 100 ] || { echo \"$latest is $age days old: the quarterly delivery review is overdue\"; exit 1; }\nfor section in 'Deployment frequency' 'Change lead time' 'Change fail rate' 'Failed deployment recovery time' 'Deployment rework rate'; do\n body=$(awk -v h=\"## $section\" '$0 == h { on = 1; next } /^## / { on = 0 } on' \"$latest\")\n grep -q '^Answer: .' <<< \"$body\" && grep -q '^Target: .' <<< \"$body\" \\\n || { echo \"$latest: the section '$section' needs an Answer: line and a Target: line\"; exit 1; }\ndone\ngrep -q '^## Actions' \"$latest\" || { echo \"$latest has no Actions section\"; exit 1; }\n```",
759
+ "hubWhen": {
760
+ "SOURCE": [
761
+ "review"
762
+ ]
763
+ }
764
+ }
765
+ ],
766
+ "relations": [
767
+ {
768
+ "id": "req-deploy-recorded--derives--need",
769
+ "sourceId": "req-deploy-recorded",
770
+ "targetId": "need",
771
+ "relationType": "derives"
772
+ },
773
+ {
774
+ "id": "req-failure-marked--derives--need",
775
+ "sourceId": "req-failure-marked",
776
+ "targetId": "need",
777
+ "relationType": "derives"
778
+ },
779
+ {
780
+ "id": "req-flow-targets--derives--need",
781
+ "sourceId": "req-flow-targets",
782
+ "targetId": "need",
783
+ "relationType": "derives"
784
+ },
785
+ {
786
+ "id": "req-stability-targets--derives--need",
787
+ "sourceId": "req-stability-targets",
788
+ "targetId": "need",
789
+ "relationType": "derives"
790
+ },
791
+ {
792
+ "id": "req-rework--derives--need",
793
+ "sourceId": "req-rework",
794
+ "targetId": "need",
795
+ "relationType": "derives"
796
+ },
797
+ {
798
+ "id": "req-platform-data--derives--need",
799
+ "sourceId": "req-platform-data",
800
+ "targetId": "need",
801
+ "relationType": "derives"
802
+ },
803
+ {
804
+ "id": "req-response-retro--derives--need",
805
+ "sourceId": "req-response-retro",
806
+ "targetId": "need",
807
+ "relationType": "derives"
808
+ },
809
+ {
810
+ "id": "req-response-reserve--derives--need",
811
+ "sourceId": "req-response-reserve",
812
+ "targetId": "need",
813
+ "relationType": "derives"
814
+ },
815
+ {
816
+ "id": "req-response-report--derives--need",
817
+ "sourceId": "req-response-report",
818
+ "targetId": "need",
819
+ "relationType": "derives"
820
+ },
821
+ {
822
+ "id": "req-review--derives--need",
823
+ "sourceId": "req-review",
824
+ "targetId": "need",
825
+ "relationType": "derives"
826
+ },
827
+ {
828
+ "id": "req-no-ranking--derives--need",
829
+ "sourceId": "req-no-ranking",
830
+ "targetId": "need",
831
+ "relationType": "derives"
832
+ },
833
+ {
834
+ "id": "sc-deploy-recorded--verifies--req-deploy-recorded",
835
+ "sourceId": "sc-deploy-recorded",
836
+ "targetId": "req-deploy-recorded",
837
+ "relationType": "verifies"
838
+ },
839
+ {
840
+ "id": "sc-failure-marked--verifies--req-failure-marked",
841
+ "sourceId": "sc-failure-marked",
842
+ "targetId": "req-failure-marked",
843
+ "relationType": "verifies"
844
+ },
845
+ {
846
+ "id": "sc-flow-targets--verifies--req-flow-targets",
847
+ "sourceId": "sc-flow-targets",
848
+ "targetId": "req-flow-targets",
849
+ "relationType": "verifies"
850
+ },
851
+ {
852
+ "id": "sc-stability-targets--verifies--req-stability-targets",
853
+ "sourceId": "sc-stability-targets",
854
+ "targetId": "req-stability-targets",
855
+ "relationType": "verifies"
856
+ },
857
+ {
858
+ "id": "sc-rework--verifies--req-rework",
859
+ "sourceId": "sc-rework",
860
+ "targetId": "req-rework",
861
+ "relationType": "verifies"
862
+ },
863
+ {
864
+ "id": "sc-platform-data--verifies--req-platform-data",
865
+ "sourceId": "sc-platform-data",
866
+ "targetId": "req-platform-data",
867
+ "relationType": "verifies"
868
+ },
869
+ {
870
+ "id": "sc-response-retro--verifies--req-response-retro",
871
+ "sourceId": "sc-response-retro",
872
+ "targetId": "req-response-retro",
873
+ "relationType": "verifies"
874
+ },
875
+ {
876
+ "id": "sc-response-reserve--verifies--req-response-reserve",
877
+ "sourceId": "sc-response-reserve",
878
+ "targetId": "req-response-reserve",
879
+ "relationType": "verifies"
880
+ },
881
+ {
882
+ "id": "sc-response-report--verifies--req-response-report",
883
+ "sourceId": "sc-response-report",
884
+ "targetId": "req-response-report",
885
+ "relationType": "verifies"
886
+ },
887
+ {
888
+ "id": "sc-review--verifies--req-review",
889
+ "sourceId": "sc-review",
890
+ "targetId": "req-review",
891
+ "relationType": "verifies"
892
+ },
893
+ {
894
+ "id": "sc-no-ranking--verifies--req-no-ranking",
895
+ "sourceId": "sc-no-ranking",
896
+ "targetId": "req-no-ranking",
897
+ "relationType": "verifies"
898
+ },
899
+ {
900
+ "id": "ff-deploy-record--implements--adr-script",
901
+ "sourceId": "ff-deploy-record",
902
+ "targetId": "adr-script",
903
+ "relationType": "implements"
904
+ },
905
+ {
906
+ "id": "ff-failure-marked--implements--adr-script",
907
+ "sourceId": "ff-failure-marked",
908
+ "targetId": "adr-script",
909
+ "relationType": "implements"
910
+ },
911
+ {
912
+ "id": "ff-change-flow--implements--adr-script",
913
+ "sourceId": "ff-change-flow",
914
+ "targetId": "adr-script",
915
+ "relationType": "implements"
916
+ },
917
+ {
918
+ "id": "ff-failures--implements--adr-script",
919
+ "sourceId": "ff-failures",
920
+ "targetId": "adr-script",
921
+ "relationType": "implements"
922
+ },
923
+ {
924
+ "id": "ff-platform-metrics--implements--adr-platform",
925
+ "sourceId": "ff-platform-metrics",
926
+ "targetId": "adr-platform",
927
+ "relationType": "implements"
928
+ },
929
+ {
930
+ "id": "ff-platform-tiers--implements--adr-platform",
931
+ "sourceId": "ff-platform-tiers",
932
+ "targetId": "adr-platform",
933
+ "relationType": "implements"
934
+ },
935
+ {
936
+ "id": "ff-miss-streak--implements--adr-script",
937
+ "sourceId": "ff-miss-streak",
938
+ "targetId": "adr-script",
939
+ "relationType": "implements"
940
+ },
941
+ {
942
+ "id": "ff-miss-streak--implements--adr-platform",
943
+ "sourceId": "ff-miss-streak",
944
+ "targetId": "adr-platform",
945
+ "relationType": "implements"
946
+ },
947
+ {
948
+ "id": "ff-improvement-item--implements--adr-script",
949
+ "sourceId": "ff-improvement-item",
950
+ "targetId": "adr-script",
951
+ "relationType": "implements"
952
+ },
953
+ {
954
+ "id": "ff-improvement-item--implements--adr-platform",
955
+ "sourceId": "ff-improvement-item",
956
+ "targetId": "adr-platform",
957
+ "relationType": "implements"
958
+ },
959
+ {
960
+ "id": "ff-review-record--implements--adr-review",
961
+ "sourceId": "ff-review-record",
962
+ "targetId": "adr-review",
963
+ "relationType": "implements"
964
+ }
965
+ ]
966
+ }