@radicaltools/mcp 0.3.0 → 0.3.2

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 (59) hide show
  1. package/README.md +7 -5
  2. package/dist/{chunk-Z7THA3L5.js → chunk-KEIZXREX.js} +68 -35
  3. package/dist/{elkLayout-TAUBPPVN.js → elkLayout-MFJXDTJG.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 +449 -210
  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 +287 -131
  11. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  12. package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
  13. package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
  14. package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
  15. package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
  16. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
  17. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  18. package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
  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 +473 -167
  24. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  25. package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
  26. package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
  27. package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
  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 +343 -92
  32. package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
  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 +467 -160
  36. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  37. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
  38. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
  39. package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
  40. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
  41. package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
  42. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  43. package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
  44. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  45. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
  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 +332 -74
  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 +257 -183
  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 +271 -137
  56. package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
  57. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  58. package/dist/index.js +1893 -468
  59. package/package.json +1 -1
@@ -0,0 +1,1416 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-code-review-branching",
4
+ "category": "concern",
5
+ "name": "Code review and branching",
6
+ "description": "How a change travels from a developer's machine to the main branch: the branching model, who reviews it and how many must approve, who owns which code, how big a change may be and how old a branch, and what a commit message says.",
7
+ "tags": [
8
+ "maintainability",
9
+ "code review",
10
+ "branching",
11
+ "trunk-based development",
12
+ "codeowners",
13
+ "conventional commits",
14
+ "pull requests"
15
+ ],
16
+ "requiredMetamodel": "c4-ddd-governance-builtin",
17
+ "concern": {
18
+ "id": "code-review-branching",
19
+ "trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
20
+ "why": "code lives in these elements and several people change it, so how a change is branched, reviewed and merged has to be decided; one decision usually covers a whole repository and is bound to every element built from it.",
21
+ "group": "sdlc"
22
+ },
23
+ "sources": [
24
+ {
25
+ "title": "Google Engineering Practices: Code Review Developer Guide",
26
+ "url": "https://google.github.io/eng-practices/review/"
27
+ },
28
+ {
29
+ "title": "Paul Hammant: Trunk Based Development",
30
+ "url": "https://trunkbaseddevelopment.com/"
31
+ },
32
+ {
33
+ "title": "Martin Fowler: Patterns for Managing Source Code Branches",
34
+ "url": "https://martinfowler.com/articles/branching-patterns.html"
35
+ },
36
+ {
37
+ "title": "DORA: DevOps Research and Assessment (Accelerate, State of DevOps)",
38
+ "url": "https://dora.dev/"
39
+ },
40
+ {
41
+ "title": "Vincent Driessen: A successful Git branching model (with the 2020 note of reflection)",
42
+ "url": "https://nvie.com/posts/a-successful-git-branching-model/"
43
+ },
44
+ {
45
+ "title": "Conventional Commits 1.0.0",
46
+ "url": "https://www.conventionalcommits.org/en/v1.0.0/"
47
+ },
48
+ {
49
+ "title": "SmartBear: Best Practices for Peer Code Review (the Cisco review study)",
50
+ "url": "https://smartbear.com/learn/code-review/best-practices-for-peer-code-review/"
51
+ },
52
+ {
53
+ "title": "GitHub Docs: About code owners",
54
+ "url": "https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners"
55
+ },
56
+ {
57
+ "title": "GitHub Docs: About rulesets",
58
+ "url": "https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets"
59
+ }
60
+ ],
61
+ "templateParams": [
62
+ {
63
+ "key": "BRANCHING",
64
+ "title": "Branching",
65
+ "label": "How do changes reach the main branch?",
66
+ "hint": "This decides how long a change lives apart from everyone else's, how unfinished work is hidden, and whether there are branches for versions at all.",
67
+ "defaultValue": "trunk",
68
+ "options": [
69
+ {
70
+ "value": "trunk",
71
+ "label": "trunk-based development",
72
+ "description": "Everyone works on main: a change is a branch of at most a day or two merged through a short pull request; unfinished work ships behind a feature flag. Pick it for a service you deploy continuously (see the Deployment pack) with a test suite the team trusts and a team willing to split work into small steps."
73
+ },
74
+ {
75
+ "value": "feature-pr",
76
+ "label": "feature branches with a pull request each",
77
+ "description": "Each change is a branch with a pull request, merged to main when reviewed and green; main is always releasable and nothing lives on it that is not reviewed. Pick it for most teams: it needs no feature flags for unfinished work, as long as branches stay under a week (set the branch age to 7) and are rebased daily."
78
+ },
79
+ {
80
+ "value": "gitflow",
81
+ "label": "GitFlow with release and hotfix branches",
82
+ "description": "A develop branch collects the next version, a release/x.y branch stabilises it, main holds only tagged releases merged with merge commits, and hotfix branches patch a version in support. Pick it only for a product shipped in numbered versions that customers install and keep running (desktop, on-premises, embedded, SDKs); for a deployed service its own author advises against it (Driessen, 2020 note)."
83
+ }
84
+ ]
85
+ },
86
+ {
87
+ "key": "REVIEW",
88
+ "title": "Review",
89
+ "label": "Who must approve a change?",
90
+ "hint": "A review catches the mistakes tests do not describe and spreads knowledge of the code; the rule says how many eyes a change gets and whether a pair counts.",
91
+ "defaultValue": "one-reviewer",
92
+ "options": [
93
+ {
94
+ "value": "one-reviewer",
95
+ "label": "one approving review from someone other than the author",
96
+ "description": "Every pull request needs one approval from a person who did not write it; a new commit dismisses stale approvals. Pick it as the baseline for a team of three or more; it is what Google's practice assumes."
97
+ },
98
+ {
99
+ "value": "two-critical",
100
+ "label": "two reviews on critical paths, one elsewhere",
101
+ "description": "Changes under the critical directories (payments/, auth/ and migrations/ by default) need two approvals; everything else needs one. Pick it when some directories move money, decide access or change the schema, so a mistake there costs more than a second review."
102
+ },
103
+ {
104
+ "value": "pairing",
105
+ "label": "pair or mob programming counts as the review",
106
+ "description": "A change written by a pair or mob carries Co-authored-by trailers and the partner's approval merges it; a change written alone still needs one review from someone who did not write it. Pick it for a team that pairs most of the day and wants to merge within the hour instead of waiting for an asynchronous review."
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "key": "OWNERSHIP",
112
+ "title": "Ownership",
113
+ "label": "Who owns which code?",
114
+ "hint": "Ownership decides who is asked to review and who may say no; without it, reviews go to whoever is free and nobody is accountable for a directory. Other packs refer to this answer where they need an owner.",
115
+ "defaultValue": "codeowners",
116
+ "options": [
117
+ {
118
+ "value": "codeowners",
119
+ "label": "CODEOWNERS per directory",
120
+ "description": "A CODEOWNERS file maps every top-level directory to a team; a change under a directory needs that team's approval and GitHub asks it automatically. Pick it with two or more teams in one repository, or anywhere a directory holds code with a single accountable team."
121
+ },
122
+ {
123
+ "value": "collective",
124
+ "label": "collective ownership with rotating reviewers",
125
+ "description": "Anyone may change and review anything; a reviewer is assigned round-robin from the team so that reviews spread and knowledge does too. Pick it for one team of up to about eight on one codebase, where naming owners per directory would create bottlenecks."
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "key": "SIZE",
131
+ "title": "Size",
132
+ "label": "Is there a limit on the size of a change?",
133
+ "hint": "Reviewers find most defects in the first 200 to 400 lines and little after that; a limit forces the split that reviewers would otherwise have to ask for.",
134
+ "defaultValue": "limit",
135
+ "options": [
136
+ {
137
+ "value": "limit",
138
+ "label": "a hard limit per pull request",
139
+ "description": "A pull request may change at most a set number of lines (400 by default; generated files and lock files excluded) and is split otherwise; a lead may label an exception. Pick it whenever reviews are slow or shallow today: a limit is the one lever that changes both."
140
+ },
141
+ {
142
+ "value": "none",
143
+ "label": "no limit, with the size reported",
144
+ "description": "The changed-line count is posted on every pull request but nothing blocks; a reviewer may send a large change back. Pick it for a small, disciplined team where large changes are rare and already questioned."
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ "key": "COMMITS",
150
+ "title": "Commits",
151
+ "label": "What must a commit message say?",
152
+ "hint": "The history of main is what the next incident is debugged from and, with a convention, what the changelog and version number are computed from.",
153
+ "defaultValue": "conventional",
154
+ "options": [
155
+ {
156
+ "value": "conventional",
157
+ "label": "Conventional Commits, enforced by commitlint",
158
+ "description": "Every commit subject is type(scope): description (feat, fix, refactor, …), checked by a commit-msg hook, in CI over the branch's commits and on the pull request title that becomes the squash subject; the changelog and the next version are derived from the types. Pick it when you publish a changelog or version numbers, or several teams read one history."
159
+ },
160
+ {
161
+ "value": "free",
162
+ "label": "free-form subjects, squash-merged",
163
+ "description": "A subject line under 72 characters in the imperative, a body that says why; pull requests are squash-merged so the integration branch holds one commit per change with its pull request number. Pick it when nothing is derived from the messages and the pull request, not the commit, is the unit of history."
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ "key": "MAX_PR_LINES",
169
+ "label": "How many changed lines may a pull request have at most?",
170
+ "defaultValue": "400",
171
+ "type": "number"
172
+ },
173
+ {
174
+ "key": "MAX_BRANCH_DAYS",
175
+ "label": "How old may a branch get before it is flagged (days)?",
176
+ "defaultValue": "2",
177
+ "type": "number"
178
+ },
179
+ {
180
+ "key": "REVIEW_HOURS",
181
+ "label": "Within how many working hours must a pull request get its first review?",
182
+ "defaultValue": "4",
183
+ "type": "number"
184
+ },
185
+ {
186
+ "key": "CRITICAL_PATHS",
187
+ "label": "Which directories are critical (need the stricter review)? Comma-separated, each ending with /",
188
+ "defaultValue": "payments/, auth/, migrations/"
189
+ }
190
+ ]
191
+ },
192
+ "nodes": [
193
+ {
194
+ "id": "need",
195
+ "type": "need",
196
+ "label": "Changes merge small, reviewed and soon",
197
+ "x": 0,
198
+ "y": 0,
199
+ "kind": "brief",
200
+ "source": "Hub concern pack: Code review and branching",
201
+ "description": "Several people change this element every day. Each change must reach the main branch while it is still small enough to review and fresh enough to merge without conflict, must be seen by someone other than its author before it lands, must be looked at by the people accountable for the code it touches, and must leave a history that explains itself a year later. Reviews must not become the queue everything waits in."
202
+ },
203
+ {
204
+ "id": "req-protected-main",
205
+ "type": "requirement",
206
+ "label": "Main branch protected",
207
+ "x": 260,
208
+ "y": 0,
209
+ "ears_type": "ubiquitous",
210
+ "action": "protect the main branch with a ruleset that refuses direct pushes, force pushes and deletion, requires a pull request with at least one approval and stale-review dismissal, and requires the status checks named by the Code quality gate and Test strategy decisions to pass",
211
+ "rationale": "A rule that lives in people's memory is skipped under pressure; one in the repository's rulesets is not (GitHub Docs: About rulesets; Fowler, Patterns for Managing Source Code Branches: mainline)."
212
+ },
213
+ {
214
+ "id": "req-linear-history",
215
+ "type": "requirement",
216
+ "label": "Main history is linear",
217
+ "x": 260,
218
+ "y": 130,
219
+ "ears_type": "ubiquitous",
220
+ "action": "keep the history of main linear: the ruleset requires linear history, merge commits are disabled in the repository settings, and every commit on main belongs to a merged pull request",
221
+ "rationale": "A linear history is what bisect and blame work on, and a commit on main without a pull request is a change nobody reviewed (Fowler, Patterns for Managing Source Code Branches: mainline integration; GitHub Docs: About rulesets).",
222
+ "hubWhen": {
223
+ "BRANCHING": [
224
+ "trunk",
225
+ "feature-pr"
226
+ ]
227
+ }
228
+ },
229
+ {
230
+ "id": "req-one-review",
231
+ "type": "requirement",
232
+ "label": "One review from another person",
233
+ "x": 260,
234
+ "y": 260,
235
+ "ears_type": "state-driven",
236
+ "precondition": "a pull request has no approving review from a person other than its author, or its last approval predates its latest commit",
237
+ "action": "refuse to merge it",
238
+ "rationale": "The author is the one person who cannot see their own blind spots; a stale approval has not seen the code being merged (Google, Code Review Developer Guide: the standard of code review).",
239
+ "hubWhen": {
240
+ "REVIEW": [
241
+ "one-reviewer"
242
+ ]
243
+ }
244
+ },
245
+ {
246
+ "id": "req-two-critical",
247
+ "type": "requirement",
248
+ "label": "Two reviews on critical paths",
249
+ "x": 260,
250
+ "y": 390,
251
+ "ears_type": "state-driven",
252
+ "precondition": "a pull request changes a file under {{CRITICAL_PATHS}}",
253
+ "action": "require two current approving reviews from people other than the author before it merges; one approval elsewhere",
254
+ "rationale": "Where a mistake moves money, grants access or loses data, a second reviewer is cheaper than the incident; everywhere else a second review only lengthens the queue (SmartBear, review study: inspection rate and defect density).",
255
+ "hubWhen": {
256
+ "REVIEW": [
257
+ "two-critical"
258
+ ]
259
+ }
260
+ },
261
+ {
262
+ "id": "req-pairing",
263
+ "type": "requirement",
264
+ "label": "Pair counts as review",
265
+ "x": 260,
266
+ "y": 520,
267
+ "ears_type": "event-driven",
268
+ "trigger": "a pull request is opened",
269
+ "action": "merge it on an approval from someone other than the author when every commit carries a Co-authored-by trailer, and otherwise only on an approval from someone who authored or co-authored none of its commits",
270
+ "rationale": "Two people at one keyboard have reviewed every line as it was written; the trailer makes that visible and auditable, and a solo change gets the review it did not have (Fowler, Patterns for Managing Source Code Branches: pre-integration review vs. pairing).",
271
+ "hubWhen": {
272
+ "REVIEW": [
273
+ "pairing"
274
+ ]
275
+ }
276
+ },
277
+ {
278
+ "id": "req-turnaround",
279
+ "type": "requirement",
280
+ "label": "First review within hours",
281
+ "x": 260,
282
+ "y": 650,
283
+ "ears_type": "event-driven",
284
+ "trigger": "a pull request is marked ready for review",
285
+ "action": "give it a first review, review comment or comment from someone other than the author within {{REVIEW_HOURS}} working hours, with the median over the pull requests merged in the last 30 days under {{REVIEW_HOURS}} working hours and the 90th percentile under one working day (8 hours)",
286
+ "rationale": "A review that waits a day stalls the change, grows it while it waits, and pushes the author to start another branch; Google asks for a reply within one business day at most and prefers hours (Google, Speed of Code Reviews; DORA, lead time for changes)."
287
+ },
288
+ {
289
+ "id": "req-owner-approval",
290
+ "type": "requirement",
291
+ "label": "Owning team approves",
292
+ "x": 260,
293
+ "y": 780,
294
+ "ears_type": "event-driven",
295
+ "trigger": "a pull request changes a file under a directory listed in CODEOWNERS",
296
+ "action": "request a review from the owning team automatically and refuse to merge until a member of it approves (the ruleset requires a code-owner review), with every top-level directory listed in CODEOWNERS and every owner a team",
297
+ "rationale": "The team accountable for a directory is the one that knows what a change there breaks; a directory without an owner is reviewed by nobody in particular (GitHub Docs: About code owners).",
298
+ "hubWhen": {
299
+ "OWNERSHIP": [
300
+ "codeowners"
301
+ ]
302
+ }
303
+ },
304
+ {
305
+ "id": "req-rotation",
306
+ "type": "requirement",
307
+ "label": "Reviewer assigned by rotation",
308
+ "x": 260,
309
+ "y": 910,
310
+ "ears_type": "event-driven",
311
+ "trigger": "a pull request is marked ready for review",
312
+ "action": "assign one reviewer from the team round-robin within 15 minutes (the team's review assignment set to round robin), so that over the pull requests merged in the last 30 days no one person gave more than 40% of the reviews",
313
+ "rationale": "Collective ownership works only when reviews actually spread; left to volunteers they go to the same two people (Fowler, Patterns for Managing Source Code Branches; Google, The Standard of Code Review: knowledge sharing).",
314
+ "hubWhen": {
315
+ "OWNERSHIP": [
316
+ "collective"
317
+ ]
318
+ }
319
+ },
320
+ {
321
+ "id": "req-pr-size",
322
+ "type": "requirement",
323
+ "label": "Oversized change split",
324
+ "x": 260,
325
+ "y": 1040,
326
+ "ears_type": "unwanted-behaviour",
327
+ "unwanted_condition": "a pull request changes more than {{MAX_PR_LINES}} lines, generated files and lock files excluded",
328
+ "action": "fail the size check with the count and the suggestion to split, and allow the merge only with a size-exception label set by a lead",
329
+ "rationale": "Reviewers find most defects in the first 200 to 400 lines and little after; past that a review is a formality (SmartBear, review study: 200 to 400 LOC per review; Google, Small CLs).",
330
+ "hubWhen": {
331
+ "SIZE": [
332
+ "limit"
333
+ ]
334
+ }
335
+ },
336
+ {
337
+ "id": "req-size-reported",
338
+ "type": "requirement",
339
+ "label": "Size shown on every pull request",
340
+ "x": 260,
341
+ "y": 1170,
342
+ "ears_type": "event-driven",
343
+ "trigger": "a pull request is opened or updated",
344
+ "action": "post its changed-line count (generated files and lock files excluded) in the check summary, without blocking the merge",
345
+ "rationale": "A number in front of the reviewer is what makes \"please split this\" a fair request instead of a feeling (Google, Small CLs; SmartBear, review study).",
346
+ "hubWhen": {
347
+ "SIZE": [
348
+ "none"
349
+ ]
350
+ }
351
+ },
352
+ {
353
+ "id": "req-branch-age",
354
+ "type": "requirement",
355
+ "label": "Old branches flagged",
356
+ "x": 260,
357
+ "y": 1300,
358
+ "ears_type": "unwanted-behaviour",
359
+ "unwanted_condition": "a branch other than main, develop or a release or hotfix branch has not been merged {{MAX_BRANCH_DAYS}} days after its first commit",
360
+ "action": "flag it in the daily report with its last author, so that it is merged, split or deleted; bot branches (renovate/, dependabot/) are listed apart and not counted",
361
+ "rationale": "The cost of a merge grows with the time apart; a branch older than a few days is already a merge nobody wants to do (Hammant, Trunk Based Development: short-lived feature branches; DORA: lead time)."
362
+ },
363
+ {
364
+ "id": "req-conventional",
365
+ "type": "requirement",
366
+ "label": "Conventional commit messages",
367
+ "x": 260,
368
+ "y": 1430,
369
+ "ears_type": "ubiquitous",
370
+ "action": "accept only commits whose subject follows Conventional Commits 1.0.0 (type, optional scope, description, the header under 72 characters; a ! or BREAKING CHANGE footer for breaking changes), checked by a commit-msg hook on every machine, by commitlint over the pull request's commits in CI, and on the pull request title",
371
+ "rationale": "A typed history is read by people and by tools: the changelog and the next version are computed from it, and a breaking change is marked where it was made; with squash merges the pull request title is the subject that lands on main (Conventional Commits 1.0.0).",
372
+ "hubWhen": {
373
+ "COMMITS": [
374
+ "conventional"
375
+ ]
376
+ }
377
+ },
378
+ {
379
+ "id": "req-free-commits",
380
+ "type": "requirement",
381
+ "label": "Short subjects, one commit per change",
382
+ "x": 260,
383
+ "y": 1560,
384
+ "ears_type": "ubiquitous",
385
+ "action": "keep every commit subject under 72 characters in the imperative with a body saying why, and squash-merge pull requests so that the integration branch (main, or develop under GitFlow) holds one commit per change with the pull request number in its subject",
386
+ "rationale": "Without a convention, the pull request is the unit of history; squashing keeps the integration branch as one line per change with a link to the discussion that explains it (Fowler, Patterns for Managing Source Code Branches: mainline integration).",
387
+ "hubWhen": {
388
+ "COMMITS": [
389
+ "free"
390
+ ]
391
+ }
392
+ },
393
+ {
394
+ "id": "req-trunk",
395
+ "type": "requirement",
396
+ "label": "Branches merge within days",
397
+ "x": 260,
398
+ "y": 1690,
399
+ "ears_type": "ubiquitous",
400
+ "action": "merge every branch to main within {{MAX_BRANCH_DAYS}} days of its first commit, hide unfinished work behind a feature flag (as the Deployment decision sets) or a branch by abstraction, and have every developer integrate to main on at least 80% of the days they commit",
401
+ "rationale": "Daily integration is the practice behind the DORA findings on lead time and change failure rate; a change that waits a week is a week of other people's changes to merge against (Hammant, Trunk Based Development; DORA, Trunk-based development capability).",
402
+ "hubWhen": {
403
+ "BRANCHING": [
404
+ "trunk"
405
+ ]
406
+ }
407
+ },
408
+ {
409
+ "id": "req-feature-pr",
410
+ "type": "requirement",
411
+ "label": "Main always releasable",
412
+ "x": 260,
413
+ "y": 1820,
414
+ "ears_type": "ubiquitous",
415
+ "action": "make every change through a branch and a pull request, merge only when reviewed and green, keep branches under {{MAX_BRANCH_DAYS}} days, and let no commit reach main outside a merged pull request",
416
+ "rationale": "A pull request per change gives every change its review and its checks before it lands; the branch age keeps the model close to continuous integration instead of drifting to long-lived feature branches (Fowler, Patterns for Managing Source Code Branches: feature branching; Hammant: short-lived branches).",
417
+ "hubWhen": {
418
+ "BRANCHING": [
419
+ "feature-pr"
420
+ ]
421
+ }
422
+ },
423
+ {
424
+ "id": "req-gitflow",
425
+ "type": "requirement",
426
+ "label": "Releases and hotfixes branched",
427
+ "x": 260,
428
+ "y": 1950,
429
+ "ears_type": "event-driven",
430
+ "trigger": "a version is about to ship, or a shipped version needs a fix",
431
+ "action": "create release/x.y from develop (fixes only, no features), merge it to main with a merge commit and an annotated tag vX.Y.Z and back into develop, and for a fix branch hotfix/x.y.z from the tag on main and merge it to both main and develop, so that main holds only tagged release and hotfix merges and develop is protected like main",
432
+ "rationale": "Customers who installed version 2.3 need a 2.3.1 without the features of 2.4; release and hotfix branches give each supported version a place to be fixed (Driessen, A successful Git branching model).",
433
+ "hubWhen": {
434
+ "BRANCHING": [
435
+ "gitflow"
436
+ ]
437
+ }
438
+ },
439
+ {
440
+ "id": "sc-protected-main",
441
+ "type": "scenario",
442
+ "label": "Direct push refused",
443
+ "x": 520,
444
+ "y": 0,
445
+ "given": "a developer with write access",
446
+ "when": "they push a commit straight to main, then force-push a branch that was merged",
447
+ "then": "both pushes are refused by the ruleset and the only way in is a pull request with green checks"
448
+ },
449
+ {
450
+ "id": "sc-linear-history",
451
+ "type": "scenario",
452
+ "label": "Merge commit refused",
453
+ "x": 520,
454
+ "y": 130,
455
+ "given": "the ruleset on main",
456
+ "when": "a merge commit is pushed and the weekly history check runs",
457
+ "then": "the push is refused by the linear-history rule, and the check finds no commit on main without a pull request",
458
+ "hubWhen": {
459
+ "BRANCHING": [
460
+ "trunk",
461
+ "feature-pr"
462
+ ]
463
+ }
464
+ },
465
+ {
466
+ "id": "sc-one-review",
467
+ "type": "scenario",
468
+ "label": "Stale approval dismissed",
469
+ "x": 520,
470
+ "y": 260,
471
+ "given": "a pull request approved by a reviewer",
472
+ "when": "the author pushes another commit",
473
+ "then": "the approval is dismissed and the merge button stays disabled until someone approves again",
474
+ "hubWhen": {
475
+ "REVIEW": [
476
+ "one-reviewer"
477
+ ]
478
+ }
479
+ },
480
+ {
481
+ "id": "sc-two-critical",
482
+ "type": "scenario",
483
+ "label": "Second approval required",
484
+ "x": 520,
485
+ "y": 390,
486
+ "given": "a pull request changing a file under {{CRITICAL_PATHS}} with one approval",
487
+ "when": "the merge is attempted",
488
+ "then": "the required check \"critical-paths-review\" fails naming the files and the missing second approval",
489
+ "hubWhen": {
490
+ "REVIEW": [
491
+ "two-critical"
492
+ ]
493
+ }
494
+ },
495
+ {
496
+ "id": "sc-pairing",
497
+ "type": "scenario",
498
+ "label": "Solo change still reviewed",
499
+ "x": 520,
500
+ "y": 520,
501
+ "given": "two pull requests, one with Co-authored-by trailers on all commits and one without",
502
+ "when": "each is approved by a co-author of the first",
503
+ "then": "the first may merge; the second waits for a review from someone who did not write it",
504
+ "hubWhen": {
505
+ "REVIEW": [
506
+ "pairing"
507
+ ]
508
+ }
509
+ },
510
+ {
511
+ "id": "sc-turnaround",
512
+ "type": "scenario",
513
+ "label": "Review turnaround measured",
514
+ "x": 520,
515
+ "y": 650,
516
+ "given": "the pull requests merged in the last 30 days",
517
+ "when": "the working hours from ready-for-review to the first review or comment by someone else are computed from each timeline",
518
+ "then": "the median is under {{REVIEW_HOURS}} working hours and the 90th percentile under 8"
519
+ },
520
+ {
521
+ "id": "sc-owner-approval",
522
+ "type": "scenario",
523
+ "label": "Owner review requested",
524
+ "x": 520,
525
+ "y": 780,
526
+ "given": "a CODEOWNERS file naming a team for payments/",
527
+ "when": "a pull request changes payments/refund.ts",
528
+ "then": "the team is requested automatically and the merge waits for one of its members; the CODEOWNERS check fails on a top-level directory without a team",
529
+ "hubWhen": {
530
+ "OWNERSHIP": [
531
+ "codeowners"
532
+ ]
533
+ }
534
+ },
535
+ {
536
+ "id": "sc-rotation",
537
+ "type": "scenario",
538
+ "label": "Reviews spread",
539
+ "x": 520,
540
+ "y": 910,
541
+ "given": "the team with round-robin assignment and the pull requests merged in the last 30 days",
542
+ "when": "the weekly rotation check runs",
543
+ "then": "every pull request got its review request within 15 minutes of ready-for-review, and no reviewer gave more than 40% of the reviews",
544
+ "hubWhen": {
545
+ "OWNERSHIP": [
546
+ "collective"
547
+ ]
548
+ }
549
+ },
550
+ {
551
+ "id": "sc-pr-size",
552
+ "type": "scenario",
553
+ "label": "Large pull request blocked",
554
+ "x": 520,
555
+ "y": 1040,
556
+ "given": "a pull request changing {{MAX_PR_LINES}} + 1 lines of source",
557
+ "when": "the size check runs",
558
+ "then": "it fails with the line count, and passes only after a split or a size-exception label",
559
+ "hubWhen": {
560
+ "SIZE": [
561
+ "limit"
562
+ ]
563
+ }
564
+ },
565
+ {
566
+ "id": "sc-size-reported",
567
+ "type": "scenario",
568
+ "label": "Size posted",
569
+ "x": 520,
570
+ "y": 1170,
571
+ "given": "a pull request changing 900 lines",
572
+ "when": "the size step runs",
573
+ "then": "the check summary shows 900 changed lines and the check passes",
574
+ "hubWhen": {
575
+ "SIZE": [
576
+ "none"
577
+ ]
578
+ }
579
+ },
580
+ {
581
+ "id": "sc-branch-age",
582
+ "type": "scenario",
583
+ "label": "Stale branch reported",
584
+ "x": 520,
585
+ "y": 1300,
586
+ "given": "a branch whose first commit is {{MAX_BRANCH_DAYS}} + 1 days old and unmerged",
587
+ "when": "the daily branch report runs",
588
+ "then": "the branch is listed with its author and age, and renovate/ and dependabot/ branches appear in a separate list"
589
+ },
590
+ {
591
+ "id": "sc-conventional",
592
+ "type": "scenario",
593
+ "label": "Untyped commit refused",
594
+ "x": 520,
595
+ "y": 1430,
596
+ "given": "a developer committing \"fixed stuff\"",
597
+ "when": "the commit-msg hook runs, and then the same commit is pushed in a pull request titled \"fixed stuff\"",
598
+ "then": "the hook refuses it, the CI commitlint job fails the pull request naming the commit, and the title check fails too",
599
+ "hubWhen": {
600
+ "COMMITS": [
601
+ "conventional"
602
+ ]
603
+ }
604
+ },
605
+ {
606
+ "id": "sc-free-commits",
607
+ "type": "scenario",
608
+ "label": "Squash merge only",
609
+ "x": 520,
610
+ "y": 1560,
611
+ "given": "a pull request with five commits",
612
+ "when": "it is merged and the weekly history check runs",
613
+ "then": "the integration branch gained exactly one commit whose subject is under 72 characters and ends with the pull request number",
614
+ "hubWhen": {
615
+ "COMMITS": [
616
+ "free"
617
+ ]
618
+ }
619
+ },
620
+ {
621
+ "id": "sc-trunk",
622
+ "type": "scenario",
623
+ "label": "Daily integration",
624
+ "x": 520,
625
+ "y": 1690,
626
+ "given": "the commits and merges of the last 14 days",
627
+ "when": "they are grouped by author and day",
628
+ "then": "every active developer merged to main on at least 80% of the days they committed, and the daily report lists no branch older than {{MAX_BRANCH_DAYS}} days",
629
+ "hubWhen": {
630
+ "BRANCHING": [
631
+ "trunk"
632
+ ]
633
+ }
634
+ },
635
+ {
636
+ "id": "sc-feature-pr",
637
+ "type": "scenario",
638
+ "label": "Every commit of main came through a pull request",
639
+ "x": 520,
640
+ "y": 1820,
641
+ "given": "the commits on main in the last 30 days and the branches of the repository",
642
+ "when": "the weekly history check and the daily branch report run",
643
+ "then": "every commit on main belongs to a merged pull request, and no branch is older than {{MAX_BRANCH_DAYS}} days",
644
+ "hubWhen": {
645
+ "BRANCHING": [
646
+ "feature-pr"
647
+ ]
648
+ }
649
+ },
650
+ {
651
+ "id": "sc-gitflow",
652
+ "type": "scenario",
653
+ "label": "Hotfix reaches both branches",
654
+ "x": 520,
655
+ "y": 1950,
656
+ "given": "version 2.3.0 tagged on main and develop ahead of it",
657
+ "when": "a hotfix/2.3.1 is merged and the history job runs",
658
+ "then": "main holds the tag v2.3.1 on a merge from hotfix/2.3.1, develop contains the fix, and the job finds no merge into main from any other branch",
659
+ "hubWhen": {
660
+ "BRANCHING": [
661
+ "gitflow"
662
+ ]
663
+ }
664
+ },
665
+ {
666
+ "id": "adr-trunk",
667
+ "type": "adr",
668
+ "label": "Trunk-based development",
669
+ "x": 780,
670
+ "y": 0,
671
+ "concern": "code-review-branching",
672
+ "status": "accepted",
673
+ "date": "",
674
+ "context": "Several people change the code of this element every day, and every change travels from one machine to the main branch through a branch, a review and a merge. The forces: a branch that lives long drifts from main and merges with pain, but one merged within hours needs a way to hide unfinished work; a review catches the mistakes tests do not describe, but a review that waits a day stalls every change behind it and a review of 2,000 lines catches almost nothing (SmartBear: defect density falls off past about 400 lines); the people who know a directory best are not always free to review it; the history of main is what the next incident is debugged from, so what a commit message says and whether history is linear matters a year later; and products shipped in numbered versions to customers who install them need branches for versions in support, which a service deployed continuously never does. The snippets assume GitHub (rulesets, the GitHub CLI and GraphQL API, GitHub Actions) and one repository layout with source in src/ and the workflow files under .github/workflows/.",
675
+ "decision": "The element is developed trunk-based on GitHub: a change is a branch of at most {{MAX_BRANCH_DAYS}} days merged to main through a short pull request, and unfinished work ships behind a feature flag (OpenFeature with the provider the Deployment decision names) or a branch by abstraction. Main is protected by a ruleset: no direct push or force push, required checks (the Code quality gate and Test strategy jobs), linear history by squash merge. Review: {{REVIEW}}. Ownership: {{OWNERSHIP}}. Size: {{SIZE}}. Commits: {{COMMITS}}. A first review is due within {{REVIEW_HOURS}} working hours; a daily job lists branches older than {{MAX_BRANCH_DAYS}} days.",
676
+ "consequences": "• Merges are small and conflicts rare, because nobody is more than two days away from main; lead time for a change is hours.\n• Unfinished work needs flags or abstraction seams, and flags need clean-up (the Deployment pack's stale-flag check).\n• Every developer must split work into steps that each leave main releasable, which is a skill the team has to build.\n• There is no branch to stabilise a release on: the test suite and the rollout checks are the only safety net.",
677
+ "alternatives": "1. Feature branches with a pull request each: no flags needed for unfinished work, but branches live longer and merges hurt more.\n2. GitFlow: a branch per release, right for installed products, needless ceremony for a service deployed continuously.\n3. Direct commits to main without pull requests: faster still, but the review and the checks have nowhere to run before the code lands.",
678
+ "hubWhen": {
679
+ "BRANCHING": [
680
+ "trunk"
681
+ ]
682
+ }
683
+ },
684
+ {
685
+ "id": "adr-feature-pr",
686
+ "type": "adr",
687
+ "label": "Feature branches with pull requests",
688
+ "x": 780,
689
+ "y": 130,
690
+ "concern": "code-review-branching",
691
+ "status": "accepted",
692
+ "date": "",
693
+ "context": "Several people change the code of this element every day, and every change travels from one machine to the main branch through a branch, a review and a merge. The forces: a branch that lives long drifts from main and merges with pain, but one merged within hours needs a way to hide unfinished work; a review catches the mistakes tests do not describe, but a review that waits a day stalls every change behind it and a review of 2,000 lines catches almost nothing (SmartBear: defect density falls off past about 400 lines); the people who know a directory best are not always free to review it; the history of main is what the next incident is debugged from, so what a commit message says and whether history is linear matters a year later; and products shipped in numbered versions to customers who install them need branches for versions in support, which a service deployed continuously never does. The snippets assume GitHub (rulesets, the GitHub CLI and GraphQL API, GitHub Actions) and one repository layout with source in src/ and the workflow files under .github/workflows/.",
694
+ "decision": "Every change to the element is a branch from main and a pull request on GitHub, rebased on main before merge and merged by squash when reviewed and green; main is always releasable and nothing reaches it any other way. Branches stay under {{MAX_BRANCH_DAYS}} days, and a daily job flags the ones that do not. Main is protected by a ruleset: no direct push or force push, required checks (the Code quality gate and Test strategy jobs), linear history. Review: {{REVIEW}}. Ownership: {{OWNERSHIP}}. Size: {{SIZE}}. Commits: {{COMMITS}}. A first review is due within {{REVIEW_HOURS}} working hours.",
695
+ "consequences": "• Every change gets its review and its checks before it lands; main is releasable at any commit.\n• Unfinished work can stay on its branch, so no feature flags are needed for it, but a branch past a week drifts and merges with pain: the age check is what keeps this model honest.\n• Two branches that touch the same files find out at merge time, later than trunk-based development would.\n• Pull requests are the unit of history and discussion; the squash commit links to it.",
696
+ "alternatives": "1. Trunk-based development: shorter lead time and fewer merge conflicts, at the price of feature flags and smaller steps.\n2. GitFlow: adds develop, release and hotfix branches that a continuously deployed service does not need.\n3. Long-lived feature branches merged when the feature is done: the merges become projects of their own and main stops reflecting the team's work.",
697
+ "hubWhen": {
698
+ "BRANCHING": [
699
+ "feature-pr"
700
+ ]
701
+ }
702
+ },
703
+ {
704
+ "id": "adr-gitflow",
705
+ "type": "adr",
706
+ "label": "GitFlow with release and hotfix branches",
707
+ "x": 780,
708
+ "y": 260,
709
+ "concern": "code-review-branching",
710
+ "status": "accepted",
711
+ "date": "",
712
+ "context": "Several people change the code of this element every day, and every change travels from one machine to the main branch through a branch, a review and a merge. The forces: a branch that lives long drifts from main and merges with pain, but one merged within hours needs a way to hide unfinished work; a review catches the mistakes tests do not describe, but a review that waits a day stalls every change behind it and a review of 2,000 lines catches almost nothing (SmartBear: defect density falls off past about 400 lines); the people who know a directory best are not always free to review it; the history of main is what the next incident is debugged from, so what a commit message says and whether history is linear matters a year later; and products shipped in numbered versions to customers who install them need branches for versions in support, which a service deployed continuously never does. The snippets assume GitHub (rulesets, the GitHub CLI and GraphQL API, GitHub Actions) and one repository layout with source in src/ and the workflow files under .github/workflows/. Here the element ships in numbered versions that customers install and keep running, so a version in support needs a branch of its own to be fixed on.",
713
+ "decision": "The element follows GitFlow on GitHub: feature branches merge to develop through pull requests; a release/x.y branch is cut from develop for each version, takes fixes only, and is merged to main with a merge commit and an annotated tag vX.Y.Z and back into develop; a hotfix/x.y.z branch is cut from the tag on main and merged to both. Main and develop are protected by rulesets (no direct or force push, a pull request with an approval, required checks from the Code quality gate and Test strategy decisions); main accepts merges from release/* and hotfix/* only, so its history holds merge commits and is not linear. Review: {{REVIEW}}. Ownership: {{OWNERSHIP}}. Size: {{SIZE}}. Commits: {{COMMITS}}. Feature branches stay under {{MAX_BRANCH_DAYS}} days; a first review is due within {{REVIEW_HOURS}} working hours. The git-flow AVH command-line extension does the branching; a GitHub Actions job checks main's history and develop's protection.",
714
+ "consequences": "• Each supported version has a branch to fix on; customers on 2.3 get 2.3.1 without 2.4's features.\n• Two long-lived branches (main, develop) and a release branch per version mean double merges and the occasional fix forgotten on one side; the back-merge is checked, not trusted.\n• Integration happens on develop, later than on a trunk; the age limit on feature branches keeps it from drifting further.\n• The model's own author advises against it for software deployed continuously; if the element ever becomes a service, this decision is superseded by trunk-based development.",
715
+ "alternatives": "1. Trunk-based development with release branches cut from main and fixes cherry-picked back: fewer long-lived branches, enough for most versioned products (Hammant: branch for release).\n2. Feature branches with pull requests and tags on main only: no place to fix a version in support once main has moved on.\n3. One branch per customer version kept forever: unbounded maintenance.",
716
+ "hubWhen": {
717
+ "BRANCHING": [
718
+ "gitflow"
719
+ ]
720
+ }
721
+ },
722
+ {
723
+ "id": "adr-codeowners",
724
+ "type": "adr",
725
+ "label": "Code owners per directory",
726
+ "x": 780,
727
+ "y": 390,
728
+ "concern": "code-review-branching",
729
+ "status": "accepted",
730
+ "date": "",
731
+ "context": "Several people change the code of this element every day, and every change travels from one machine to the main branch through a branch, a review and a merge. The forces: a branch that lives long drifts from main and merges with pain, but one merged within hours needs a way to hide unfinished work; a review catches the mistakes tests do not describe, but a review that waits a day stalls every change behind it and a review of 2,000 lines catches almost nothing (SmartBear: defect density falls off past about 400 lines); the people who know a directory best are not always free to review it; the history of main is what the next incident is debugged from, so what a commit message says and whether history is linear matters a year later; and products shipped in numbered versions to customers who install them need branches for versions in support, which a service deployed continuously never does. The snippets assume GitHub (rulesets, the GitHub CLI and GraphQL API, GitHub Actions) and one repository layout with source in src/ and the workflow files under .github/workflows/.",
732
+ "decision": "A CODEOWNERS file at .github/CODEOWNERS maps every top-level directory of the element to a GitHub team; a catch-all line at the top names the platform team for anything unlisted. The ruleset requires a code-owner review, so a change under a directory waits for its team, which GitHub requests automatically. Critical directories ({{CRITICAL_PATHS}}) are owned by the team accountable for them. A CI check parses CODEOWNERS and fails when a top-level directory has no owner or an owner is not a team, and reads the ruleset to confirm the code-owner review is required.",
733
+ "consequences": "• The people who know a directory see every change to it, and a change in payments/ cannot be waved through by a stranger.\n• A team that is slow to review becomes a bottleneck for everyone touching its directory; the turnaround measure shows where.\n• The file must be kept in step with the directory tree; the check fails the build when it is not.\n• Cross-cutting changes collect several owners and several approvals.",
734
+ "alternatives": "1. Collective ownership with rotating reviewers: no bottleneck per directory, but nobody accountable for one either.\n2. Owners listed in a wiki: not enforced, out of date within a month.\n3. One owner for the whole repository: a single person on every pull request's path.",
735
+ "hubWhen": {
736
+ "OWNERSHIP": [
737
+ "codeowners"
738
+ ]
739
+ }
740
+ },
741
+ {
742
+ "id": "adr-collective",
743
+ "type": "adr",
744
+ "label": "Collective ownership with rotating reviewers",
745
+ "x": 780,
746
+ "y": 520,
747
+ "concern": "code-review-branching",
748
+ "status": "accepted",
749
+ "date": "",
750
+ "context": "Several people change the code of this element every day, and every change travels from one machine to the main branch through a branch, a review and a merge. The forces: a branch that lives long drifts from main and merges with pain, but one merged within hours needs a way to hide unfinished work; a review catches the mistakes tests do not describe, but a review that waits a day stalls every change behind it and a review of 2,000 lines catches almost nothing (SmartBear: defect density falls off past about 400 lines); the people who know a directory best are not always free to review it; the history of main is what the next incident is debugged from, so what a commit message says and whether history is linear matters a year later; and products shipped in numbered versions to customers who install them need branches for versions in support, which a service deployed continuously never does. The snippets assume GitHub (rulesets, the GitHub CLI and GraphQL API, GitHub Actions) and one repository layout with source in src/ and the workflow files under .github/workflows/.",
751
+ "decision": "Nobody owns a directory: anyone on the team may change and review any part of the element, and there is no CODEOWNERS file. The team's review assignment on GitHub is set to round robin with one reviewer per pull request, so a review request lands within minutes of ready-for-review and reviews spread across the team; a weekly job reads the reviews of the last 30 days and fails when one person gave more than 40% of them or a request took longer than 15 minutes. Other packs that need an owner of a directory take the whole team.",
752
+ "consequences": "• No bottleneck on one team or person; knowledge of every part spreads with the rotation.\n• Nobody is accountable for a directory, so a critical directory relies on the review count, not on who reviews it.\n• Works for one team of up to about eight; beyond that the rotation lands reviews on people who do not know the code.\n• The assignment setting lives in the team's configuration on GitHub and is checked, not trusted.",
753
+ "alternatives": "1. CODEOWNERS per directory: accountable owners and automatic requests, with a bottleneck per team.\n2. Volunteers picking reviews from a queue: reviews go to the same two people within a month.\n3. Load-balanced assignment: fewer reviews for the busy, but reviews stop spreading evenly.",
754
+ "hubWhen": {
755
+ "OWNERSHIP": [
756
+ "collective"
757
+ ]
758
+ }
759
+ },
760
+ {
761
+ "id": "ff-branch-protection",
762
+ "type": "fitness-fn",
763
+ "label": "Main is protected by a ruleset",
764
+ "x": 1040,
765
+ "y": 0,
766
+ "characteristic": "maintainability",
767
+ "scope": "atomic",
768
+ "cadence": "triggered",
769
+ "trigger": "nightly",
770
+ "invocation": "automated",
771
+ "description": "A scheduled job reads the rules in force on main through the GitHub rulesets API and fails when one of the required rules is missing or weaker than the decision, so a setting changed by hand in the web UI is noticed within a day. The endpoint returns ruleset rules only: a repository still on classic branch protection moves to a ruleset first.\n\nThreshold: The rules active on main include pull_request with at least 1 required approval and stale-review dismissal, required_status_checks with strict mode and at least one context, non_fast_forward (no force push) and deletion; 0 of them missing\n\nTool: GitHub CLI (gh api) in a scheduled GitHub Actions job\n\n```bash\n#!/usr/bin/env bash\n# daily: fails when a rule required by the branching decision is missing on main (rulesets only)\nset -euo pipefail\nrules=$(gh api \"repos/$GITHUB_REPOSITORY/rules/branches/main\")\nneed() { echo \"$rules\" | jq -e \"$1\" > /dev/null || { echo \"missing on main: $2\"; exit 1; }; }\nneed 'map(select(.type==\"pull_request\" and .parameters.required_approving_review_count>=1 and .parameters.dismiss_stale_reviews_on_push)) | length>0' 'pull request with 1 approval, stale reviews dismissed'\nneed 'map(select(.type==\"required_status_checks\" and .parameters.strict_required_status_checks_policy and (.parameters.required_status_checks|length>0))) | length>0' 'required status checks (strict, at least one)'\nneed 'map(select(.type==\"non_fast_forward\")) | length>0' 'no force push'\nneed 'map(select(.type==\"deletion\")) | length>0' 'no deletion'\necho \"main is protected as decided\"\n```"
772
+ },
773
+ {
774
+ "id": "ff-linear-history",
775
+ "type": "fitness-fn",
776
+ "label": "Main history is linear and reviewed",
777
+ "x": 1040,
778
+ "y": 130,
779
+ "characteristic": "maintainability",
780
+ "scope": "atomic",
781
+ "cadence": "triggered",
782
+ "trigger": "weekly",
783
+ "invocation": "automated",
784
+ "description": "A weekly job reads the rules on main and the repository's merge settings through the GitHub API and fails unless linear history is required and merge commits are off; then it walks the commits on main of the last 30 days and asks the API which pull request each belongs to, failing on a commit that belongs to none.\n\nThreshold: The rules active on main include required_linear_history; merge commits are disabled in the repository; 0 commits on main in the last 30 days without an associated merged pull request\n\nTool: GitHub CLI (gh api) with git in a scheduled GitHub Actions job\n\n```bash\n#!/usr/bin/env bash\n# weekly: linear history required, merge commits off, every commit on main from a pull request\nset -euo pipefail\ngh api \"repos/$GITHUB_REPOSITORY/rules/branches/main\" | jq -e 'map(select(.type==\"required_linear_history\")) | length>0' > /dev/null \\\n || { echo \"::error::main does not require linear history\"; exit 1; }\ngh api \"repos/$GITHUB_REPOSITORY\" | jq -e '.allow_merge_commit | not' > /dev/null \\\n || { echo \"::error::merge commits are allowed in the repository settings\"; exit 1; }\ngit fetch --no-tags origin main\nbad=0\nfor sha in $(git log --since='30 days ago' --format=%H origin/main); do\n n=$(gh api \"repos/$GITHUB_REPOSITORY/commits/$sha/pulls\" --jq 'map(select(.merged_at != null)) | length')\n [ \"$n\" -ge 1 ] || { echo \"::error::$sha reached main without a merged pull request\"; bad=1; }\ndone\nexit $bad\n```",
785
+ "hubWhen": {
786
+ "BRANCHING": [
787
+ "trunk",
788
+ "feature-pr"
789
+ ]
790
+ }
791
+ },
792
+ {
793
+ "id": "ff-codeowners",
794
+ "type": "fitness-fn",
795
+ "label": "Every directory has an owner",
796
+ "x": 1040,
797
+ "y": 260,
798
+ "characteristic": "maintainability",
799
+ "scope": "atomic",
800
+ "cadence": "triggered",
801
+ "trigger": "pull-request",
802
+ "invocation": "automated",
803
+ "description": "The CODEOWNERS file names a team per top-level directory with a catch-all first (* @shop/platform, then payments/ @shop/payments, auth/ @shop/identity, migrations/ @shop/data, web/ @shop/storefront); a CI step walks the top-level directories and fails when one has no line of its own, or when an owner is a single person instead of a team, and reads the rules on main to confirm a code-owner review is required.\n\nThreshold: 0 top-level directories without a matching CODEOWNERS line; every owner is a team (@org/team); the rules on main include pull_request with require_code_owner_review\n\nTool: GitHub CODEOWNERS with a shell check and gh api in CI\n\n```bash\n#!/usr/bin/env bash\n# CI step: every top-level directory owned by a team, and the ruleset asks the owners\nset -euo pipefail\nfor dir in $(git ls-tree -d --name-only HEAD | grep -v '^\\.'); do\n grep -Eq \"^$dir/\\s+@[a-z0-9-]+/[a-z0-9-]+\" .github/CODEOWNERS || { echo \"no team owns $dir/\"; exit 1; }\ndone\nif grep -Eq '^\\S+\\s+@[a-z0-9-]+\\s*$' .github/CODEOWNERS; then echo \"an owner is a person, not a team\"; exit 1; fi\ngh api \"repos/$GITHUB_REPOSITORY/rules/branches/main\" | jq -e 'map(select(.type==\"pull_request\" and .parameters.require_code_owner_review)) | length>0' > /dev/null \\\n || { echo \"the ruleset on main does not require a code-owner review\"; exit 1; }\necho \"every top-level directory has an owning team, and the ruleset asks it\"\n```",
804
+ "hubWhen": {
805
+ "OWNERSHIP": [
806
+ "codeowners"
807
+ ]
808
+ }
809
+ },
810
+ {
811
+ "id": "ff-review-rotation",
812
+ "type": "fitness-fn",
813
+ "label": "Reviews rotate and arrive in minutes",
814
+ "x": 1040,
815
+ "y": 390,
816
+ "characteristic": "maintainability",
817
+ "scope": "atomic",
818
+ "cadence": "triggered",
819
+ "trigger": "weekly",
820
+ "invocation": "automated",
821
+ "description": "A weekly script reads the team's review-assignment settings and the last 100 merged pull requests through the GraphQL API, keeps the ones merged in the last 30 days, measures the minutes from ready-for-review (or creation) to the first review request, counts the reviews per reviewer and fails on a request slower than 15 minutes, a reviewer above 40%, or an assignment algorithm other than round robin.\n\nThreshold: The team's review assignment is round robin; over the pull requests merged in the last 30 days, every review request came within 15 minutes of ready-for-review and no reviewer gave more than 40% of the reviews\n\nTool: GitHub GraphQL API (gh api graphql) with a Node script\n\n```ts\n// scripts/review-rotation.ts (weekly; TEAM=<team slug>)\nimport { execFileSync } from 'node:child_process'\nconst [owner, name] = process.env.GITHUB_REPOSITORY!.split('/')\nconst gql = (query: string, vars: Record<string, string>) =>\n JSON.parse(execFileSync('gh', ['api', 'graphql', '-f', `query=${query}`, ...Object.entries(vars).flatMap(([k, v]) => ['-F', `${k}=${v}`])]).toString()).data\nconst team = gql(`query($owner:String!,$team:String!){ organization(login:$owner){ team(slug:$team){ reviewRequestDelegationEnabled reviewRequestDelegationAlgorithm } } }`,\n { owner, team: process.env.TEAM! }).organization.team\nconst prs = gql(`query($owner:String!,$name:String!){ repository(owner:$owner,name:$name){\n pullRequests(first:100, states:MERGED, orderBy:{field:UPDATED_AT,direction:DESC}){ nodes{ number createdAt mergedAt author{login}\n timelineItems(itemTypes:[READY_FOR_REVIEW_EVENT,REVIEW_REQUESTED_EVENT,PULL_REQUEST_REVIEW], first:50){ nodes{ __typename\n ... on ReadyForReviewEvent{ createdAt } ... on ReviewRequestedEvent{ createdAt } ... on PullRequestReview{ author{login} } } } } } } }`,\n { owner, name }).repository.pullRequests.nodes.filter((pr: any) => Date.parse(pr.mergedAt) > Date.now() - 30 * 86_400_000)\nconst perReviewer: Record<string, number> = {}\nlet slow = 0\nfor (const pr of prs) {\n const items = pr.timelineItems.nodes\n const ready = items.filter((i: any) => i.__typename === 'ReadyForReviewEvent').map((i: any) => i.createdAt).sort().pop() ?? pr.createdAt\n const requested = items.find((i: any) => i.__typename === 'ReviewRequestedEvent' && i.createdAt >= ready)\n if (!requested || Date.parse(requested.createdAt) - Date.parse(ready) > 15 * 60_000) slow++\n for (const r of items.filter((i: any) => i.__typename === 'PullRequestReview' && i.author?.login !== pr.author?.login)) perReviewer[r.author.login] = (perReviewer[r.author.login] ?? 0) + 1\n}\nconst total = Object.values(perReviewer).reduce((a, b) => a + b, 0)\nconst top = Object.entries(perReviewer).sort((a, b) => b[1] - a[1])[0]\nconsole.log({ prs: prs.length, slowRequests: slow, top, algorithm: team.reviewRequestDelegationAlgorithm })\nif (!team.reviewRequestDelegationEnabled || team.reviewRequestDelegationAlgorithm !== 'ROUND_ROBIN') { console.error('review assignment is not round robin'); process.exit(1) }\nif (slow > 0 || (top && top[1] > 0.4 * total)) process.exit(1)\n```",
822
+ "hubWhen": {
823
+ "OWNERSHIP": [
824
+ "collective"
825
+ ]
826
+ }
827
+ },
828
+ {
829
+ "id": "ff-pr-size",
830
+ "type": "fitness-fn",
831
+ "label": "Pull requests stay small",
832
+ "x": 1040,
833
+ "y": 520,
834
+ "characteristic": "maintainability",
835
+ "scope": "atomic",
836
+ "cadence": "triggered",
837
+ "trigger": "pull-request",
838
+ "invocation": "automated",
839
+ "description": "A required check on every pull request sums additions and deletions over its files from the GitHub API (all pages, slurped into one array, since a large pull request has more than one page of files), skipping lock files, snapshots and generated code, and fails above the limit with the count; a lead may set the size-exception label, which the check honours.\n\nThreshold: Changed lines per pull request (additions + deletions, generated and lock files excluded) at most {{MAX_PR_LINES}}; the check fails above it unless the size-exception label is set\n\nTool: GitHub CLI (gh api --paginate --slurp) as a required GitHub Actions check\n\n```bash\n#!/usr/bin/env bash\n# required check \"pr-size\": fails above the limit of changed lines of source\nset -euo pipefail\nMAX={{MAX_PR_LINES}}\npr=$(jq -r .pull_request.number \"$GITHUB_EVENT_PATH\")\nlines=$(gh api --paginate --slurp \"repos/$GITHUB_REPOSITORY/pulls/$pr/files\" \\\n | jq '[.[][] | select(.filename | test(\"(package-lock\\\\.json|yarn\\\\.lock|pnpm-lock\\\\.yaml|\\\\.snap$|/generated/|\\\\.min\\\\.js$)\") | not)\n | .additions + .deletions] | add // 0')\nlabels=$(gh pr view \"$pr\" --json labels -q '.labels[].name')\necho \"changed lines of source: $lines (limit $MAX)\"\nif [ \"$lines\" -gt \"$MAX\" ] && ! grep -qx size-exception <<< \"$labels\"; then\n echo \"::error::$lines changed lines; split the pull request or ask a lead for the size-exception label\"; exit 1\nfi\n```",
840
+ "hubWhen": {
841
+ "SIZE": [
842
+ "limit"
843
+ ]
844
+ }
845
+ },
846
+ {
847
+ "id": "ff-pr-size-report",
848
+ "type": "fitness-fn",
849
+ "label": "Size shown on the pull request",
850
+ "x": 1040,
851
+ "y": 650,
852
+ "characteristic": "maintainability",
853
+ "scope": "atomic",
854
+ "cadence": "triggered",
855
+ "trigger": "pull-request",
856
+ "invocation": "automated",
857
+ "description": "A step on every pull request sums additions and deletions over its files from the GitHub API (all pages), skipping lock files, snapshots and generated code, and writes the count to the job summary as a notice; nothing blocks.\n\nThreshold: Every pull request's check summary shows its changed lines of source (additions + deletions, generated and lock files excluded); the step exits 0\n\nTool: GitHub CLI (gh api --paginate --slurp) in a GitHub Actions step\n\n```bash\n#!/usr/bin/env bash\n# pull-request step \"pr-size\": the count in the summary, never blocking\nset -euo pipefail\npr=$(jq -r .pull_request.number \"$GITHUB_EVENT_PATH\")\nlines=$(gh api --paginate --slurp \"repos/$GITHUB_REPOSITORY/pulls/$pr/files\" \\\n | jq '[.[][] | select(.filename | test(\"(package-lock\\\\.json|yarn\\\\.lock|pnpm-lock\\\\.yaml|\\\\.snap$|/generated/|\\\\.min\\\\.js$)\") | not)\n | .additions + .deletions] | add // 0')\necho \"::notice::$lines changed lines of source\"\necho \"Changed lines of source: **$lines**\" >> \"$GITHUB_STEP_SUMMARY\"\n```",
858
+ "hubWhen": {
859
+ "SIZE": [
860
+ "none"
861
+ ]
862
+ }
863
+ },
864
+ {
865
+ "id": "ff-branch-age",
866
+ "type": "fitness-fn",
867
+ "label": "No long-lived branches",
868
+ "x": 1040,
869
+ "y": 780,
870
+ "characteristic": "maintainability",
871
+ "scope": "atomic",
872
+ "cadence": "triggered",
873
+ "trigger": "nightly",
874
+ "invocation": "automated",
875
+ "description": "A daily job lists every branch, computes the age of its first commit not on main, and fails naming the branches over the limit and their last authors; Renovate and Dependabot branches are listed separately so a stale dependency update does not hide a stale feature branch, and the other way round.\n\nThreshold: 0 branches older than {{MAX_BRANCH_DAYS}} days (first commit not on main) other than main, develop, release/* and hotfix/*; bot branches (renovate/, dependabot/) reported apart and not counted\n\nTool: git in a scheduled GitHub Actions job\n\n```bash\n#!/usr/bin/env bash\n# daily: flags branches whose first own commit is older than the limit\nset -euo pipefail\nMAX={{MAX_BRANCH_DAYS}}\ngit fetch --prune origin '+refs/heads/*:refs/remotes/origin/*'\nnow=$(date +%s); stale=0\nfor b in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin | grep -Ev '/(main|develop|HEAD)$|/(release|hotfix)/'); do\n first=$(git log --format=%ct origin/main..\"$b\" | tail -1); [ -z \"$first\" ] && continue # oldest commit not on main\n age=$(( (now - first) / 86400 )); author=$(git log -1 --format=%an \"$b\")\n case \"$b\" in\n origin/renovate/*|origin/dependabot/*) echo \"bot: $b $age d\";;\n *) if [ \"$age\" -gt \"$MAX\" ]; then echo \"::error::$b is $age days old (last: $author); merge, split or delete it\"; stale=$((stale+1)); fi;;\n esac\ndone\n[ \"$stale\" -eq 0 ]\n```"
876
+ },
877
+ {
878
+ "id": "ff-commitlint",
879
+ "type": "fitness-fn",
880
+ "label": "Commit messages are conventional",
881
+ "x": 1040,
882
+ "y": 910,
883
+ "characteristic": "maintainability",
884
+ "scope": "atomic",
885
+ "cadence": "triggered",
886
+ "trigger": "pull-request",
887
+ "invocation": "automated",
888
+ "description": "commitlint with the conventional config runs on every commit through a husky commit-msg hook, and again in CI over all commits of the pull request, so a commit made with --no-verify is still caught before the merge; a second job checks the pull request title, which becomes the subject on main under squash merges. semantic-release or release-please derives the changelog and version from the types.\n\nThreshold: 100% of commits in a pull request pass commitlint with the conventional config and a header of at most 72 characters; the pull request title passes the same check; the hook runs on every clone after npm install\n\nTool: commitlint with husky, and action-semantic-pull-request for the title\n\n```js\n// commitlint.config.js\nmodule.exports = {\n extends: ['@commitlint/config-conventional'],\n rules: {\n 'header-max-length': [2, 'always', 72],\n 'scope-enum': [2, 'always', ['api', 'web', 'payments', 'auth', 'db', 'ci', 'deps']],\n },\n}\n// package.json: \"scripts\": { \"prepare\": \"husky\" }\n// .husky/commit-msg: npx --no -- commitlint --edit \"$1\"\n// CI (pull_request): npx commitlint --from \"$BASE_SHA\" --to \"$HEAD_SHA\" --verbose\n// the title, which squash merges put on main (.github/workflows/pr-title.yml, on: pull_request_target: types [opened, edited, synchronize]):\n// - uses: amannn/action-semantic-pull-request@v6.1.1 # pin by commit SHA in your repository\n// env: { GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} }\n```",
889
+ "hubWhen": {
890
+ "COMMITS": [
891
+ "conventional"
892
+ ]
893
+ }
894
+ },
895
+ {
896
+ "id": "ff-squash-subjects",
897
+ "type": "fitness-fn",
898
+ "label": "Squash merges with short subjects",
899
+ "x": 1040,
900
+ "y": 1040,
901
+ "characteristic": "maintainability",
902
+ "scope": "atomic",
903
+ "cadence": "triggered",
904
+ "trigger": "nightly",
905
+ "invocation": "automated",
906
+ "description": "A scheduled job reads the repository's merge settings through the API and fails unless squash is the only merge method, then walks the last 30 days of main and fails on a subject over 72 characters or one that does not end with a pull request number.\n\nThreshold: Repository allows squash merge only (merge commits and rebase merges off); 0 commits on main in the last 30 days with a subject over 72 characters or without a pull request number\n\nTool: GitHub CLI (gh api) with git in a scheduled GitHub Actions job\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\ngh api \"repos/$GITHUB_REPOSITORY\" | jq -e '.allow_squash_merge and (.allow_merge_commit|not) and (.allow_rebase_merge|not)' > /dev/null \\\n || { echo \"::error::squash must be the only merge method\"; exit 1; }\ngit fetch --no-tags origin main\nbad=0\nwhile IFS= read -r subject; do\n if [ \"${#subject}\" -gt 72 ] || ! grep -Eq '\\(#[0-9]+\\)$' <<< \"$subject\"; then echo \"::error::bad subject on main: $subject\"; bad=$((bad+1)); fi\ndone < <(git log --since='30 days ago' --no-merges --format=%s origin/main)\n[ \"$bad\" -eq 0 ]\n```",
907
+ "hubWhen": {
908
+ "COMMITS": [
909
+ "free"
910
+ ],
911
+ "BRANCHING": [
912
+ "trunk",
913
+ "feature-pr"
914
+ ]
915
+ }
916
+ },
917
+ {
918
+ "id": "ff-develop-subjects",
919
+ "type": "fitness-fn",
920
+ "label": "Squash merges into develop with short subjects",
921
+ "x": 1040,
922
+ "y": 1170,
923
+ "characteristic": "maintainability",
924
+ "scope": "atomic",
925
+ "cadence": "triggered",
926
+ "trigger": "nightly",
927
+ "invocation": "automated",
928
+ "description": "Under GitFlow the release and hotfix merges into main are merge commits, so the squash rule applies to develop: a scheduled job checks that rebase merging is off (squash for feature pull requests, merge commits for releases), then walks the non-merge commits of develop in the last 30 days and fails on a subject over 72 characters or without a pull request number.\n\nThreshold: Repository allows squash and merge commits, rebase merges off; 0 non-merge commits on develop in the last 30 days with a subject over 72 characters or without a pull request number\n\nTool: GitHub CLI (gh api) with git in a scheduled GitHub Actions job\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\ngh api \"repos/$GITHUB_REPOSITORY\" | jq -e '.allow_squash_merge and .allow_merge_commit and (.allow_rebase_merge|not)' > /dev/null \\\n || { echo \"::error::squash (features) and merge commits (releases) on, rebase merges off\"; exit 1; }\ngit fetch --no-tags origin develop\nbad=0\nwhile IFS= read -r subject; do\n if [ \"${#subject}\" -gt 72 ] || ! grep -Eq '\\(#[0-9]+\\)$' <<< \"$subject\"; then echo \"::error::bad subject on develop: $subject\"; bad=$((bad+1)); fi\ndone < <(git log --since='30 days ago' --no-merges --first-parent --format=%s origin/develop)\n[ \"$bad\" -eq 0 ]\n```",
929
+ "hubWhen": {
930
+ "COMMITS": [
931
+ "free"
932
+ ],
933
+ "BRANCHING": [
934
+ "gitflow"
935
+ ]
936
+ }
937
+ },
938
+ {
939
+ "id": "ff-review-turnaround",
940
+ "type": "fitness-fn",
941
+ "label": "Reviews come within hours",
942
+ "x": 1040,
943
+ "y": 1300,
944
+ "characteristic": "maintainability",
945
+ "scope": "atomic",
946
+ "cadence": "triggered",
947
+ "trigger": "weekly",
948
+ "invocation": "automated",
949
+ "description": "A weekly job reads the last 100 merged pull requests through the GraphQL API, keeps the ones merged in the last 30 days, takes the later of each one's creation and its last ready-for-review event as the start and the first review (which also covers review comments) or conversation comment by someone other than the author as the end, counts working hours (Mon–Fri, 9–17 in the runner's TZ) between them, and fails on the percentiles; the numbers go to the team's dashboard beside the DORA lead time.\n\nThreshold: Over the pull requests merged in the last 30 days, working hours from ready-for-review to the first review, review comment or comment by someone else: median under {{REVIEW_HOURS}}, 90th percentile under 8\n\nTool: GitHub GraphQL API (gh api graphql) with a Node script\n\n```ts\n// scripts/review-turnaround.ts (weekly; TZ=Europe/Warsaw)\nimport { execFileSync } from 'node:child_process'\nconst REVIEW_HOURS = {{REVIEW_HOURS}}\nconst q = `query($owner:String!,$name:String!){ repository(owner:$owner,name:$name){\n pullRequests(first:100, states:MERGED, orderBy:{field:UPDATED_AT,direction:DESC}){ nodes{ number createdAt mergedAt author{login}\n timelineItems(itemTypes:[READY_FOR_REVIEW_EVENT,PULL_REQUEST_REVIEW,ISSUE_COMMENT], first:50){ nodes{ __typename\n ... on ReadyForReviewEvent{ createdAt } ... on PullRequestReview{ createdAt author{login} } ... on IssueComment{ createdAt author{login} } } } } } } }`\nconst [owner, name] = process.env.GITHUB_REPOSITORY!.split('/')\nconst data = JSON.parse(execFileSync('gh', ['api', 'graphql', '-f', `query=${q}`, '-F', `owner=${owner}`, '-F', `name=${name}`]).toString())\nconst workingHours = (from: Date, to: Date): number => { // Mon–Fri 9–17, hour by hour\n let h = 0\n for (const t = new Date(from); t < to; t.setHours(t.getHours() + 1)) if (t.getDay() >= 1 && t.getDay() <= 5 && t.getHours() >= 9 && t.getHours() < 17) h++\n return h\n}\nconst hours = data.data.repository.pullRequests.nodes\n .filter((pr: any) => Date.parse(pr.mergedAt) > Date.now() - 30 * 86_400_000)\n .flatMap((pr: any) => {\n const items = pr.timelineItems.nodes\n const ready = items.filter((i: any) => i.__typename === 'ReadyForReviewEvent').map((i: any) => i.createdAt).sort().pop() ?? pr.createdAt\n const first = items.find((i: any) => i.__typename !== 'ReadyForReviewEvent' && i.author?.login !== pr.author?.login && i.createdAt > ready)\n return first ? [workingHours(new Date(ready), new Date(first.createdAt))] : []\n }).sort((a: number, b: number) => a - b)\nconst p = (n: number) => hours[Math.floor(hours.length * n)] ?? 0\nconsole.log({ prs: hours.length, p50: p(0.5), p90: p(0.9) })\nif (p(0.5) > REVIEW_HOURS || p(0.9) > 8) process.exit(1)\n```"
950
+ },
951
+ {
952
+ "id": "ff-critical-two-approvals",
953
+ "type": "fitness-fn",
954
+ "label": "Critical paths get two approvals",
955
+ "x": 1040,
956
+ "y": 1430,
957
+ "characteristic": "maintainability",
958
+ "scope": "atomic",
959
+ "cadence": "triggered",
960
+ "trigger": "pull-request",
961
+ "invocation": "manual",
962
+ "description": "GitHub rulesets cannot vary the approval count by path, so a required check does it: on every review and push it lists the changed files, and when one is under a critical path it counts the latest review per reviewer (so a reviewer who later requested changes no longer counts) by people other than the author and fails below two. With CODEOWNERS, the ruleset requires the owning team's approval on top.\n\nThreshold: A pull request touching {{CRITICAL_PATHS}} merges only with 2 current approvals from non-authors; 0 such merges with fewer\n\nTool: GitHub Actions with gh (required check \"critical-paths-review\")\n\n```yaml\n# .github/workflows/critical-paths-review.yml\nname: critical-paths-review\non:\n pull_request: { types: [opened, synchronize, ready_for_review] }\n pull_request_review: { types: [submitted, dismissed] }\njobs:\n check:\n runs-on: ubuntu-latest\n env:\n GH_TOKEN: ${{ github.token }}\n PR: ${{ github.event.pull_request.number }}\n CRITICAL: '{{CRITICAL_PATHS}}'\n steps:\n - run: |\n pattern=\"^($(sed -E 's#/##g; s/, */|/g' <<< \"$CRITICAL\"))/\" # \"payments/, auth/, migrations/\" -> ^(payments|auth|migrations)/\n files=$(gh api --paginate \"repos/$GITHUB_REPOSITORY/pulls/$PR/files\" -q '.[].filename')\n grep -Eq \"$pattern\" <<< \"$files\" || { echo \"no critical path touched\"; exit 0; }\n author=$(gh pr view \"$PR\" --json author -q .author.login)\n approvals=$(gh pr view \"$PR\" --json latestReviews -q \"[.latestReviews[] | select(.state==\\\"APPROVED\\\" and .author.login!=\\\"$author\\\") | .author.login] | unique | length\")\n [ \"$approvals\" -ge 2 ] || { echo \"::error::critical path changed; $approvals of 2 approvals\"; exit 1; }\n```",
963
+ "hubWhen": {
964
+ "REVIEW": [
965
+ "two-critical"
966
+ ]
967
+ }
968
+ },
969
+ {
970
+ "id": "ff-pair-trailer",
971
+ "type": "fitness-fn",
972
+ "label": "Pair changes name their partner",
973
+ "x": 1040,
974
+ "y": 1560,
975
+ "characteristic": "maintainability",
976
+ "scope": "atomic",
977
+ "cadence": "triggered",
978
+ "trigger": "pull-request",
979
+ "invocation": "manual",
980
+ "description": "A required check reads the pull request's commits and its latest review per reviewer: when every commit carries a Co-authored-by trailer, an approval from anyone but the author is enough (the partner's included); otherwise the approver must have written none of the commits, so each approver's login is resolved to e-mail addresses through the users API (the public e-mail and the two noreply forms) and compared with the trailers. Pairs set the trailer once with git-mob or a commit template.\n\nThreshold: A pull request with a Co-authored-by trailer on 100% of its commits merges on any current approval by a non-author; one without merges only on an approval from someone whose e-mail is neither the author's nor in any trailer\n\nTool: GitHub Actions with gh and git interpret-trailers (required check \"pair-or-review\")\n\n```bash\n#!/usr/bin/env bash\n# required check \"pair-or-review\": a pair's partner may approve; a solo change needs an outsider\nset -euo pipefail\nauthor=$(gh pr view \"$PR\" --json author -q .author.login)\napprovers=$(gh pr view \"$PR\" --json latestReviews -q '.latestReviews[] | select(.state==\"APPROVED\") | .author.login' | sort -u | grep -vx \"$author\" || true)\n[ -n \"$approvers\" ] || { echo \"::error::no approval from anyone but the author\"; exit 1; }\ntrailers=\"\"; solo=0\nfor sha in $(gh pr view \"$PR\" --json commits -q '.commits[].oid'); do\n t=$(git log -1 --format=%B \"$sha\" | git interpret-trailers --parse | grep -i '^Co-authored-by:' || true)\n [ -n \"$t\" ] || solo=1\n trailers=\"$trailers $(tr 'A-Z' 'a-z' <<< \"$t\")\"\ndone\nif [ \"$solo\" -eq 0 ]; then echo \"pair change: Co-authored-by on every commit, the partner's approval counts\"; exit 0; fi\nemails_of() { gh api \"users/$1\" --jq '[.email // empty, \"\\(.id)+\\(.login)@users.noreply.github.com\", \"\\(.login)@users.noreply.github.com\"] | .[]' | tr 'A-Z' 'a-z'; }\nfor a in $approvers; do # a solo change: the approver must not be one of its writers\n outsider=1\n for e in $(emails_of \"$a\"); do grep -qF \"<$e>\" <<< \"$trailers\" && outsider=0; done\n [ \"$outsider\" -eq 1 ] && { echo \"approved by $a, who wrote none of the commits\"; exit 0; }\ndone\necho \"::error::not every commit names a partner, and every approver co-wrote the change; ask someone else to review\"; exit 1\n```",
981
+ "hubWhen": {
982
+ "REVIEW": [
983
+ "pairing"
984
+ ]
985
+ }
986
+ },
987
+ {
988
+ "id": "ff-gitflow-history",
989
+ "type": "fitness-fn",
990
+ "label": "Main holds only releases, develop is protected",
991
+ "x": 1040,
992
+ "y": 1690,
993
+ "characteristic": "maintainability",
994
+ "scope": "atomic",
995
+ "cadence": "triggered",
996
+ "trigger": "pull-request",
997
+ "invocation": "automated",
998
+ "description": "A job on every push to main checks that each merged branch was a release or hotfix branch, that the merge is tagged with a semantic version, and that the tagged commit is reachable from develop (the back-merge happened); it fails otherwise, so a forgotten back-merge is found the same day and not in the next release. It also reads the rules on develop and fails when develop takes direct or force pushes.\n\nThreshold: 100% of merge commits on main come from release/* or hotfix/*; every merge to main carries an annotated tag vX.Y.Z; 0 tags on main absent from develop; the rules on develop include pull_request and non_fast_forward\n\nTool: git and gh api in a GitHub Actions job on push to main\n\n```bash\n#!/usr/bin/env bash\n# on push to main: release and hotfix merges only, tagged and back-merged; develop protected\nset -euo pipefail\ngit fetch origin develop --tags\nfor m in $(git log --merges --first-parent --format=%H origin/main~20..origin/main); do\n src=$(git log -1 --format=%s \"$m\" | grep -oE \"(release|hotfix)/[0-9]+\\.[0-9]+(\\.[0-9]+)?\" || true)\n [ -n \"$src\" ] || { echo \"::error::$m merged into main from something other than release/* or hotfix/*\"; exit 1; }\n tag=$(git tag --points-at \"$m\" | grep -E '^v[0-9]+\\.[0-9]+\\.[0-9]+$' || true)\n [ -n \"$tag\" ] || { echo \"::error::merge $m of $src has no vX.Y.Z tag\"; exit 1; }\n git merge-base --is-ancestor \"$m\" origin/develop || { echo \"::error::$tag not merged back into develop\"; exit 1; }\ndone\ngh api \"repos/$GITHUB_REPOSITORY/rules/branches/develop\" | jq -e '(map(select(.type==\"pull_request\")) | length>0) and (map(select(.type==\"non_fast_forward\")) | length>0)' > /dev/null \\\n || { echo \"::error::develop is not protected (pull request required, no force push)\"; exit 1; }\necho \"main holds tagged releases, all back-merged; develop is protected\"\n```",
999
+ "hubWhen": {
1000
+ "BRANCHING": [
1001
+ "gitflow"
1002
+ ]
1003
+ }
1004
+ },
1005
+ {
1006
+ "id": "ff-daily-integration",
1007
+ "type": "fitness-fn",
1008
+ "label": "Everyone integrates daily",
1009
+ "x": 1040,
1010
+ "y": 1820,
1011
+ "characteristic": "maintainability",
1012
+ "scope": "atomic",
1013
+ "cadence": "triggered",
1014
+ "trigger": "weekly",
1015
+ "invocation": "automated",
1016
+ "description": "A weekly job groups the merges to main by author and day and compares them with the days each person committed anywhere; a developer committing for days without merging is working on a hidden branch, which is what trunk-based development is meant to prevent. The branch age itself is the daily branch report's job. The result sits beside the DORA lead time on the team's dashboard.\n\nThreshold: Over the last 14 days, every developer with a commit merged to main on at least 80% of the days they committed\n\nTool: git in a scheduled GitHub Actions job\n\n```bash\n#!/usr/bin/env bash\n# weekly: days committed vs. days merged to main, per author, last 14 days\nset -euo pipefail\ngit fetch origin '+refs/heads/*:refs/remotes/origin/*'\nsince='14 days ago'\ncommitted=$(git log --all --since=\"$since\" --format='%ae %as' | sort -u)\nmerged=$(git log origin/main --since=\"$since\" --format='%ae %as' | sort -u)\nfail=0\nfor a in $(cut -d' ' -f1 <<< \"$committed\" | sort -u); do\n c=$(grep -c \"^$a \" <<< \"$committed\"); m=$(grep -c \"^$a \" <<< \"$merged\" || true)\n echo \"$a: committed on $c days, merged to main on $m\"\n [ $((m * 10)) -ge $((c * 8)) ] || { echo \"::error::$a merged on fewer than 80% of their active days\"; fail=1; }\ndone\nexit $fail\n```",
1017
+ "hubWhen": {
1018
+ "BRANCHING": [
1019
+ "trunk"
1020
+ ]
1021
+ }
1022
+ }
1023
+ ],
1024
+ "relations": [
1025
+ {
1026
+ "id": "req-protected-main--derives--need",
1027
+ "sourceId": "req-protected-main",
1028
+ "targetId": "need",
1029
+ "relationType": "derives"
1030
+ },
1031
+ {
1032
+ "id": "req-linear-history--derives--need",
1033
+ "sourceId": "req-linear-history",
1034
+ "targetId": "need",
1035
+ "relationType": "derives"
1036
+ },
1037
+ {
1038
+ "id": "req-one-review--derives--need",
1039
+ "sourceId": "req-one-review",
1040
+ "targetId": "need",
1041
+ "relationType": "derives"
1042
+ },
1043
+ {
1044
+ "id": "req-two-critical--derives--need",
1045
+ "sourceId": "req-two-critical",
1046
+ "targetId": "need",
1047
+ "relationType": "derives"
1048
+ },
1049
+ {
1050
+ "id": "req-pairing--derives--need",
1051
+ "sourceId": "req-pairing",
1052
+ "targetId": "need",
1053
+ "relationType": "derives"
1054
+ },
1055
+ {
1056
+ "id": "req-turnaround--derives--need",
1057
+ "sourceId": "req-turnaround",
1058
+ "targetId": "need",
1059
+ "relationType": "derives"
1060
+ },
1061
+ {
1062
+ "id": "req-owner-approval--derives--need",
1063
+ "sourceId": "req-owner-approval",
1064
+ "targetId": "need",
1065
+ "relationType": "derives"
1066
+ },
1067
+ {
1068
+ "id": "req-rotation--derives--need",
1069
+ "sourceId": "req-rotation",
1070
+ "targetId": "need",
1071
+ "relationType": "derives"
1072
+ },
1073
+ {
1074
+ "id": "req-pr-size--derives--need",
1075
+ "sourceId": "req-pr-size",
1076
+ "targetId": "need",
1077
+ "relationType": "derives"
1078
+ },
1079
+ {
1080
+ "id": "req-size-reported--derives--need",
1081
+ "sourceId": "req-size-reported",
1082
+ "targetId": "need",
1083
+ "relationType": "derives"
1084
+ },
1085
+ {
1086
+ "id": "req-branch-age--derives--need",
1087
+ "sourceId": "req-branch-age",
1088
+ "targetId": "need",
1089
+ "relationType": "derives"
1090
+ },
1091
+ {
1092
+ "id": "req-conventional--derives--need",
1093
+ "sourceId": "req-conventional",
1094
+ "targetId": "need",
1095
+ "relationType": "derives"
1096
+ },
1097
+ {
1098
+ "id": "req-free-commits--derives--need",
1099
+ "sourceId": "req-free-commits",
1100
+ "targetId": "need",
1101
+ "relationType": "derives"
1102
+ },
1103
+ {
1104
+ "id": "req-trunk--derives--need",
1105
+ "sourceId": "req-trunk",
1106
+ "targetId": "need",
1107
+ "relationType": "derives"
1108
+ },
1109
+ {
1110
+ "id": "req-feature-pr--derives--need",
1111
+ "sourceId": "req-feature-pr",
1112
+ "targetId": "need",
1113
+ "relationType": "derives"
1114
+ },
1115
+ {
1116
+ "id": "req-gitflow--derives--need",
1117
+ "sourceId": "req-gitflow",
1118
+ "targetId": "need",
1119
+ "relationType": "derives"
1120
+ },
1121
+ {
1122
+ "id": "sc-protected-main--verifies--req-protected-main",
1123
+ "sourceId": "sc-protected-main",
1124
+ "targetId": "req-protected-main",
1125
+ "relationType": "verifies"
1126
+ },
1127
+ {
1128
+ "id": "sc-linear-history--verifies--req-linear-history",
1129
+ "sourceId": "sc-linear-history",
1130
+ "targetId": "req-linear-history",
1131
+ "relationType": "verifies"
1132
+ },
1133
+ {
1134
+ "id": "sc-one-review--verifies--req-one-review",
1135
+ "sourceId": "sc-one-review",
1136
+ "targetId": "req-one-review",
1137
+ "relationType": "verifies"
1138
+ },
1139
+ {
1140
+ "id": "sc-two-critical--verifies--req-two-critical",
1141
+ "sourceId": "sc-two-critical",
1142
+ "targetId": "req-two-critical",
1143
+ "relationType": "verifies"
1144
+ },
1145
+ {
1146
+ "id": "sc-pairing--verifies--req-pairing",
1147
+ "sourceId": "sc-pairing",
1148
+ "targetId": "req-pairing",
1149
+ "relationType": "verifies"
1150
+ },
1151
+ {
1152
+ "id": "sc-turnaround--verifies--req-turnaround",
1153
+ "sourceId": "sc-turnaround",
1154
+ "targetId": "req-turnaround",
1155
+ "relationType": "verifies"
1156
+ },
1157
+ {
1158
+ "id": "sc-owner-approval--verifies--req-owner-approval",
1159
+ "sourceId": "sc-owner-approval",
1160
+ "targetId": "req-owner-approval",
1161
+ "relationType": "verifies"
1162
+ },
1163
+ {
1164
+ "id": "sc-rotation--verifies--req-rotation",
1165
+ "sourceId": "sc-rotation",
1166
+ "targetId": "req-rotation",
1167
+ "relationType": "verifies"
1168
+ },
1169
+ {
1170
+ "id": "sc-pr-size--verifies--req-pr-size",
1171
+ "sourceId": "sc-pr-size",
1172
+ "targetId": "req-pr-size",
1173
+ "relationType": "verifies"
1174
+ },
1175
+ {
1176
+ "id": "sc-size-reported--verifies--req-size-reported",
1177
+ "sourceId": "sc-size-reported",
1178
+ "targetId": "req-size-reported",
1179
+ "relationType": "verifies"
1180
+ },
1181
+ {
1182
+ "id": "sc-branch-age--verifies--req-branch-age",
1183
+ "sourceId": "sc-branch-age",
1184
+ "targetId": "req-branch-age",
1185
+ "relationType": "verifies"
1186
+ },
1187
+ {
1188
+ "id": "sc-conventional--verifies--req-conventional",
1189
+ "sourceId": "sc-conventional",
1190
+ "targetId": "req-conventional",
1191
+ "relationType": "verifies"
1192
+ },
1193
+ {
1194
+ "id": "sc-free-commits--verifies--req-free-commits",
1195
+ "sourceId": "sc-free-commits",
1196
+ "targetId": "req-free-commits",
1197
+ "relationType": "verifies"
1198
+ },
1199
+ {
1200
+ "id": "sc-trunk--verifies--req-trunk",
1201
+ "sourceId": "sc-trunk",
1202
+ "targetId": "req-trunk",
1203
+ "relationType": "verifies"
1204
+ },
1205
+ {
1206
+ "id": "sc-feature-pr--verifies--req-feature-pr",
1207
+ "sourceId": "sc-feature-pr",
1208
+ "targetId": "req-feature-pr",
1209
+ "relationType": "verifies"
1210
+ },
1211
+ {
1212
+ "id": "sc-gitflow--verifies--req-gitflow",
1213
+ "sourceId": "sc-gitflow",
1214
+ "targetId": "req-gitflow",
1215
+ "relationType": "verifies"
1216
+ },
1217
+ {
1218
+ "id": "ff-branch-protection--implements--adr-trunk",
1219
+ "sourceId": "ff-branch-protection",
1220
+ "targetId": "adr-trunk",
1221
+ "relationType": "implements"
1222
+ },
1223
+ {
1224
+ "id": "ff-branch-protection--implements--adr-feature-pr",
1225
+ "sourceId": "ff-branch-protection",
1226
+ "targetId": "adr-feature-pr",
1227
+ "relationType": "implements"
1228
+ },
1229
+ {
1230
+ "id": "ff-branch-protection--implements--adr-gitflow",
1231
+ "sourceId": "ff-branch-protection",
1232
+ "targetId": "adr-gitflow",
1233
+ "relationType": "implements"
1234
+ },
1235
+ {
1236
+ "id": "ff-linear-history--implements--adr-trunk",
1237
+ "sourceId": "ff-linear-history",
1238
+ "targetId": "adr-trunk",
1239
+ "relationType": "implements"
1240
+ },
1241
+ {
1242
+ "id": "ff-linear-history--implements--adr-feature-pr",
1243
+ "sourceId": "ff-linear-history",
1244
+ "targetId": "adr-feature-pr",
1245
+ "relationType": "implements"
1246
+ },
1247
+ {
1248
+ "id": "ff-codeowners--implements--adr-codeowners",
1249
+ "sourceId": "ff-codeowners",
1250
+ "targetId": "adr-codeowners",
1251
+ "relationType": "implements"
1252
+ },
1253
+ {
1254
+ "id": "ff-review-rotation--implements--adr-collective",
1255
+ "sourceId": "ff-review-rotation",
1256
+ "targetId": "adr-collective",
1257
+ "relationType": "implements"
1258
+ },
1259
+ {
1260
+ "id": "ff-pr-size--implements--adr-trunk",
1261
+ "sourceId": "ff-pr-size",
1262
+ "targetId": "adr-trunk",
1263
+ "relationType": "implements"
1264
+ },
1265
+ {
1266
+ "id": "ff-pr-size--implements--adr-feature-pr",
1267
+ "sourceId": "ff-pr-size",
1268
+ "targetId": "adr-feature-pr",
1269
+ "relationType": "implements"
1270
+ },
1271
+ {
1272
+ "id": "ff-pr-size--implements--adr-gitflow",
1273
+ "sourceId": "ff-pr-size",
1274
+ "targetId": "adr-gitflow",
1275
+ "relationType": "implements"
1276
+ },
1277
+ {
1278
+ "id": "ff-pr-size-report--implements--adr-trunk",
1279
+ "sourceId": "ff-pr-size-report",
1280
+ "targetId": "adr-trunk",
1281
+ "relationType": "implements"
1282
+ },
1283
+ {
1284
+ "id": "ff-pr-size-report--implements--adr-feature-pr",
1285
+ "sourceId": "ff-pr-size-report",
1286
+ "targetId": "adr-feature-pr",
1287
+ "relationType": "implements"
1288
+ },
1289
+ {
1290
+ "id": "ff-pr-size-report--implements--adr-gitflow",
1291
+ "sourceId": "ff-pr-size-report",
1292
+ "targetId": "adr-gitflow",
1293
+ "relationType": "implements"
1294
+ },
1295
+ {
1296
+ "id": "ff-branch-age--implements--adr-trunk",
1297
+ "sourceId": "ff-branch-age",
1298
+ "targetId": "adr-trunk",
1299
+ "relationType": "implements"
1300
+ },
1301
+ {
1302
+ "id": "ff-branch-age--implements--adr-feature-pr",
1303
+ "sourceId": "ff-branch-age",
1304
+ "targetId": "adr-feature-pr",
1305
+ "relationType": "implements"
1306
+ },
1307
+ {
1308
+ "id": "ff-branch-age--implements--adr-gitflow",
1309
+ "sourceId": "ff-branch-age",
1310
+ "targetId": "adr-gitflow",
1311
+ "relationType": "implements"
1312
+ },
1313
+ {
1314
+ "id": "ff-commitlint--implements--adr-trunk",
1315
+ "sourceId": "ff-commitlint",
1316
+ "targetId": "adr-trunk",
1317
+ "relationType": "implements"
1318
+ },
1319
+ {
1320
+ "id": "ff-commitlint--implements--adr-feature-pr",
1321
+ "sourceId": "ff-commitlint",
1322
+ "targetId": "adr-feature-pr",
1323
+ "relationType": "implements"
1324
+ },
1325
+ {
1326
+ "id": "ff-commitlint--implements--adr-gitflow",
1327
+ "sourceId": "ff-commitlint",
1328
+ "targetId": "adr-gitflow",
1329
+ "relationType": "implements"
1330
+ },
1331
+ {
1332
+ "id": "ff-squash-subjects--implements--adr-trunk",
1333
+ "sourceId": "ff-squash-subjects",
1334
+ "targetId": "adr-trunk",
1335
+ "relationType": "implements"
1336
+ },
1337
+ {
1338
+ "id": "ff-squash-subjects--implements--adr-feature-pr",
1339
+ "sourceId": "ff-squash-subjects",
1340
+ "targetId": "adr-feature-pr",
1341
+ "relationType": "implements"
1342
+ },
1343
+ {
1344
+ "id": "ff-develop-subjects--implements--adr-gitflow",
1345
+ "sourceId": "ff-develop-subjects",
1346
+ "targetId": "adr-gitflow",
1347
+ "relationType": "implements"
1348
+ },
1349
+ {
1350
+ "id": "ff-review-turnaround--implements--adr-trunk",
1351
+ "sourceId": "ff-review-turnaround",
1352
+ "targetId": "adr-trunk",
1353
+ "relationType": "implements"
1354
+ },
1355
+ {
1356
+ "id": "ff-review-turnaround--implements--adr-feature-pr",
1357
+ "sourceId": "ff-review-turnaround",
1358
+ "targetId": "adr-feature-pr",
1359
+ "relationType": "implements"
1360
+ },
1361
+ {
1362
+ "id": "ff-review-turnaround--implements--adr-gitflow",
1363
+ "sourceId": "ff-review-turnaround",
1364
+ "targetId": "adr-gitflow",
1365
+ "relationType": "implements"
1366
+ },
1367
+ {
1368
+ "id": "ff-critical-two-approvals--implements--adr-trunk",
1369
+ "sourceId": "ff-critical-two-approvals",
1370
+ "targetId": "adr-trunk",
1371
+ "relationType": "implements"
1372
+ },
1373
+ {
1374
+ "id": "ff-critical-two-approvals--implements--adr-feature-pr",
1375
+ "sourceId": "ff-critical-two-approvals",
1376
+ "targetId": "adr-feature-pr",
1377
+ "relationType": "implements"
1378
+ },
1379
+ {
1380
+ "id": "ff-critical-two-approvals--implements--adr-gitflow",
1381
+ "sourceId": "ff-critical-two-approvals",
1382
+ "targetId": "adr-gitflow",
1383
+ "relationType": "implements"
1384
+ },
1385
+ {
1386
+ "id": "ff-pair-trailer--implements--adr-trunk",
1387
+ "sourceId": "ff-pair-trailer",
1388
+ "targetId": "adr-trunk",
1389
+ "relationType": "implements"
1390
+ },
1391
+ {
1392
+ "id": "ff-pair-trailer--implements--adr-feature-pr",
1393
+ "sourceId": "ff-pair-trailer",
1394
+ "targetId": "adr-feature-pr",
1395
+ "relationType": "implements"
1396
+ },
1397
+ {
1398
+ "id": "ff-pair-trailer--implements--adr-gitflow",
1399
+ "sourceId": "ff-pair-trailer",
1400
+ "targetId": "adr-gitflow",
1401
+ "relationType": "implements"
1402
+ },
1403
+ {
1404
+ "id": "ff-gitflow-history--implements--adr-gitflow",
1405
+ "sourceId": "ff-gitflow-history",
1406
+ "targetId": "adr-gitflow",
1407
+ "relationType": "implements"
1408
+ },
1409
+ {
1410
+ "id": "ff-daily-integration--implements--adr-trunk",
1411
+ "sourceId": "ff-daily-integration",
1412
+ "targetId": "adr-trunk",
1413
+ "relationType": "implements"
1414
+ }
1415
+ ]
1416
+ }