@radicaltools/cli 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 (57) hide show
  1. package/README.md +332 -44
  2. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  3. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  4. package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
  5. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  6. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  7. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  8. package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
  9. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  10. package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
  11. package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
  12. package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
  13. package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
  14. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
  15. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  16. package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
  17. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  18. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  19. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  20. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  21. package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
  22. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  23. package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
  24. package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
  25. package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
  26. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  27. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  28. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  29. package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
  30. package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
  31. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  32. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  33. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
  34. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  35. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
  36. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
  37. package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
  38. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
  39. package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
  40. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  41. package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
  42. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  43. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
  44. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  45. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  46. package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
  47. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  48. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  49. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  50. package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
  51. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  52. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  53. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
  54. package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
  55. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  56. package/dist/index.js +10608 -6579
  57. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  "id": "concern-data-store",
4
4
  "category": "concern",
5
5
  "name": "Data store",
6
- "description": "Which kind of data store keeps the element's data and which product, how consistent reads are, who runs it, and how its schema changes.",
6
+ "description": "Which kind of data store keeps the element's data and which product, how consistent reads are, who runs the engine, and how its schema changes.",
7
7
  "tags": [
8
8
  "technology",
9
9
  "database",
@@ -11,6 +11,7 @@
11
11
  "postgresql",
12
12
  "mongodb",
13
13
  "dynamodb",
14
+ "redis",
14
15
  "schema migrations"
15
16
  ],
16
17
  "requiredMetamodel": "c4-ddd-governance-builtin",
@@ -30,17 +31,21 @@
30
31
  "url": "https://martinfowler.com/bliki/PolyglotPersistence.html"
31
32
  },
32
33
  {
33
- "title": "Danilo Sato: ParallelChange (expand and contract)",
34
- "url": "https://martinfowler.com/bliki/ParallelChange.html"
35
- },
36
- {
37
- "title": "Thoughtworks Technology Radar",
38
- "url": "https://www.thoughtworks.com/radar"
34
+ "title": "Martin Kleppmann: Designing Data-Intensive Applications",
35
+ "url": "https://dataintensive.net/"
39
36
  },
40
37
  {
41
38
  "title": "endoflife.date: database support lifecycles",
42
39
  "url": "https://endoflife.date/"
43
40
  },
41
+ {
42
+ "title": "PostgreSQL versioning policy",
43
+ "url": "https://www.postgresql.org/support/versioning/"
44
+ },
45
+ {
46
+ "title": "PostgreSQL documentation: constraints",
47
+ "url": "https://www.postgresql.org/docs/current/ddl-constraints.html"
48
+ },
44
49
  {
45
50
  "title": "Amazon DynamoDB best practices",
46
51
  "url": "https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/best-practices.html"
@@ -50,8 +55,12 @@
50
55
  "url": "https://www.mongodb.com/docs/manual/core/schema-validation/"
51
56
  },
52
57
  {
53
- "title": "Squawk, a linter for PostgreSQL migrations",
54
- "url": "https://github.com/sbdchd/squawk"
58
+ "title": "MongoDB: the Schema Versioning pattern",
59
+ "url": "https://www.mongodb.com/blog/post/building-with-patterns-the-schema-versioning-pattern"
60
+ },
61
+ {
62
+ "title": "Regulation (EU) 2022/2554 (DORA), Art. 28: ICT third-party risk and exit strategies",
63
+ "url": "https://eur-lex.europa.eu/eli/reg/2022/2554/oj"
55
64
  }
56
65
  ],
57
66
  "templateParams": [
@@ -75,7 +84,7 @@
75
84
  {
76
85
  "value": "keyvalue",
77
86
  "label": "a key-value store (DynamoDB or Redis)",
78
- "description": "Items read and written by key, with access patterns designed up front. Pick it for very high volume with a few known lookups (sessions, carts, counters, device state) needing single-digit-millisecond latency at any scale."
87
+ "description": "Items read and written by key, with access patterns designed up front. Pick it for very high volume with a few known lookups (sessions, carts, counters, device state) needing single-digit-millisecond latency at any scale. DynamoDB is only managed; self-hosting means Redis or Valkey."
79
88
  }
80
89
  ]
81
90
  },
@@ -94,26 +103,26 @@
94
103
  {
95
104
  "value": "eventual",
96
105
  "label": "eventual, with a bound on staleness",
97
- "description": "Replicas and indexes may lag the primary by a bounded time. Pick it for read-heavy data that may be seconds old (catalogues, feeds, analytics) or replicas in several regions."
106
+ "description": "Replicas and indexes may lag the primary by a bounded time, asked below. Pick it for read-heavy data that may be seconds old (catalogues, feeds, analytics) or replicas in several regions."
98
107
  }
99
108
  ]
100
109
  },
101
110
  {
102
111
  "key": "HOSTING",
103
112
  "title": "Hosting",
104
- "label": "Who runs the store?",
105
- "hint": "Running a database well means patching, failover, backups, monitoring and tuning, at any hour.",
113
+ "label": "Who runs the engine?",
114
+ "hint": "Running a database well means patching, failover, backups, monitoring and tuning, at any hour. The engine's hosting is decided here, not in the Infrastructure pack.",
106
115
  "defaultValue": "managed",
107
116
  "options": [
108
117
  {
109
118
  "value": "managed",
110
119
  "label": "a managed cloud service",
111
- "description": "Amazon RDS or Aurora, Azure Database for PostgreSQL, Cloud SQL, MongoDB Atlas, DynamoDB or ElastiCache run the engine. Pick it when the team has no database operators, or runs in a public cloud already."
120
+ "description": "Amazon RDS or Aurora, Azure Database, Cloud SQL, MongoDB Atlas, DynamoDB or ElastiCache run the engine. Pick it when the team has no database operators, or runs in a public cloud already."
112
121
  },
113
122
  {
114
123
  "value": "self",
115
124
  "label": "self-hosted by us",
116
- "description": "We run the engine on our Kubernetes (CloudNativePG, Percona or MongoDB operators) or virtual machines (Patroni). Pick it when data must stay on premises, a provider is ruled out, or the scale makes a managed service too costly, and people with the skills are on call."
125
+ "description": "We run the engine on our Kubernetes (CloudNativePG, Percona or MongoDB operators) or virtual machines (Patroni). Pick it when data must stay on premises, a provider is ruled out, or the scale makes a managed service too costly, and people with the skills are on call. With a key-value store this means Redis or Valkey, not DynamoDB."
117
126
  }
118
127
  ]
119
128
  },
@@ -121,35 +130,35 @@
121
130
  "key": "MIGRATIONS",
122
131
  "title": "Schema changes",
123
132
  "label": "How does the schema change?",
124
- "hint": "The schema will change many times while the system runs; each change has to be repeatable in every environment and safe for the code still running.",
133
+ "hint": "The schema will change many times while the system runs; each change has to be repeatable in every environment and safe for the code still running. Only when the store has a schema to migrate: a key-value store's tables and indexes are infrastructure code, and its item shapes carry a version.",
125
134
  "defaultValue": "tool",
126
135
  "options": [
127
136
  {
128
137
  "value": "tool",
129
138
  "label": "a versioned migration tool (Flyway or Liquibase)",
130
- "description": "Numbered SQL (or changelog) migrations kept with the code, applied by the deploy. Pick it for relational stores, especially when several applications or languages share the tooling or DBAs review SQL."
139
+ "description": "Numbered SQL (or changelog) migrations kept with the code, applied by the deploy. Pick it for relational stores, especially when several applications or languages share the tooling or DBAs review SQL; for MongoDB, Liquibase with its MongoDB extension. Not with a key-value store."
131
140
  },
132
141
  {
133
142
  "value": "orm",
134
143
  "label": "the ORM's migrations (Prisma, EF Core, Alembic, Django)",
135
- "description": "Migrations generated from the model in code and applied by the deploy. Pick it when one application owns the store and its ORM generates migrations the team reviews."
144
+ "description": "Migrations generated from the model in code and applied by the deploy. Pick it when one application owns a relational store and its ORM generates migrations the team reviews. Not with a document or key-value store: Prisma and Mongoose generate no migrations for MongoDB."
136
145
  },
137
146
  {
138
147
  "value": "lazy",
139
148
  "label": "a schema version per record, upgraded in code",
140
- "description": "Each document or item carries its schema version; code upgrades old records when it reads them, and a backfill catches up. Pick it for document and key-value stores with large collections where rewriting everything at once is too costly."
149
+ "description": "Each document or item carries its schema version; code upgrades old records when it reads them, and a backfill catches up. Pick it for document and key-value stores with large collections where rewriting everything at once is too costly. Not with a relational database."
141
150
  }
142
151
  ]
143
152
  },
144
153
  {
145
154
  "key": "STALE_SECONDS",
146
- "label": "How old may a read be when consistency is eventual (seconds)?",
155
+ "label": "How old may a read be when consistency is eventual (seconds)? Used only with eventual consistency",
147
156
  "defaultValue": "5",
148
157
  "type": "number"
149
158
  },
150
159
  {
151
160
  "key": "P99_MS",
152
- "label": "What 99th-percentile latency must key lookups meet (ms)?",
161
+ "label": "What 99th-percentile latency must key lookups meet (ms)? Used only with a key-value store",
153
162
  "defaultValue": "20",
154
163
  "type": "number"
155
164
  }
@@ -164,7 +173,7 @@
164
173
  "y": 0,
165
174
  "kind": "brief",
166
175
  "source": "Hub concern pack: Data store",
167
- "description": "The element keeps data the system depends on. It has to be kept in a store whose data model fits the way the data is read and changed, consistent where it must be, run by people who can keep it healthy, and able to change shape many times while the system stays online. The choice and its reasons must be written down, because data is far harder to move later than code."
176
+ "description": "The element keeps data the system depends on. It has to be kept in a store whose data model fits the way the data is read and changed, consistent where it must be, run by people who can keep it healthy, and able to change shape many times while the system stays online. The choice and its reasons must be written down, because data is far harder to move later than code. The checks assume one repository per element with SQL migrations in db/migration, Prisma migrations in prisma/migrations, a Liquibase changelog in db/changelog.xml with its jars in db/lib, request-handling code under src/ and batch jobs under src/jobs/."
168
177
  },
169
178
  {
170
179
  "id": "req-access-patterns",
@@ -173,18 +182,29 @@
173
182
  "x": 260,
174
183
  "y": 0,
175
184
  "ears_type": "ubiquitous",
176
- "action": "list every query the element makes in an access-pattern catalogue with its expected volume, and serve each from a key or index designed for it, with 0 full scans of a table or collection on a request path",
177
- "rationale": "A store fits only if its data model serves the queries; a full scan that is fast at launch is a time-out a year later (Fowler, PolyglotPersistence; DynamoDB best practices: design for access patterns)."
185
+ "action": "list every query the element makes in an access-pattern catalogue with its expected volume, serve each from a key or index designed for it, and make 0 Scan or KEYS calls on a request path",
186
+ "rationale": "A key-value store fits only when every query is a known lookup; a scan that is fast at launch is a time-out a year later (DynamoDB best practices: design for access patterns; Fowler, PolyglotPersistence).",
187
+ "hubWhen": {
188
+ "MODEL": [
189
+ "keyvalue"
190
+ ]
191
+ }
178
192
  },
