@radicaltools/mcp 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-Z7THA3L5.js → chunk-2SZDTOYJ.js} +65 -33
- package/dist/{elkLayout-TAUBPPVN.js → elkLayout-VYJDCCIT.js} +1 -1
- package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
- package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
- package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
- package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
- package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
- package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
- package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
- package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
- package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
- package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
- package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
- package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
- package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
- package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
- package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
- package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
- package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
- package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
- package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
- package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
- package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
- package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
- package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
- package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
- package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
- package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
- package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
- package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
- package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
- package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
- package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
- package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
- package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
- package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
- package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
- package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
- package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
- package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
- package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
- package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
- package/dist/index.js +1001 -230
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "concern-communication-style",
|
|
4
4
|
"category": "concern",
|
|
5
5
|
"name": "Communication style",
|
|
6
|
-
"description": "How the system's own parts talk to each other: synchronous calls, commands over queues, published events or streams; when to deviate from the default, how deep a chain of calls may go, how contracts are written and checked, and who coordinates a flow across parts.",
|
|
6
|
+
"description": "How the system's own parts talk to each other: synchronous calls, commands over queues, published events or streams; when to deviate from the default, how deep a chain of calls may go, how contracts between the parts are written and checked, and who coordinates a flow across parts. The snippets are TypeScript (Vitest, pact-js, Temporal's TypeScript SDK) with Spectral, Buf, oasdiff, Conftest and Prometheus; each tool line names the JVM equivalent.",
|
|
7
7
|
"tags": [
|
|
8
8
|
"architecture",
|
|
9
9
|
"communication",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"title": "microservices.io, Saga (choreography and orchestration)",
|
|
43
43
|
"url": "https://microservices.io/patterns/data/saga.html"
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
"title": "microservices.io, Service Integration Contract Test",
|
|
47
|
+
"url": "https://microservices.io/patterns/testing/service-integration-contract-test.html"
|
|
48
|
+
},
|
|
45
49
|
{
|
|
46
50
|
"title": "Enterprise Integration Patterns",
|
|
47
51
|
"url": "https://www.enterpriseintegrationpatterns.com/"
|
|
@@ -61,6 +65,10 @@
|
|
|
61
65
|
{
|
|
62
66
|
"title": "Sam Newman: Building Microservices, 2nd ed. (O'Reilly)",
|
|
63
67
|
"url": "https://www.oreilly.com/library/view/building-microservices-2nd/9781492034018/"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"title": "Ford, Parsons, Kua, Sadalage: Building Evolutionary Architectures, 2nd ed. (fitness functions)",
|
|
71
|
+
"url": "https://www.oreilly.com/library/view/building-evolutionary-architectures/9781492097532/"
|
|
64
72
|
}
|
|
65
73
|
],
|
|
66
74
|
"templateParams": [
|
|
@@ -74,12 +82,12 @@
|
|
|
74
82
|
{
|
|
75
83
|
"value": "sync",
|
|
76
84
|
"label": "synchronous request and response",
|
|
77
|
-
"description": "A part calls another and waits for the answer. Pick it for a modular monolith or a few services, when most interactions are queries that need an answer now, and every part on a chain has the availability the caller needs."
|
|
85
|
+
"description": "A part calls another and waits for the answer. Pick it for a modular monolith or a few services, when most interactions are queries that need an answer now, and every part on a chain has the availability the caller needs. Flows across parts are then orchestrated or kept local; choreography needs published events."
|
|
78
86
|
},
|
|
79
87
|
{
|
|
80
88
|
"value": "commands",
|
|
81
89
|
"label": "commands over queues",
|
|
82
|
-
"description": "A part asks another to do something by sending a command to the receiver's queue and learns the outcome from a reply later; queries stay synchronous. Pick it when work takes longer than a user should wait (documents, payments, provisioning), the receiver may be down for a while, or load comes in bursts."
|
|
90
|
+
"description": "A part asks another to do something by sending a command to the receiver's queue and learns the outcome from a reply later; queries stay synchronous. Pick it when work takes longer than a user should wait (documents, payments, provisioning), the receiver may be down for a while, or load comes in bursts. Flows across parts are then orchestrated or kept local; choreography needs published events."
|
|
83
91
|
},
|
|
84
92
|
{
|
|
85
93
|
"value": "events",
|
|
@@ -116,7 +124,7 @@
|
|
|
116
124
|
"key": "FLOWS",
|
|
117
125
|
"title": "Multi-step flows",
|
|
118
126
|
"label": "Who coordinates a business flow that spans several parts?",
|
|
119
|
-
"hint": "Placing an order may reserve stock, take payment and book shipping in three parts. Someone has to know the steps, and what to undo when one fails (all-or-nothing semantics are the Data consistency pack).",
|
|
127
|
+
"hint": "Placing an order may reserve stock, take payment and book shipping in three parts. Someone has to know the steps, and what to undo when one fails (all-or-nothing semantics are the Data consistency pack). Choreography is available only with published events or streams as the default; with synchronous calls or commands it falls back to an orchestrator.",
|
|
120
128
|
"defaultValue": "orchestration",
|
|
121
129
|
"options": [
|
|
122
130
|
{
|
|
@@ -127,7 +135,7 @@
|
|
|
127
135
|
{
|
|
128
136
|
"value": "choreography",
|
|
129
137
|
"label": "parts react to each other's events",
|
|
130
|
-
"description": "No coordinator: each part reacts to events of others and publishes its own. Pick it for short flows (up to three steps) where each reaction belongs to a different team
|
|
138
|
+
"description": "No coordinator: each part reacts to events of others and publishes its own. Pick it for short flows (up to three steps) where each reaction belongs to a different team; longer flows become hard to follow. Only with published events or event streams as the default: with synchronous calls or commands nothing is published to react to, and flows are orchestrated instead."
|
|
131
139
|
},
|
|
132
140
|
{
|
|
133
141
|
"value": "local",
|
|
@@ -140,7 +148,7 @@
|
|
|
140
148
|
"key": "CONTRACTS",
|
|
141
149
|
"title": "Contracts",
|
|
142
150
|
"label": "How is it checked that a change does not break another part?",
|
|
143
|
-
"hint": "Parts are released apart, so every call and message is a contract. A diff of the contract finds a break in the document; consumer-driven tests find a break in what consumers really use.",
|
|
151
|
+
"hint": "Parts are released apart, so every call and message between them is a contract. A diff of the contract finds a break in the document; consumer-driven tests find a break in what consumers really use. Contracts with callers outside the system are decided in the API evolution pack.",
|
|
144
152
|
"defaultValue": "pact",
|
|
145
153
|
"options": [
|
|
146
154
|
{
|
|
@@ -196,7 +204,7 @@
|
|
|
196
204
|
"y": 0,
|
|
197
205
|
"kind": "brief",
|
|
198
206
|
"source": "Hub concern pack: Communication style",
|
|
199
|
-
"description": "The system's parts depend on each other for data and for work. When one is slow or down, the others should degrade in a known way instead of stalling in a chain of waiting calls; when one changes, the others should not break; and when a business flow runs across several parts, someone should be able to tell where it stands and what happens when a step fails. That needs a default way of talking, known exceptions, contracts for every interaction, and limits that the build and the monitoring check."
|
|
207
|
+
"description": "The system's parts depend on each other for data and for work. When one is slow or down, the others should degrade in a known way instead of stalling in a chain of waiting calls; when one changes, the others should not break; and when a business flow runs across several parts, someone should be able to tell where it stands and what happens when a step fails. That needs a default way of talking, known exceptions, contracts for every interaction, and limits that the build and the monitoring check. The checks below share one layout: each part lives in services/<name> with its contract in services/<name>/openapi.yaml, services/<name>/asyncapi.yaml or proto/; the parts started for the end-to-end suite export their traces over OTLP (port 4318) to a Jaeger container whose query API (port 16686) the tests read through test/e2e/traces.ts; Kafka topics are declared as Strimzi KafkaTopic manifests in platform/kafka/topics/, RabbitMQ queues in platform/rabbitmq/definitions.json, and the topics and queues of a managed broker (Amazon SNS and SQS, Google Pub/Sub, Azure Service Bus, Confluent Cloud) in Terraform under infra/."
|
|
200
208
|
},
|
|
201
209
|
{
|
|
202
210
|
"id": "req-default",
|
|
@@ -206,7 +214,8 @@
|
|
|
206
214
|
"y": 0,
|
|
207
215
|
"ears_type": "ubiquitous",
|
|
208
216
|
"action": "use {{DEFAULT}} for every interaction between the system's own parts and record each exception in an ADR with its reason, with 0 interactions in the model that are neither the default nor a recorded exception",
|
|
209
|
-
"rationale": "Mixing styles case by case makes failure behaviour unpredictable; a default with recorded exceptions keeps it decidable (Newman, Building Microservices, ch. 4)."
|
|
217
|
+
"rationale": "Mixing styles case by case makes failure behaviour unpredictable; a default with recorded exceptions keeps it decidable (Newman, Building Microservices, ch. 4).",
|
|
218
|
+
"unchecked": "The architects compare the interactions in the model with the default and the recorded exceptions at the quarterly architecture review; whether a reason holds is judged by people, not read by a tool."
|
|
210
219
|
},
|
|
211
220
|
{
|
|
212
221
|
"id": "req-depth",
|
|
@@ -237,12 +246,7 @@
|
|
|
237
246
|
"ears_type": "event-driven",
|
|
238
247
|
"trigger": "a part calls another part synchronously",
|
|
239
248
|
"action": "pass the remaining deadline of the user's request with the call and give up when it has passed, so that a user request spends at most {{CALL_BUDGET_MS}} ms in calls between parts at the 99th percentile",
|
|
240
|
-
"rationale": "
|
|
241
|
-
"hubWhen": {
|
|
242
|
-
"DEFAULT": [
|
|
243
|
-
"sync"
|
|
244
|
-
]
|
|
245
|
-
}
|
|
249
|
+
"rationale": "Deadline propagation stops a slow part from holding every caller above it, whatever the default style leaves synchronous (gRPC, Deadlines; Google SRE book, Addressing Cascading Failures)."
|
|
246
250
|
},
|
|
247
251
|
{
|
|
248
252
|
"id": "req-commands",
|
|
@@ -267,7 +271,7 @@
|
|
|
267
271
|
"x": 260,
|
|
268
272
|
"y": 650,
|
|
269
273
|
"ears_type": "ubiquitous",
|
|
270
|
-
"action": "publish an event after every committed change other parts depend on, carrying the state they need, and answer user requests from the part's own data, with 0 synchronous calls to another
|
|
274
|
+
"action": "publish an event after every committed change other parts depend on, carrying the state they need, and answer user requests from the part's own data, with 0 synchronous calls from one back-end part to another on a user's request path outside the recorded exceptions (the front end calling its back end is not one)",
|
|
271
275
|
"rationale": "Event-carried state transfer removes the temporal coupling: a part keeps answering while the publisher is down (Fowler, What do you mean by \"Event-Driven\"?).",
|
|
272
276
|
"hubWhen": {
|
|
273
277
|
"DEFAULT": [
|
|
@@ -323,12 +327,31 @@
|
|
|
323
327
|
]
|
|
324
328
|
}
|
|
325
329
|
},
|
|
330
|
+
{
|
|
331
|
+
"id": "req-orchestrated-fallback",
|
|
332
|
+
"type": "requirement",
|
|
333
|
+
"label": "Flows run in an orchestrator for want of events",
|
|
334
|
+
"x": 260,
|
|
335
|
+
"y": 1170,
|
|
336
|
+
"ears_type": "ubiquitous",
|
|
337
|
+
"action": "run every business flow that spans more than one part as a workflow in the orchestrator, with each instance's current step and history visible, a compensation declared for every step that changes data, and the flow finished or compensated within {{FLOW_MINUTES}} minutes",
|
|
338
|
+
"rationale": "Choreography needs published events and this default publishes none, so the orchestrator takes the flows. An orchestrator keeps the steps of a flow in one place and its state visible per instance (microservices.io, Saga: orchestration).",
|
|
339
|
+
"hubWhen": {
|
|
340
|
+
"FLOWS": [
|
|
341
|
+
"choreography"
|
|
342
|
+
],
|
|
343
|
+
"DEFAULT": [
|
|
344
|
+
"sync",
|
|
345
|
+
"commands"
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
},
|
|
326
349
|
{
|
|
327
350
|
"id": "req-choreographed",
|
|
328
351
|
"type": "requirement",
|
|
329
352
|
"label": "Choreographed flows are traced",
|
|
330
353
|
"x": 260,
|
|
331
|
-
"y":
|
|
354
|
+
"y": 1300,
|
|
332
355
|
"ears_type": "unwanted-behaviour",
|
|
333
356
|
"unwanted_condition": "a flow that spans parts has started and not reached its end event within {{FLOW_MINUTES}} minutes",
|
|
334
357
|
"action": "report it as stuck with its correlation id and the last event seen, and alert the team that owns the part that should have reacted",
|
|
@@ -336,6 +359,10 @@
|
|
|
336
359
|
"hubWhen": {
|
|
337
360
|
"FLOWS": [
|
|
338
361
|
"choreography"
|
|
362
|
+
],
|
|
363
|
+
"DEFAULT": [
|
|
364
|
+
"events",
|
|
365
|
+
"streams"
|
|
339
366
|
]
|
|
340
367
|
}
|
|
341
368
|
},
|
|
@@ -344,9 +371,9 @@
|
|
|
344
371
|
"type": "requirement",
|
|
345
372
|
"label": "Operations stay in one part",
|
|
346
373
|
"x": 260,
|
|
347
|
-
"y":
|
|
374
|
+
"y": 1430,
|
|
348
375
|
"ears_type": "ubiquitous",
|
|
349
|
-
"action": "complete every business operation inside one part and one local transaction, with 0 operations
|
|
376
|
+
"action": "complete every business operation inside one part and one local transaction, with 0 operations in which one part asks another to change data",
|
|
350
377
|
"rationale": "A flow that stays inside one part needs neither a coordinator nor compensation; boundaries are drawn to keep it so (Newman, Building Microservices, ch. 6).",
|
|
351
378
|
"hubWhen": {
|
|
352
379
|
"FLOWS": [
|
|
@@ -359,7 +386,7 @@
|
|
|
359
386
|
"type": "requirement",
|
|
360
387
|
"label": "Breaking changes refused",
|
|
361
388
|
"x": 260,
|
|
362
|
-
"y":
|
|
389
|
+
"y": 1560,
|
|
363
390
|
"ears_type": "event-driven",
|
|
364
391
|
"trigger": "a change to a contract between parts is proposed",
|
|
365
392
|
"action": "lint it against the house rules and compare it with the contract on the main branch, and refuse to merge a change that would break an existing consumer",
|
|
@@ -375,7 +402,7 @@
|
|
|
375
402
|
"type": "requirement",
|
|
376
403
|
"label": "Consumers' pacts verified",
|
|
377
404
|
"x": 260,
|
|
378
|
-
"y":
|
|
405
|
+
"y": 1690,
|
|
379
406
|
"ears_type": "event-driven",
|
|
380
407
|
"trigger": "a part is about to be deployed",
|
|
381
408
|
"action": "verify it against every pact its consumers have published, for calls and for messages, and deploy it only when every pact of the consumer versions in production passes",
|
|
@@ -424,12 +451,7 @@
|
|
|
424
451
|
"y": 390,
|
|
425
452
|
"given": "a request whose deadline has 50 ms left",
|
|
426
453
|
"when": "the first part calls a second that takes 500 ms",
|
|
427
|
-
"then": "the call is cancelled after 50 ms, the second part
|
|
428
|
-
"hubWhen": {
|
|
429
|
-
"DEFAULT": [
|
|
430
|
-
"sync"
|
|
431
|
-
]
|
|
432
|
-
}
|
|
454
|
+
"then": "the call is cancelled after 50 ms, the second part is not called again, and the user gets a timely error"
|
|
433
455
|
},
|
|
434
456
|
{
|
|
435
457
|
"id": "sc-commands",
|
|
@@ -508,18 +530,41 @@
|
|
|
508
530
|
]
|
|
509
531
|
}
|
|
510
532
|
},
|
|
533
|
+
{
|
|
534
|
+
"id": "sc-orchestrated-fallback",
|
|
535
|
+
"type": "scenario",
|
|
536
|
+
"label": "Failed step compensated",
|
|
537
|
+
"x": 520,
|
|
538
|
+
"y": 1170,
|
|
539
|
+
"given": "the place-order workflow with reserve stock, take payment and book shipping",
|
|
540
|
+
"when": "the payment is declined",
|
|
541
|
+
"then": "the workflow releases the stock, ends as failed, and its history shows each step",
|
|
542
|
+
"hubWhen": {
|
|
543
|
+
"FLOWS": [
|
|
544
|
+
"choreography"
|
|
545
|
+
],
|
|
546
|
+
"DEFAULT": [
|
|
547
|
+
"sync",
|
|
548
|
+
"commands"
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
},
|
|
511
552
|
{
|
|
512
553
|
"id": "sc-choreographed",
|
|
513
554
|
"type": "scenario",
|
|
514
555
|
"label": "Stuck flow reported",
|
|
515
556
|
"x": 520,
|
|
516
|
-
"y":
|
|
557
|
+
"y": 1300,
|
|
517
558
|
"given": "an order placed and its stock reserved",
|
|
518
559
|
"when": "no payment event follows within {{FLOW_MINUTES}} minutes",
|
|
519
560
|
"then": "the flow is reported stuck with its correlation id and the payment team is alerted",
|
|
520
561
|
"hubWhen": {
|
|
521
562
|
"FLOWS": [
|
|
522
563
|
"choreography"
|
|
564
|
+
],
|
|
565
|
+
"DEFAULT": [
|
|
566
|
+
"events",
|
|
567
|
+
"streams"
|
|
523
568
|
]
|
|
524
569
|
}
|
|
525
570
|
},
|
|
@@ -528,10 +573,10 @@
|
|
|
528
573
|
"type": "scenario",
|
|
529
574
|
"label": "Operation stays local",
|
|
530
575
|
"x": 520,
|
|
531
|
-
"y":
|
|
532
|
-
"given": "the
|
|
533
|
-
"when": "each
|
|
534
|
-
"then": "
|
|
576
|
+
"y": 1430,
|
|
577
|
+
"given": "the traces of the journeys that change data",
|
|
578
|
+
"when": "the calls between parts in each are listed",
|
|
579
|
+
"then": "none asks another part to create, change or delete anything",
|
|
535
580
|
"hubWhen": {
|
|
536
581
|
"FLOWS": [
|
|
537
582
|
"local"
|
|
@@ -543,7 +588,7 @@
|
|
|
543
588
|
"type": "scenario",
|
|
544
589
|
"label": "Removed field refused",
|
|
545
590
|
"x": 520,
|
|
546
|
-
"y":
|
|
591
|
+
"y": 1560,
|
|
547
592
|
"given": "an event contract with a field consumers read",
|
|
548
593
|
"when": "a change removes that field",
|
|
549
594
|
"then": "the build fails naming the breaking change",
|
|
@@ -558,7 +603,7 @@
|
|
|
558
603
|
"type": "scenario",
|
|
559
604
|
"label": "Breaking deploy blocked",
|
|
560
605
|
"x": 520,
|
|
561
|
-
"y":
|
|
606
|
+
"y": 1690,
|
|
562
607
|
"given": "a consumer in production whose pact reads a field",
|
|
563
608
|
"when": "the provider removes the field and tries to deploy",
|
|
564
609
|
"then": "verification fails and can-i-deploy blocks the release",
|
|
@@ -577,8 +622,8 @@
|
|
|
577
622
|
"concern": "communication-style",
|
|
578
623
|
"status": "accepted",
|
|
579
624
|
"date": "",
|
|
580
|
-
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack,
|
|
581
|
-
"decision": "Parts talk by synchronous request and response by default: {{SYNC_API}}
|
|
625
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
626
|
+
"decision": "Parts talk by synchronous request and response by default: {{SYNC_API}}, with clients generated from the contracts. Every call carries the remaining deadline of the user's request (gRPC deadlines, or the X-Request-Deadline header the server honours, as an absolute Unix epoch in milliseconds); a user request spends at most {{CALL_BUDGET_MS}} ms in calls between parts and a chain is at most {{MAX_DEPTH}} calls deep. A command over a queue or an event is used instead, recorded as an exception, when the caller does not need the result to answer, the work takes longer than the budget, several parts react, or the callee may be down longer than the caller can wait. Flows across parts are orchestrated or stay local, as the flows decision records; choreography needs published events, so with this default it falls back to the orchestrator. Contract checks: {{CONTRACTS}}.",
|
|
582
627
|
"consequences": "• Simplest to write, follow and debug: one request, one trace, an answer or an error.\n• The caller is only as available as everything it calls: availabilities multiply along a chain, hence the depth limit.\n• Overload spreads upstream unless deadlines and load shedding stop it.\n• Work that takes long or must survive a callee being down needs the recorded exceptions.",
|
|
583
628
|
"alternatives": "1. Commands over queues: callers do not wait, at the cost of answering later.\n2. Published events: no temporal coupling, at the cost of copies and eventual consistency.\n3. A service mesh to add retries and timeouts: helps, but does not remove the coupling of waiting.",
|
|
584
629
|
"hubWhen": {
|
|
@@ -596,8 +641,8 @@
|
|
|
596
641
|
"concern": "communication-style",
|
|
597
642
|
"status": "accepted",
|
|
598
643
|
"date": "",
|
|
599
|
-
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack,
|
|
600
|
-
"decision": "A part that needs another to do something sends a command to that part's own queue (RabbitMQ or Azure Service Bus queues, Amazon SQS; one owning part per queue) and answers its own caller with the command's id; the receiver replies with an outcome
|
|
644
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
645
|
+
"decision": "A part that needs another to do something sends a command to that part's own queue (RabbitMQ or Azure Service Bus queues, Amazon SQS; one owning part per queue) and answers its own caller with the command's id; the receiver replies with an outcome message the sender correlates by id, within {{PROPAGATION_SECONDS}} seconds at the 99th percentile while it is up. Queries that need an answer now stay synchronous ({{SYNC_API}}), at most {{MAX_DEPTH}} calls deep, each carrying the remaining deadline and spending at most {{CALL_BUDGET_MS}} ms per user request. Messages are described in AsyncAPI; delivery guarantees, deduplication and dead-lettering follow the Messaging pack. Flows across parts are orchestrated or stay local, as the flows decision records; choreography needs published events, so with this default it falls back to the orchestrator. Contract checks: {{CONTRACTS}}.",
|
|
601
646
|
"consequences": "• Senders keep working while a receiver is busy or down; bursts wait in the queue.\n• Users see an accepted state and the outcome later, so screens and APIs must show pending work.\n• Each queue has one owner, so who executes a command is never in doubt.\n• Following a request means following a correlation id across messages.",
|
|
602
647
|
"alternatives": "1. Synchronous calls: immediate answers, coupled availability.\n2. Published events: receivers decide what to do, no one is told to do anything.\n3. A shared job table polled by workers: no broker, but a database used as a queue.",
|
|
603
648
|
"hubWhen": {
|
|
@@ -615,8 +660,8 @@
|
|
|
615
660
|
"concern": "communication-style",
|
|
616
661
|
"status": "accepted",
|
|
617
662
|
"date": "",
|
|
618
|
-
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack,
|
|
619
|
-
"decision": "Each part publishes events about its own committed changes (through an outbox, as CloudEvents described in AsyncAPI) carrying the state its subscribers need; subscribers keep their own copies and answer user requests from them. Events go through a publish-subscribe broker: Apache Kafka for many subscribers and replay, Amazon SNS with SQS or Google Pub/Sub on those clouds, Azure Service Bus topics on Azure. Copies are updated within {{PROPAGATION_SECONDS}} seconds at the 99th percentile. A command to one specific part goes to that part's queue; a synchronous call ({{SYNC_API}}, at most {{MAX_DEPTH}} deep) is a recorded exception for an answer only its owner can give now, such as a payment authorisation. Flows across parts: {{FLOWS}}. Contract checks: {{CONTRACTS}}.",
|
|
663
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
664
|
+
"decision": "Each part publishes events about its own committed changes (through an outbox, as the Data consistency pack decides; as CloudEvents described in AsyncAPI) carrying the state its subscribers need; subscribers keep their own copies and answer user requests from them. Events go through a publish-subscribe broker: Apache Kafka for many subscribers and replay, Amazon SNS with SQS or Google Pub/Sub on those clouds, Azure Service Bus topics on Azure. Copies are updated within {{PROPAGATION_SECONDS}} seconds at the 99th percentile. A command to one specific part goes to that part's queue; a synchronous call between back-end parts ({{SYNC_API}}, at most {{MAX_DEPTH}} deep, carrying the remaining deadline, at most {{CALL_BUDGET_MS}} ms per user request) is a recorded exception for an answer only its owner can give now, such as a payment authorisation; the front end calling its back end is no exception. Flows across parts: {{FLOWS}}. Contract checks: {{CONTRACTS}}.",
|
|
620
665
|
"consequences": "• A part keeps answering while the parts it depends on are down: no temporal coupling on the user path.\n• Data is copied and eventually consistent; screens and rules must tolerate {{PROPAGATION_SECONDS}} seconds of lag.\n• Publishers do not know their subscribers; what happens after an event is visible only in the contracts and traces.\n• Event schemas become long-lived contracts that need versioning.",
|
|
621
666
|
"alternatives": "1. Synchronous calls: simpler, coupled availability.\n2. Commands over queues: the sender decides what happens, coupling it to the receivers.\n3. Event notification without state (subscribers call back for data): smaller events, but the temporal coupling returns.",
|
|
622
667
|
"hubWhen": {
|
|
@@ -634,8 +679,8 @@
|
|
|
634
679
|
"concern": "communication-style",
|
|
635
680
|
"status": "accepted",
|
|
636
681
|
"date": "",
|
|
637
|
-
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack,
|
|
638
|
-
"decision": "Parts write their events to a durable, partitioned log
|
|
682
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
683
|
+
"decision": "Parts write their events to a durable, partitioned log: Apache Kafka on Kubernetes with Strimzi, whose topics are KafkaTopic manifests (a managed Kafka such as Confluent Cloud, Amazon MSK or Redpanda Cloud declares its topics in Terraform and checks the same retention there). Topics are keyed by entity so that order holds per entity, retained for at least {{RETENTION_DAYS}} days, with topics holding current state compacted. Consumers read at their own pace, keep their own views (Kafka Streams, Apache Flink or plain consumers) and can rebuild them by replaying from the start; events reach every consumer within {{PROPAGATION_SECONDS}} seconds at the 99th percentile. Synchronous calls between back-end parts ({{SYNC_API}}, at most {{MAX_DEPTH}} deep, carrying the remaining deadline, at most {{CALL_BUDGET_MS}} ms per user request) are recorded exceptions; the front end calling its back end is no exception. Flows across parts: {{FLOWS}}. Contract checks: {{CONTRACTS}}.",
|
|
639
684
|
"consequences": "• New consumers and new views are added without asking producers, by replaying history.\n• High throughput, with order per key and parallelism per partition.\n• A cluster to run (or pay for) and partitions to size; consumer lag becomes a key metric.\n• Events in the log live for days or forever, so their schemas must stay readable for that long.",
|
|
640
685
|
"alternatives": "1. Published events through a pub/sub broker without replay: simpler, but views cannot be rebuilt from history.\n2. Commands over queues: work distribution, not a history.\n3. Change data capture from each database: no code to publish, but internal tables become the contract.",
|
|
641
686
|
"hubWhen": {
|
|
@@ -644,16 +689,54 @@
|
|
|
644
689
|
]
|
|
645
690
|
}
|
|
646
691
|
},
|
|
692
|
+
{
|
|
693
|
+
"id": "adr-rest",
|
|
694
|
+
"type": "adr",
|
|
695
|
+
"label": "Synchronous calls over HTTP and JSON",
|
|
696
|
+
"x": 780,
|
|
697
|
+
"y": 520,
|
|
698
|
+
"concern": "communication-style",
|
|
699
|
+
"status": "accepted",
|
|
700
|
+
"date": "",
|
|
701
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
702
|
+
"decision": "Synchronous calls between parts are resource-style HTTP with JSON bodies, described in OpenAPI 3.1 documents owned by the providing part (services/<name>/openapi.yaml), linted with Spectral against the house ruleset in every build; errors are application/problem+json. Clients are generated from the documents (openapi-typescript or OpenAPI Generator) and never written by hand. The remaining deadline travels in the X-Request-Deadline header.",
|
|
703
|
+
"consequences": "• Any language and any browser can call; people can read and try the API.\n• JSON over HTTP/1.1 costs more per call than a binary protocol; high-volume paths may need the gRPC exception.\n• Deadlines are a house convention the servers must honour, not a protocol feature.",
|
|
704
|
+
"alternatives": "1. gRPC: generated clients, deadlines and streaming built in, but browsers need a gateway.\n2. GraphQL between parts: flexible queries, and a contract that is hard to diff for breaking changes.",
|
|
705
|
+
"hubWhen": {
|
|
706
|
+
"SYNC_API": [
|
|
707
|
+
"rest"
|
|
708
|
+
]
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"id": "adr-grpc",
|
|
713
|
+
"type": "adr",
|
|
714
|
+
"label": "Synchronous calls over gRPC",
|
|
715
|
+
"x": 780,
|
|
716
|
+
"y": 650,
|
|
717
|
+
"concern": "communication-style",
|
|
718
|
+
"status": "accepted",
|
|
719
|
+
"date": "",
|
|
720
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
721
|
+
"decision": "Synchronous calls between parts are gRPC over HTTP/2, described in .proto files owned by the providing part under proto/, linted with Buf's STANDARD rules and compared with the main branch in every build. Clients are generated with Buf (Connect for TypeScript, grpc-java, Grpc.Net.Client) and never written by hand. The remaining deadline travels as the gRPC deadline, which every client wrapper sets from the incoming one.",
|
|
722
|
+
"consequences": "• Binary, fast, with deadlines and streaming built into the protocol.\n• Browsers and scripts need gRPC-Web, Connect or a gateway; people cannot try the API with curl.\n• Field numbers are forever: a removed or retyped field is a break Buf refuses.",
|
|
723
|
+
"alternatives": "1. HTTP and JSON with OpenAPI: readable by people and browsers, slower per call.\n2. gRPC only where volume demands it, HTTP elsewhere: two client stacks to keep.",
|
|
724
|
+
"hubWhen": {
|
|
725
|
+
"SYNC_API": [
|
|
726
|
+
"grpc"
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
},
|
|
647
730
|
{
|
|
648
731
|
"id": "adr-orchestration",
|
|
649
732
|
"type": "adr",
|
|
650
733
|
"label": "Flows run by an orchestrator",
|
|
651
734
|
"x": 780,
|
|
652
|
-
"y":
|
|
735
|
+
"y": 780,
|
|
653
736
|
"concern": "communication-style",
|
|
654
737
|
"status": "accepted",
|
|
655
738
|
"date": "",
|
|
656
|
-
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack,
|
|
739
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
657
740
|
"decision": "Every business flow across parts runs as a workflow in an orchestrator: Temporal for flows written as code, Camunda 8 where the flow is modelled in BPMN with business people, AWS Step Functions on AWS. The workflow calls each part's commands, keeps the state and history of each instance, retries steps with backoff, waits on timers and human tasks, and runs a declared compensation for every completed step that changed data when a later one fails (saga semantics as in the Data consistency pack). A flow finishes or is compensated within {{FLOW_MINUTES}} minutes. The workflow belongs to the part that owns the business outcome.",
|
|
658
741
|
"consequences": "• Each flow is written in one place and each instance's state is visible and searchable.\n• Timeouts, retries and compensation come from the engine instead of hand-written state machines.\n• The orchestrator is a component to run (or pay for) and must be highly available.\n• The owning part knows every step: a change to a step means changing the workflow too.",
|
|
659
742
|
"alternatives": "1. Choreography: no central component, but flows are visible only through tracing.\n2. Hand-written state machines in a database table: no engine, but timers, retries and history to build.\n3. Distributed transactions (two-phase commit): unsupported by most brokers and services, and blocking.",
|
|
@@ -663,22 +746,106 @@
|
|
|
663
746
|
]
|
|
664
747
|
}
|
|
665
748
|
},
|
|
749
|
+
{
|
|
750
|
+
"id": "adr-orchestration-fallback",
|
|
751
|
+
"type": "adr",
|
|
752
|
+
"label": "Flows run by an orchestrator, as nothing is published",
|
|
753
|
+
"x": 780,
|
|
754
|
+
"y": 910,
|
|
755
|
+
"concern": "communication-style",
|
|
756
|
+
"status": "accepted",
|
|
757
|
+
"date": "",
|
|
758
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
759
|
+
"decision": "Choreography was chosen, but it needs published events and the default ({{DEFAULT}}) publishes none, so flows across parts are orchestrated. Every business flow across parts runs as a workflow in an orchestrator: Temporal for flows written as code, Camunda 8 where the flow is modelled in BPMN with business people, AWS Step Functions on AWS. The workflow calls each part's commands, keeps the state and history of each instance, retries steps with backoff, waits on timers and human tasks, and runs a declared compensation for every completed step that changed data when a later one fails (saga semantics as in the Data consistency pack). A flow finishes or is compensated within {{FLOW_MINUTES}} minutes. The workflow belongs to the part that owns the business outcome.",
|
|
760
|
+
"consequences": "• Each flow is written in one place and each instance's state is visible and searchable.\n• Timeouts, retries and compensation come from the engine instead of hand-written state machines.\n• The orchestrator is a component to run (or pay for) and must be highly available.\n• The owning part knows every step: a change to a step means changing the workflow too.",
|
|
761
|
+
"alternatives": "1. Choreography: no central component, but flows are visible only through tracing.\n2. Hand-written state machines in a database table: no engine, but timers, retries and history to build.\n3. Distributed transactions (two-phase commit): unsupported by most brokers and services, and blocking.",
|
|
762
|
+
"hubWhen": {
|
|
763
|
+
"FLOWS": [
|
|
764
|
+
"choreography"
|
|
765
|
+
],
|
|
766
|
+
"DEFAULT": [
|
|
767
|
+
"sync",
|
|
768
|
+
"commands"
|
|
769
|
+
]
|
|
770
|
+
}
|
|
771
|
+
},
|
|
666
772
|
{
|
|
667
773
|
"id": "adr-choreography",
|
|
668
774
|
"type": "adr",
|
|
669
775
|
"label": "Flows by choreography",
|
|
670
776
|
"x": 780,
|
|
671
|
-
"y":
|
|
777
|
+
"y": 1040,
|
|
672
778
|
"concern": "communication-style",
|
|
673
779
|
"status": "accepted",
|
|
674
780
|
"date": "",
|
|
675
|
-
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack,
|
|
781
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
676
782
|
"decision": "Flows across parts are choreographed: each part reacts to the events of others and publishes its own, and no part coordinates the flow. Every flow is documented as an event chain (which part reacts to which event and what it publishes) in the AsyncAPI documents and a flow diagram in the model; every event carries the flow's correlation id. A process monitor subscribes to the start and end events of each flow and reports an instance not finished within {{FLOW_MINUTES}} minutes. A flow that grows past three steps or needs timeouts is moved to an orchestrator by a new ADR.",
|
|
677
783
|
"consequences": "• No central component; each team owns its reaction and changes it alone.\n• The flow exists only as the sum of reactions; without the documented chain and the monitor nobody can tell where an instance is.\n• Compensation is spread across parts, each undoing its own step on a failure event.\n• Cyclic reactions are possible and must be caught in review.",
|
|
678
784
|
"alternatives": "1. An orchestrator: one place for the flow and its state, at the cost of a central component.\n2. Keeping the flow in one part: no coordination at all, if the boundaries allow it.",
|
|
679
785
|
"hubWhen": {
|
|
680
786
|
"FLOWS": [
|
|
681
787
|
"choreography"
|
|
788
|
+
],
|
|
789
|
+
"DEFAULT": [
|
|
790
|
+
"events",
|
|
791
|
+
"streams"
|
|
792
|
+
]
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"id": "adr-local-flows",
|
|
797
|
+
"type": "adr",
|
|
798
|
+
"label": "No flow spans parts",
|
|
799
|
+
"x": 780,
|
|
800
|
+
"y": 1170,
|
|
801
|
+
"concern": "communication-style",
|
|
802
|
+
"status": "accepted",
|
|
803
|
+
"date": "",
|
|
804
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
805
|
+
"decision": "No business flow spans parts: every operation that changes data completes inside one part and one local transaction, and the boundaries between parts are drawn (and redrawn, through the Decomposition pack) so that this holds. A part may ask another for data on the way, never to change anything; an operation that would need two parts to change data is a reason to move the boundary, not to add a coordinator. The end-to-end traces prove it on every run.",
|
|
806
|
+
"consequences": "• No orchestrator, no compensation, no stuck flows: each operation is one transaction.\n• The boundaries carry the constraint: a feature that spans two parts cannot be built until they are re-cut or merged.\n• Reads across parts stay synchronous or come from copies; writes never cross.",
|
|
807
|
+
"alternatives": "1. An orchestrator for the few flows that must span parts: a central component for the exceptions.\n2. Choreography: reactions across parts, visible only through tracing.",
|
|
808
|
+
"hubWhen": {
|
|
809
|
+
"FLOWS": [
|
|
810
|
+
"local"
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"id": "adr-contract-diffs",
|
|
816
|
+
"type": "adr",
|
|
817
|
+
"label": "Contracts diffed on every change",
|
|
818
|
+
"x": 780,
|
|
819
|
+
"y": 1300,
|
|
820
|
+
"concern": "communication-style",
|
|
821
|
+
"status": "accepted",
|
|
822
|
+
"date": "",
|
|
823
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
824
|
+
"decision": "A change to a contract between parts is checked against the version on the main branch in the pull request: oasdiff for OpenAPI, the AsyncAPI CLI's diff for AsyncAPI, Buf for .proto files. A breaking change (a field or operation removed, a type narrowed, a required field added to a request) fails the build; it ships only as a new version of the contract with the old one kept until every consumer has moved, as the API evolution pack decides for callers outside.",
|
|
825
|
+
"consequences": "• Works for consumers the provider does not know, with no test code on the consumer side.\n• A diff knows the document, not what consumers use: a change that breaks nobody still fails, and a semantic change the schema cannot express passes.\n• Versioning and deprecation become routine work for every provider.",
|
|
826
|
+
"alternatives": "1. Consumer-driven contract tests: precise about what consumers use, but every consumer must run Pact.\n2. End-to-end tests across parts in a shared environment: slow, flaky and late.",
|
|
827
|
+
"hubWhen": {
|
|
828
|
+
"CONTRACTS": [
|
|
829
|
+
"spec"
|
|
830
|
+
]
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
"id": "adr-consumer-contracts",
|
|
835
|
+
"type": "adr",
|
|
836
|
+
"label": "Consumer-driven contract tests",
|
|
837
|
+
"x": 780,
|
|
838
|
+
"y": 1430,
|
|
839
|
+
"concern": "communication-style",
|
|
840
|
+
"status": "accepted",
|
|
841
|
+
"date": "",
|
|
842
|
+
"context": "The system's own parts (services, modules, front ends and back ends) have to ask each other for data and to get things done. How they do it decides how they fail together. The forces: a synchronous call ties the caller to the callee being up and fast at that moment (temporal coupling), and a chain of them multiplies latency and the odds that one link is down; asynchronous messages decouple in time but make the result arrive later and the flow harder to follow; events let parts react without the publisher knowing them, until nobody can tell what happens after an order is placed; a flow across parts needs either a coordinator that knows every step or a chain of reactions nobody owns; and parts are released apart, so every interaction is a contract that must not break. Delivery guarantees of a queue are the Messaging pack, calls to systems outside are Integration resilience, and contracts with callers outside the system are the API evolution pack.",
|
|
843
|
+
"decision": "Every consuming part records the calls and messages it relies on as pacts with Pact and publishes them to the Pact Broker (or PactFlow); every provider build fetches and verifies the pacts of the consumer versions on main and deployed, publishes the results, and the deploy job asks can-i-deploy before deploying and records the deployment after. Messages are verified with message pacts; gRPC calls with the pact-protobuf-plugin. A provider may change anything no pact relies on.",
|
|
844
|
+
"consequences": "• A breaking change is found in the provider's build, in minutes, without an environment that holds every part.\n• Only what consumers use is protected: a consumer without a pact is on its own.\n• The broker is one more component to run (or a subscription), and every team has to learn the workflow.",
|
|
845
|
+
"alternatives": "1. Contract diffs on every change: no consumer tests to write, but no knowledge of what consumers really use.\n2. Provider-written schema tests: the provider against its own document, not against its consumers.",
|
|
846
|
+
"hubWhen": {
|
|
847
|
+
"CONTRACTS": [
|
|
848
|
+
"pact"
|
|
682
849
|
]
|
|
683
850
|
}
|
|
684
851
|
},
|
|
@@ -688,9 +855,12 @@
|
|
|
688
855
|
"label": "Call chains within depth",
|
|
689
856
|
"x": 1040,
|
|
690
857
|
"y": 0,
|
|
691
|
-
"
|
|
692
|
-
"
|
|
693
|
-
"
|
|
858
|
+
"characteristic": "reliability",
|
|
859
|
+
"scope": "holistic",
|
|
860
|
+
"cadence": "triggered",
|
|
861
|
+
"trigger": "pull-request",
|
|
862
|
+
"invocation": "automated",
|
|
863
|
+
"description": "The parts started for the end-to-end suite export their spans over OTLP to a Jaeger container; each journey is run with a traceparent header the test generates, the trace is fetched from Jaeger's query API by that id, and the test follows each span's parents counting nested HTTP and gRPC client spans that another part continues with a server span (database calls and calls to systems outside are not counted), and fails when one part serves twice in a line of nested calls (a cycle). The HTTP method is read under the stable name http.request.method and the old http.method, so SDKs on either semantic convention are counted. A new call that deepens a chain fails the test. The helper test/e2e/traces.ts is shared with the other trace-based checks of this pack.\n\nThreshold: 0 traces of the end-to-end journeys with more than {{MAX_DEPTH}} nested synchronous calls between parts, and 0 in which a part is reached again through its own calls\n\nTool: Vitest with Jaeger (jaegertracing/jaeger, OTLP in on 4318, query API on 16686; the /api/traces endpoint is Jaeger's internal JSON API); for the JVM: the same test with JUnit 5 and RestClient\n\n```ts\n// test/e2e/traces.ts — the parts export spans over OTLP to the Jaeger container started for the suite\nimport { randomBytes, randomUUID } from 'node:crypto'\n\nexport interface Span { id: string; parent?: string; service: string; kind?: string; method?: string; durationMs: number; rpc: boolean }\n\nexport const newTraceId = () => randomUUID().replace(/-/g, '')\nexport const traceparent = (traceId: string) => `00-${traceId}-${randomBytes(8).toString('hex')}-01`\n\n/** The spans of one trace, once Jaeger has them all (two reads in a row agree). */\nexport async function trace(traceId: string): Promise<Span[]> {\n let last = -1\n for (let i = 0; i < 20; i++) {\n const res = await fetch(`${process.env.JAEGER_URL}/api/traces/${traceId}`)\n const spans = res.ok ? toSpans((await res.json()).data[0]) : []\n if (spans.length > 0 && spans.length === last) return spans\n last = spans.length\n await new Promise((r) => setTimeout(r, 500))\n }\n throw new Error(`trace ${traceId} did not settle`)\n}\n\n// A call between parts is an HTTP or gRPC client span that a server span of another part continues;\n// a call to a system outside has no server span in the trace and is not counted. The HTTP method is\n// read under the stable semantic-convention name and the old one (SDKs still emitting http.method).\nconst toSpans = (trace: any): Span[] => {\n const spans = trace.spans.map((s: any) => {\n const tag = (key: string) => s.tags.find((t: any) => t.key === key)?.value\n const method = tag('http.request.method') ?? tag('http.method')\n return {\n id: s.spanID,\n parent: s.references.find((r: any) => r.refType === 'CHILD_OF')?.spanID,\n service: trace.processes[s.processID].serviceName,\n kind: tag('span.kind'),\n method,\n durationMs: s.duration / 1000,\n rpc: tag('span.kind') === 'client' && (method !== undefined || tag('rpc.system') !== undefined),\n }\n })\n return spans.map((s: Span) => ({ ...s, rpc: s.rpc && spans.some((x: Span) => x.kind === 'server' && x.parent === s.id) }))\n}\n\n// test/e2e/depth.test.ts\nimport { expect, it } from 'vitest'\nimport { journeys } from './journeys' // the journeys of the suite; each takes the headers to send with its first request\nimport { newTraceId, trace, traceparent, type Span } from './traces'\n\nconst ancestry = (spans: Span[], s: Span): Span[] => {\n const line: Span[] = []\n for (let p: Span | undefined = s; p; p = spans.find((x) => x.id === p!.parent)) line.push(p)\n return line\n}\nconst depth = (spans: Span[], s: Span) => ancestry(spans, s).filter((p) => p.rpc).length\n// a part reached again through its own calls: its service serves twice in one line of server spans\nconst cycle = (spans: Span[], s: Span) => {\n const served = ancestry(spans, s).filter((p) => p.kind === 'server').map((p) => p.service)\n return new Set(served).size < served.length\n}\n\nit.each(journeys)('$name goes at most {{MAX_DEPTH}} calls deep, without cycles', async (journey) => {\n const traceId = newTraceId()\n await journey.run({ traceparent: traceparent(traceId) }) // the parts continue the trace\n const spans = await trace(traceId)\n expect(Math.max(0, ...spans.map((s) => depth(spans, s)))).toBeLessThanOrEqual({{MAX_DEPTH}})\n expect(spans.filter((s) => cycle(spans, s)).map((s) => s.service)).toEqual([])\n})\n```"
|
|
694
864
|
},
|
|
695
865
|
{
|
|
696
866
|
"id": "ff-budget",
|
|
@@ -698,12 +868,46 @@
|
|
|
698
868
|
"label": "Calls within budget",
|
|
699
869
|
"x": 1040,
|
|
700
870
|
"y": 130,
|
|
701
|
-
"
|
|
702
|
-
"
|
|
703
|
-
"
|
|
871
|
+
"characteristic": "performance-efficiency",
|
|
872
|
+
"scope": "holistic",
|
|
873
|
+
"cadence": "triggered",
|
|
874
|
+
"trigger": "pull-request",
|
|
875
|
+
"invocation": "automated",
|
|
876
|
+
"description": "The same traces as the depth check: for each journey run, the test finds the server span the request entered and sums the durations of its outgoing client spans (nested calls run inside them); the 99th percentile over all runs must stay within the budget. Under production load the same number is read from the traces in Jaeger or Tempo with the same arithmetic.\n\nThreshold: 99th percentile over the traces of the end-to-end journeys of the time a request spends in calls between parts at most {{CALL_BUDGET_MS}} ms\n\nTool: Vitest with Jaeger (test/e2e/traces.ts); for the JVM: the same test with JUnit 5\n\n```ts\nimport { expect, it } from 'vitest'\nimport { journeys } from './journeys'\nimport { newTraceId, trace, traceparent } from './traces'\n\nit('a request spends at most {{CALL_BUDGET_MS}} ms in calls between parts (p99 over the journeys)', async () => {\n const spent: number[] = []\n for (const journey of journeys) for (let i = 0; i < 20; i++) {\n const traceId = newTraceId()\n await journey.run({ traceparent: traceparent(traceId) })\n const spans = await trace(traceId)\n const ids = new Set(spans.map((s) => s.id))\n const entry = spans.find((s) => s.kind === 'server' && !(s.parent && ids.has(s.parent))) // where the request entered\n const outgoing = spans.filter((s) => s.rpc && s.parent === entry?.id) // nested calls run inside these\n spent.push(outgoing.reduce((sum, s) => sum + s.durationMs, 0))\n }\n spent.sort((a, b) => a - b)\n expect(spent[Math.floor((spent.length - 1) * 0.99)]).toBeLessThanOrEqual({{CALL_BUDGET_MS}})\n}, 600_000)\n```"
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
"id": "ff-deadline",
|
|
880
|
+
"type": "fitness-fn",
|
|
881
|
+
"label": "Expired deadline stops the call",
|
|
882
|
+
"x": 1040,
|
|
883
|
+
"y": 260,
|
|
884
|
+
"characteristic": "reliability",
|
|
885
|
+
"scope": "atomic",
|
|
886
|
+
"cadence": "triggered",
|
|
887
|
+
"trigger": "pull-request",
|
|
888
|
+
"invocation": "automated",
|
|
889
|
+
"description": "A test starts a stand-in for the called part that answers after 500 ms, points the part under test at it, sends a request whose X-Request-Deadline is 50 ms away and expects a 504 well within the budget and a single downstream call.\n\nThreshold: A request whose deadline passes during a call to another part is answered with 504 within {{CALL_BUDGET_MS}} ms and the called part is not called again\n\nTool: Vitest with a Node http server as the slow part; for the JVM: the same test with JUnit 5 and WireMock's fixed delay\n\n```ts\nimport http from 'node:http'\nimport { afterAll, beforeAll, expect, it } from 'vitest'\n\n// a stand-in for the part called downstream, answering after 500 ms;\n// the part under test is started with DOWNSTREAM_URL=http://localhost:18081\nlet calls = 0\nconst slow = http.createServer((_req, res) => { calls++; setTimeout(() => res.end('{}'), 500) })\nbeforeAll(() => new Promise<void>((resolve) => slow.listen(18081, resolve)))\nafterAll(() => slow.close())\n\nit('gives up when the deadline has passed', async () => {\n const started = Date.now()\n const res = await fetch(`${process.env.PART_URL}/orders/1/status`, {\n headers: { 'X-Request-Deadline': String(Date.now() + 50) }, // absolute deadline, Unix epoch milliseconds\n })\n expect(res.status).toBe(504)\n expect(Date.now() - started).toBeLessThan({{CALL_BUDGET_MS}})\n expect(calls).toBe(1) // no retry past the deadline\n})\n```",
|
|
704
890
|
"hubWhen": {
|
|
705
|
-
"
|
|
706
|
-
"
|
|
891
|
+
"SYNC_API": [
|
|
892
|
+
"rest"
|
|
893
|
+
]
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
"id": "ff-deadline-grpc",
|
|
898
|
+
"type": "fitness-fn",
|
|
899
|
+
"label": "Expired gRPC deadline stops the call",
|
|
900
|
+
"x": 1040,
|
|
901
|
+
"y": 390,
|
|
902
|
+
"characteristic": "reliability",
|
|
903
|
+
"scope": "atomic",
|
|
904
|
+
"cadence": "triggered",
|
|
905
|
+
"trigger": "pull-request",
|
|
906
|
+
"invocation": "automated",
|
|
907
|
+
"description": "A test starts a stand-in for the called part as a gRPC server that answers after 500 ms, points the part under test at it, calls the part under test with a deadline 50 ms away and expects DEADLINE_EXCEEDED within the budget. The stand-in records the deadline it was given: it must be set and no later than the caller's (the part passed it on rather than starting a fresh one), and it is called once (no retry past the deadline). Both sides use pass-through serializers with empty messages, so no generated code is needed; an empty message is a valid Protocol Buffers message whose fields all hold their defaults.\n\nThreshold: A call whose deadline is 50 ms away ends with DEADLINE_EXCEEDED within {{CALL_BUDGET_MS}} ms, the called part receives the same deadline, and it is called once\n\nTool: Vitest with @grpc/grpc-js; for the JVM: the same test with JUnit 5, grpc-java's in-process server and Context.current().getDeadline()\n\n```ts\nimport * as grpc from '@grpc/grpc-js'\nimport { afterAll, beforeAll, expect, it } from 'vitest'\n\n// a stand-in for the part called downstream, answering after 500 ms;\n// the part under test is started with DOWNSTREAM_GRPC=localhost:18082 and served at PART_GRPC\nconst raw = { serialize: (b: Buffer) => b, deserialize: (b: Buffer) => b }\nconst method = (path: string) => ({ path, requestStream: false, responseStream: false, requestSerialize: raw.serialize, requestDeserialize: raw.deserialize, responseSerialize: raw.serialize, responseDeserialize: raw.deserialize })\n\nconst seen: Array<number> = [] // the deadline of each downstream call, in epoch milliseconds\nconst slow = new grpc.Server()\nslow.addService({ GetStock: method('/inventory.v1.InventoryService/GetStock') }, {\n GetStock: (call: grpc.ServerUnaryCall<Buffer, Buffer>, done: grpc.sendUnaryData<Buffer>) => {\n const d = call.getDeadline()\n seen.push(d instanceof Date ? d.getTime() : d) // Infinity when the caller set none\n setTimeout(() => done(null, Buffer.alloc(0)), 500)\n },\n})\nbeforeAll(() => new Promise<void>((resolve, reject) =>\n slow.bindAsync('localhost:18082', grpc.ServerCredentials.createInsecure(), (err) => (err ? reject(err) : resolve())),\n))\nafterAll(() => slow.forceShutdown())\n\nit('gives up when the deadline has passed and passes the deadline on', async () => {\n const client = new grpc.Client(process.env.PART_GRPC!, grpc.credentials.createInsecure())\n const started = Date.now()\n const deadline = started + 50\n const code = await new Promise<grpc.status>((resolve) => client.makeUnaryRequest(\n '/ordering.v1.OrderingService/GetOrderStatus', raw.serialize, raw.deserialize, Buffer.alloc(0),\n new grpc.Metadata(), { deadline }, (err) => resolve(err ? err.code : grpc.status.OK),\n ))\n expect(code).toBe(grpc.status.DEADLINE_EXCEEDED)\n expect(Date.now() - started).toBeLessThan({{CALL_BUDGET_MS}})\n await new Promise((r) => setTimeout(r, 600)) // room for a retry, which must not come\n expect(seen).toHaveLength(1)\n expect(seen[0]).toBeLessThanOrEqual(deadline + 20) // the caller's deadline, give or take the clock's rounding\n client.close()\n})\n```",
|
|
908
|
+
"hubWhen": {
|
|
909
|
+
"SYNC_API": [
|
|
910
|
+
"grpc"
|
|
707
911
|
]
|
|
708
912
|
}
|
|
709
913
|
},
|
|
@@ -712,10 +916,13 @@
|
|
|
712
916
|
"type": "fitness-fn",
|
|
713
917
|
"label": "Commands accepted and answered",
|
|
714
918
|
"x": 1040,
|
|
715
|
-
"y":
|
|
716
|
-
"
|
|
717
|
-
"
|
|
718
|
-
"
|
|
919
|
+
"y": 520,
|
|
920
|
+
"characteristic": "compatibility",
|
|
921
|
+
"scope": "atomic",
|
|
922
|
+
"cadence": "triggered",
|
|
923
|
+
"trigger": "pull-request",
|
|
924
|
+
"invocation": "automated",
|
|
925
|
+
"description": "An integration test starts RabbitMQ in a container and the receiving part against it, sends a command to the receiver's queue and waits for the correlated reply on the sender's reply queue; a second test stops the receiver, sends, restarts it and expects the reply.\n\nThreshold: A command's outcome reply arrives within {{PROPAGATION_SECONDS}} seconds while the receiver is up; a command sent while the receiver is down is answered within {{PROPAGATION_SECONDS}} seconds of its restart\n\nTool: Vitest with Testcontainers (@testcontainers/rabbitmq) and amqplib; for the JVM: Testcontainers with Spring AMQP and Awaitility\n\n```ts\nimport { randomUUID } from 'node:crypto'\nimport amqp from 'amqplib'\nimport { RabbitMQContainer, type StartedRabbitMQContainer } from '@testcontainers/rabbitmq'\nimport { afterAll, beforeAll, it } from 'vitest'\nimport { startInventory, type RunningPart } from './parts' // starts the receiving part against the broker\n\nlet rabbit: StartedRabbitMQContainer\nlet inventory: RunningPart\nbeforeAll(async () => {\n rabbit = await new RabbitMQContainer('rabbitmq:4-management').start()\n inventory = await startInventory({ AMQP_URL: rabbit.getAmqpUrl() })\n}, 120_000)\nafterAll(async () => { await inventory.stop(); await rabbit.stop() })\n\nconst send = async (id: string) => {\n const channel = await (await amqp.connect(rabbit.getAmqpUrl())).createChannel()\n await channel.assertQueue('inventory.commands', { durable: true })\n channel.sendToQueue('inventory.commands', Buffer.from(JSON.stringify({ type: 'reserve-stock', id, sku: 'SKU-1', quantity: 2 })))\n}\nconst replyTo = async (id: string, withinMs: number) => {\n const channel = await (await amqp.connect(rabbit.getAmqpUrl())).createChannel()\n await channel.assertQueue('ordering.replies', { durable: true })\n await new Promise<void>((resolve, reject) => {\n const timer = setTimeout(() => reject(new Error(`no reply for ${id} within ${withinMs} ms`)), withinMs)\n channel.consume('ordering.replies', (m) => {\n if (m && JSON.parse(m.content.toString()).commandId === id) { clearTimeout(timer); channel.ack(m); resolve() }\n })\n })\n}\n\nit('answers a command within {{PROPAGATION_SECONDS}} s while the receiver is up', async () => {\n const id = randomUUID()\n await send(id)\n await replyTo(id, {{PROPAGATION_SECONDS}} * 1000)\n})\n\nit('answers a command sent while the receiver was down, once it is back', async () => {\n await inventory.stop()\n const id = randomUUID()\n await send(id)\n inventory = await startInventory({ AMQP_URL: rabbit.getAmqpUrl() })\n await replyTo(id, {{PROPAGATION_SECONDS}} * 1000) // rejects when no reply comes in time\n})\n```",
|
|
719
926
|
"hubWhen": {
|
|
720
927
|
"DEFAULT": [
|
|
721
928
|
"commands"
|
|
@@ -727,13 +934,52 @@
|
|
|
727
934
|
"type": "fitness-fn",
|
|
728
935
|
"label": "Message contracts valid",
|
|
729
936
|
"x": 1040,
|
|
730
|
-
"y":
|
|
731
|
-
"
|
|
732
|
-
"
|
|
733
|
-
"
|
|
937
|
+
"y": 650,
|
|
938
|
+
"characteristic": "compatibility",
|
|
939
|
+
"scope": "atomic",
|
|
940
|
+
"cadence": "triggered",
|
|
941
|
+
"trigger": "pull-request",
|
|
942
|
+
"invocation": "automated",
|
|
943
|
+
"description": "CI validates and lints every part's AsyncAPI document and compares the channel addresses in the documents with the topics declared for the broker: Strimzi KafkaTopic manifests under platform/kafka/topics, and the topics of a managed broker (aws_sns_topic, google_pubsub_topic, azurerm_servicebus_topic, confluent_kafka_topic) read from the Terraform state under infra/ with the job's read access to it. A topic no document describes fails the job, and so does finding no topic at all.\n\nThreshold: 0 AsyncAPI validation errors, 0 Spectral warnings, and every topic declared for the broker described in an AsyncAPI document\n\nTool: AsyncAPI CLI and Spectral (spectral:asyncapi) with yq, jq and terraform show -json in GitHub Actions\n\n```yaml\n# .github/workflows/contracts.yml (.spectral-asyncapi.yaml holds: extends: [\"spectral:asyncapi\"])\njobs:\n asyncapi:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - run: |\n for doc in services/*/asyncapi.yaml; do npx -y @asyncapi/cli validate \"$doc\"; done\n - run: npx -y @stoplight/spectral-cli lint \"services/*/asyncapi.yaml\" --ruleset .spectral-asyncapi.yaml --fail-severity warn\n - uses: hashicorp/setup-terraform@v3.1.2 # pin by commit SHA in your repository\n - run: |\n # every topic declared for the broker is described in some AsyncAPI document\n shopt -s nullglob\n yq '.channels[].address' services/*/asyncapi.yaml | sort -u > described.txt\n manifests=(platform/kafka/topics/*.yaml) # Strimzi KafkaTopic manifests\n if [ ${#manifests[@]} -gt 0 ]; then yq '.spec.topicName // .metadata.name' \"${manifests[@]}\"; fi > used.txt\n if [ -d infra ]; then # topics of a managed broker, from the Terraform state\n terraform -chdir=infra init -input=false > /dev/null\n terraform -chdir=infra show -json | jq -r '\n def modules: ., (.child_modules[]? | modules);\n .values.root_module | modules | .resources[]?\n | select(.type | IN(\"aws_sns_topic\", \"google_pubsub_topic\", \"azurerm_servicebus_topic\", \"confluent_kafka_topic\"))\n | .values.name // .values.topic_name' >> used.txt\n fi\n sort -u -o used.txt used.txt\n [ -s used.txt ] || { echo \"no topics found in platform/kafka/topics or infra/\"; exit 1; }\n comm -23 used.txt described.txt | tee undescribed.txt\n [ ! -s undescribed.txt ]\n```",
|
|
944
|
+
"hubWhen": {
|
|
945
|
+
"DEFAULT": [
|
|
946
|
+
"events",
|
|
947
|
+
"streams"
|
|
948
|
+
]
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
"id": "ff-asyncapi-queues",
|
|
953
|
+
"type": "fitness-fn",
|
|
954
|
+
"label": "Command contracts valid",
|
|
955
|
+
"x": 1040,
|
|
956
|
+
"y": 780,
|
|
957
|
+
"characteristic": "compatibility",
|
|
958
|
+
"scope": "atomic",
|
|
959
|
+
"cadence": "triggered",
|
|
960
|
+
"trigger": "pull-request",
|
|
961
|
+
"invocation": "automated",
|
|
962
|
+
"description": "CI validates and lints every part's AsyncAPI document and compares the channel addresses in the documents with the queues declared for the broker: the RabbitMQ definitions file the broker is loaded with, and the queues of a managed broker (aws_sqs_queue, azurerm_servicebus_queue) read from the Terraform state under infra/. A queue no document describes fails the job, and so does finding no queue at all.\n\nThreshold: 0 AsyncAPI validation errors, 0 Spectral warnings, and every queue declared for the broker described in an AsyncAPI document\n\nTool: AsyncAPI CLI and Spectral (spectral:asyncapi) with yq, jq and terraform show -json in GitHub Actions\n\n```yaml\n# .github/workflows/contracts.yml (.spectral-asyncapi.yaml holds: extends: [\"spectral:asyncapi\"])\njobs:\n asyncapi:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - run: |\n for doc in services/*/asyncapi.yaml; do npx -y @asyncapi/cli validate \"$doc\"; done\n - run: npx -y @stoplight/spectral-cli lint \"services/*/asyncapi.yaml\" --ruleset .spectral-asyncapi.yaml --fail-severity warn\n - uses: hashicorp/setup-terraform@v3.1.2 # pin by commit SHA in your repository\n - run: |\n # every queue declared for the broker is described in some AsyncAPI document\n yq '.channels[].address' services/*/asyncapi.yaml | sort -u > described.txt\n defs=platform/rabbitmq/definitions.json\n if [ -f \"$defs\" ]; then jq -r '.queues[].name' \"$defs\"; fi > used.txt\n if [ -d infra ]; then # queues of a managed broker, from the Terraform state\n terraform -chdir=infra init -input=false > /dev/null\n terraform -chdir=infra show -json | jq -r '\n def modules: ., (.child_modules[]? | modules);\n .values.root_module | modules | .resources[]?\n | select(.type | IN(\"aws_sqs_queue\", \"azurerm_servicebus_queue\")) | .values.name' >> used.txt\n fi\n sort -u -o used.txt used.txt\n [ -s used.txt ] || { echo \"no queues found in $defs or infra/\"; exit 1; }\n comm -23 used.txt described.txt | tee undescribed.txt\n [ ! -s undescribed.txt ]\n```",
|
|
963
|
+
"hubWhen": {
|
|
964
|
+
"DEFAULT": [
|
|
965
|
+
"commands"
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
"id": "ff-no-sync-calls",
|
|
971
|
+
"type": "fitness-fn",
|
|
972
|
+
"label": "No undecided synchronous call",
|
|
973
|
+
"x": 1040,
|
|
974
|
+
"y": 910,
|
|
975
|
+
"characteristic": "maintainability",
|
|
976
|
+
"scope": "holistic",
|
|
977
|
+
"cadence": "triggered",
|
|
978
|
+
"trigger": "pull-request",
|
|
979
|
+
"invocation": "automated",
|
|
980
|
+
"description": "From the same traces as the depth check, the test pairs each client span with the server span it produced in another part and checks the pair against the list of recorded exceptions (caller, callee, ADR); a call to a system outside has no server span and is not counted, and the suite's own requests to the back end are not spans.\n\nThreshold: 0 synchronous calls between back-end parts in the traces of the end-to-end journeys outside the recorded exceptions\n\nTool: Vitest with Jaeger (test/e2e/traces.ts); for the JVM: the same test with JUnit 5\n\n```ts\nimport { expect, it } from 'vitest'\nimport exceptions from './sync-call-exceptions.json' // [{ \"from\": \"ordering\", \"to\": \"payment\", \"adr\": \"ADR-023 Payment authorisation is synchronous\" }]\nimport { journeys } from './journeys'\nimport { newTraceId, trace, traceparent } from './traces'\n\nit.each(journeys)('$name makes no synchronous call between back-end parts outside the recorded exceptions', async (journey) => {\n const traceId = newTraceId()\n await journey.run({ traceparent: traceparent(traceId) })\n const spans = await trace(traceId)\n const calls = spans.filter((s) => s.rpc).map((client) => ({\n from: client.service,\n to: spans.find((s) => s.kind === 'server' && s.parent === client.id)?.service, // undefined: a system outside\n }))\n const undecided = calls.filter((c) => c.to && !exceptions.some((e) => e.from === c.from && e.to === c.to))\n expect(undecided).toEqual([])\n})\n```",
|
|
734
981
|
"hubWhen": {
|
|
735
982
|
"DEFAULT": [
|
|
736
|
-
"commands",
|
|
737
983
|
"events",
|
|
738
984
|
"streams"
|
|
739
985
|
]
|
|
@@ -744,10 +990,12 @@
|
|
|
744
990
|
"type": "fitness-fn",
|
|
745
991
|
"label": "Events applied in time",
|
|
746
992
|
"x": 1040,
|
|
747
|
-
"y":
|
|
748
|
-
"
|
|
749
|
-
"
|
|
750
|
-
"
|
|
993
|
+
"y": 1040,
|
|
994
|
+
"characteristic": "performance-efficiency",
|
|
995
|
+
"scope": "holistic",
|
|
996
|
+
"cadence": "continual",
|
|
997
|
+
"invocation": "automated",
|
|
998
|
+
"description": "Each subscriber records, for every event it applies, the seconds since the event's time attribute as a histogram event_applied_delay_seconds labelled with the subscriber; an alert fires when the 99th percentile passes the limit.\n\nThreshold: 99th percentile of the time from publishing an event to its being applied by each subscriber at most {{PROPAGATION_SECONDS}} seconds over 10 minutes\n\nTool: Prometheus alerting rule (the histogram is exported by the subscribers with the OpenTelemetry metrics SDK or Micrometer)\n\n```yaml\ngroups:\n - name: event-propagation\n rules:\n - alert: EventsAppliedLate\n expr: |\n histogram_quantile(0.99, sum by (le, subscriber) (rate(event_applied_delay_seconds_bucket[10m]))) > {{PROPAGATION_SECONDS}}\n for: 10m\n labels: { severity: page }\n annotations:\n summary: \"{{ $labels.subscriber }} applies events later than {{PROPAGATION_SECONDS}} s\"\n```",
|
|
751
999
|
"hubWhen": {
|
|
752
1000
|
"DEFAULT": [
|
|
753
1001
|
"events",
|
|
@@ -760,10 +1008,13 @@
|
|
|
760
1008
|
"type": "fitness-fn",
|
|
761
1009
|
"label": "Log keeps events",
|
|
762
1010
|
"x": 1040,
|
|
763
|
-
"y":
|
|
764
|
-
"
|
|
765
|
-
"
|
|
766
|
-
"
|
|
1011
|
+
"y": 1170,
|
|
1012
|
+
"characteristic": "reliability",
|
|
1013
|
+
"scope": "atomic",
|
|
1014
|
+
"cadence": "triggered",
|
|
1015
|
+
"trigger": "pull-request",
|
|
1016
|
+
"invocation": "automated",
|
|
1017
|
+
"description": "Topics are declared as Strimzi KafkaTopic manifests under platform/kafka/topics; a policy run in CI over the manifests refuses a topic whose cleanup policy deletes and whose retention is shorter than the limit (a purely compacted topic keeps the latest state per key and passes).\n\nThreshold: 0 deleting topics (cleanup.policy delete or compact,delete) retaining events for less than {{RETENTION_DAYS}} days\n\nTool: Conftest (Open Policy Agent, rego.v1) over the KafkaTopic manifests; for a managed Kafka declared in Terraform: the same rule over the config of confluent_kafka_topic resources in terraform show -json\n\n```rego\npackage main\nimport rego.v1\n\nmin_ms := {{RETENTION_DAYS}} * 24 * 60 * 60 * 1000\n\ndeny contains msg if {\n input.kind == \"KafkaTopic\"\n cfg := object.get(input.spec, \"config\", {})\n contains(object.get(cfg, \"cleanup.policy\", \"delete\"), \"delete\") # \"delete\" and \"compact,delete\" both delete\n retention := to_number(object.get(cfg, \"retention.ms\", 604800000))\n retention >= 0\n retention < min_ms\n msg := sprintf(\"topic %s keeps events less than {{RETENTION_DAYS}} days\", [input.metadata.name])\n}\n```",
|
|
767
1018
|
"hubWhen": {
|
|
768
1019
|
"DEFAULT": [
|
|
769
1020
|
"streams"
|
|
@@ -775,10 +1026,13 @@
|
|
|
775
1026
|
"type": "fitness-fn",
|
|
776
1027
|
"label": "Call contracts linted",
|
|
777
1028
|
"x": 1040,
|
|
778
|
-
"y":
|
|
779
|
-
"
|
|
780
|
-
"
|
|
781
|
-
"
|
|
1029
|
+
"y": 1300,
|
|
1030
|
+
"characteristic": "compatibility",
|
|
1031
|
+
"scope": "atomic",
|
|
1032
|
+
"cadence": "triggered",
|
|
1033
|
+
"trigger": "pull-request",
|
|
1034
|
+
"invocation": "automated",
|
|
1035
|
+
"description": "Spectral lints every part's OpenAPI document with the built-in OpenAPI ruleset plus the house rules (operation ids, problem+json errors) and fails the build on a warning.\n\nThreshold: 0 errors or warnings from the house ruleset on every OpenAPI document\n\nTool: Spectral (spectral:oas); for Buf-generated OpenAPI from .proto files the same ruleset applies\n\n```yaml\n# .spectral.yaml — npx -y @stoplight/spectral-cli lint \"services/*/openapi.yaml\" --fail-severity warn\nextends: [\"spectral:oas\"]\nrules:\n operation-operationId: error\n errors-use-problem-json:\n description: Every error response is application/problem+json\n given: \"$.paths.*.*.responses[?(@property >= '400')].content\"\n then: { field: \"application/problem+json\", function: truthy }\n severity: error\n```",
|
|
782
1036
|
"hubWhen": {
|
|
783
1037
|
"SYNC_API": [
|
|
784
1038
|
"rest"
|
|
@@ -790,10 +1044,13 @@
|
|
|
790
1044
|
"type": "fitness-fn",
|
|
791
1045
|
"label": "Proto contracts checked",
|
|
792
1046
|
"x": 1040,
|
|
793
|
-
"y":
|
|
794
|
-
"
|
|
795
|
-
"
|
|
796
|
-
"
|
|
1047
|
+
"y": 1430,
|
|
1048
|
+
"characteristic": "compatibility",
|
|
1049
|
+
"scope": "atomic",
|
|
1050
|
+
"cadence": "triggered",
|
|
1051
|
+
"trigger": "pull-request",
|
|
1052
|
+
"invocation": "automated",
|
|
1053
|
+
"description": "Buf lints every .proto file with its STANDARD rules and compares them with the main branch, failing on a field number reused, a field removed or a type changed. Deadlines are set by the house client wrapper, not by the contract.\n\nThreshold: 0 buf lint errors and 0 breaking changes against the main branch in the .proto files\n\nTool: Buf (buf lint, buf breaking)\n\n```yaml\n# buf.yaml\nversion: v2\nmodules:\n - path: proto\nlint:\n use: [STANDARD]\nbreaking:\n use: [FILE]\n# CI:\n# buf lint\n# buf breaking --against '.git#branch=main'\n```",
|
|
797
1054
|
"hubWhen": {
|
|
798
1055
|
"SYNC_API": [
|
|
799
1056
|
"grpc"
|
|
@@ -805,10 +1062,13 @@
|
|
|
805
1062
|
"type": "fitness-fn",
|
|
806
1063
|
"label": "No breaking contract change",
|
|
807
1064
|
"x": 1040,
|
|
808
|
-
"y":
|
|
809
|
-
"
|
|
810
|
-
"
|
|
811
|
-
"
|
|
1065
|
+
"y": 1560,
|
|
1066
|
+
"characteristic": "compatibility",
|
|
1067
|
+
"scope": "atomic",
|
|
1068
|
+
"cadence": "triggered",
|
|
1069
|
+
"trigger": "pull-request",
|
|
1070
|
+
"invocation": "automated",
|
|
1071
|
+
"description": "For each changed contract, CI compares the new version with the one on main: oasdiff for OpenAPI, the AsyncAPI CLI's diff for AsyncAPI (Buf covers .proto files, see Proto contracts checked). A breaking change fails the build.\n\nThreshold: 0 breaking changes against the main branch in OpenAPI and AsyncAPI documents\n\nTool: oasdiff (breaking --fail-on ERR) and AsyncAPI CLI (diff, which exits with an error on a breaking change)\n\n```bash\nset -euo pipefail\nfor doc in services/*/openapi.yaml; do\n git show \"origin/main:$doc\" > base.yaml 2>/dev/null || continue # new contract\n oasdiff breaking --fail-on ERR base.yaml \"$doc\"\ndone\nfor doc in services/*/asyncapi.yaml; do\n git show \"origin/main:$doc\" > base.yaml 2>/dev/null || continue\n npx -y @asyncapi/cli diff base.yaml \"$doc\" --type breaking --format json # exits non-zero on a breaking change\ndone\n```",
|
|
812
1072
|
"hubWhen": {
|
|
813
1073
|
"CONTRACTS": [
|
|
814
1074
|
"spec"
|
|
@@ -820,10 +1080,13 @@
|
|
|
820
1080
|
"type": "fitness-fn",
|
|
821
1081
|
"label": "Consumers' pacts pass",
|
|
822
1082
|
"x": 1040,
|
|
823
|
-
"y":
|
|
824
|
-
"
|
|
825
|
-
"
|
|
826
|
-
"
|
|
1083
|
+
"y": 1690,
|
|
1084
|
+
"characteristic": "compatibility",
|
|
1085
|
+
"scope": "holistic",
|
|
1086
|
+
"cadence": "triggered",
|
|
1087
|
+
"trigger": "pull-request",
|
|
1088
|
+
"invocation": "automated",
|
|
1089
|
+
"description": "Every provider build verifies the pacts of its consumers (HTTP interactions with the Verifier, messages with MessageProviderPact) and publishes the result to the Pact Broker; the deploy job runs can-i-deploy first and records the deployment after.\n\nThreshold: 100% of the pacts of consumer versions on main or deployed verified in every provider build; 0 deploys without a passing can-i-deploy answer\n\nTool: Pact (pact-js Verifier and MessageProviderPact; for gRPC the pact-protobuf-plugin through pact-js's plugin API, PactV4) and the Pact Broker CLI from @pact-foundation/pact-cli; for the JVM: pact-jvm's @PactBroker provider tests with the same CLI\n\n```ts\nimport { Verifier } from '@pact-foundation/pact'\nimport { it } from 'vitest'\n\nit('honours every consumer\\'s pact', () =>\n new Verifier({\n provider: 'ordering',\n providerBaseUrl: 'http://localhost:8080',\n pactBrokerUrl: process.env.PACT_BROKER_URL,\n pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n consumerVersionSelectors: [{ mainBranch: true }, { deployedOrReleased: true }],\n publishVerificationResult: true,\n providerVersion: process.env.GIT_SHA,\n providerVersionBranch: process.env.GIT_BRANCH,\n }).verifyProvider())\n\n// deploy job, before and after deploying (the one CLI; `npx pact-broker` alone does not exist):\n// npx --package=@pact-foundation/pact-cli pact-broker can-i-deploy --pacticipant ordering --version \"$GIT_SHA\" \\\n// --to-environment production --broker-base-url \"$PACT_BROKER_URL\" --broker-token \"$PACT_BROKER_TOKEN\" \\\n// --retry-while-unknown 6 --retry-interval 10\n// ./deploy.sh services/ordering\n// npx --package=@pact-foundation/pact-cli pact-broker record-deployment --pacticipant ordering --version \"$GIT_SHA\" \\\n// --environment production --broker-base-url \"$PACT_BROKER_URL\" --broker-token \"$PACT_BROKER_TOKEN\"\n```",
|
|
827
1090
|
"hubWhen": {
|
|
828
1091
|
"CONTRACTS": [
|
|
829
1092
|
"pact"
|
|
@@ -835,28 +1098,77 @@
|
|
|
835
1098
|
"type": "fitness-fn",
|
|
836
1099
|
"label": "Workflows compensate",
|
|
837
1100
|
"x": 1040,
|
|
838
|
-
"y":
|
|
839
|
-
"
|
|
840
|
-
"
|
|
841
|
-
"
|
|
1101
|
+
"y": 1820,
|
|
1102
|
+
"characteristic": "reliability",
|
|
1103
|
+
"scope": "atomic",
|
|
1104
|
+
"cadence": "triggered",
|
|
1105
|
+
"trigger": "pull-request",
|
|
1106
|
+
"invocation": "automated",
|
|
1107
|
+
"description": "Workflow tests run in Temporal's time-skipping test environment with the activities mocked; for each step the test makes it fail with a non-retryable failure and verifies the compensations of the earlier steps ran.\n\nThreshold: Every workflow has a test in which each step that changes data fails once and the earlier steps are compensated\n\nTool: Temporal TypeScript SDK (@temporalio/testing) with Vitest; for the JVM: Temporal's TestWorkflowExtension with JUnit 5\n\n```ts\nimport { WorkflowFailedError } from '@temporalio/client'\nimport { ApplicationFailure } from '@temporalio/common'\nimport { TestWorkflowEnvironment } from '@temporalio/testing'\nimport { Worker } from '@temporalio/worker'\nimport { afterAll, beforeAll, expect, it, vi } from 'vitest'\nimport type * as activities from '../src/activities'\nimport { placeOrder } from '../src/workflows'\n\nconst ORDER = { id: 'order-1', sku: 'SKU-1', quantity: 2, amountCents: 4200 } // the workflow's input, as src/workflows declares it\n\nlet env: TestWorkflowEnvironment\nbeforeAll(async () => { env = await TestWorkflowEnvironment.createTimeSkipping() })\nafterAll(async () => { await env?.teardown() })\n\nit('releases the stock when the payment is declined', async () => {\n const mocks = {\n reserveStock: vi.fn(async () => 'reservation-1'),\n releaseStock: vi.fn(async () => {}),\n charge: vi.fn(async () => { throw ApplicationFailure.nonRetryable('declined', 'PaymentDeclined') }),\n bookShipping: vi.fn(async () => 'shipment-1'),\n } satisfies typeof activities\n const worker = await Worker.create({\n connection: env.nativeConnection,\n taskQueue: 'test',\n workflowsPath: new URL('../src/workflows.ts', import.meta.url).pathname,\n activities: mocks,\n })\n await expect(worker.runUntil(\n env.client.workflow.execute(placeOrder, { args: [ORDER], workflowId: 'order-1', taskQueue: 'test' }),\n )).rejects.toBeInstanceOf(WorkflowFailedError)\n expect(mocks.releaseStock).toHaveBeenCalledWith('reservation-1')\n expect(mocks.bookShipping).not.toHaveBeenCalled()\n})\n```",
|
|
842
1108
|
"hubWhen": {
|
|
843
1109
|
"FLOWS": [
|
|
844
1110
|
"orchestration"
|
|
845
1111
|
]
|
|
846
1112
|
}
|
|
847
1113
|
},
|
|
1114
|
+
{
|
|
1115
|
+
"id": "ff-workflow-fallback",
|
|
1116
|
+
"type": "fitness-fn",
|
|
1117
|
+
"label": "Workflows compensate",
|
|
1118
|
+
"x": 1040,
|
|
1119
|
+
"y": 1950,
|
|
1120
|
+
"characteristic": "reliability",
|
|
1121
|
+
"scope": "atomic",
|
|
1122
|
+
"cadence": "triggered",
|
|
1123
|
+
"trigger": "pull-request",
|
|
1124
|
+
"invocation": "automated",
|
|
1125
|
+
"description": "Workflow tests run in Temporal's time-skipping test environment with the activities mocked; for each step the test makes it fail with a non-retryable failure and verifies the compensations of the earlier steps ran.\n\nThreshold: Every workflow has a test in which each step that changes data fails once and the earlier steps are compensated\n\nTool: Temporal TypeScript SDK (@temporalio/testing) with Vitest; for the JVM: Temporal's TestWorkflowExtension with JUnit 5\n\n```ts\nimport { WorkflowFailedError } from '@temporalio/client'\nimport { ApplicationFailure } from '@temporalio/common'\nimport { TestWorkflowEnvironment } from '@temporalio/testing'\nimport { Worker } from '@temporalio/worker'\nimport { afterAll, beforeAll, expect, it, vi } from 'vitest'\nimport type * as activities from '../src/activities'\nimport { placeOrder } from '../src/workflows'\n\nconst ORDER = { id: 'order-1', sku: 'SKU-1', quantity: 2, amountCents: 4200 } // the workflow's input, as src/workflows declares it\n\nlet env: TestWorkflowEnvironment\nbeforeAll(async () => { env = await TestWorkflowEnvironment.createTimeSkipping() })\nafterAll(async () => { await env?.teardown() })\n\nit('releases the stock when the payment is declined', async () => {\n const mocks = {\n reserveStock: vi.fn(async () => 'reservation-1'),\n releaseStock: vi.fn(async () => {}),\n charge: vi.fn(async () => { throw ApplicationFailure.nonRetryable('declined', 'PaymentDeclined') }),\n bookShipping: vi.fn(async () => 'shipment-1'),\n } satisfies typeof activities\n const worker = await Worker.create({\n connection: env.nativeConnection,\n taskQueue: 'test',\n workflowsPath: new URL('../src/workflows.ts', import.meta.url).pathname,\n activities: mocks,\n })\n await expect(worker.runUntil(\n env.client.workflow.execute(placeOrder, { args: [ORDER], workflowId: 'order-1', taskQueue: 'test' }),\n )).rejects.toBeInstanceOf(WorkflowFailedError)\n expect(mocks.releaseStock).toHaveBeenCalledWith('reservation-1')\n expect(mocks.bookShipping).not.toHaveBeenCalled()\n})\n```",
|
|
1126
|
+
"hubWhen": {
|
|
1127
|
+
"FLOWS": [
|
|
1128
|
+
"choreography"
|
|
1129
|
+
],
|
|
1130
|
+
"DEFAULT": [
|
|
1131
|
+
"sync",
|
|
1132
|
+
"commands"
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
848
1136
|
{
|
|
849
1137
|
"id": "ff-stuck-flows",
|
|
850
1138
|
"type": "fitness-fn",
|
|
851
1139
|
"label": "Stuck flows alerted",
|
|
852
1140
|
"x": 1040,
|
|
853
|
-
"y":
|
|
854
|
-
"
|
|
855
|
-
"
|
|
856
|
-
"
|
|
1141
|
+
"y": 2080,
|
|
1142
|
+
"characteristic": "reliability",
|
|
1143
|
+
"scope": "holistic",
|
|
1144
|
+
"cadence": "continual",
|
|
1145
|
+
"invocation": "automated",
|
|
1146
|
+
"description": "A process monitor subscribes to the start and end events of each documented flow, correlated by id, and exports the age of the oldest open instance per flow as flow_oldest_open_instance_seconds; the alert names the flow and goes to the owner of the step expected next.\n\nThreshold: 0 flow instances open longer than {{FLOW_MINUTES}} minutes without an alert\n\nTool: Prometheus alerting rule (the gauge is exported by the process monitor)\n\n```yaml\ngroups:\n - name: choreographed-flows\n rules:\n - alert: FlowStuck\n expr: max by (flow, next_step_owner) (flow_oldest_open_instance_seconds) > {{FLOW_MINUTES}} * 60\n labels: { severity: ticket }\n annotations:\n summary: \"A {{ $labels.flow }} flow has been open for more than {{FLOW_MINUTES}} minutes\"\n```",
|
|
857
1147
|
"hubWhen": {
|
|
858
1148
|
"FLOWS": [
|
|
859
1149
|
"choreography"
|
|
1150
|
+
],
|
|
1151
|
+
"DEFAULT": [
|
|
1152
|
+
"events",
|
|
1153
|
+
"streams"
|
|
1154
|
+
]
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
"id": "ff-local-flows",
|
|
1159
|
+
"type": "fitness-fn",
|
|
1160
|
+
"label": "No write crosses a part",
|
|
1161
|
+
"x": 1040,
|
|
1162
|
+
"y": 2210,
|
|
1163
|
+
"characteristic": "maintainability",
|
|
1164
|
+
"scope": "holistic",
|
|
1165
|
+
"cadence": "triggered",
|
|
1166
|
+
"trigger": "pull-request",
|
|
1167
|
+
"invocation": "automated",
|
|
1168
|
+
"description": "From the same traces as the depth check, the test lists the HTTP client spans of each data-changing journey and fails on one whose method changes data in another part; reads between parts pass. For gRPC the mutating methods are named in a list instead of taken from the HTTP method.\n\nThreshold: 0 client spans with a mutating method (POST, PUT, PATCH, DELETE) between parts in the traces of the journeys that change data\n\nTool: Vitest with Jaeger (test/e2e/traces.ts); for the JVM: the same test with JUnit 5\n\n```ts\nimport { expect, it } from 'vitest'\nimport { journeys } from './journeys'\nimport { newTraceId, trace, traceparent } from './traces'\n\nconst MUTATING = new Set(['POST', 'PUT', 'PATCH', 'DELETE'])\n\nit.each(journeys.filter((j) => j.changesData))('$name changes data in one part only', async (journey) => {\n const traceId = newTraceId()\n await journey.run({ traceparent: traceparent(traceId) })\n const spans = await trace(traceId)\n const writesElsewhere = spans\n .filter((s) => s.rpc && MUTATING.has(s.method ?? ''))\n .map((client) => ({ from: client.service, to: spans.find((s) => s.kind === 'server' && s.parent === client.id)?.service, method: client.method }))\n .filter((c) => c.to !== undefined) // a system outside is not a part\n expect(writesElsewhere).toEqual([])\n})\n```",
|
|
1169
|
+
"hubWhen": {
|
|
1170
|
+
"FLOWS": [
|
|
1171
|
+
"local"
|
|
860
1172
|
]
|
|
861
1173
|
}
|
|
862
1174
|
}
|
|
@@ -916,6 +1228,12 @@
|
|
|
916
1228
|
"targetId": "need",
|
|
917
1229
|
"relationType": "derives"
|
|
918
1230
|
},
|
|
1231
|
+
{
|
|
1232
|
+
"id": "req-orchestrated-fallback--derives--need",
|
|
1233
|
+
"sourceId": "req-orchestrated-fallback",
|
|
1234
|
+
"targetId": "need",
|
|
1235
|
+
"relationType": "derives"
|
|
1236
|
+
},
|
|
919
1237
|
{
|
|
920
1238
|
"id": "req-choreographed--derives--need",
|
|
921
1239
|
"sourceId": "req-choreographed",
|
|
@@ -994,6 +1312,12 @@
|
|
|
994
1312
|
"targetId": "req-orchestrated",
|
|
995
1313
|
"relationType": "verifies"
|
|
996
1314
|
},
|
|
1315
|
+
{
|
|
1316
|
+
"id": "sc-orchestrated-fallback--verifies--req-orchestrated-fallback",
|
|
1317
|
+
"sourceId": "sc-orchestrated-fallback",
|
|
1318
|
+
"targetId": "req-orchestrated-fallback",
|
|
1319
|
+
"relationType": "verifies"
|
|
1320
|
+
},
|
|
997
1321
|
{
|
|
998
1322
|
"id": "sc-choreographed--verifies--req-choreographed",
|
|
999
1323
|
"sourceId": "sc-choreographed",
|
|
@@ -1049,141 +1373,111 @@
|
|
|
1049
1373
|
"relationType": "implements"
|
|
1050
1374
|
},
|
|
1051
1375
|
{
|
|
1052
|
-
"id": "ff-
|
|
1053
|
-
"sourceId": "ff-
|
|
1054
|
-
"targetId": "adr-commands",
|
|
1055
|
-
"relationType": "implements"
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
"id": "ff-asyncapi--implements--adr-commands",
|
|
1059
|
-
"sourceId": "ff-asyncapi",
|
|
1376
|
+
"id": "ff-budget--implements--adr-commands",
|
|
1377
|
+
"sourceId": "ff-budget",
|
|
1060
1378
|
"targetId": "adr-commands",
|
|
1061
1379
|
"relationType": "implements"
|
|
1062
1380
|
},
|
|
1063
1381
|
{
|
|
1064
|
-
"id": "ff-
|
|
1065
|
-
"sourceId": "ff-
|
|
1066
|
-
"targetId": "adr-events",
|
|
1067
|
-
"relationType": "implements"
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
"id": "ff-asyncapi--implements--adr-streams",
|
|
1071
|
-
"sourceId": "ff-asyncapi",
|
|
1072
|
-
"targetId": "adr-streams",
|
|
1073
|
-
"relationType": "implements"
|
|
1074
|
-
},
|
|
1075
|
-
{
|
|
1076
|
-
"id": "ff-propagation--implements--adr-events",
|
|
1077
|
-
"sourceId": "ff-propagation",
|
|
1382
|
+
"id": "ff-budget--implements--adr-events",
|
|
1383
|
+
"sourceId": "ff-budget",
|
|
1078
1384
|
"targetId": "adr-events",
|
|
1079
1385
|
"relationType": "implements"
|
|
1080
1386
|
},
|
|
1081
1387
|
{
|
|
1082
|
-
"id": "ff-
|
|
1083
|
-
"sourceId": "ff-
|
|
1388
|
+
"id": "ff-budget--implements--adr-streams",
|
|
1389
|
+
"sourceId": "ff-budget",
|
|
1084
1390
|
"targetId": "adr-streams",
|
|
1085
1391
|
"relationType": "implements"
|
|
1086
1392
|
},
|
|
1087
1393
|
{
|
|
1088
|
-
"id": "ff-
|
|
1089
|
-
"sourceId": "ff-
|
|
1090
|
-
"targetId": "adr-
|
|
1394
|
+
"id": "ff-deadline--implements--adr-rest",
|
|
1395
|
+
"sourceId": "ff-deadline",
|
|
1396
|
+
"targetId": "adr-rest",
|
|
1091
1397
|
"relationType": "implements"
|
|
1092
1398
|
},
|
|
1093
1399
|
{
|
|
1094
|
-
"id": "ff-
|
|
1095
|
-
"sourceId": "ff-
|
|
1096
|
-
"targetId": "adr-
|
|
1400
|
+
"id": "ff-deadline-grpc--implements--adr-grpc",
|
|
1401
|
+
"sourceId": "ff-deadline-grpc",
|
|
1402
|
+
"targetId": "adr-grpc",
|
|
1097
1403
|
"relationType": "implements"
|
|
1098
1404
|
},
|
|
1099
1405
|
{
|
|
1100
|
-
"id": "ff-
|
|
1101
|
-
"sourceId": "ff-
|
|
1406
|
+
"id": "ff-command-reply--implements--adr-commands",
|
|
1407
|
+
"sourceId": "ff-command-reply",
|
|
1102
1408
|
"targetId": "adr-commands",
|
|
1103
1409
|
"relationType": "implements"
|
|
1104
1410
|
},
|
|
1105
1411
|
{
|
|
1106
|
-
"id": "ff-
|
|
1107
|
-
"sourceId": "ff-
|
|
1412
|
+
"id": "ff-asyncapi--implements--adr-events",
|
|
1413
|
+
"sourceId": "ff-asyncapi",
|
|
1108
1414
|
"targetId": "adr-events",
|
|
1109
1415
|
"relationType": "implements"
|
|
1110
1416
|
},
|
|
1111
1417
|
{
|
|
1112
|
-
"id": "ff-
|
|
1113
|
-
"sourceId": "ff-
|
|
1418
|
+
"id": "ff-asyncapi--implements--adr-streams",
|
|
1419
|
+
"sourceId": "ff-asyncapi",
|
|
1114
1420
|
"targetId": "adr-streams",
|
|
1115
1421
|
"relationType": "implements"
|
|
1116
1422
|
},
|
|
1117
1423
|
{
|
|
1118
|
-
"id": "ff-
|
|
1119
|
-
"sourceId": "ff-
|
|
1120
|
-
"targetId": "adr-sync",
|
|
1121
|
-
"relationType": "implements"
|
|
1122
|
-
},
|
|
1123
|
-
{
|
|
1124
|
-
"id": "ff-buf--implements--adr-commands",
|
|
1125
|
-
"sourceId": "ff-buf",
|
|
1424
|
+
"id": "ff-asyncapi-queues--implements--adr-commands",
|
|
1425
|
+
"sourceId": "ff-asyncapi-queues",
|
|
1126
1426
|
"targetId": "adr-commands",
|
|
1127
1427
|
"relationType": "implements"
|
|
1128
1428
|
},
|
|
1129
1429
|
{
|
|
1130
|
-
"id": "ff-
|
|
1131
|
-
"sourceId": "ff-
|
|
1430
|
+
"id": "ff-no-sync-calls--implements--adr-events",
|
|
1431
|
+
"sourceId": "ff-no-sync-calls",
|
|
1132
1432
|
"targetId": "adr-events",
|
|
1133
1433
|
"relationType": "implements"
|
|
1134
1434
|
},
|
|
1135
1435
|
{
|
|
1136
|
-
"id": "ff-
|
|
1137
|
-
"sourceId": "ff-
|
|
1436
|
+
"id": "ff-no-sync-calls--implements--adr-streams",
|
|
1437
|
+
"sourceId": "ff-no-sync-calls",
|
|
1138
1438
|
"targetId": "adr-streams",
|
|
1139
1439
|
"relationType": "implements"
|
|
1140
1440
|
},
|
|
1141
1441
|
{
|
|
1142
|
-
"id": "ff-
|
|
1143
|
-
"sourceId": "ff-
|
|
1144
|
-
"targetId": "adr-
|
|
1145
|
-
"relationType": "implements"
|
|
1146
|
-
},
|
|
1147
|
-
{
|
|
1148
|
-
"id": "ff-breaking--implements--adr-commands",
|
|
1149
|
-
"sourceId": "ff-breaking",
|
|
1150
|
-
"targetId": "adr-commands",
|
|
1442
|
+
"id": "ff-propagation--implements--adr-events",
|
|
1443
|
+
"sourceId": "ff-propagation",
|
|
1444
|
+
"targetId": "adr-events",
|
|
1151
1445
|
"relationType": "implements"
|
|
1152
1446
|
},
|
|
1153
1447
|
{
|
|
1154
|
-
"id": "ff-
|
|
1155
|
-
"sourceId": "ff-
|
|
1156
|
-
"targetId": "adr-
|
|
1448
|
+
"id": "ff-propagation--implements--adr-streams",
|
|
1449
|
+
"sourceId": "ff-propagation",
|
|
1450
|
+
"targetId": "adr-streams",
|
|
1157
1451
|
"relationType": "implements"
|
|
1158
1452
|
},
|
|
1159
1453
|
{
|
|
1160
|
-
"id": "ff-
|
|
1161
|
-
"sourceId": "ff-
|
|
1454
|
+
"id": "ff-retention--implements--adr-streams",
|
|
1455
|
+
"sourceId": "ff-retention",
|
|
1162
1456
|
"targetId": "adr-streams",
|
|
1163
1457
|
"relationType": "implements"
|
|
1164
1458
|
},
|
|
1165
1459
|
{
|
|
1166
|
-
"id": "ff-
|
|
1167
|
-
"sourceId": "ff-
|
|
1168
|
-
"targetId": "adr-
|
|
1460
|
+
"id": "ff-openapi--implements--adr-rest",
|
|
1461
|
+
"sourceId": "ff-openapi",
|
|
1462
|
+
"targetId": "adr-rest",
|
|
1169
1463
|
"relationType": "implements"
|
|
1170
1464
|
},
|
|
1171
1465
|
{
|
|
1172
|
-
"id": "ff-
|
|
1173
|
-
"sourceId": "ff-
|
|
1174
|
-
"targetId": "adr-
|
|
1466
|
+
"id": "ff-buf--implements--adr-grpc",
|
|
1467
|
+
"sourceId": "ff-buf",
|
|
1468
|
+
"targetId": "adr-grpc",
|
|
1175
1469
|
"relationType": "implements"
|
|
1176
1470
|
},
|
|
1177
1471
|
{
|
|
1178
|
-
"id": "ff-
|
|
1179
|
-
"sourceId": "ff-
|
|
1180
|
-
"targetId": "adr-
|
|
1472
|
+
"id": "ff-breaking--implements--adr-contract-diffs",
|
|
1473
|
+
"sourceId": "ff-breaking",
|
|
1474
|
+
"targetId": "adr-contract-diffs",
|
|
1181
1475
|
"relationType": "implements"
|
|
1182
1476
|
},
|
|
1183
1477
|
{
|
|
1184
|
-
"id": "ff-pact--implements--adr-
|
|
1478
|
+
"id": "ff-pact--implements--adr-consumer-contracts",
|
|
1185
1479
|
"sourceId": "ff-pact",
|
|
1186
|
-
"targetId": "adr-
|
|
1480
|
+
"targetId": "adr-consumer-contracts",
|
|
1187
1481
|
"relationType": "implements"
|
|
1188
1482
|
},
|
|
1189
1483
|
{
|
|
@@ -1192,11 +1486,23 @@
|
|
|
1192
1486
|
"targetId": "adr-orchestration",
|
|
1193
1487
|
"relationType": "implements"
|
|
1194
1488
|
},
|
|
1489
|
+
{
|
|
1490
|
+
"id": "ff-workflow-fallback--implements--adr-orchestration-fallback",
|
|
1491
|
+
"sourceId": "ff-workflow-fallback",
|
|
1492
|
+
"targetId": "adr-orchestration-fallback",
|
|
1493
|
+
"relationType": "implements"
|
|
1494
|
+
},
|
|
1195
1495
|
{
|
|
1196
1496
|
"id": "ff-stuck-flows--implements--adr-choreography",
|
|
1197
1497
|
"sourceId": "ff-stuck-flows",
|
|
1198
1498
|
"targetId": "adr-choreography",
|
|
1199
1499
|
"relationType": "implements"
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
"id": "ff-local-flows--implements--adr-local-flows",
|
|
1503
|
+
"sourceId": "ff-local-flows",
|
|
1504
|
+
"targetId": "adr-local-flows",
|
|
1505
|
+
"relationType": "implements"
|
|
1200
1506
|
}
|
|
1201
1507
|
]
|
|
1202
1508
|
}
|