@radicaltools/mcp 0.1.1 → 0.3.0

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 (161) hide show
  1. package/README.md +52 -26
  2. package/dist/chunk-Z7THA3L5.js +3200 -0
  3. package/dist/elkLayout-TAUBPPVN.js +8 -0
  4. package/dist/hub-catalogue/concern/concern-api-evolution.radical +935 -0
  5. package/dist/hub-catalogue/concern/concern-architecture-style.radical +1112 -0
  6. package/dist/hub-catalogue/concern/concern-authentication.radical +685 -0
  7. package/dist/hub-catalogue/concern/concern-authorization.radical +1464 -0
  8. package/dist/hub-catalogue/concern/concern-availability.radical +804 -0
  9. package/dist/hub-catalogue/concern/concern-backend-stack.radical +1118 -0
  10. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1304 -0
  11. package/dist/hub-catalogue/concern/concern-capacity.radical +802 -0
  12. package/dist/hub-catalogue/concern/concern-communication-style.radical +1202 -0
  13. package/dist/hub-catalogue/concern/concern-data-consistency.radical +1081 -0
  14. package/dist/hub-catalogue/concern/concern-data-store.radical +960 -0
  15. package/dist/hub-catalogue/concern/concern-decomposition.radical +1143 -0
  16. package/dist/hub-catalogue/concern/concern-deployment.radical +952 -0
  17. package/dist/hub-catalogue/concern/concern-encryption.radical +1055 -0
  18. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1340 -0
  19. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1151 -0
  20. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1079 -0
  21. package/dist/hub-catalogue/concern/concern-messaging.radical +940 -0
  22. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +864 -0
  23. package/dist/hub-catalogue/concern/concern-observability.radical +1048 -0
  24. package/dist/hub-catalogue/concern/concern-personal-data.radical +1434 -0
  25. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1153 -0
  26. package/dist/hub-catalogue/concern/concern-secrets.radical +1026 -0
  27. package/dist/hub-catalogue/concern/concern-supply-chain.radical +1312 -0
  28. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1306 -0
  29. package/dist/hub-catalogue/concern/concern-test-strategy.radical +1193 -0
  30. package/dist/index.js +22690 -6064
  31. package/package.json +1 -1
  32. package/dist/chunk-KI4NVSTU.js +0 -1763
  33. package/dist/elkLayout-WC6AXWOG.js +0 -185
  34. package/dist/hub-catalogue/adr/adr-api-versioning.radical +0 -53
  35. package/dist/hub-catalogue/adr/adr-auth-strategy.radical +0 -53
  36. package/dist/hub-catalogue/adr/adr-caching-strategy.radical +0 -59
  37. package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +0 -40
  38. package/dist/hub-catalogue/adr/adr-data-store.radical +0 -47
  39. package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +0 -53
  40. package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +0 -53
  41. package/dist/hub-catalogue/adr/adr-integration-style.radical +0 -50
  42. package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +0 -38
  43. package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +0 -40
  44. package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +0 -39
  45. package/dist/hub-catalogue/adr/adr-multi-region.radical +0 -60
  46. package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +0 -41
  47. package/dist/hub-catalogue/adr/adr-observability.radical +0 -59
  48. package/dist/hub-catalogue/adr/adr-realtime-transport.radical +0 -38
  49. package/dist/hub-catalogue/adr/adr-tech-stack.radical +0 -45
  50. package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +0 -40
  51. package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +0 -1641
  52. package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +0 -1428
  53. package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +0 -1989
  54. package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +0 -1701
  55. package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +0 -1792
  56. package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +0 -1421
  57. package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +0 -1713
  58. package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +0 -34
  59. package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +0 -52
  60. package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +0 -36
  61. package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +0 -67
  62. package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +0 -62
  63. package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +0 -45
  64. package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +0 -53
  65. package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +0 -64
  66. package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +0 -45
  67. package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +0 -51
  68. package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +0 -43
  69. package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +0 -37
  70. package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +0 -46
  71. package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +0 -52
  72. package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +0 -53
  73. package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +0 -59
  74. package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +0 -34
  75. package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +0 -34
  76. package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +0 -59
  77. package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +0 -44
  78. package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +0 -45
  79. package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +0 -43
  80. package/dist/hub-catalogue/fitness-function/ff-mttr.radical +0 -45
  81. package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +0 -66
  82. package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +0 -35
  83. package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +0 -66
  84. package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +0 -45
  85. package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +0 -66
  86. package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +0 -45
  87. package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +0 -43
  88. package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +0 -57
  89. package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +0 -88
  90. package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +0 -168
  91. package/dist/hub-catalogue/pattern/pattern-bff.radical +0 -179
  92. package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +0 -114
  93. package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +0 -219
  94. package/dist/hub-catalogue/pattern/pattern-cqrs.radical +0 -195
  95. package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +0 -200
  96. package/dist/hub-catalogue/pattern/pattern-event-driven.radical +0 -210
  97. package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +0 -211
  98. package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +0 -196
  99. package/dist/hub-catalogue/pattern/pattern-microservices.radical +0 -262
  100. package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +0 -213
  101. package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +0 -114
  102. package/dist/hub-catalogue/pattern/pattern-saga.radical +0 -208
  103. package/dist/hub-catalogue/pattern/pattern-sidecar.radical +0 -123
  104. package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +0 -227
  105. package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +0 -209
  106. package/dist/hub-catalogue/requirement/req-accessibility.radical +0 -48
  107. package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +0 -51
  108. package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +0 -45
  109. package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +0 -46
  110. package/dist/hub-catalogue/requirement/req-alerting.radical +0 -52
  111. package/dist/hub-catalogue/requirement/req-api-response-time.radical +0 -51
  112. package/dist/hub-catalogue/requirement/req-api-standard.radical +0 -45
  113. package/dist/hub-catalogue/requirement/req-audit-logging.radical +0 -43
  114. package/dist/hub-catalogue/requirement/req-auth-response-time.radical +0 -45
  115. package/dist/hub-catalogue/requirement/req-auth.radical +0 -43
  116. package/dist/hub-catalogue/requirement/req-autoscaling.radical +0 -62
  117. package/dist/hub-catalogue/requirement/req-availability.radical +0 -50
  118. package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +0 -46
  119. package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +0 -50
  120. package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +0 -64
  121. package/dist/hub-catalogue/requirement/req-centralised-logging.radical +0 -45
  122. package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +0 -43
  123. package/dist/hub-catalogue/requirement/req-code-complexity.radical +0 -43
  124. package/dist/hub-catalogue/requirement/req-config-propagation.radical +0 -45
  125. package/dist/hub-catalogue/requirement/req-data-integrity.radical +0 -35
  126. package/dist/hub-catalogue/requirement/req-data-retention.radical +0 -44
  127. package/dist/hub-catalogue/requirement/req-db-query-response.radical +0 -44
  128. package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +0 -59
  129. package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +0 -45
  130. package/dist/hub-catalogue/requirement/req-encryption.radical +0 -49
  131. package/dist/hub-catalogue/requirement/req-error-rate.radical +0 -45
  132. package/dist/hub-catalogue/requirement/req-error-recovery.radical +0 -34
  133. package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +0 -37
  134. package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +0 -55
  135. package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +0 -69
  136. package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +0 -44
  137. package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +0 -39
  138. package/dist/hub-catalogue/requirement/req-health-checks.radical +0 -43
  139. package/dist/hub-catalogue/requirement/req-iac.radical +0 -36
  140. package/dist/hub-catalogue/requirement/req-idempotency.radical +0 -47
  141. package/dist/hub-catalogue/requirement/req-input-validation.radical +0 -37
  142. package/dist/hub-catalogue/requirement/req-least-privilege.radical +0 -47
  143. package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +0 -38
  144. package/dist/hub-catalogue/requirement/req-mfa.radical +0 -36
  145. package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +0 -42
  146. package/dist/hub-catalogue/requirement/req-onboarding-time.radical +0 -42
  147. package/dist/hub-catalogue/requirement/req-page-load-time.radical +0 -59
  148. package/dist/hub-catalogue/requirement/req-payout-latency.radical +0 -46
  149. package/dist/hub-catalogue/requirement/req-presence-latency.radical +0 -46
  150. package/dist/hub-catalogue/requirement/req-rate-limiting.radical +0 -45
  151. package/dist/hub-catalogue/requirement/req-report-generation.radical +0 -44
  152. package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +0 -64
  153. package/dist/hub-catalogue/requirement/req-resource-headroom.radical +0 -53
  154. package/dist/hub-catalogue/requirement/req-resource-isolation.radical +0 -37
  155. package/dist/hub-catalogue/requirement/req-search-response-time.radical +0 -44
  156. package/dist/hub-catalogue/requirement/req-secrets-management.radical +0 -45
  157. package/dist/hub-catalogue/requirement/req-task-success-rate.radical +0 -42
  158. package/dist/hub-catalogue/requirement/req-test-coverage.radical +0 -42
  159. package/dist/hub-catalogue/requirement/req-throughput.radical +0 -55
  160. package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +0 -52
  161. package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +0 -39