179
193
  {
180
- "id": "req-expand-contract",
194
+ "id": "req-indexed-reads",
181
195
  "type": "requirement",
182
- "label": "Schema changes without downtime",
196
+ "label": "Request paths read by index",
183
197
  "x": 260,
184
198
  "y": 130,
185
199
  "ears_type": "ubiquitous",
186
- "action": "keep each schema change compatible with the previous release of the code (expand, migrate, then contract in a later release), so that a deploy needs 0 minutes of planned downtime",
187
- "rationale": "During a rolling deploy the old and the new code run against the same schema; a change only the new code understands breaks the old (Sato, ParallelChange; Sadalage and Fowler, Evolutionary Database Design)."
200
+ "action": "serve every query on a request path from a key or an index, with 0 whole-table or whole-collection scans over a table or collection above 10,000 rows on a request path",
201
+ "rationale": "A full scan that is fast at launch is a time-out a year later; small tables are scanned by design and are not the problem (Fowler, PolyglotPersistence; Kleppmann, Designing Data-Intensive Applications, ch. 3).",
202
+ "hubWhen": {
203
+ "MODEL": [
204
+ "relational",
205
+ "document"
206
+ ]
207
+ }
188
208
  },
189
209
  {
190
210
  "id": "req-versioned",
@@ -200,6 +220,28 @@
200
220
  "MIGRATIONS": [
201
221
  "tool",
202
222
  "orm"
223
+ ],
224
+ "MODEL": [
225
+ "relational"
226
+ ]
227
+ }
228
+ },
229
+ {
230
+ "id": "req-versioned-doc",
231
+ "type": "requirement",
232
+ "label": "Collection changes are versioned",
233
+ "x": 260,
234
+ "y": 390,
235
+ "ears_type": "event-driven",
236
+ "trigger": "a change needs a different validator, index or reference data",
237
+ "action": "apply it as a versioned changeset committed with the code and run by the deploy pipeline with {{MIGRATIONS}}, with 0 validator or index changes made by hand in any shared environment",
238
+ "rationale": "A collection changed by hand differs between environments, and the difference shows up in production (Sadalage and Fowler, Evolutionary Database Design: all database artefacts are version controlled).",
239
+ "hubWhen": {
240
+ "MIGRATIONS": [
241
+ "tool"
242
+ ],
243
+ "MODEL": [
244
+ "document"
203
245
  ]
204
246
  }
205
247
  },
@@ -208,14 +250,18 @@
208
250
  "type": "requirement",
209
251
  "label": "Old records upgraded",
210
252
  "x": 260,
211
- "y": 390,
253
+ "y": 520,
212
254
  "ears_type": "event-driven",
213
255
  "trigger": "a record written under an older schema version is read",
214
256
  "action": "upgrade it to the current version in code before use, write it back at the next save, and backfill in the background so that 0 records are more than 2 schema versions behind",
215
- "rationale": "Upgrading on read spreads the cost of a change over time; the backfill keeps the code from carrying upgraders for every version ever written (MongoDB Schema Versioning pattern).",
257
+ "rationale": "Upgrading on read spreads the cost of a change over time; the backfill keeps the code from carrying upgraders for every version ever written (MongoDB, the Schema Versioning pattern).",
216
258
  "hubWhen": {
217
259
  "MIGRATIONS": [
218
260
  "lazy"
261
+ ],
262
+ "MODEL": [
263
+ "document",
264
+ "keyvalue"
219
265
  ]
220
266
  }
221
267
  },
@@ -224,10 +270,10 @@
224
270
  "type": "requirement",
225
271
  "label": "Integrity enforced by the database",
226
272
  "x": 260,
227
- "y": 520,
273
+ "y": 650,
228
274
  "ears_type": "ubiquitous",
229
275
  "action": "enforce the invariants between records in the database itself, with a primary key on 100% of tables, a foreign key on every reference column, and unique and check constraints for the rules they can express",
230
- "rationale": "Every code path, script and future application obeys a constraint; only some of them obey application code (Evolutionary Database Design; PostgreSQL documentation, constraints).",
276
+ "rationale": "Every code path, script and future application obeys a constraint; only some of them obey application code (Sadalage and Fowler, Evolutionary Database Design; PostgreSQL documentation, constraints).",
231
277
  "hubWhen": {
232
278
  "MODEL": [
233
279
  "relational"
@@ -239,7 +285,7 @@
239
285
  "type": "requirement",
240
286
  "label": "Documents validated and bounded",
241
287
  "x": 260,
242
- "y": 650,
288
+ "y": 780,
243
289
  "ears_type": "ubiquitous",
244
290
  "action": "store each aggregate as one document, validate 100% of collections with a JSON Schema validator that rejects invalid writes, and keep every document under 1 MB",
245
291
  "rationale": "Schema-flexible does not mean schema-free: a validator stops malformed documents at the door, and the size bound keeps documents well below MongoDB's 16 MB limit and fast to read (MongoDB schema validation).",
@@ -254,9 +300,9 @@
254
300
  "type": "requirement",
255
301
  "label": "Key lookups are fast",
256
302
  "x": 260,
257
- "y": 780,
303
+ "y": 910,
258
304
  "ears_type": "ubiquitous",
259
- "action": "answer 99% of key reads and writes within {{P99_MS}} ms at peak load, and keep every item under 400 KB",
305
+ "action": "answer 99% of key reads and writes within {{P99_MS}} ms as measured by the store, and keep every item under 400 KB",
260
306
  "rationale": "Predictable low latency at any scale is the reason to give up queries; 400 KB is DynamoDB's item limit, and large values in Redis block other commands (DynamoDB best practices).",
261
307
  "hubWhen": {
262
308
  "MODEL": [
@@ -269,11 +315,11 @@
269
315
  "type": "requirement",
270
316
  "label": "Operations commit whole",
271
317
  "x": 260,
272
- "y": 910,
318
+ "y": 1040,
273
319
  "ears_type": "event-driven",
274
320
  "trigger": "a business operation changes several records",
275
321
  "action": "commit all its changes in one transaction, so that 0 readers see part of the operation and a failure leaves none of it",
276
- "rationale": "A half-applied operation (money taken, order not created) is the hardest kind of bug to find and repair (ACID; Kleppmann, Designing Data-Intensive Applications, ch. 7).",
322
+ "rationale": "A half-applied operation (money taken, order not created) is the hardest kind of bug to find and repair (Kleppmann, Designing Data-Intensive Applications, ch. 7).",
277
323
  "hubWhen": {
278
324
  "CONSISTENCY": [
279
325
  "strong"
@@ -285,7 +331,7 @@
285
331
  "type": "requirement",
286
332
  "label": "Staleness is bounded",
287
333
  "x": 260,
288
- "y": 1040,
334
+ "y": 1170,
289
335
  "ears_type": "state-driven",
290
336
  "precondition": "replicas or secondary indexes lag behind the primary",
291
337
  "action": "serve reads at most {{STALE_SECONDS}} seconds old, and read from the primary wherever a user must see their own write",
@@ -301,10 +347,10 @@
301
347
  "type": "requirement",
302
348
  "label": "Data can leave the provider",
303
349
  "x": 260,
304
- "y": 1170,
350
+ "y": 1300,
305
351
  "ears_type": "ubiquitous",
306
- "action": "keep a logical export of all data, no older than 24 hours, in storage the organisation controls and in a format another provider or a self-hosted engine can load",
307
- "rationale": "A managed service is a dependency on one provider; an export it does not hold is the exit plan (EBA Guidelines on outsourcing arrangements, exit strategies; DORA Art. 28).",
352
+ "action": "keep a daily logical export of all data in storage the organisation controls, in a format a self-hosted engine of the same kind loads, with the newest export less than 26 hours old",
353
+ "rationale": "A managed service is a dependency on one provider; an export it does not hold is the exit plan (DORA Art. 28, exit strategies). Loading it into a self-hosted engine is the restore drill of the Backup and recovery pack.",
308
354
  "hubWhen": {
309
355
  "HOSTING": [
310
356
  "managed"
@@ -316,7 +362,7 @@
316
362
  "type": "requirement",
317
363
  "label": "Engine patched on time",
318
364
  "x": 260,
319
- "y": 1300,
365
+ "y": 1430,
320
366
  "ears_type": "event-driven",
321
367
  "trigger": "a minor or security release of the database engine is published",
322
368
  "action": "apply it within 30 days by a rolling upgrade with automatic failover, keeping writes unavailable for under 30 seconds",
@@ -330,22 +376,33 @@
330
376
  {
331
377
  "id": "sc-access-patterns",
332
378
  "type": "scenario",
333
- "label": "No scan on request path",
379
+ "label": "Scan on request path refused",
334
380
  "x": 520,
335
381
  "y": 0,
336
- "given": "the access-pattern catalogue and the store with production-sized data",
337
- "when": "every listed query runs and its plan is read",
338
- "then": "each uses a key or an index, and none scans a whole table or collection"
382
+ "given": "the access-pattern catalogue and the request-handling code",
383
+ "when": "a change calls Scan or KEYS outside a batch job",
384
+ "then": "the lint fails naming the call",
385
+ "hubWhen": {
386
+ "MODEL": [
387
+ "keyvalue"
388
+ ]
389
+ }
339
390
  },
340
391
  {
341
- "id": "sc-expand-contract",
392
+ "id": "sc-indexed-reads",
342
393
  "type": "scenario",
343
- "label": "Old code survives migration",
394
+ "label": "No scan on request path",
344
395
  "x": 520,
345
396
  "y": 130,
346
- "given": "the previous release running against the store",
347
- "when": "the next release's migrations are applied",
348
- "then": "the previous release's tests still pass against the migrated schema"
397
+ "given": "the store loaded with production-sized data and its scan counters reset",
398
+ "when": "the request-path test suite runs and the counters are read",
399
+ "then": "no table or collection above 10,000 rows was scanned whole",
400
+ "hubWhen": {
401
+ "MODEL": [
402
+ "relational",
403
+ "document"
404
+ ]
405
+ }
349
406
  },
350
407
  {
351
408
  "id": "sc-versioned",
@@ -360,6 +417,27 @@
360
417
  "MIGRATIONS": [
361
418
  "tool",
362
419
  "orm"
420
+ ],
421
+ "MODEL": [
422
+ "relational"
423
+ ]
424
+ }
425
+ },
426
+ {
427
+ "id": "sc-versioned-doc",
428
+ "type": "scenario",
429
+ "label": "Changeset applied by pipeline",
430
+ "x": 520,
431
+ "y": 390,
432
+ "given": "a change that adds an index",
433
+ "when": "it is deployed to each environment in turn",
434
+ "then": "the same versioned changeset is applied by the pipeline everywhere, and the changelog history matches in every environment",
435
+ "hubWhen": {
436
+ "MIGRATIONS": [
437
+ "tool"
438
+ ],
439
+ "MODEL": [
440
+ "document"
363
441
  ]
364
442
  }
365
443
  },
@@ -368,13 +446,17 @@
368
446
  "type": "scenario",
369
447
  "label": "Old record read",
370
448
  "x": 520,
371
- "y": 390,
449
+ "y": 520,
372
450
  "given": "a record at schema version N-1",
373
451
  "when": "the element reads it and later saves it",
374
452
  "then": "it is used as version N and stored as version N",
375
453
  "hubWhen": {
376
454
  "MIGRATIONS": [
377
455
  "lazy"
456
+ ],
457
+ "MODEL": [
458
+ "document",
459
+ "keyvalue"
378
460
  ]
379
461
  }
380
462
  },
@@ -383,7 +465,7 @@
383
465
  "type": "scenario",
384
466
  "label": "Dangling reference refused",
385
467
  "x": 520,
386
- "y": 520,
468
+ "y": 650,
387
469
  "given": "an order line that references an order",
388
470
  "when": "a line is inserted for an order that does not exist",
389
471
  "then": "the database refuses the insert",
@@ -398,7 +480,7 @@
398
480
  "type": "scenario",
399
481
  "label": "Invalid document refused",
400
482
  "x": 520,
401
- "y": 650,
483
+ "y": 780,
402
484
  "given": "a collection with its JSON Schema validator",
403
485
  "when": "a document missing a required field is inserted",
404
486
  "then": "the database refuses the write",
@@ -413,10 +495,10 @@
413
495
  "type": "scenario",
414
496
  "label": "Lookups within target",
415
497
  "x": 520,
416
- "y": 780,
498
+ "y": 910,
417
499
  "given": "the store at production volume",
418
- "when": "a load test reads and writes by key at peak rate for 10 minutes",
419
- "then": "the 99th percentile stays within {{P99_MS}} ms",
500
+ "when": "a day of key reads and writes has been served and the store's latency percentiles are read",
501
+ "then": "the 99th percentile of reads and of writes is within {{P99_MS}} ms",
420
502
  "hubWhen": {
421
503
  "MODEL": [
422
504
  "keyvalue"
@@ -428,7 +510,7 @@
428
510
  "type": "scenario",
429
511
  "label": "Failure leaves nothing",
430
512
  "x": 520,
431
- "y": 910,
513
+ "y": 1040,
432
514
  "given": "an operation that writes three records",
433
515
  "when": "it fails after the second write",
434
516
  "then": "none of the three records is changed and no reader saw the first two",
@@ -443,7 +525,7 @@
443
525
  "type": "scenario",
444
526
  "label": "Own write visible",
445
527
  "x": 520,
446
- "y": 1040,
528
+ "y": 1170,
447
529
  "given": "a user who has just changed a record",
448
530
  "when": "the user reads it again while replicas lag",
449
531
  "then": "the user sees the change, and other readers see it within {{STALE_SECONDS}} seconds",
@@ -456,12 +538,12 @@
456
538
  {
457
539
  "id": "sc-exit",
458
540
  "type": "scenario",
459
- "label": "Export loads elsewhere",
541
+ "label": "Export is fresh",
460
542
  "x": 520,
461
- "y": 1170,
462
- "given": "the latest export",
463
- "when": "it is loaded into a self-hosted engine of the same kind",
464
- "then": "it loads without error and is less than 24 hours old",
543
+ "y": 1300,
544
+ "given": "the storage the organisation controls",
545
+ "when": "the freshness check runs",
546
+ "then": "the newest export there is less than 26 hours old",
465
547
  "hubWhen": {
466
548
  "HOSTING": [
467
549
  "managed"
@@ -473,7 +555,7 @@
473
555
  "type": "scenario",
474
556
  "label": "Minor release applied",
475
557
  "x": 520,
476
- "y": 1300,
558
+ "y": 1430,
477
559
  "given": "a new minor release of the engine",
478
560
  "when": "30 days have passed",
479
561
  "then": "every node runs it, and the failover during the upgrade kept writes unavailable for under 30 seconds",
@@ -492,9 +574,9 @@
492
574
  "concern": "data-store",
493
575
  "status": "accepted",
494
576
  "date": "",
495
- "context": "This element keeps the system's data, and the store chosen for it outlives most of the code around it: data is far harder to move than code. The forces: the way the data is queried (ad hoc and across entities, whole aggregates by id, or a few known lookups at very high volume) favours different data models; some operations must never be seen half done, while others can accept reading slightly old data in exchange for scale and availability; a managed service takes patching, failover and backups off the team but adds a provider, its limits and its bill, while self-hosting needs people who can run the engine at three in the morning; and the schema will change many times while the system is live, so every change has to be repeatable and safe for the code version still running. Backup and recovery is its own concern.",
496
- "decision": "The data is kept in a relational database: PostgreSQL by default, MySQL where the team or platform already runs it. Consistency: {{CONSISTENCY}}; hosting: {{HOSTING}} (managed: Amazon RDS or Aurora, Azure Database for PostgreSQL flexible server, Google Cloud SQL; self-hosted: CloudNativePG on Kubernetes or Patroni on virtual machines). Schema changes: {{MIGRATIONS}}, linted with Squawk for PostgreSQL. Constraints, not only code, enforce the invariants; JSONB columns hold the parts whose shape varies. Choosing PostgreSQL or MySQL: PostgreSQL for richer types (JSONB, arrays, ranges), extensions (PostGIS, pgvector) and transactional DDL; MySQL when existing operations know it. Choosing managed or self-hosted: managed unless data residency, cost at scale or an on-premises platform rules it out.",
497
- "consequences": "• Any query can be written later, including the reports and back-office searches nobody listed today.\n• Transactions and constraints keep the data consistent across entities without application code.\n• Scaling writes past one primary needs partitioning, sharding (Citus, Vitess) or a different store for the hot path.\n• Schema changes need migrations and expand-and-contract discipline.",
577
+ "context": "This element keeps the system's data, and the store chosen for it outlives most of the code around it: data is far harder to move than code. The forces: the way the data is queried (ad hoc and across entities, whole aggregates by id, or a few known lookups at very high volume) favours different data models; some operations must never be seen half done, while others can accept reading slightly old data in exchange for scale and availability; a managed service takes patching, failover and backups off the team but adds a provider, its limits and its bill, while self-hosting needs people who can run the engine at three in the morning; and the schema will change many times while the system is live, so every change has to be repeatable and safe for the code version still running. Backup and recovery is its own concern; whether a change ships as expand and contract or in a window is decided in the Deployment and rollback pack.",
578
+ "decision": "The data is kept in a relational database: PostgreSQL by default, MySQL where the team or platform already runs it. Consistency: {{CONSISTENCY}}; where it is eventual, reads are at most {{STALE_SECONDS}} seconds old. Hosting: {{HOSTING}} (managed: Amazon RDS or Aurora, Azure Database for PostgreSQL or for MySQL flexible server, Google Cloud SQL; self-hosted: CloudNativePG on Kubernetes or Patroni on virtual machines). Schema changes: {{MIGRATIONS}}; whether a change ships as expand and contract or in a window, and how migrations are linted for it, is decided in the Deployment and rollback pack. Constraints, not only code, enforce the invariants; JSONB columns hold the parts whose shape varies. Choosing PostgreSQL or MySQL: PostgreSQL for richer types (JSONB, arrays, ranges), extensions (PostGIS, pgvector) and transactional DDL; MySQL when existing operations know it. Choosing managed or self-hosted: managed unless data residency, cost at scale or an on-premises platform rules it out.",
579
+ "consequences": "• Any query can be written later, including the reports and back-office searches nobody listed today.\n• Transactions and constraints keep the data consistent across entities without application code.\n• Scaling writes past one primary needs partitioning, sharding (Citus, Vitess) or a different store for the hot path.\n• Every schema change is a migration, planned with the code version still running.",
498
580
  "alternatives": "1. A document database: aggregates read whole and flexible shapes, at the cost of joins and cross-document constraints.\n2. A key-value store: scale and latency for known lookups, no ad hoc queries.\n3. A distributed SQL database (CockroachDB, YugabyteDB, Spanner): relational with horizontal write scale, more cost and latency per write.",
499
581
  "hubWhen": {
500
582
  "MODEL": [
@@ -511,8 +593,8 @@
511
593
  "concern": "data-store",
512
594
  "status": "accepted",
513
595
  "date": "",
514
- "context": "This element keeps the system's data, and the store chosen for it outlives most of the code around it: data is far harder to move than code. The forces: the way the data is queried (ad hoc and across entities, whole aggregates by id, or a few known lookups at very high volume) favours different data models; some operations must never be seen half done, while others can accept reading slightly old data in exchange for scale and availability; a managed service takes patching, failover and backups off the team but adds a provider, its limits and its bill, while self-hosting needs people who can run the engine at three in the morning; and the schema will change many times while the system is live, so every change has to be repeatable and safe for the code version still running. Backup and recovery is its own concern.",
515
- "decision": "The data is kept in a document database, MongoDB, one document per aggregate, with a JSON Schema validator on every collection. Consistency: {{CONSISTENCY}} (majority write concern; reads from the primary or with majority read concern where it must be strong); hosting: {{HOSTING}} (managed: MongoDB Atlas; self-hosted: the MongoDB or Percona operator on Kubernetes). Schema changes: {{MIGRATIONS}}. References between aggregates by id; multi-document transactions only where one operation must change two aggregates. Choosing MongoDB or a PostgreSQL JSONB column: MongoDB when most data is documents and scale-out by sharding is likely; JSONB when only a part of a mostly relational model varies in shape. Amazon DocumentDB or Azure Cosmos DB for MongoDB only after checking the features you need are compatible.",
596
+ "context": "This element keeps the system's data, and the store chosen for it outlives most of the code around it: data is far harder to move than code. The forces: the way the data is queried (ad hoc and across entities, whole aggregates by id, or a few known lookups at very high volume) favours different data models; some operations must never be seen half done, while others can accept reading slightly old data in exchange for scale and availability; a managed service takes patching, failover and backups off the team but adds a provider, its limits and its bill, while self-hosting needs people who can run the engine at three in the morning; and the schema will change many times while the system is live, so every change has to be repeatable and safe for the code version still running. Backup and recovery is its own concern; whether a change ships as expand and contract or in a window is decided in the Deployment and rollback pack.",
597
+ "decision": "The data is kept in a document database, MongoDB, one document per aggregate, with a JSON Schema validator on every collection. Consistency: {{CONSISTENCY}} (majority write concern; reads from the primary or with majority read concern where it must be strong); where it is eventual, secondaries serve reads at most {{STALE_SECONDS}} seconds old. Hosting: {{HOSTING}} (managed: MongoDB Atlas; self-hosted: the MongoDB or Percona operator on Kubernetes). Schema changes: {{MIGRATIONS}}; whether a change ships as expand and contract or in a window is decided in the Deployment and rollback pack. References between aggregates by id; multi-document transactions only where one operation must change two aggregates. Choosing MongoDB or a PostgreSQL JSONB column: MongoDB when most data is documents and scale-out by sharding is likely; JSONB when only a part of a mostly relational model varies in shape. Amazon DocumentDB or Azure Cosmos DB for MongoDB only after checking the features you need are compatible.",
516
598
  "consequences": "• An aggregate is read and written in one operation, with no mapping to tables.\n• Shapes can vary between records, and the validator still stops malformed writes.\n• Joins and constraints across documents are the application's job; queries not planned for need new indexes or pipelines.\n• Data duplicated across documents for read speed must be kept in step by code.",
517
599
  "alternatives": "1. A relational database with JSONB columns: constraints and joins with flexible parts.\n2. A key-value store: simpler and faster for lookups by key, no queries on content.\n3. A search engine (OpenSearch) as the main store: great for text search, weak as a system of record.",
518
600
  "hubWhen": {
@@ -530,8 +612,8 @@
530
612
  "concern": "data-store",
531
613
  "status": "accepted",
532
614
  "date": "",
533
- "context": "This element keeps the system's data, and the store chosen for it outlives most of the code around it: data is far harder to move than code. The forces: the way the data is queried (ad hoc and across entities, whole aggregates by id, or a few known lookups at very high volume) favours different data models; some operations must never be seen half done, while others can accept reading slightly old data in exchange for scale and availability; a managed service takes patching, failover and backups off the team but adds a provider, its limits and its bill, while self-hosting needs people who can run the engine at three in the morning; and the schema will change many times while the system is live, so every change has to be repeatable and safe for the code version still running. Backup and recovery is its own concern.",
534
- "decision": "The data is kept in a key-value store designed from its access patterns: Amazon DynamoDB (single-table design, keys and global secondary indexes per listed access pattern, on-demand or provisioned capacity) for durable data on AWS; Redis (or Valkey) with persistence only for small, short-lived or rebuildable data such as sessions, counters and rate limits. Consistency: {{CONSISTENCY}} (DynamoDB strongly consistent reads and TransactWriteItems where it must be strong); hosting: {{HOSTING}} (managed: DynamoDB, ElastiCache or MemoryDB; self-hosted: Redis with Sentinel or Valkey cluster). Schema changes: {{MIGRATIONS}}. No Scan on a request path. Choosing DynamoDB or Redis: DynamoDB when the data must survive and grow without limit; Redis when it fits in memory and losing the last second is acceptable. Outside AWS: Azure Cosmos DB or Google Bigtable play DynamoDB's part.",
615
+ "context": "This element keeps the system's data, and the store chosen for it outlives most of the code around it: data is far harder to move than code. The forces: the way the data is queried (ad hoc and across entities, whole aggregates by id, or a few known lookups at very high volume) favours different data models; some operations must never be seen half done, while others can accept reading slightly old data in exchange for scale and availability; a managed service takes patching, failover and backups off the team but adds a provider, its limits and its bill, while self-hosting needs people who can run the engine at three in the morning; and the schema will change many times while the system is live, so every change has to be repeatable and safe for the code version still running. Backup and recovery is its own concern; whether a change ships as expand and contract or in a window is decided in the Deployment and rollback pack.",
616
+ "decision": "The data is kept in a key-value store designed from its access patterns: Amazon DynamoDB (single-table design, keys and global secondary indexes per listed access pattern, on-demand or provisioned capacity) for durable data on AWS; Redis (or Valkey) with persistence only for small, short-lived or rebuildable data such as sessions, counters and rate limits. Key reads and writes answer within {{P99_MS}} ms at the 99th percentile, measured by the store. Consistency: {{CONSISTENCY}} (DynamoDB strongly consistent reads and TransactWriteItems where it must be strong); where it is eventual, replicas and global tables lag at most {{STALE_SECONDS}} seconds. Hosting: {{HOSTING}} (managed: DynamoDB, ElastiCache or MemoryDB; self-hosted: Redis with Sentinel or Valkey cluster). Schema changes: tables and indexes are infrastructure code applied by the pipeline; item shapes carry a schema version and old items are upgraded in code when read. No Scan on a request path. Choosing DynamoDB or Redis: DynamoDB when the data must survive and grow without limit; Redis when it fits in memory and losing the last second is acceptable. Outside AWS: Azure Cosmos DB or Google Bigtable play DynamoDB's part.",
535
617
  "consequences": "• Single-digit-millisecond latency at any scale, with capacity that scales without re-architecture.\n• Every query must be designed up front; a new access pattern means a new index or a backfill.\n• No joins and limited transactions; reports and analytics go to an export (DynamoDB to S3, Athena) rather than the store.\n• DynamoDB ties the element to AWS; the item and transaction limits shape the design.",
536
618
  "alternatives": "1. A relational database: any query, transactions and constraints, with less headroom for scale.\n2. A document database: richer queries on content, more operational work.\n3. A cache in front of a relational database: keeps queries flexible and lookups fast, adds invalidation.",
537
619
  "hubWhen": {
@@ -546,12 +628,39 @@
546
628
  "label": "Migrations apply cleanly",
547
629
  "x": 1040,
548
630
  "y": 0,
549
- "category": "process",
550
- "threshold": "Every migration applies to an empty database and to the previous release's schema; 0 checksum mismatches against applied migrations",
551
- "description": "On every pull request the pipeline starts the production engine and version, applies all migrations from empty, and validates them; the deploy runs migrate and validate against each environment. With Liquibase the same is `liquibase update` followed by `liquibase validate`.\n\nTool: Flyway\n\n```yaml\n# .github/workflows/migrations.yml\njobs:\n migrations:\n runs-on: ubuntu-latest\n services:\n postgres:\n image: postgres:17 # the production major version\n env: { POSTGRES_PASSWORD: test, POSTGRES_DB: app }\n ports: ['5432:5432']\n options: --health-cmd pg_isready --health-interval 5s\n steps:\n - uses: actions/checkout@v4\n - run: |\n docker run --rm --network host -v \"$PWD/db/migration:/flyway/sql\" flyway/flyway:11 \\\n -url=jdbc:postgresql://localhost:5432/app -user=postgres -password=test \\\n -validateMigrationNaming=true migrate validate\n```",
631
+ "characteristic": "maintainability",
632
+ "scope": "atomic",
633
+ "cadence": "triggered",
634
+ "trigger": "pull-request",
635
+ "invocation": "automated",
636
+ "description": "On every pull request the pipeline starts the production engine and version, applies all migrations from empty, and validates them; the deploy runs migrate and validate against each environment, so a schema changed by hand shows up as a validation failure. With Liquibase the same is `liquibase update` followed by `liquibase validate`.\n\nThreshold: Every migration applies to an empty database of the production engine and version; 0 checksum mismatches against applied migrations\n\nTool: Flyway (PostgreSQL shown; MySQL: the mysql service image and a jdbc:mysql URL)\n\n```yaml\n# .github/workflows/migrations.yml\njobs:\n migrations:\n runs-on: ubuntu-latest\n services:\n postgres:\n image: postgres:17 # the production major version\n env: { POSTGRES_PASSWORD: test, POSTGRES_DB: app }\n ports: ['5432:5432']\n options: --health-cmd pg_isready --health-interval 5s\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - run: |\n docker run --rm --network host -v \"$PWD/db/migration:/flyway/sql\" flyway/flyway:11 \\\n -url=jdbc:postgresql://localhost:5432/app -user=postgres -password=test \\\n -validateMigrationNaming=true migrate validate\n```",
552
637
  "hubWhen": {
553
638
  "MIGRATIONS": [
554
639
  "tool"
640
+ ],
641
+ "MODEL": [
642
+ "relational"
643
+ ]
644
+ }
645
+ },
646
+ {
647
+ "id": "ff-liquibase-mongo",
648
+ "type": "fitness-fn",
649
+ "label": "Changesets apply cleanly",
650
+ "x": 1040,
651
+ "y": 130,
652
+ "characteristic": "maintainability",
653
+ "scope": "atomic",
654
+ "cadence": "triggered",
655
+ "trigger": "pull-request",
656
+ "invocation": "automated",
657
+ "description": "On every pull request the pipeline starts the production MongoDB version, applies the changelog from empty with Liquibase and its MongoDB extension (the extension and MongoDB driver jars are kept in db/lib and mounted into /liquibase/lib), and checks that status reports the database up to date; the deploy runs the same update against each environment.\n\nThreshold: Every changeset applies to an empty MongoDB of the production version; after the update the changelog reports nothing pending\n\nTool: Liquibase with the liquibase-mongodb extension\n\n```yaml\n# .github/workflows/migrations.yml\njobs:\n migrations:\n runs-on: ubuntu-latest\n services:\n mongo:\n image: mongo:8.0 # the production version\n ports: ['27017:27017']\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - run: |\n lb() { docker run --rm --network host -v \"$PWD/db:/liquibase/changelog\" -v \"$PWD/db/lib:/liquibase/lib\" \\\n liquibase/liquibase:4.31 --url=\"mongodb://localhost:27017/app\" --changelog-file=changelog.xml \"$@\"; }\n lb update\n lb status --verbose | grep -q 'is up to date'\n```",
658
+ "hubWhen": {
659
+ "MIGRATIONS": [
660
+ "tool"
661
+ ],
662
+ "MODEL": [
663
+ "document"
555
664
  ]
556
665
  }
557
666
  },
@@ -560,55 +669,112 @@
560
669
  "type": "fitness-fn",
561
670
  "label": "Model and migrations agree",
562
671
  "x": 1040,
563
- "y": 130,
564
- "category": "process",
565
- "threshold": "0 differences between the model in code and the committed migrations",
566
- "description": "The build fails when the model in code changed without a migration. Prisma compares the migrations with the schema; the equivalents are `dotnet ef migrations has-pending-model-changes` (EF Core), `alembic check` (Alembic) and `python manage.py makemigrations --check --dry-run` (Django).\n\nTool: Prisma Migrate (prisma migrate diff)\n\n```bash\n# exits 2 when the schema and the migrations differ\nnpx prisma migrate diff \\\n --from-migrations prisma/migrations \\\n --to-schema-datamodel prisma/schema.prisma \\\n --shadow-database-url \"$SHADOW_DATABASE_URL\" \\\n --exit-code\n```",
672
+ "y": 260,
673
+ "characteristic": "maintainability",
674
+ "scope": "atomic",
675
+ "cadence": "triggered",
676
+ "trigger": "pull-request",
677
+ "invocation": "automated",
678
+ "description": "The build fails when the model in code changed without a migration, so every schema change is a committed, versioned migration.\n\nThreshold: 0 differences between the model in code and the committed migrations\n\nTool: Prisma Migrate (prisma migrate diff); EF Core: dotnet ef migrations has-pending-model-changes; Alembic: alembic check; Django: manage.py makemigrations --check --dry-run\n\n```bash\n# exits 2 when the schema and the migrations differ\nnpx prisma migrate diff \\\n --from-migrations prisma/migrations \\\n --to-schema-datamodel prisma/schema.prisma \\\n --shadow-database-url \"$SHADOW_DATABASE_URL\" \\\n --exit-code\n```",
567
679
  "hubWhen": {
568
680
  "MIGRATIONS": [
569
681
  "orm"
682
+ ],
683
+ "MODEL": [
684
+ "relational"
570
685
  ]
571
686
  }
572
687
  },
573
688
  {
574
689
  "id": "ff-schema-versions",
575
690
  "type": "fitness-fn",
576
- "label": "No record far behind",
691
+ "label": "No document far behind",
577
692
  "x": 1040,
578
- "y": 260,
579
- "category": "operational",
580
- "threshold": "0 records more than 2 schema versions behind the current one",
581
- "description": "A scheduled job counts the records per schema version in each collection and fails when any is more than two versions behind; the backfill job then runs. For DynamoDB, the same count comes from a sparse index on the schema version attribute.\n\nTool: mongosh (scheduled job)\n\n```js\n// check-schema-versions.js — mongosh \"$MONGODB_URI\" --file check-schema-versions.js\nconst CURRENT = { orders: 7, customers: 4 } // the version the code writes\nlet behind = 0\nfor (const [name, version] of Object.entries(CURRENT)) {\n const n = db.getCollection(name).countDocuments({ schemaVersion: { $lt: version - 2 } })\n if (n > 0) print(`${name}: ${n} documents more than 2 versions behind`)\n behind += n\n}\nif (behind > 0) quit(1)\n```",
693
+ "y": 390,
694
+ "characteristic": "maintainability",
695
+ "scope": "atomic",
696
+ "cadence": "triggered",
697
+ "trigger": "nightly",
698
+ "invocation": "automated",
699
+ "description": "A scheduled job counts the documents per collection that are more than two versions behind the version the code writes, or carry no schema version at all (the oldest of all), and fails when any exist; the backfill job then runs.\n\nThreshold: 0 documents more than 2 schema versions behind the current one, documents without a version field included\n\nTool: mongosh (scheduled job)\n\n```js\n// check-schema-versions.js — mongosh \"$MONGODB_URI\" --file check-schema-versions.js\nconst CURRENT = { orders: 7, customers: 4 } // the version the code writes\nlet behind = 0\nfor (const [name, version] of Object.entries(CURRENT)) {\n const n = db.getCollection(name).countDocuments({\n $or: [{ schemaVersion: { $lt: version - 2 } }, { schemaVersion: { $exists: false } }],\n })\n if (n > 0) print(`${name}: ${n} documents more than 2 versions behind`)\n behind += n\n}\nif (behind > 0) quit(1)\n```",
582
700
  "hubWhen": {
583
701
  "MIGRATIONS": [
584
702
  "lazy"
703
+ ],
704
+ "MODEL": [
705
+ "document"
585
706
  ]
586
707
  }
587
708
  },
588
709
  {
589
- "id": "ff-squawk",
710
+ "id": "ff-schema-versions-kv",
590
711
  "type": "fitness-fn",
591
- "label": "Migrations safe to deploy",
712
+ "label": "No item far behind",
592
713
  "x": 1040,
593
- "y": 390,
594
- "category": "structural",
595
- "threshold": "0 Squawk findings in new migrations (no dropped or renamed column in use, no blocking index build, no NOT NULL column without a default)",
596
- "description": "Squawk lints the SQL of each new migration for changes that lock tables or break the code still running; the build fails on any finding.\n\nTool: Squawk\n\n```bash\n# lint only the migrations the pull request adds\ngit diff --name-only --diff-filter=A origin/main -- 'db/migration/*.sql' \\\n | xargs --no-run-if-empty npx squawk-cli \\\n --exclude=prefer-big-int,prefer-text-field\n```",
714
+ "y": 520,
715
+ "characteristic": "maintainability",
716
+ "scope": "atomic",
717
+ "cadence": "triggered",
718
+ "trigger": "nightly",
719
+ "invocation": "automated",
720
+ "description": "A scheduled batch job (the one place a Scan is allowed) counts the items more than two versions behind the version the code writes, or without a schema version at all, and fails when any exist; the backfill job then runs. The CLI pages the scan and sums the count.\n\nThreshold: 0 items more than 2 schema versions behind the current one, items without a version attribute included\n\nTool: AWS CLI (DynamoDB); Redis: a SCAN over the key space in a job, reading the version field of each value\n\n```bash\n#!/usr/bin/env bash\n# CURRENT: the schema version the code writes; TABLE from the environment\nset -euo pipefail\nCURRENT=7\nbehind=$(aws dynamodb scan --table-name \"$TABLE\" --select COUNT \\\n --filter-expression 'attribute_not_exists(schemaVersion) OR schemaVersion < :v' \\\n --expression-attribute-values \"{\\\":v\\\":{\\\"N\\\":\\\"$((CURRENT - 2))\\\"}}\" --query Count --output text)\n[ \"$behind\" -eq 0 ] || { echo \"$behind items more than 2 schema versions behind\"; exit 1; }\n```",
721
+ "hubWhen": {
722
+ "MIGRATIONS": [
723
+ "lazy"
724
+ ],
725
+ "MODEL": [
726
+ "keyvalue"
727
+ ]
728
+ }
729
+ },
730
+ {
731
+ "id": "ff-seq-scan",
732
+ "type": "fitness-fn",
733
+ "label": "No sequential scan on request paths",
734
+ "x": 1040,
735
+ "y": 650,
736
+ "characteristic": "performance-efficiency",
737
+ "scope": "atomic",
738
+ "cadence": "triggered",
739
+ "trigger": "pull-request",
740
+ "invocation": "automated",
741
+ "description": "The integration pipeline loads a database with production-sized data, resets the statistics, runs the request-path test suite, then reads pg_stat_user_tables: a table above 10,000 rows with a sequential scan since the reset fails the job.\n\nThreshold: 0 sequential scans over a table above 10,000 rows during the request-path test suite\n\nTool: psql (PostgreSQL); MySQL: sys.schema_tables_with_full_table_scans after the same suite\n\n```sql\n-- before the request-path test suite, on a database loaded with production-sized data:\nSELECT pg_stat_reset();\n\n-- after it: tables above 10,000 rows that were read whole; the job fails on any row\nSELECT relname, seq_scan, n_live_tup\nFROM pg_stat_user_tables\nWHERE n_live_tup > 10000 AND seq_scan > 0\nORDER BY seq_scan DESC;\n```",
597
742
  "hubWhen": {
598
743
  "MODEL": [
599
744
  "relational"
600
745
  ]
601
746
  }
602
747
  },
748
+ {
749
+ "id": "ff-collscan",
750
+ "type": "fitness-fn",
751
+ "label": "No collection scan on request paths",
752
+ "x": 1040,
753
+ "y": 780,
754
+ "characteristic": "performance-efficiency",
755
+ "scope": "atomic",
756
+ "cadence": "triggered",
757
+ "trigger": "pull-request",
758
+ "invocation": "automated",
759
+ "description": "The integration pipeline loads a database with production-sized data, turns the profiler on for every operation, runs the request-path test suite, then reads system.profile: an operation whose plan was a collection scan over a collection above 10,000 documents fails the job.\n\nThreshold: 0 COLLSCAN operations over a collection above 10,000 documents during the request-path test suite\n\nTool: mongosh\n\n```js\n// before the request-path test suite: db.setProfilingLevel(2)\n// after it — mongosh \"$MONGODB_URI\" --file check-collscan.js\nconst big = db.getCollectionNames()\n .filter((n) => !n.startsWith('system.') && db.getCollection(n).estimatedDocumentCount() > 10000)\n .map((n) => `${db.getName()}.${n}`)\nconst scans = db.system.profile.find({ planSummary: 'COLLSCAN', ns: { $in: big } }).toArray()\nif (scans.length) {\n print(scans.map((s) => `${s.ns}: ${JSON.stringify(s.command)}`).join('\\n'))\n quit(1)\n}\n```",
760
+ "hubWhen": {
761
+ "MODEL": [
762
+ "document"
763
+ ]
764
+ }
765
+ },
603
766
  {
604
767
  "id": "ff-integrity",
605
768
  "type": "fitness-fn",
606
769
  "label": "Keys and foreign keys present",
607
770
  "x": 1040,
608
- "y": 520,
609
- "category": "structural",
610
- "threshold": "100% of tables have a primary key; 0 columns named *_id without a foreign key",
611
- "description": "A test migrates a fresh database in a container and queries the catalogue for tables without a primary key and reference columns without a foreign key; both lists must be empty.\n\nTool: Testcontainers with a SQL query on information_schema (PostgreSQL)\n\n```sql\n-- tables without a primary key\nSELECT t.table_name FROM information_schema.tables t\nWHERE t.table_schema = 'public' AND t.table_type = 'BASE TABLE'\n AND NOT EXISTS (SELECT 1 FROM information_schema.table_constraints c\n WHERE c.table_name = t.table_name AND c.constraint_type = 'PRIMARY KEY');\n\n-- reference columns without a foreign key\nSELECT k.table_name, k.column_name FROM information_schema.columns k\nWHERE k.table_schema = 'public' AND k.column_name LIKE '%\\_id'\n AND NOT EXISTS (SELECT 1 FROM information_schema.key_column_usage u\n JOIN information_schema.table_constraints c USING (constraint_name, table_name)\n WHERE c.constraint_type = 'FOREIGN KEY'\n AND u.table_name = k.table_name AND u.column_name = k.column_name);\n```",
771
+ "y": 910,
772
+ "characteristic": "functional-suitability",
773
+ "scope": "atomic",
774
+ "cadence": "triggered",
775
+ "trigger": "pull-request",
776
+ "invocation": "automated",
777
+ "description": "A test migrates a fresh database in a container and queries the catalogue for tables without a primary key and reference columns without a foreign key; both lists must be empty.\n\nThreshold: 100% of tables have a primary key; 0 columns named *_id without a foreign key\n\nTool: Testcontainers with a SQL query on information_schema (PostgreSQL)\n\n```sql\n-- tables without a primary key\nSELECT t.table_name FROM information_schema.tables t\nWHERE t.table_schema = 'public' AND t.table_type = 'BASE TABLE'\n AND NOT EXISTS (SELECT 1 FROM information_schema.table_constraints c\n WHERE c.table_name = t.table_name AND c.constraint_type = 'PRIMARY KEY');\n\n-- reference columns without a foreign key\nSELECT k.table_name, k.column_name FROM information_schema.columns k\nWHERE k.table_schema = 'public' AND k.column_name LIKE '%\\_id'\n AND NOT EXISTS (SELECT 1 FROM information_schema.key_column_usage u\n JOIN information_schema.table_constraints c USING (constraint_name, table_name)\n WHERE c.constraint_type = 'FOREIGN KEY'\n AND u.table_name = k.table_name AND u.column_name = k.column_name);\n```",
612
778
  "hubWhen": {
613
779
  "MODEL": [
614
780
  "relational"
@@ -620,10 +786,13 @@
620
786
  "type": "fitness-fn",
621
787
  "label": "Collections validate writes",
622
788
  "x": 1040,
623
- "y": 650,
624
- "category": "structural",
625
- "threshold": "100% of collections have a $jsonSchema validator with validationLevel strict and validationAction error",
626
- "description": "A check run after each deploy lists the collections and fails when one has no JSON Schema validator, or one that only warns.\n\nTool: mongosh\n\n```js\n// check-validators.js — mongosh \"$MONGODB_URI\" --file check-validators.js\nconst missing = db.getCollectionInfos({ type: 'collection' })\n .filter((c) => !c.name.startsWith('system.'))\n .filter((c) => !c.options?.validator?.$jsonSchema\n || (c.options.validationLevel ?? 'strict') !== 'strict'\n || (c.options.validationAction ?? 'error') !== 'error')\n .map((c) => c.name)\nif (missing.length) { print('Collections without a strict validator: ' + missing.join(', ')); quit(1) }\n```",
789
+ "y": 1040,
790
+ "characteristic": "functional-suitability",
791
+ "scope": "atomic",
792
+ "cadence": "triggered",
793
+ "trigger": "deploy",
794
+ "invocation": "automated",
795
+ "description": "A check run after each deploy lists the collections and fails when one has no JSON Schema validator, or one that only warns.\n\nThreshold: 100% of collections have a $jsonSchema validator with validationLevel strict and validationAction error\n\nTool: mongosh\n\n```js\n// check-validators.js — mongosh \"$MONGODB_URI\" --file check-validators.js\nconst missing = db.getCollectionInfos({ type: 'collection' })\n .filter((c) => !c.name.startsWith('system.'))\n .filter((c) => !c.options?.validator?.$jsonSchema\n || (c.options.validationLevel ?? 'strict') !== 'strict'\n || (c.options.validationAction ?? 'error') !== 'error')\n .map((c) => c.name)\nif (missing.length) { print('Collections without a strict validator: ' + missing.join(', ')); quit(1) }\n```",
627
796
  "hubWhen": {
628
797
  "MODEL": [
629
798
  "document"
@@ -635,28 +804,112 @@
635
804
  "type": "fitness-fn",
636
805
  "label": "No Scan in request code",
637
806
  "x": 1040,
638
- "y": 780,
639
- "category": "structural",
640
- "threshold": "0 uses of Scan outside batch jobs",
641
- "description": "A lint rule forbids the DynamoDB Scan command in request-handling code; batch jobs under src/jobs are exempt. For Redis, the same rule forbids KEYS.\n\nTool: ESLint (no-restricted-imports)\n\n```js\n// eslint.config.mjs\nexport default [\n {\n files: ['src/**/*.ts'],\n ignores: ['src/jobs/**'],\n rules: {\n 'no-restricted-imports': ['error', {\n paths: [\n { name: '@aws-sdk/client-dynamodb', importNames: ['ScanCommand'], message: 'ADR Key-value store: serve requests from a key or index, never Scan.' },\n { name: '@aws-sdk/lib-dynamodb', importNames: ['ScanCommand'], message: 'ADR Key-value store: serve requests from a key or index, never Scan.' },\n ],\n }],\n },\n },\n]\n```",
807
+ "y": 1170,
808
+ "characteristic": "performance-efficiency",
809
+ "scope": "atomic",
810
+ "cadence": "triggered",
811
+ "trigger": "pull-request",
812
+ "invocation": "automated",
813
+ "description": "A lint rule forbids importing the DynamoDB Scan command and calling keys() on a client in request-handling code; batch jobs under src/jobs are exempt.\n\nThreshold: 0 uses of the DynamoDB Scan command or the Redis KEYS command outside src/jobs\n\nTool: ESLint (Node.js); other runtimes: a Semgrep rule on the same call names\n\n```js\n// eslint.config.mjs\nexport default [\n {\n files: ['src/**/*.ts'],\n ignores: ['src/jobs/**'],\n rules: {\n 'no-restricted-imports': ['error', {\n paths: [\n { name: '@aws-sdk/client-dynamodb', importNames: ['ScanCommand'], message: 'ADR Key-value store: serve requests from a key or index, never Scan.' },\n { name: '@aws-sdk/lib-dynamodb', importNames: ['ScanCommand'], message: 'ADR Key-value store: serve requests from a key or index, never Scan.' },\n ],\n }],\n 'no-restricted-syntax': ['error', {\n selector: 'CallExpression[callee.property.name=\"keys\"][callee.object.name!=\"Object\"]',\n message: 'ADR Key-value store: KEYS blocks Redis; use SCAN in a job under src/jobs, never in a request.',\n }],\n },\n },\n]\n```",
642
814
  "hubWhen": {
643
815
  "MODEL": [
644
816
  "keyvalue"
645
817
  ]
646
818
  }
647
819
  },
820
+ {
821
+ "id": "ff-kv-latency",
822
+ "type": "fitness-fn",
823
+ "label": "Key lookups within target",
824
+ "x": 1040,
825
+ "y": 1300,
826
+ "characteristic": "performance-efficiency",
827
+ "scope": "atomic",
828
+ "cadence": "triggered",
829
+ "trigger": "nightly",
830
+ "invocation": "automated",
831
+ "description": "A daily job reads the store's own latency percentile per operation from CloudWatch (SuccessfulRequestLatency, p99, hourly) and fails when any hour exceeds the budget. Runs on Linux (GNU date).\n\nThreshold: 99th percentile of the store's request latency for GetItem and PutItem at most {{P99_MS}} ms in every hour of the last 24 hours\n\nTool: AWS CLI with CloudWatch SuccessfulRequestLatency (DynamoDB); Redis: redis-benchmark -t get,set against the production-sized store, reading its p99 line\n\n```bash\n#!/usr/bin/env bash\n# daily: the store's p99 for key reads and writes over the last 24 hours, per hour\nset -euo pipefail\nfail=0\nfor op in GetItem PutItem; do\n p99=$(aws cloudwatch get-metric-statistics --namespace AWS/DynamoDB --metric-name SuccessfulRequestLatency \\\n --dimensions Name=TableName,Value=\"$TABLE\" Name=Operation,Value=\"$op\" \\\n --start-time \"$(date -u -d '24 hours ago' +%FT%TZ)\" --end-time \"$(date -u +%FT%TZ)\" --period 3600 \\\n --extended-statistics p99 --query 'max(Datapoints[].ExtendedStatistics.p99)' --output text)\n [ \"$p99\" = None ] || [ \"$(jq -n \"$p99 <= {{P99_MS}}\")\" = true ] || { echo \"$op p99 $p99 ms, budget {{P99_MS}} ms\"; fail=1; }\ndone\nexit $fail\n```",
832
+ "hubWhen": {
833
+ "MODEL": [
834
+ "keyvalue"
835
+ ]
836
+ }
837
+ },
838
+ {
839
+ "id": "ff-atomic",
840
+ "type": "fitness-fn",
841
+ "label": "Failed operation leaves nothing",
842
+ "x": 1040,
843
+ "y": 1430,
844
+ "characteristic": "functional-suitability",
845
+ "scope": "atomic",
846
+ "cadence": "triggered",
847
+ "trigger": "pull-request",
848
+ "invocation": "automated",
849
+ "description": "An integration test against the real engine (Testcontainers) injects a fault after the second write of an operation through the repository's test hook and asserts that none of its records exists afterwards; one such test per multi-record operation.\n\nThreshold: For every business operation that writes several records: a fault after its second write leaves 0 records changed\n\nTool: Vitest (or your stack's test runner) with Testcontainers\n\n```ts\nimport { afterEach, expect, it } from 'vitest'\nimport { failAfterWrites, reset } from '../src/data/testHooks' // the repository's fault injection, test builds only\nimport { orderLines, orders, placeOrder } from '../src/orders'\n\nafterEach(reset)\n\nit('a failure after the second write leaves nothing of the operation', async () => {\n failAfterWrites(2) // the third write throws\n await expect(placeOrder(sampleOrderWithThreeLines())).rejects.toThrow()\n expect(await orders.find(sampleOrderId)).toBeNull()\n expect(await orderLines.countFor(sampleOrderId)).toBe(0)\n})\n```",
850
+ "hubWhen": {
851
+ "CONSISTENCY": [
852
+ "strong"
853
+ ]
854
+ }
855
+ },
648
856
  {
649
857
  "id": "ff-replica-lag",
650
858
  "type": "fitness-fn",
651
859
  "label": "Replica lag within bound",
652
860
  "x": 1040,
653
- "y": 910,
654
- "category": "operational",
655
- "threshold": "Replica lag at most {{STALE_SECONDS}} seconds; an alert fires after 2 minutes above it",
656
- "description": "An alert on the exporter's replication-lag metric pages when replicas fall further behind than the bound. For MongoDB use the replica set member lag from the MongoDB exporter; for DynamoDB global tables, the ReplicationLatency metric in CloudWatch.\n\nTool: Prometheus with postgres_exporter\n\n```yaml\ngroups:\n - name: data-store\n rules:\n - alert: ReplicaLagAboveBound\n expr: max by (instance) (pg_replication_lag_seconds) > 5 # STALE_SECONDS\n for: 2m\n labels: { severity: page }\n annotations:\n summary: \"Replica {{ $labels.instance }} lags {{ $value }}s behind the primary\"\n```",
861
+ "y": 1560,
862
+ "characteristic": "reliability",
863
+ "scope": "atomic",
864
+ "cadence": "continual",
865
+ "invocation": "automated",
866
+ "description": "An alert on postgres_exporter's replication-lag metric pages when a replica falls further behind than the bound.\n\nThreshold: Replica lag at most {{STALE_SECONDS}} seconds; an alert fires after 2 minutes above it\n\nTool: Prometheus with postgres_exporter (PostgreSQL); MySQL: mysqld_exporter's mysql_slave_status_seconds_behind_master\n\n```yaml\ngroups:\n - name: data-store\n rules:\n - alert: ReplicaLagAboveBound\n expr: max by (instance) (pg_replication_lag_seconds) > {{STALE_SECONDS}}\n for: 2m\n labels: { severity: page }\n annotations:\n summary: \"Replica {{ $labels.instance }} lags {{ $value }}s behind the primary\"\n```",
657
867
  "hubWhen": {
658
868
  "CONSISTENCY": [
659
869
  "eventual"
870
+ ],
871
+ "MODEL": [
872
+ "relational"
873
+ ]
874
+ }
875
+ },
876
+ {
877
+ "id": "ff-replica-lag-document",
878
+ "type": "fitness-fn",
879
+ "label": "Secondary lag within bound",
880
+ "x": 1040,
881
+ "y": 1690,
882
+ "characteristic": "reliability",
883
+ "scope": "atomic",
884
+ "cadence": "continual",
885
+ "invocation": "automated",
886
+ "description": "An alert on the MongoDB exporter's member replication lag (compatible-mode metric from replSetGetStatus) pages when a secondary falls further behind than the bound.\n\nThreshold: Replica set member lag at most {{STALE_SECONDS}} seconds; an alert fires after 2 minutes above it\n\nTool: Prometheus with the Percona mongodb_exporter (--compatible-mode)\n\n```yaml\ngroups:\n - name: data-store\n rules:\n - alert: SecondaryLagAboveBound\n expr: max by (set, name) (mongodb_mongod_replset_member_replication_lag{state=\"SECONDARY\"}) > {{STALE_SECONDS}}\n for: 2m\n labels: { severity: page }\n annotations:\n summary: \"{{ $labels.name }} in {{ $labels.set }} lags {{ $value }}s behind the primary\"\n```",
887
+ "hubWhen": {
888
+ "CONSISTENCY": [
889
+ "eventual"
890
+ ],
891
+ "MODEL": [
892
+ "document"
893
+ ]
894
+ }
895
+ },
896
+ {
897
+ "id": "ff-replica-lag-kv",
898
+ "type": "fitness-fn",
899
+ "label": "Replication lag within bound",
900
+ "x": 1040,
901
+ "y": 1820,
902
+ "characteristic": "reliability",
903
+ "scope": "atomic",
904
+ "cadence": "continual",
905
+ "invocation": "automated",
906
+ "description": "Two alert rules: the Redis exporter's replica lag, and DynamoDB's ReplicationLatency (milliseconds, per receiving region) brought into Prometheus by the CloudWatch exporter; either pages when a replica falls further behind than the bound.\n\nThreshold: Redis replica lag, or DynamoDB global table replication latency, at most {{STALE_SECONDS}} seconds; an alert fires after 2 minutes above it\n\nTool: Prometheus with redis_exporter and the CloudWatch exporter (aws_dynamodb_replication_latency_maximum)\n\n```yaml\ngroups:\n - name: data-store\n rules:\n - alert: RedisReplicaLagAboveBound\n expr: max by (instance) (redis_connected_slave_lag_seconds) > {{STALE_SECONDS}}\n for: 2m\n labels: { severity: page }\n annotations:\n summary: \"Redis {{ $labels.instance }}: a replica lags {{ $value }}s\"\n - alert: DynamoDBReplicationLagAboveBound\n expr: max by (table_name, receiving_region) (aws_dynamodb_replication_latency_maximum) / 1000 > {{STALE_SECONDS}}\n for: 2m\n labels: { severity: page }\n annotations:\n summary: \"{{ $labels.table_name }} replicates to {{ $labels.receiving_region }} with {{ $value }}s latency\"\n```",
907
+ "hubWhen": {
908
+ "CONSISTENCY": [
909
+ "eventual"
910
+ ],
911
+ "MODEL": [
912
+ "keyvalue"
660
913
  ]
661
914
  }
662
915
  },
@@ -665,10 +918,13 @@
665
918
  "type": "fitness-fn",
666
919
  "label": "Export is fresh",
667
920
  "x": 1040,
668
- "y": 1040,
669
- "category": "operational",
670
- "threshold": "The newest export in our own storage is less than 26 hours old; a monthly job loads it into a self-hosted engine without error",
671
- "description": "A scheduled check finds the newest export object in the bucket the organisation controls and fails when it is older than 26 hours (a daily export with two hours of slack).\n\nTool: AWS CLI (scheduled check)\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nnewest=$(aws s3api list-objects-v2 --bucket \"$EXPORT_BUCKET\" --prefix exports/ \\\n --query 'sort_by(Contents, &LastModified)[-1].LastModified' --output text)\nage=$(( $(date +%s) - $(date -d \"$newest\" +%s) ))\n[ \"$age\" -lt $((26 * 3600)) ] || { echo \"newest export is $((age / 3600)) h old\"; exit 1; }\n```",
921
+ "y": 1950,
922
+ "characteristic": "flexibility",
923
+ "scope": "atomic",
924
+ "cadence": "triggered",
925
+ "trigger": "nightly",
926
+ "invocation": "automated",
927
+ "description": "A scheduled check lists the export location through rclone (S3, Azure Blob Storage, Google Cloud Storage and others alike), takes the newest object's modification time and fails when it is older than 26 hours (a daily export with two hours of slack). Runs on Linux (GNU date).\n\nThreshold: The newest export in storage the organisation controls is less than 26 hours old\n\nTool: rclone with jq (scheduled check)\n\n```bash\n#!/usr/bin/env bash\n# EXPORT_REMOTE: an rclone remote in storage we control, e.g. s3:exports/orders, azblob:exports/orders, gcs:exports/orders\nset -euo pipefail\nnewest=$(rclone lsjson \"$EXPORT_REMOTE\" --files-only --recursive | jq -r 'max_by(.ModTime).ModTime')\n[ \"$newest\" != null ] || { echo \"no export found in $EXPORT_REMOTE\"; exit 1; }\nage=$(( $(date +%s) - $(date -d \"$newest\" +%s) ))\n[ \"$age\" -lt $((26 * 3600)) ] || { echo \"newest export is $((age / 3600)) h old\"; exit 1; }\n```",
672
928
  "hubWhen": {
673
929
  "HOSTING": [
674
930
  "managed"
@@ -676,17 +932,65 @@
676
932
  }
677
933
  },
678
934
  {
679
- "id": "ff-engine-current",
935
+ "id": "ff-engine-current-relational",
680
936
  "type": "fitness-fn",
681
- "label": "Engine on latest minor",
937
+ "label": "PostgreSQL on latest minor",
682
938
  "x": 1040,
683
- "y": 1170,
684
- "category": "operational",
685
- "threshold": "Every node runs the latest minor release of its major, or one published less than 30 days ago; 0 majors past end of support",
686
- "description": "A scheduled job compares the version each node reports with the latest release of its major on endoflife.date, and fails when the latest has been out for more than 30 days or the major has reached end of support. Products: postgresql, mysql, mongodb, redis.\n\nTool: endoflife.date API (curl and jq)\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nrunning=$(psql \"$DATABASE_URL\" -tAc 'SHOW server_version' | cut -d' ' -f1) # e.g. 17.4\nmajor=${running%%.*}\ninfo=$(curl -fsS \"https://endoflife.date/api/postgresql/${major}.json\")\nlatest=$(jq -r '.latest' <<<\"$info\"); released=$(jq -r '.latestReleaseDate' <<<\"$info\"); eol=$(jq -r '.eol' <<<\"$info\")\n[ \"$eol\" != \"true\" ] && { [ \"$eol\" = \"false\" ] || [ \"$(date -d \"$eol\" +%s)\" -gt \"$(date +%s)\" ]; } \\\n || { echo \"PostgreSQL $major is past end of support\"; exit 1; }\nif [ \"$running\" != \"$latest\" ] && [ \"$(date -d \"$released\" +%s)\" -lt \"$(date -d '30 days ago' +%s)\" ]; then\n echo \"running $running, $latest released on $released\"; exit 1\nfi\n```",
939
+ "y": 2080,
940
+ "characteristic": "maintainability",
941
+ "scope": "atomic",
942
+ "cadence": "triggered",
943
+ "trigger": "nightly",
944
+ "invocation": "automated",
945
+ "description": "A scheduled job asks each node its version, looks its cycle up on endoflife.date (postgresql) and fails when the newest release of the cycle has been out for more than 30 days without being applied, or the cycle has reached end of support. Runs on Linux (GNU date).\n\nThreshold: Every PostgreSQL node runs the latest release of its postgresql cycle on endoflife.date, or one published less than 30 days ago; 0 cycles past end of support\n\nTool: endoflife.date API with psql (PostgreSQL); MySQL: SELECT VERSION() and the mysql product, cycle of two numbers\n\n```bash\n#!/usr/bin/env bash\n# run once per node; the node's connection string comes from the environment\nset -euo pipefail\nrunning=$(psql \"$DATABASE_URL\" -tAc 'SHOW server_version' | cut -d' ' -f1)\ncycle=$(cut -d. -f1-1 <<<\"$running\")\ninfo=$(curl -fsS \"https://endoflife.date/api/postgresql/${cycle}.json\")\nlatest=$(jq -r '.latest' <<<\"$info\"); released=$(jq -r '.latestReleaseDate' <<<\"$info\"); eol=$(jq -r '.eol' <<<\"$info\")\nif [ \"$eol\" = true ] || { [ \"$eol\" != false ] && [ \"$(date -d \"$eol\" +%s)\" -lt \"$(date +%s)\" ]; }; then\n echo \"PostgreSQL $cycle is past end of support ($eol)\"; exit 1\nfi\nif [ \"$running\" != \"$latest\" ] && [ \"$(date -d \"$released\" +%s)\" -lt \"$(date -d '30 days ago' +%s)\" ]; then\n echo \"running $running, $latest released on $released (30 days allowed)\"; exit 1\nfi\n```",
687
946
  "hubWhen": {
688
947
  "HOSTING": [
689
948
  "self"
949
+ ],
950
+ "MODEL": [
951
+ "relational"
952
+ ]
953
+ }
954
+ },
955
+ {
956
+ "id": "ff-engine-current-document",
957
+ "type": "fitness-fn",
958
+ "label": "MongoDB on latest minor",
959
+ "x": 1040,
960
+ "y": 2210,
961
+ "characteristic": "maintainability",
962
+ "scope": "atomic",
963
+ "cadence": "triggered",
964
+ "trigger": "nightly",
965
+ "invocation": "automated",
966
+ "description": "A scheduled job asks each node its version, looks its cycle up on endoflife.date (mongodb) and fails when the newest release of the cycle has been out for more than 30 days without being applied, or the cycle has reached end of support. Runs on Linux (GNU date).\n\nThreshold: Every MongoDB node runs the latest release of its mongodb cycle on endoflife.date, or one published less than 30 days ago; 0 cycles past end of support\n\nTool: endoflife.date API with mongosh\n\n```bash\n#!/usr/bin/env bash\n# run once per node; the node's connection string comes from the environment\nset -euo pipefail\nrunning=$(mongosh \"$MONGODB_URI\" --quiet --eval 'db.version()')\ncycle=$(cut -d. -f1-2 <<<\"$running\")\ninfo=$(curl -fsS \"https://endoflife.date/api/mongodb/${cycle}.json\")\nlatest=$(jq -r '.latest' <<<\"$info\"); released=$(jq -r '.latestReleaseDate' <<<\"$info\"); eol=$(jq -r '.eol' <<<\"$info\")\nif [ \"$eol\" = true ] || { [ \"$eol\" != false ] && [ \"$(date -d \"$eol\" +%s)\" -lt \"$(date +%s)\" ]; }; then\n echo \"MongoDB $cycle is past end of support ($eol)\"; exit 1\nfi\nif [ \"$running\" != \"$latest\" ] && [ \"$(date -d \"$released\" +%s)\" -lt \"$(date -d '30 days ago' +%s)\" ]; then\n echo \"running $running, $latest released on $released (30 days allowed)\"; exit 1\nfi\n```",
967
+ "hubWhen": {
968
+ "HOSTING": [
969
+ "self"
970
+ ],
971
+ "MODEL": [
972
+ "document"
973
+ ]
974
+ }
975
+ },
976
+ {
977
+ "id": "ff-engine-current-keyvalue",
978
+ "type": "fitness-fn",
979
+ "label": "Redis on latest minor",
980
+ "x": 1040,
981
+ "y": 2340,
982
+ "characteristic": "maintainability",
983
+ "scope": "atomic",
984
+ "cadence": "triggered",
985
+ "trigger": "nightly",
986
+ "invocation": "automated",
987
+ "description": "A scheduled job asks each node its version, looks its cycle up on endoflife.date (redis) and fails when the newest release of the cycle has been out for more than 30 days without being applied, or the cycle has reached end of support. Runs on Linux (GNU date).\n\nThreshold: Every Redis node runs the latest release of its redis cycle on endoflife.date, or one published less than 30 days ago; 0 cycles past end of support\n\nTool: endoflife.date API with redis-cli (Redis; Valkey: the valkey product)\n\n```bash\n#!/usr/bin/env bash\n# run once per node; the node's connection string comes from the environment\nset -euo pipefail\nrunning=$(redis-cli -u \"$REDIS_URL\" INFO server | tr -d '\\r' | awk -F: '/^redis_version:/ { print $2 }')\ncycle=$(cut -d. -f1-2 <<<\"$running\")\ninfo=$(curl -fsS \"https://endoflife.date/api/redis/${cycle}.json\")\nlatest=$(jq -r '.latest' <<<\"$info\"); released=$(jq -r '.latestReleaseDate' <<<\"$info\"); eol=$(jq -r '.eol' <<<\"$info\")\nif [ \"$eol\" = true ] || { [ \"$eol\" != false ] && [ \"$(date -d \"$eol\" +%s)\" -lt \"$(date +%s)\" ]; }; then\n echo \"Redis $cycle is past end of support ($eol)\"; exit 1\nfi\nif [ \"$running\" != \"$latest\" ] && [ \"$(date -d \"$released\" +%s)\" -lt \"$(date -d '30 days ago' +%s)\" ]; then\n echo \"running $running, $latest released on $released (30 days allowed)\"; exit 1\nfi\n```",
988
+ "hubWhen": {
989
+ "HOSTING": [
990
+ "self"
991
+ ],
992
+ "MODEL": [
993
+ "keyvalue"
690
994
  ]
691
995
  }
692
996
  }
@@ -699,8 +1003,8 @@
699
1003
  "relationType": "derives"
700
1004
  },
701
1005
  {
702
- "id": "req-expand-contract--derives--need",
703
- "sourceId": "req-expand-contract",
1006
+ "id": "req-indexed-reads--derives--need",
1007
+ "sourceId": "req-indexed-reads",
704
1008
  "targetId": "need",
705
1009
  "relationType": "derives"
706
1010
  },
@@ -710,6 +1014,12 @@
710
1014
  "targetId": "need",
711
1015
  "relationType": "derives"
712
1016
  },
1017
+ {
1018
+ "id": "req-versioned-doc--derives--need",
1019
+ "sourceId": "req-versioned-doc",
1020
+ "targetId": "need",
1021
+ "relationType": "derives"
1022
+ },
713
1023
  {
714
1024
  "id": "req-lazy--derives--need",
715
1025
  "sourceId": "req-lazy",
@@ -765,9 +1075,9 @@
765
1075
  "relationType": "verifies"
766
1076
  },
767
1077
  {
768
- "id": "sc-expand-contract--verifies--req-expand-contract",
769
- "sourceId": "sc-expand-contract",
770
- "targetId": "req-expand-contract",
1078
+ "id": "sc-indexed-reads--verifies--req-indexed-reads",
1079
+ "sourceId": "sc-indexed-reads",
1080
+ "targetId": "req-indexed-reads",
771
1081
  "relationType": "verifies"
772
1082
  },
773
1083
  {
@@ -776,6 +1086,12 @@
776
1086
  "targetId": "req-versioned",
777
1087
  "relationType": "verifies"
778
1088
  },
1089
+ {
1090
+ "id": "sc-versioned-doc--verifies--req-versioned-doc",
1091
+ "sourceId": "sc-versioned-doc",
1092
+ "targetId": "req-versioned-doc",
1093
+ "relationType": "verifies"
1094
+ },
779
1095
  {
780
1096
  "id": "sc-lazy--verifies--req-lazy",
781
1097
  "sourceId": "sc-lazy",
@@ -831,17 +1147,11 @@
831
1147
  "relationType": "implements"
832
1148
  },
833
1149
  {
834
- "id": "ff-flyway--implements--adr-document",
835
- "sourceId": "ff-flyway",
1150
+ "id": "ff-liquibase-mongo--implements--adr-document",
1151
+ "sourceId": "ff-liquibase-mongo",
836
1152
  "targetId": "adr-document",
837
1153
  "relationType": "implements"
838
1154
  },
839
- {
840
- "id": "ff-flyway--implements--adr-keyvalue",
841
- "sourceId": "ff-flyway",
842
- "targetId": "adr-keyvalue",
843
- "relationType": "implements"
844
- },
845
1155
  {
846
1156
  "id": "ff-orm-drift--implements--adr-relational",
847
1157
  "sourceId": "ff-orm-drift",
@@ -849,56 +1159,68 @@
849
1159
  "relationType": "implements"
850
1160
  },
851
1161
  {
852
- "id": "ff-orm-drift--implements--adr-document",
853
- "sourceId": "ff-orm-drift",
1162
+ "id": "ff-schema-versions--implements--adr-document",
1163
+ "sourceId": "ff-schema-versions",
854
1164
  "targetId": "adr-document",
855
1165
  "relationType": "implements"
856
1166
  },
857
1167
  {
858
- "id": "ff-orm-drift--implements--adr-keyvalue",
859
- "sourceId": "ff-orm-drift",
1168
+ "id": "ff-schema-versions-kv--implements--adr-keyvalue",
1169
+ "sourceId": "ff-schema-versions-kv",
860
1170
  "targetId": "adr-keyvalue",
861
1171
  "relationType": "implements"
862
1172
  },
863
1173
  {
864
- "id": "ff-schema-versions--implements--adr-relational",
865
- "sourceId": "ff-schema-versions",
1174
+ "id": "ff-seq-scan--implements--adr-relational",
1175
+ "sourceId": "ff-seq-scan",
866
1176
  "targetId": "adr-relational",
867
1177
  "relationType": "implements"
868
1178
  },
869
1179
  {
870
- "id": "ff-schema-versions--implements--adr-document",
871
- "sourceId": "ff-schema-versions",
1180
+ "id": "ff-collscan--implements--adr-document",
1181
+ "sourceId": "ff-collscan",
872
1182
  "targetId": "adr-document",
873
1183
  "relationType": "implements"
874
1184
  },
875
1185
  {
876
- "id": "ff-schema-versions--implements--adr-keyvalue",
877
- "sourceId": "ff-schema-versions",
1186
+ "id": "ff-integrity--implements--adr-relational",
1187
+ "sourceId": "ff-integrity",
1188
+ "targetId": "adr-relational",
1189
+ "relationType": "implements"
1190
+ },
1191
+ {
1192
+ "id": "ff-validators--implements--adr-document",
1193
+ "sourceId": "ff-validators",
1194
+ "targetId": "adr-document",
1195
+ "relationType": "implements"
1196
+ },
1197
+ {
1198
+ "id": "ff-no-scan--implements--adr-keyvalue",
1199
+ "sourceId": "ff-no-scan",
878
1200
  "targetId": "adr-keyvalue",
879
1201
  "relationType": "implements"
880
1202
  },
881
1203
  {
882
- "id": "ff-squawk--implements--adr-relational",
883
- "sourceId": "ff-squawk",
884
- "targetId": "adr-relational",
1204
+ "id": "ff-kv-latency--implements--adr-keyvalue",
1205
+ "sourceId": "ff-kv-latency",
1206
+ "targetId": "adr-keyvalue",
885
1207
  "relationType": "implements"
886
1208
  },
887
1209
  {
888
- "id": "ff-integrity--implements--adr-relational",
889
- "sourceId": "ff-integrity",
1210
+ "id": "ff-atomic--implements--adr-relational",
1211
+ "sourceId": "ff-atomic",
890
1212
  "targetId": "adr-relational",
891
1213
  "relationType": "implements"
892
1214
  },
893
1215
  {
894
- "id": "ff-validators--implements--adr-document",
895
- "sourceId": "ff-validators",
1216
+ "id": "ff-atomic--implements--adr-document",
1217
+ "sourceId": "ff-atomic",
896
1218
  "targetId": "adr-document",
897
1219
  "relationType": "implements"
898
1220
  },
899
1221
  {
900
- "id": "ff-no-scan--implements--adr-keyvalue",
901
- "sourceId": "ff-no-scan",
1222
+ "id": "ff-atomic--implements--adr-keyvalue",
1223
+ "sourceId": "ff-atomic",
902
1224
  "targetId": "adr-keyvalue",
903
1225
  "relationType": "implements"
904
1226
  },
@@ -909,14 +1231,14 @@
909
1231
  "relationType": "implements"
910
1232
  },
911
1233
  {
912
- "id": "ff-replica-lag--implements--adr-document",
913
- "sourceId": "ff-replica-lag",
1234
+ "id": "ff-replica-lag-document--implements--adr-document",
1235
+ "sourceId": "ff-replica-lag-document",
914
1236
  "targetId": "adr-document",
915
1237
  "relationType": "implements"
916
1238
  },
917
1239
  {
918
- "id": "ff-replica-lag--implements--adr-keyvalue",
919
- "sourceId": "ff-replica-lag",
1240
+ "id": "ff-replica-lag-kv--implements--adr-keyvalue",
1241
+ "sourceId": "ff-replica-lag-kv",
920
1242
  "targetId": "adr-keyvalue",
921
1243
  "relationType": "implements"
922
1244
  },
@@ -939,20 +1261,20 @@
939
1261
  "relationType": "implements"
940
1262
  },
941
1263
  {
942
- "id": "ff-engine-current--implements--adr-relational",
943
- "sourceId": "ff-engine-current",
1264
+ "id": "ff-engine-current-relational--implements--adr-relational",
1265
+ "sourceId": "ff-engine-current-relational",
944
1266
  "targetId": "adr-relational",
945
1267
  "relationType": "implements"
946
1268
  },
947
1269
  {
948
- "id": "ff-engine-current--implements--adr-document",
949
- "sourceId": "ff-engine-current",
1270
+ "id": "ff-engine-current-document--implements--adr-document",
1271
+ "sourceId": "ff-engine-current-document",
950
1272
  "targetId": "adr-document",
951
1273
  "relationType": "implements"
952
1274
  },
953
1275
  {
954
- "id": "ff-engine-current--implements--adr-keyvalue",
955
- "sourceId": "ff-engine-current",
1276
+ "id": "ff-engine-current-keyvalue--implements--adr-keyvalue",
1277
+ "sourceId": "ff-engine-current-keyvalue",
956
1278
  "targetId": "adr-keyvalue",
957
1279
  "relationType": "implements"
958
1280
  }