@@ -0,0 +1,960 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-data-store",
4
+ "category": "concern",
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.",
7
+ "tags": [
8
+ "technology",
9
+ "database",
10
+ "data store",
11
+ "postgresql",
12
+ "mongodb",
13
+ "dynamodb",
14
+ "schema migrations"
15
+ ],
16
+ "requiredMetamodel": "c4-ddd-governance-builtin",
17
+ "concern": {
18
+ "id": "data-store",
19
+ "trigger": "LIST NODES WHERE type = \"database\" AND external != true",
20
+ "why": "these elements keep the system's data, so the kind of store, the product, who runs it and how its schema changes have to be decided.",
21
+ "group": "technology"
22
+ },
23
+ "sources": [
24
+ {
25
+ "title": "Pramod Sadalage, Martin Fowler: Evolutionary Database Design",
26
+ "url": "https://martinfowler.com/articles/evodb.html"
27
+ },
28
+ {
29
+ "title": "Martin Fowler: PolyglotPersistence",
30
+ "url": "https://martinfowler.com/bliki/PolyglotPersistence.html"
31
+ },
32
+ {
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"
39
+ },
40
+ {
41
+ "title": "endoflife.date: database support lifecycles",
42
+ "url": "https://endoflife.date/"
43
+ },
44
+ {
45
+ "title": "Amazon DynamoDB best practices",
46
+ "url": "https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/best-practices.html"
47
+ },
48
+ {
49
+ "title": "MongoDB schema validation",
50
+ "url": "https://www.mongodb.com/docs/manual/core/schema-validation/"
51
+ },
52
+ {
53
+ "title": "Squawk, a linter for PostgreSQL migrations",
54
+ "url": "https://github.com/sbdchd/squawk"
55
+ }
56
+ ],
57
+ "templateParams": [
58
+ {
59
+ "key": "MODEL",
60
+ "title": "Data model",
61
+ "label": "What kind of store keeps the data?",
62
+ "hint": "The data model decides which queries are easy, which are expensive and which are impossible. Choose by how the data is read and changed, not by fashion.",
63
+ "defaultValue": "relational",
64
+ "options": [
65
+ {
66
+ "value": "relational",
67
+ "label": "a relational database (PostgreSQL or MySQL)",
68
+ "description": "Tables, joins, constraints and transactions across rows. Pick it by default, and whenever the data is related, queried in ways not all known up front (reports, search, back office), or must stay consistent across entities."
69
+ },
70
+ {
71
+ "value": "document",
72
+ "label": "a document database (MongoDB)",
73
+ "description": "Each aggregate is one JSON document read and written whole. Pick it when the data is naturally a tree read by id, its shape varies between records, and queries across documents are few and known."
74
+ },
75
+ {
76
+ "value": "keyvalue",
77
+ "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."
79
+ }
80
+ ]
81
+ },
82
+ {
83
+ "key": "CONSISTENCY",
84
+ "title": "Consistency",
85
+ "label": "How consistent must reads be?",
86
+ "hint": "Strong consistency is simplest to program against; eventual consistency buys scale, availability and replicas in other regions at the cost of reading old data for a while.",
87
+ "defaultValue": "strong",
88
+ "options": [
89
+ {
90
+ "value": "strong",
91
+ "label": "strong, with transactions",
92
+ "description": "A read sees every committed write, and a business operation commits all of its changes or none. Pick it when money, stock or anything counted is involved, or users must see their own changes at once."
93
+ },
94
+ {
95
+ "value": "eventual",
96
+ "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."
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "key": "HOSTING",
103
+ "title": "Hosting",
104
+ "label": "Who runs the store?",
105
+ "hint": "Running a database well means patching, failover, backups, monitoring and tuning, at any hour.",
106
+ "defaultValue": "managed",
107
+ "options": [
108
+ {
109
+ "value": "managed",
110
+ "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."
112
+ },
113
+ {
114
+ "value": "self",
115
+ "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."
117
+ }
118
+ ]
119
+ },
120
+ {
121
+ "key": "MIGRATIONS",
122
+ "title": "Schema changes",
123
+ "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.",
125
+ "defaultValue": "tool",
126
+ "options": [
127
+ {
128
+ "value": "tool",
129
+ "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."
131
+ },
132
+ {
133
+ "value": "orm",
134
+ "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."
136
+ },
137
+ {
138
+ "value": "lazy",
139
+ "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."
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "key": "STALE_SECONDS",
146
+ "label": "How old may a read be when consistency is eventual (seconds)?",
147
+ "defaultValue": "5",
148
+ "type": "number"
149
+ },
150
+ {
151
+ "key": "P99_MS",
152
+ "label": "What 99th-percentile latency must key lookups meet (ms)?",
153
+ "defaultValue": "20",
154
+ "type": "number"
155
+ }
156
+ ]
157
+ },
158
+ "nodes": [
159
+ {
160
+ "id": "need",
161
+ "type": "need",
162
+ "label": "Data kept in the right store",
163
+ "x": 0,
164
+ "y": 0,
165
+ "kind": "brief",
166
+ "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."
168
+ },
169
+ {
170
+ "id": "req-access-patterns",
171
+ "type": "requirement",
172
+ "label": "Queries designed, not scanned",
173
+ "x": 260,
174
+ "y": 0,
175
+ "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)."
178
+ },
179
+ {
180
+ "id": "req-expand-contract",
181
+ "type": "requirement",
182
+ "label": "Schema changes without downtime",
183
+ "x": 260,
184
+ "y": 130,
185
+ "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)."
188
+ },
189
+ {
190
+ "id": "req-versioned",
191
+ "type": "requirement",
192
+ "label": "Migrations are versioned",
193
+ "x": 260,
194
+ "y": 260,
195
+ "ears_type": "event-driven",
196
+ "trigger": "a change needs a different schema, index or reference data",
197
+ "action": "apply it as a versioned migration committed with the code and run by the deploy pipeline with {{MIGRATIONS}}, with 0 schema changes made by hand in any shared environment",
198
+ "rationale": "A schema 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).",
199
+ "hubWhen": {
200
+ "MIGRATIONS": [
201
+ "tool",
202
+ "orm"
203
+ ]
204
+ }
205
+ },
206
+ {
207
+ "id": "req-lazy",
208
+ "type": "requirement",
209
+ "label": "Old records upgraded",
210
+ "x": 260,
211
+ "y": 390,
212
+ "ears_type": "event-driven",
213
+ "trigger": "a record written under an older schema version is read",
214
+ "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).",
216
+ "hubWhen": {
217
+ "MIGRATIONS": [
218
+ "lazy"
219
+ ]
220
+ }
221
+ },
222
+ {
223
+ "id": "req-integrity",
224
+ "type": "requirement",
225
+ "label": "Integrity enforced by the database",
226
+ "x": 260,
227
+ "y": 520,
228
+ "ears_type": "ubiquitous",
229
+ "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).",
231
+ "hubWhen": {
232
+ "MODEL": [
233
+ "relational"
234
+ ]
235
+ }
236
+ },
237
+ {
238
+ "id": "req-documents",
239
+ "type": "requirement",
240
+ "label": "Documents validated and bounded",
241
+ "x": 260,
242
+ "y": 650,
243
+ "ears_type": "ubiquitous",
244
+ "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
+ "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).",
246
+ "hubWhen": {
247
+ "MODEL": [
248
+ "document"
249
+ ]
250
+ }
251
+ },
252
+ {
253
+ "id": "req-kv-latency",
254
+ "type": "requirement",
255
+ "label": "Key lookups are fast",
256
+ "x": 260,
257
+ "y": 780,
258
+ "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",
260
+ "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
+ "hubWhen": {
262
+ "MODEL": [
263
+ "keyvalue"
264
+ ]
265
+ }
266
+ },
267
+ {
268
+ "id": "req-transactions",
269
+ "type": "requirement",
270
+ "label": "Operations commit whole",
271
+ "x": 260,
272
+ "y": 910,
273
+ "ears_type": "event-driven",
274
+ "trigger": "a business operation changes several records",
275
+ "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).",
277
+ "hubWhen": {
278
+ "CONSISTENCY": [
279
+ "strong"
280
+ ]
281
+ }
282
+ },
283
+ {
284
+ "id": "req-staleness",
285
+ "type": "requirement",
286
+ "label": "Staleness is bounded",
287
+ "x": 260,
288
+ "y": 1040,
289
+ "ears_type": "state-driven",
290
+ "precondition": "replicas or secondary indexes lag behind the primary",
291
+ "action": "serve reads at most {{STALE_SECONDS}} seconds old, and read from the primary wherever a user must see their own write",
292
+ "rationale": "Eventual consistency is acceptable only with a known bound and with read-your-writes where users notice (Kleppmann, Designing Data-Intensive Applications, ch. 5: replication lag).",
293
+ "hubWhen": {
294
+ "CONSISTENCY": [
295
+ "eventual"
296
+ ]
297
+ }
298
+ },
299
+ {
300
+ "id": "req-exit",
301
+ "type": "requirement",
302
+ "label": "Data can leave the provider",
303
+ "x": 260,
304
+ "y": 1170,
305
+ "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).",
308
+ "hubWhen": {
309
+ "HOSTING": [
310
+ "managed"
311
+ ]
312
+ }
313
+ },
314
+ {
315
+ "id": "req-engine-patch",
316
+ "type": "requirement",
317
+ "label": "Engine patched on time",
318
+ "x": 260,
319
+ "y": 1300,
320
+ "ears_type": "event-driven",
321
+ "trigger": "a minor or security release of the database engine is published",
322
+ "action": "apply it within 30 days by a rolling upgrade with automatic failover, keeping writes unavailable for under 30 seconds",
323
+ "rationale": "Self-hosting makes patching our job; minor releases carry security and data-corruption fixes, and the engine's support lifecycle ends on published dates (PostgreSQL versioning policy; endoflife.date).",
324
+ "hubWhen": {
325
+ "HOSTING": [
326
+ "self"
327
+ ]
328
+ }
329
+ },
330
+ {
331
+ "id": "sc-access-patterns",
332
+ "type": "scenario",
333
+ "label": "No scan on request path",
334
+ "x": 520,
335
+ "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"
339
+ },
340
+ {
341
+ "id": "sc-expand-contract",
342
+ "type": "scenario",
343
+ "label": "Old code survives migration",
344
+ "x": 520,
345
+ "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"
349
+ },
350
+ {
351
+ "id": "sc-versioned",
352
+ "type": "scenario",
353
+ "label": "Migration applied by pipeline",
354
+ "x": 520,
355
+ "y": 260,
356
+ "given": "a change that adds a column",
357
+ "when": "it is deployed to each environment in turn",
358
+ "then": "the same versioned migration is applied by the pipeline everywhere, and the migration history matches in every environment",
359
+ "hubWhen": {
360
+ "MIGRATIONS": [
361
+ "tool",
362
+ "orm"
363
+ ]
364
+ }
365
+ },
366
+ {
367
+ "id": "sc-lazy",
368
+ "type": "scenario",
369
+ "label": "Old record read",
370
+ "x": 520,
371
+ "y": 390,
372
+ "given": "a record at schema version N-1",
373
+ "when": "the element reads it and later saves it",
374
+ "then": "it is used as version N and stored as version N",
375
+ "hubWhen": {
376
+ "MIGRATIONS": [
377
+ "lazy"
378
+ ]
379
+ }
380
+ },
381
+ {
382
+ "id": "sc-integrity",
383
+ "type": "scenario",
384
+ "label": "Dangling reference refused",
385
+ "x": 520,
386
+ "y": 520,
387
+ "given": "an order line that references an order",
388
+ "when": "a line is inserted for an order that does not exist",
389
+ "then": "the database refuses the insert",
390
+ "hubWhen": {
391
+ "MODEL": [
392
+ "relational"
393
+ ]
394
+ }
395
+ },
396
+ {
397
+ "id": "sc-documents",
398
+ "type": "scenario",
399
+ "label": "Invalid document refused",
400
+ "x": 520,
401
+ "y": 650,
402
+ "given": "a collection with its JSON Schema validator",
403
+ "when": "a document missing a required field is inserted",
404
+ "then": "the database refuses the write",
405
+ "hubWhen": {
406
+ "MODEL": [
407
+ "document"
408
+ ]
409
+ }
410
+ },
411
+ {
412
+ "id": "sc-kv-latency",
413
+ "type": "scenario",
414
+ "label": "Lookups within target",
415
+ "x": 520,
416
+ "y": 780,
417
+ "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",
420
+ "hubWhen": {
421
+ "MODEL": [
422
+ "keyvalue"
423
+ ]
424
+ }
425
+ },
426
+ {
427
+ "id": "sc-transactions",
428
+ "type": "scenario",
429
+ "label": "Failure leaves nothing",
430
+ "x": 520,
431
+ "y": 910,
432
+ "given": "an operation that writes three records",
433
+ "when": "it fails after the second write",
434
+ "then": "none of the three records is changed and no reader saw the first two",
435
+ "hubWhen": {
436
+ "CONSISTENCY": [
437
+ "strong"
438
+ ]
439
+ }
440
+ },
441
+ {
442
+ "id": "sc-staleness",
443
+ "type": "scenario",
444
+ "label": "Own write visible",
445
+ "x": 520,
446
+ "y": 1040,
447
+ "given": "a user who has just changed a record",
448
+ "when": "the user reads it again while replicas lag",
449
+ "then": "the user sees the change, and other readers see it within {{STALE_SECONDS}} seconds",
450
+ "hubWhen": {
451
+ "CONSISTENCY": [
452
+ "eventual"
453
+ ]
454
+ }
455
+ },
456
+ {
457
+ "id": "sc-exit",
458
+ "type": "scenario",
459
+ "label": "Export loads elsewhere",
460
+ "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",
465
+ "hubWhen": {
466
+ "HOSTING": [
467
+ "managed"
468
+ ]
469
+ }
470
+ },
471
+ {
472
+ "id": "sc-engine-patch",
473
+ "type": "scenario",
474
+ "label": "Minor release applied",
475
+ "x": 520,
476
+ "y": 1300,
477
+ "given": "a new minor release of the engine",
478
+ "when": "30 days have passed",
479
+ "then": "every node runs it, and the failover during the upgrade kept writes unavailable for under 30 seconds",
480
+ "hubWhen": {
481
+ "HOSTING": [
482
+ "self"
483
+ ]
484
+ }
485
+ },
486
+ {
487
+ "id": "adr-relational",
488
+ "type": "adr",
489
+ "label": "A relational database",
490
+ "x": 780,
491
+ "y": 0,
492
+ "concern": "data-store",
493
+ "status": "accepted",
494
+ "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.",
498
+ "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
+ "hubWhen": {
500
+ "MODEL": [
501
+ "relational"
502
+ ]
503
+ }
504
+ },
505
+ {
506
+ "id": "adr-document",
507
+ "type": "adr",
508
+ "label": "A document database",
509
+ "x": 780,
510
+ "y": 130,
511
+ "concern": "data-store",
512
+ "status": "accepted",
513
+ "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.",
516
+ "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
+ "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
+ "hubWhen": {
519
+ "MODEL": [
520
+ "document"
521
+ ]
522
+ }
523
+ },
524
+ {
525
+ "id": "adr-keyvalue",
526
+ "type": "adr",
527
+ "label": "A key-value store",
528
+ "x": 780,
529
+ "y": 260,
530
+ "concern": "data-store",
531
+ "status": "accepted",
532
+ "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.",
535
+ "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
+ "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
+ "hubWhen": {
538
+ "MODEL": [
539
+ "keyvalue"
540
+ ]
541
+ }
542
+ },
543
+ {
544
+ "id": "ff-flyway",
545
+ "type": "fitness-fn",
546
+ "label": "Migrations apply cleanly",
547
+ "x": 1040,
548
+ "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```",
552
+ "hubWhen": {
553
+ "MIGRATIONS": [
554
+ "tool"
555
+ ]
556
+ }
557
+ },
558
+ {
559
+ "id": "ff-orm-drift",
560
+ "type": "fitness-fn",
561
+ "label": "Model and migrations agree",
562
+ "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```",
567
+ "hubWhen": {
568
+ "MIGRATIONS": [
569
+ "orm"
570
+ ]
571
+ }
572
+ },
573
+ {
574
+ "id": "ff-schema-versions",
575
+ "type": "fitness-fn",
576
+ "label": "No record far behind",
577
+ "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```",
582
+ "hubWhen": {
583
+ "MIGRATIONS": [
584
+ "lazy"
585
+ ]
586
+ }
587
+ },
588
+ {
589
+ "id": "ff-squawk",
590
+ "type": "fitness-fn",
591
+ "label": "Migrations safe to deploy",
592
+ "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```",
597
+ "hubWhen": {
598
+ "MODEL": [
599
+ "relational"
600
+ ]
601
+ }
602
+ },
603
+ {
604
+ "id": "ff-integrity",
605
+ "type": "fitness-fn",
606
+ "label": "Keys and foreign keys present",
607
+ "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```",
612
+ "hubWhen": {
613
+ "MODEL": [
614
+ "relational"
615
+ ]
616
+ }
617
+ },
618
+ {
619
+ "id": "ff-validators",
620
+ "type": "fitness-fn",
621
+ "label": "Collections validate writes",
622
+ "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```",
627
+ "hubWhen": {
628
+ "MODEL": [
629
+ "document"
630
+ ]
631
+ }
632
+ },
633
+ {
634
+ "id": "ff-no-scan",
635
+ "type": "fitness-fn",
636
+ "label": "No Scan in request code",
637
+ "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```",
642
+ "hubWhen": {
643
+ "MODEL": [
644
+ "keyvalue"
645
+ ]
646
+ }
647
+ },
648
+ {
649
+ "id": "ff-replica-lag",
650
+ "type": "fitness-fn",
651
+ "label": "Replica lag within bound",
652
+ "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```",
657
+ "hubWhen": {
658
+ "CONSISTENCY": [
659
+ "eventual"
660
+ ]
661
+ }
662
+ },
663
+ {
664
+ "id": "ff-export",
665
+ "type": "fitness-fn",
666
+ "label": "Export is fresh",
667
+ "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```",
672
+ "hubWhen": {
673
+ "HOSTING": [
674
+ "managed"
675
+ ]
676
+ }
677
+ },
678
+ {
679
+ "id": "ff-engine-current",
680
+ "type": "fitness-fn",
681
+ "label": "Engine on latest minor",
682
+ "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```",
687
+ "hubWhen": {
688
+ "HOSTING": [
689
+ "self"
690
+ ]
691
+ }
692
+ }
693
+ ],
694
+ "relations": [
695
+ {
696
+ "id": "req-access-patterns--derives--need",
697
+ "sourceId": "req-access-patterns",
698
+ "targetId": "need",
699
+ "relationType": "derives"
700
+ },
701
+ {
702
+ "id": "req-expand-contract--derives--need",
703
+ "sourceId": "req-expand-contract",
704
+ "targetId": "need",
705
+ "relationType": "derives"
706
+ },
707
+ {
708
+ "id": "req-versioned--derives--need",
709
+ "sourceId": "req-versioned",
710
+ "targetId": "need",
711
+ "relationType": "derives"
712
+ },
713
+ {
714
+ "id": "req-lazy--derives--need",
715
+ "sourceId": "req-lazy",
716
+ "targetId": "need",
717
+ "relationType": "derives"
718
+ },
719
+ {
720
+ "id": "req-integrity--derives--need",
721
+ "sourceId": "req-integrity",
722
+ "targetId": "need",
723
+ "relationType": "derives"
724
+ },
725
+ {
726
+ "id": "req-documents--derives--need",
727
+ "sourceId": "req-documents",
728
+ "targetId": "need",
729
+ "relationType": "derives"
730
+ },
731
+ {
732
+ "id": "req-kv-latency--derives--need",
733
+ "sourceId": "req-kv-latency",
734
+ "targetId": "need",
735
+ "relationType": "derives"
736
+ },
737
+ {
738
+ "id": "req-transactions--derives--need",
739
+ "sourceId": "req-transactions",
740
+ "targetId": "need",
741
+ "relationType": "derives"
742
+ },
743
+ {
744
+ "id": "req-staleness--derives--need",
745
+ "sourceId": "req-staleness",
746
+ "targetId": "need",
747
+ "relationType": "derives"
748
+ },
749
+ {
750
+ "id": "req-exit--derives--need",
751
+ "sourceId": "req-exit",
752
+ "targetId": "need",
753
+ "relationType": "derives"
754
+ },
755
+ {
756
+ "id": "req-engine-patch--derives--need",
757
+ "sourceId": "req-engine-patch",
758
+ "targetId": "need",
759
+ "relationType": "derives"
760
+ },
761
+ {
762
+ "id": "sc-access-patterns--verifies--req-access-patterns",
763
+ "sourceId": "sc-access-patterns",
764
+ "targetId": "req-access-patterns",
765
+ "relationType": "verifies"
766
+ },
767
+ {
768
+ "id": "sc-expand-contract--verifies--req-expand-contract",
769
+ "sourceId": "sc-expand-contract",
770
+ "targetId": "req-expand-contract",
771
+ "relationType": "verifies"
772
+ },
773
+ {
774
+ "id": "sc-versioned--verifies--req-versioned",
775
+ "sourceId": "sc-versioned",
776
+ "targetId": "req-versioned",
777
+ "relationType": "verifies"
778
+ },
779
+ {
780
+ "id": "sc-lazy--verifies--req-lazy",
781
+ "sourceId": "sc-lazy",
782
+ "targetId": "req-lazy",
783
+ "relationType": "verifies"
784
+ },
785
+ {
786
+ "id": "sc-integrity--verifies--req-integrity",
787
+ "sourceId": "sc-integrity",
788
+ "targetId": "req-integrity",
789
+ "relationType": "verifies"
790
+ },
791
+ {
792
+ "id": "sc-documents--verifies--req-documents",
793
+ "sourceId": "sc-documents",
794
+ "targetId": "req-documents",
795
+ "relationType": "verifies"
796
+ },
797
+ {
798
+ "id": "sc-kv-latency--verifies--req-kv-latency",
799
+ "sourceId": "sc-kv-latency",
800
+ "targetId": "req-kv-latency",
801
+ "relationType": "verifies"
802
+ },
803
+ {
804
+ "id": "sc-transactions--verifies--req-transactions",
805
+ "sourceId": "sc-transactions",
806
+ "targetId": "req-transactions",
807
+ "relationType": "verifies"
808
+ },
809
+ {
810
+ "id": "sc-staleness--verifies--req-staleness",
811
+ "sourceId": "sc-staleness",
812
+ "targetId": "req-staleness",
813
+ "relationType": "verifies"
814
+ },
815
+ {
816
+ "id": "sc-exit--verifies--req-exit",
817
+ "sourceId": "sc-exit",
818
+ "targetId": "req-exit",
819
+ "relationType": "verifies"
820
+ },
821
+ {
822
+ "id": "sc-engine-patch--verifies--req-engine-patch",
823
+ "sourceId": "sc-engine-patch",
824
+ "targetId": "req-engine-patch",
825
+ "relationType": "verifies"
826
+ },
827
+ {
828
+ "id": "ff-flyway--implements--adr-relational",
829
+ "sourceId": "ff-flyway",
830
+ "targetId": "adr-relational",
831
+ "relationType": "implements"
832
+ },
833
+ {
834
+ "id": "ff-flyway--implements--adr-document",
835
+ "sourceId": "ff-flyway",
836
+ "targetId": "adr-document",
837
+ "relationType": "implements"
838
+ },
839
+ {
840
+ "id": "ff-flyway--implements--adr-keyvalue",
841
+ "sourceId": "ff-flyway",
842
+ "targetId": "adr-keyvalue",
843
+ "relationType": "implements"
844
+ },
845
+ {
846
+ "id": "ff-orm-drift--implements--adr-relational",
847
+ "sourceId": "ff-orm-drift",
848
+ "targetId": "adr-relational",
849
+ "relationType": "implements"
850
+ },
851
+ {
852
+ "id": "ff-orm-drift--implements--adr-document",
853
+ "sourceId": "ff-orm-drift",
854
+ "targetId": "adr-document",
855
+ "relationType": "implements"
856
+ },
857
+ {
858
+ "id": "ff-orm-drift--implements--adr-keyvalue",
859
+ "sourceId": "ff-orm-drift",
860
+ "targetId": "adr-keyvalue",
861
+ "relationType": "implements"
862
+ },
863
+ {
864
+ "id": "ff-schema-versions--implements--adr-relational",
865
+ "sourceId": "ff-schema-versions",
866
+ "targetId": "adr-relational",
867
+ "relationType": "implements"
868
+ },
869
+ {
870
+ "id": "ff-schema-versions--implements--adr-document",
871
+ "sourceId": "ff-schema-versions",
872
+ "targetId": "adr-document",
873
+ "relationType": "implements"
874
+ },
875
+ {
876
+ "id": "ff-schema-versions--implements--adr-keyvalue",
877
+ "sourceId": "ff-schema-versions",
878
+ "targetId": "adr-keyvalue",
879
+ "relationType": "implements"
880
+ },
881
+ {
882
+ "id": "ff-squawk--implements--adr-relational",
883
+ "sourceId": "ff-squawk",
884
+ "targetId": "adr-relational",
885
+ "relationType": "implements"
886
+ },
887
+ {
888
+ "id": "ff-integrity--implements--adr-relational",
889
+ "sourceId": "ff-integrity",
890
+ "targetId": "adr-relational",
891
+ "relationType": "implements"
892
+ },
893
+ {
894
+ "id": "ff-validators--implements--adr-document",
895
+ "sourceId": "ff-validators",
896
+ "targetId": "adr-document",
897
+ "relationType": "implements"
898
+ },
899
+ {
900
+ "id": "ff-no-scan--implements--adr-keyvalue",
901
+ "sourceId": "ff-no-scan",
902
+ "targetId": "adr-keyvalue",
903
+ "relationType": "implements"
904
+ },
905
+ {
906
+ "id": "ff-replica-lag--implements--adr-relational",
907
+ "sourceId": "ff-replica-lag",
908
+ "targetId": "adr-relational",
909
+ "relationType": "implements"
910
+ },
911
+ {
912
+ "id": "ff-replica-lag--implements--adr-document",
913
+ "sourceId": "ff-replica-lag",
914
+ "targetId": "adr-document",
915
+ "relationType": "implements"
916
+ },
917
+ {
918
+ "id": "ff-replica-lag--implements--adr-keyvalue",
919
+ "sourceId": "ff-replica-lag",
920
+ "targetId": "adr-keyvalue",
921
+ "relationType": "implements"
922
+ },
923
+ {
924
+ "id": "ff-export--implements--adr-relational",
925
+ "sourceId": "ff-export",
926
+ "targetId": "adr-relational",
927
+ "relationType": "implements"
928
+ },
929
+ {
930
+ "id": "ff-export--implements--adr-document",
931
+ "sourceId": "ff-export",
932
+ "targetId": "adr-document",
933
+ "relationType": "implements"
934
+ },
935
+ {
936
+ "id": "ff-export--implements--adr-keyvalue",
937
+ "sourceId": "ff-export",
938
+ "targetId": "adr-keyvalue",
939
+ "relationType": "implements"
940
+ },
941
+ {
942
+ "id": "ff-engine-current--implements--adr-relational",
943
+ "sourceId": "ff-engine-current",
944
+ "targetId": "adr-relational",
945
+ "relationType": "implements"
946
+ },
947
+ {
948
+ "id": "ff-engine-current--implements--adr-document",
949
+ "sourceId": "ff-engine-current",
950
+ "targetId": "adr-document",
951
+ "relationType": "implements"
952
+ },
953
+ {
954
+ "id": "ff-engine-current--implements--adr-keyvalue",
955
+ "sourceId": "ff-engine-current",
956
+ "targetId": "adr-keyvalue",
957
+ "relationType": "implements"
958
+ }
959
+ ]
960
+ }