@radicaltools/mcp 0.2.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/README.md +41 -23
- package/dist/{chunk-OGN3UW2D.js → chunk-2SZDTOYJ.js} +727 -89
- package/dist/{elkLayout-S62RLGTO.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 +1174 -0
- 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 +1268 -0
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
- package/dist/hub-catalogue/concern/concern-authentication.radical +895 -0
- package/dist/hub-catalogue/concern/concern-authorization.radical +1686 -0
- package/dist/hub-catalogue/concern/concern-availability.radical +1028 -0
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +1037 -0
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1560 -0
- package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
- package/dist/hub-catalogue/concern/concern-capacity.radical +915 -0
- 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 +1508 -0
- package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +1112 -0
- package/dist/hub-catalogue/concern/concern-data-store.radical +1282 -0
- package/dist/hub-catalogue/concern/concern-decomposition.radical +1318 -0
- 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 +1203 -0
- package/dist/hub-catalogue/concern/concern-encryption.radical +1318 -0
- 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 +1647 -0
- package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +2183 -0
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1116 -0
- package/dist/hub-catalogue/concern/concern-messaging.radical +973 -0
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +867 -0
- package/dist/hub-catalogue/concern/concern-observability.radical +997 -0
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
- package/dist/hub-catalogue/concern/concern-personal-data.radical +1949 -0
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1445 -0
- 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 +1284 -0
- 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 +1386 -0
- 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 +1440 -0
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +1212 -0
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
- package/dist/index.js +10321 -3964
- package/package.json +1 -1
- package/dist/hub-catalogue/adr/adr-api-versioning.radical +0 -53
- package/dist/hub-catalogue/adr/adr-auth-strategy.radical +0 -53
- package/dist/hub-catalogue/adr/adr-caching-strategy.radical +0 -59
- package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +0 -40
- package/dist/hub-catalogue/adr/adr-data-store.radical +0 -47
- package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +0 -53
- package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +0 -53
- package/dist/hub-catalogue/adr/adr-integration-style.radical +0 -50
- package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +0 -38
- package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +0 -40
- package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +0 -39
- package/dist/hub-catalogue/adr/adr-multi-region.radical +0 -60
- package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +0 -41
- package/dist/hub-catalogue/adr/adr-observability.radical +0 -59
- package/dist/hub-catalogue/adr/adr-realtime-transport.radical +0 -38
- package/dist/hub-catalogue/adr/adr-tech-stack.radical +0 -45
- package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +0 -40
- package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +0 -1641
- package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +0 -1428
- package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +0 -1989
- package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +0 -1701
- package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +0 -1792
- package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +0 -1421
- package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +0 -1713
- package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +0 -34
- package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +0 -52
- package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +0 -36
- package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +0 -67
- package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +0 -62
- package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +0 -53
- package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +0 -64
- package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +0 -51
- package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +0 -43
- package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +0 -37
- package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +0 -46
- package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +0 -52
- package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +0 -53
- package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +0 -59
- package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +0 -34
- package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +0 -34
- package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +0 -59
- package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +0 -44
- package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +0 -43
- package/dist/hub-catalogue/fitness-function/ff-mttr.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +0 -66
- package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +0 -35
- package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +0 -66
- package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +0 -66
- package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +0 -43
- package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +0 -57
- package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +0 -88
- package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +0 -168
- package/dist/hub-catalogue/pattern/pattern-bff.radical +0 -179
- package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +0 -114
- package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +0 -219
- package/dist/hub-catalogue/pattern/pattern-cqrs.radical +0 -195
- package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +0 -200
- package/dist/hub-catalogue/pattern/pattern-event-driven.radical +0 -210
- package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +0 -211
- package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +0 -196
- package/dist/hub-catalogue/pattern/pattern-microservices.radical +0 -262
- package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +0 -213
- package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +0 -114
- package/dist/hub-catalogue/pattern/pattern-saga.radical +0 -208
- package/dist/hub-catalogue/pattern/pattern-sidecar.radical +0 -123
- package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +0 -227
- package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +0 -209
- package/dist/hub-catalogue/requirement/req-accessibility.radical +0 -48
- package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +0 -51
- package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +0 -45
- package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +0 -46
- package/dist/hub-catalogue/requirement/req-alerting.radical +0 -52
- package/dist/hub-catalogue/requirement/req-api-response-time.radical +0 -51
- package/dist/hub-catalogue/requirement/req-api-standard.radical +0 -45
- package/dist/hub-catalogue/requirement/req-audit-logging.radical +0 -43
- package/dist/hub-catalogue/requirement/req-auth-response-time.radical +0 -45
- package/dist/hub-catalogue/requirement/req-auth.radical +0 -43
- package/dist/hub-catalogue/requirement/req-autoscaling.radical +0 -62
- package/dist/hub-catalogue/requirement/req-availability.radical +0 -50
- package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +0 -46
- package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +0 -50
- package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +0 -64
- package/dist/hub-catalogue/requirement/req-centralised-logging.radical +0 -45
- package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +0 -43
- package/dist/hub-catalogue/requirement/req-code-complexity.radical +0 -43
- package/dist/hub-catalogue/requirement/req-config-propagation.radical +0 -45
- package/dist/hub-catalogue/requirement/req-data-integrity.radical +0 -35
- package/dist/hub-catalogue/requirement/req-data-retention.radical +0 -44
- package/dist/hub-catalogue/requirement/req-db-query-response.radical +0 -44
- package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +0 -59
- package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +0 -45
- package/dist/hub-catalogue/requirement/req-encryption.radical +0 -49
- package/dist/hub-catalogue/requirement/req-error-rate.radical +0 -45
- package/dist/hub-catalogue/requirement/req-error-recovery.radical +0 -34
- package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +0 -37
- package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +0 -55
- package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +0 -69
- package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +0 -44
- package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +0 -39
- package/dist/hub-catalogue/requirement/req-health-checks.radical +0 -43
- package/dist/hub-catalogue/requirement/req-iac.radical +0 -36
- package/dist/hub-catalogue/requirement/req-idempotency.radical +0 -47
- package/dist/hub-catalogue/requirement/req-input-validation.radical +0 -37
- package/dist/hub-catalogue/requirement/req-least-privilege.radical +0 -47
- package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +0 -38
- package/dist/hub-catalogue/requirement/req-mfa.radical +0 -36
- package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +0 -42
- package/dist/hub-catalogue/requirement/req-onboarding-time.radical +0 -42
- package/dist/hub-catalogue/requirement/req-page-load-time.radical +0 -59
- package/dist/hub-catalogue/requirement/req-payout-latency.radical +0 -46
- package/dist/hub-catalogue/requirement/req-presence-latency.radical +0 -46
- package/dist/hub-catalogue/requirement/req-rate-limiting.radical +0 -45
- package/dist/hub-catalogue/requirement/req-report-generation.radical +0 -44
- package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +0 -64
- package/dist/hub-catalogue/requirement/req-resource-headroom.radical +0 -53
- package/dist/hub-catalogue/requirement/req-resource-isolation.radical +0 -37
- package/dist/hub-catalogue/requirement/req-search-response-time.radical +0 -44
- package/dist/hub-catalogue/requirement/req-secrets-management.radical +0 -45
- package/dist/hub-catalogue/requirement/req-task-success-rate.radical +0 -42
- package/dist/hub-catalogue/requirement/req-test-coverage.radical +0 -42
- package/dist/hub-catalogue/requirement/req-throughput.radical +0 -55
- package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +0 -52
- package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +0 -39
|
@@ -0,0 +1,1508 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hub": {
|
|
3
|
+
"id": "concern-communication-style",
|
|
4
|
+
"category": "concern",
|
|
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 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
|
+
"tags": [
|
|
8
|
+
"architecture",
|
|
9
|
+
"communication",
|
|
10
|
+
"rest",
|
|
11
|
+
"grpc",
|
|
12
|
+
"messaging",
|
|
13
|
+
"events",
|
|
14
|
+
"event-driven",
|
|
15
|
+
"streaming",
|
|
16
|
+
"choreography",
|
|
17
|
+
"orchestration",
|
|
18
|
+
"asyncapi"
|
|
19
|
+
],
|
|
20
|
+
"requiredMetamodel": "c4-ddd-governance-builtin",
|
|
21
|
+
"concern": {
|
|
22
|
+
"id": "communication-style",
|
|
23
|
+
"trigger": "LIST RELATIONS WHERE source.external != true AND target.external != true AND (source.type = \"container\" OR source.type = \"webapp\" OR source.type = \"component\") AND (target.type = \"container\" OR target.type = \"component\" OR target.type = \"queue\")",
|
|
24
|
+
"applyTo": "source",
|
|
25
|
+
"why": "these parts of the system call or message other parts of it, so how they talk, and how they fail together, has to be decided.",
|
|
26
|
+
"group": "architecture"
|
|
27
|
+
},
|
|
28
|
+
"sources": [
|
|
29
|
+
{
|
|
30
|
+
"title": "Martin Fowler: What do you mean by \"Event-Driven\"?",
|
|
31
|
+
"url": "https://martinfowler.com/articles/201701-event-driven.html"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"title": "microservices.io, Messaging",
|
|
35
|
+
"url": "https://microservices.io/patterns/communication-style/messaging.html"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"title": "microservices.io, Remote Procedure Invocation",
|
|
39
|
+
"url": "https://microservices.io/patterns/communication-style/rpi.html"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"title": "microservices.io, Saga (choreography and orchestration)",
|
|
43
|
+
"url": "https://microservices.io/patterns/data/saga.html"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"title": "microservices.io, Service Integration Contract Test",
|
|
47
|
+
"url": "https://microservices.io/patterns/testing/service-integration-contract-test.html"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"title": "Enterprise Integration Patterns",
|
|
51
|
+
"url": "https://www.enterpriseintegrationpatterns.com/"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"title": "AsyncAPI Specification",
|
|
55
|
+
"url": "https://www.asyncapi.com/docs/reference/specification/latest"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"title": "gRPC, Deadlines",
|
|
59
|
+
"url": "https://grpc.io/docs/guides/deadlines/"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"title": "Google SRE book, Addressing Cascading Failures",
|
|
63
|
+
"url": "https://sre.google/sre-book/addressing-cascading-failures/"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"title": "Sam Newman: Building Microservices, 2nd ed. (O'Reilly)",
|
|
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/"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"templateParams": [
|
|
75
|
+
{
|
|
76
|
+
"key": "DEFAULT",
|
|
77
|
+
"title": "Default style",
|
|
78
|
+
"label": "How do the system's parts talk to each other by default?",
|
|
79
|
+
"hint": "The default is what a new interaction uses without a discussion; an exception needs a reason recorded. It decides how much one part being slow or down affects the others.",
|
|
80
|
+
"defaultValue": "events",
|
|
81
|
+
"options": [
|
|
82
|
+
{
|
|
83
|
+
"value": "sync",
|
|
84
|
+
"label": "synchronous request and response",
|
|
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."
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"value": "commands",
|
|
89
|
+
"label": "commands over queues",
|
|
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."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"value": "events",
|
|
94
|
+
"label": "published events (pub/sub)",
|
|
95
|
+
"description": "Each part publishes events about its own changes, carrying the data others need; others subscribe, keep their own copies and answer from them. Pick it for services owned by several teams, where many parts react to the same facts and a part should keep working while another is down."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"value": "streams",
|
|
99
|
+
"label": "event streams (a replayable log)",
|
|
100
|
+
"description": "Parts write events to a durable, partitioned log that consumers read at their own pace and can replay from the start to build new views. Pick it for high volume (thousands of events a second), analytics and read models rebuilt from history, or stream processing (Kafka Streams, Flink)."
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"key": "SYNC_API",
|
|
106
|
+
"title": "Calls",
|
|
107
|
+
"label": "How are synchronous calls between parts made?",
|
|
108
|
+
"hint": "Every default leaves some synchronous calls (queries at least, and the front end calling its back end). This decides their protocol and contract format; messages are described in AsyncAPI either way.",
|
|
109
|
+
"defaultValue": "rest",
|
|
110
|
+
"options": [
|
|
111
|
+
{
|
|
112
|
+
"value": "rest",
|
|
113
|
+
"label": "HTTP and JSON described in OpenAPI",
|
|
114
|
+
"description": "Resource-style HTTP with JSON, contracts in OpenAPI 3.1. Pick it when browsers or many languages call, people need to read and try the API, or call volume is moderate."
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"value": "grpc",
|
|
118
|
+
"label": "gRPC described in Protocol Buffers",
|
|
119
|
+
"description": "Binary calls over HTTP/2 with generated clients, contracts in .proto files, deadlines built in, streaming available. Pick it for high-volume service-to-service calls where both sides use generated code; browsers need gRPC-Web or a gateway."
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"key": "FLOWS",
|
|
125
|
+
"title": "Multi-step flows",
|
|
126
|
+
"label": "Who coordinates a business flow that spans several parts?",
|
|
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.",
|
|
128
|
+
"defaultValue": "orchestration",
|
|
129
|
+
"options": [
|
|
130
|
+
{
|
|
131
|
+
"value": "orchestration",
|
|
132
|
+
"label": "an orchestrator runs each flow",
|
|
133
|
+
"description": "A workflow engine (Temporal, Camunda, AWS Step Functions) runs each flow as code or a model: it calls each part, keeps the state, retries and compensates. Pick it for flows with more than three steps, branches, timeouts or human tasks, or when someone must see where each instance is."
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"value": "choreography",
|
|
137
|
+
"label": "parts react to each other's events",
|
|
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."
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"value": "local",
|
|
142
|
+
"label": "no flow spans parts",
|
|
143
|
+
"description": "Every business operation completes inside one part and one local transaction; boundaries are drawn so that this holds. Pick it for a monolith or modular monolith, or services cut so that no operation needs two of them."
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"key": "CONTRACTS",
|
|
149
|
+
"title": "Contracts",
|
|
150
|
+
"label": "How is it checked that a change does not break another part?",
|
|
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.",
|
|
152
|
+
"defaultValue": "pact",
|
|
153
|
+
"options": [
|
|
154
|
+
{
|
|
155
|
+
"value": "spec",
|
|
156
|
+
"label": "contract diffs on every change",
|
|
157
|
+
"description": "The provider's OpenAPI, .proto or AsyncAPI document is linted and compared with the version on main; a breaking change fails the build. Pick it when consumers are many or unknown, or the teams cannot run consumer tests."
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"value": "pact",
|
|
161
|
+
"label": "consumer-driven contract tests",
|
|
162
|
+
"description": "Each consumer records the calls and messages it relies on as pacts; every provider build verifies them, and can-i-deploy blocks a release that breaks one. Pick it when the consuming parts are known teams who run Pact in their builds."
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"key": "MAX_DEPTH",
|
|
168
|
+
"label": "How many synchronous calls deep may a chain between parts go?",
|
|
169
|
+
"defaultValue": "2",
|
|
170
|
+
"type": "number"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"key": "CALL_BUDGET_MS",
|
|
174
|
+
"label": "How long may a user request spend in calls between parts, at the 99th percentile (milliseconds)?",
|
|
175
|
+
"defaultValue": "800",
|
|
176
|
+
"type": "number"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"key": "PROPAGATION_SECONDS",
|
|
180
|
+
"label": "Within how many seconds must a command's outcome or an event reach the parts that act on it (99th percentile)?",
|
|
181
|
+
"defaultValue": "10",
|
|
182
|
+
"type": "number"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"key": "RETENTION_DAYS",
|
|
186
|
+
"label": "For how many days at least does the event log keep events?",
|
|
187
|
+
"defaultValue": "7",
|
|
188
|
+
"type": "number"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"key": "FLOW_MINUTES",
|
|
192
|
+
"label": "Within how many minutes must a flow across parts finish or be reported stuck?",
|
|
193
|
+
"defaultValue": "15",
|
|
194
|
+
"type": "number"
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"nodes": [
|
|
199
|
+
{
|
|
200
|
+
"id": "need",
|
|
201
|
+
"type": "need",
|
|
202
|
+
"label": "Parts talk without failing together",
|
|
203
|
+
"x": 0,
|
|
204
|
+
"y": 0,
|
|
205
|
+
"kind": "brief",
|
|
206
|
+
"source": "Hub concern pack: Communication style",
|
|
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/."
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": "req-default",
|
|
211
|
+
"type": "requirement",
|
|
212
|
+
"label": "One default, recorded exceptions",
|
|
213
|
+
"x": 260,
|
|
214
|
+
"y": 0,
|
|
215
|
+
"ears_type": "ubiquitous",
|
|
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",
|
|
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."
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"id": "req-depth",
|
|
222
|
+
"type": "requirement",
|
|
223
|
+
"label": "Call chains stay short",
|
|
224
|
+
"x": 260,
|
|
225
|
+
"y": 130,
|
|
226
|
+
"ears_type": "ubiquitous",
|
|
227
|
+
"action": "keep every chain of synchronous calls between the system's own parts at most {{MAX_DEPTH}} calls deep, with 0 cycles of calls",
|
|
228
|
+
"rationale": "Each synchronous hop multiplies latency and the chance that one link is down, and cycles of calls turn overload into cascading failure (Google SRE book, Addressing Cascading Failures)."
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": "req-contracts",
|
|
232
|
+
"type": "requirement",
|
|
233
|
+
"label": "Every interaction has a contract",
|
|
234
|
+
"x": 260,
|
|
235
|
+
"y": 260,
|
|
236
|
+
"ears_type": "ubiquitous",
|
|
237
|
+
"action": "describe every interaction between parts in a contract owned by the providing part ({{SYNC_API}} for calls, AsyncAPI 3.0 for commands and events) and generate clients, stubs or message types from it, with 0 interactions without a contract",
|
|
238
|
+
"rationale": "Parts released apart need a machine-checkable agreement; hand-written clients drift from what the provider serves (AsyncAPI Specification; microservices.io, Messaging)."
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"id": "req-deadline",
|
|
242
|
+
"type": "requirement",
|
|
243
|
+
"label": "Calls carry a deadline",
|
|
244
|
+
"x": 260,
|
|
245
|
+
"y": 390,
|
|
246
|
+
"ears_type": "event-driven",
|
|
247
|
+
"trigger": "a part calls another part synchronously",
|
|
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",
|
|
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)."
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"id": "req-commands",
|
|
253
|
+
"type": "requirement",
|
|
254
|
+
"label": "Commands answered later",
|
|
255
|
+
"x": 260,
|
|
256
|
+
"y": 520,
|
|
257
|
+
"ears_type": "event-driven",
|
|
258
|
+
"trigger": "a part needs another to do something whose result it does not need to answer its own caller",
|
|
259
|
+
"action": "send it as a command to the receiving part's queue, answer its caller with the command's id without waiting, and receive the outcome as a reply within {{PROPAGATION_SECONDS}} seconds at the 99th percentile while the receiver is up",
|
|
260
|
+
"rationale": "A command over a queue lets the sender carry on while the receiver is busy or down; each queue has one owner that executes its commands (Enterprise Integration Patterns, Command Message; microservices.io, Messaging).",
|
|
261
|
+
"hubWhen": {
|
|
262
|
+
"DEFAULT": [
|
|
263
|
+
"commands"
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"id": "req-events",
|
|
269
|
+
"type": "requirement",
|
|
270
|
+
"label": "Parts answer from own data",
|
|
271
|
+
"x": 260,
|
|
272
|
+
"y": 650,
|
|
273
|
+
"ears_type": "ubiquitous",
|
|
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)",
|
|
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\"?).",
|
|
276
|
+
"hubWhen": {
|
|
277
|
+
"DEFAULT": [
|
|
278
|
+
"events",
|
|
279
|
+
"streams"
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"id": "req-propagation",
|
|
285
|
+
"type": "requirement",
|
|
286
|
+
"label": "Events arrive in time",
|
|
287
|
+
"x": 260,
|
|
288
|
+
"y": 780,
|
|
289
|
+
"ears_type": "event-driven",
|
|
290
|
+
"trigger": "a part publishes an event",
|
|
291
|
+
"action": "apply it in every subscribing part within {{PROPAGATION_SECONDS}} seconds at the 99th percentile",
|
|
292
|
+
"rationale": "Copies kept from events are eventually consistent; bounding how long that takes makes it a requirement instead of a surprise (microservices.io, Messaging).",
|
|
293
|
+
"hubWhen": {
|
|
294
|
+
"DEFAULT": [
|
|
295
|
+
"events",
|
|
296
|
+
"streams"
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"id": "req-replay",
|
|
302
|
+
"type": "requirement",
|
|
303
|
+
"label": "Events can be replayed",
|
|
304
|
+
"x": 260,
|
|
305
|
+
"y": 910,
|
|
306
|
+
"ears_type": "ubiquitous",
|
|
307
|
+
"action": "keep every event in a log partitioned by entity key for at least {{RETENTION_DAYS}} days (topics holding current state compacted instead), so that a new or repaired consumer builds its view by reading from the start",
|
|
308
|
+
"rationale": "Replay is what a stream offers over a queue: views can be rebuilt and new consumers added without asking the producers (Fowler, What do you mean by \"Event-Driven\"?, event sourcing and streams).",
|
|
309
|
+
"hubWhen": {
|
|
310
|
+
"DEFAULT": [
|
|
311
|
+
"streams"
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"id": "req-orchestrated",
|
|
317
|
+
"type": "requirement",
|
|
318
|
+
"label": "Flows run in the orchestrator",
|
|
319
|
+
"x": 260,
|
|
320
|
+
"y": 1040,
|
|
321
|
+
"ears_type": "ubiquitous",
|
|
322
|
+
"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",
|
|
323
|
+
"rationale": "An orchestrator keeps the steps of a flow in one place and its state visible per instance (microservices.io, Saga: orchestration).",
|
|
324
|
+
"hubWhen": {
|
|
325
|
+
"FLOWS": [
|
|
326
|
+
"orchestration"
|
|
327
|
+
]
|
|
328
|
+
}
|
|
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
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"id": "req-choreographed",
|
|
351
|
+
"type": "requirement",
|
|
352
|
+
"label": "Choreographed flows are traced",
|
|
353
|
+
"x": 260,
|
|
354
|
+
"y": 1300,
|
|
355
|
+
"ears_type": "unwanted-behaviour",
|
|
356
|
+
"unwanted_condition": "a flow that spans parts has started and not reached its end event within {{FLOW_MINUTES}} minutes",
|
|
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",
|
|
358
|
+
"rationale": "Without a coordinator nobody notices a flow that stops halfway; a monitor of the event chain gives it an owner (microservices.io, Saga: choreography).",
|
|
359
|
+
"hubWhen": {
|
|
360
|
+
"FLOWS": [
|
|
361
|
+
"choreography"
|
|
362
|
+
],
|
|
363
|
+
"DEFAULT": [
|
|
364
|
+
"events",
|
|
365
|
+
"streams"
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"id": "req-local-flows",
|
|
371
|
+
"type": "requirement",
|
|
372
|
+
"label": "Operations stay in one part",
|
|
373
|
+
"x": 260,
|
|
374
|
+
"y": 1430,
|
|
375
|
+
"ears_type": "ubiquitous",
|
|
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",
|
|
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).",
|
|
378
|
+
"hubWhen": {
|
|
379
|
+
"FLOWS": [
|
|
380
|
+
"local"
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"id": "req-contract-diff",
|
|
386
|
+
"type": "requirement",
|
|
387
|
+
"label": "Breaking changes refused",
|
|
388
|
+
"x": 260,
|
|
389
|
+
"y": 1560,
|
|
390
|
+
"ears_type": "event-driven",
|
|
391
|
+
"trigger": "a change to a contract between parts is proposed",
|
|
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",
|
|
393
|
+
"rationale": "A break found in the pull request is cheap; found in production it stops the consuming part (Building Evolutionary Architectures, atomic fitness functions).",
|
|
394
|
+
"hubWhen": {
|
|
395
|
+
"CONTRACTS": [
|
|
396
|
+
"spec"
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"id": "req-pacts",
|
|
402
|
+
"type": "requirement",
|
|
403
|
+
"label": "Consumers' pacts verified",
|
|
404
|
+
"x": 260,
|
|
405
|
+
"y": 1690,
|
|
406
|
+
"ears_type": "event-driven",
|
|
407
|
+
"trigger": "a part is about to be deployed",
|
|
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",
|
|
409
|
+
"rationale": "Consumer-driven contracts test what consumers really use, so a provider can change everything else freely (microservices.io, Service Integration Contract Test).",
|
|
410
|
+
"hubWhen": {
|
|
411
|
+
"CONTRACTS": [
|
|
412
|
+
"pact"
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"id": "sc-default",
|
|
418
|
+
"type": "scenario",
|
|
419
|
+
"label": "Exception is recorded",
|
|
420
|
+
"x": 520,
|
|
421
|
+
"y": 0,
|
|
422
|
+
"given": "the interactions between parts in the model, each with its style",
|
|
423
|
+
"when": "they are compared with the default and the ADRs",
|
|
424
|
+
"then": "each one either uses the default or is named by an ADR with its reason"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"id": "sc-depth",
|
|
428
|
+
"type": "scenario",
|
|
429
|
+
"label": "Deep chain found",
|
|
430
|
+
"x": 520,
|
|
431
|
+
"y": 130,
|
|
432
|
+
"given": "traces of the user journeys",
|
|
433
|
+
"when": "the synchronous calls between parts are followed from each request",
|
|
434
|
+
"then": "no chain is deeper than {{MAX_DEPTH}} and no part calls itself through others"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"id": "sc-contracts",
|
|
438
|
+
"type": "scenario",
|
|
439
|
+
"label": "Contract for each interaction",
|
|
440
|
+
"x": 520,
|
|
441
|
+
"y": 260,
|
|
442
|
+
"given": "the interactions between parts in the model",
|
|
443
|
+
"when": "each is looked up in the providers' contracts",
|
|
444
|
+
"then": "every call is in an OpenAPI or .proto file and every message in an AsyncAPI document"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"id": "sc-deadline",
|
|
448
|
+
"type": "scenario",
|
|
449
|
+
"label": "Expired deadline stops",
|
|
450
|
+
"x": 520,
|
|
451
|
+
"y": 390,
|
|
452
|
+
"given": "a request whose deadline has 50 ms left",
|
|
453
|
+
"when": "the first part calls a second that takes 500 ms",
|
|
454
|
+
"then": "the call is cancelled after 50 ms, the second part is not called again, and the user gets a timely error"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"id": "sc-commands",
|
|
458
|
+
"type": "scenario",
|
|
459
|
+
"label": "Command accepted and answered",
|
|
460
|
+
"x": 520,
|
|
461
|
+
"y": 520,
|
|
462
|
+
"given": "the inventory part and its command queue",
|
|
463
|
+
"when": "ordering sends a reserve-stock command while inventory is up, and again while it is down",
|
|
464
|
+
"then": "ordering answers its caller at once both times; the first reply arrives within {{PROPAGATION_SECONDS}} seconds, the second after inventory is back",
|
|
465
|
+
"hubWhen": {
|
|
466
|
+
"DEFAULT": [
|
|
467
|
+
"commands"
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"id": "sc-events",
|
|
473
|
+
"type": "scenario",
|
|
474
|
+
"label": "Publisher down, reader works",
|
|
475
|
+
"x": 520,
|
|
476
|
+
"y": 650,
|
|
477
|
+
"given": "shipping keeping a copy of the order data it needs from ordering's events",
|
|
478
|
+
"when": "ordering is stopped and a user asks shipping for a delivery",
|
|
479
|
+
"then": "shipping answers from its own copy",
|
|
480
|
+
"hubWhen": {
|
|
481
|
+
"DEFAULT": [
|
|
482
|
+
"events",
|
|
483
|
+
"streams"
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"id": "sc-propagation",
|
|
489
|
+
"type": "scenario",
|
|
490
|
+
"label": "Copy catches up",
|
|
491
|
+
"x": 520,
|
|
492
|
+
"y": 780,
|
|
493
|
+
"given": "shipping subscribed to ordering's events",
|
|
494
|
+
"when": "an order's address changes",
|
|
495
|
+
"then": "shipping's copy shows the new address within {{PROPAGATION_SECONDS}} seconds",
|
|
496
|
+
"hubWhen": {
|
|
497
|
+
"DEFAULT": [
|
|
498
|
+
"events",
|
|
499
|
+
"streams"
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"id": "sc-replay",
|
|
505
|
+
"type": "scenario",
|
|
506
|
+
"label": "View rebuilt by replay",
|
|
507
|
+
"x": 520,
|
|
508
|
+
"y": 910,
|
|
509
|
+
"given": "a consumer whose view was lost",
|
|
510
|
+
"when": "it is reset to the start of the log",
|
|
511
|
+
"then": "it rebuilds the view from the retained events without any producer being involved",
|
|
512
|
+
"hubWhen": {
|
|
513
|
+
"DEFAULT": [
|
|
514
|
+
"streams"
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"id": "sc-orchestrated",
|
|
520
|
+
"type": "scenario",
|
|
521
|
+
"label": "Failed step compensated",
|
|
522
|
+
"x": 520,
|
|
523
|
+
"y": 1040,
|
|
524
|
+
"given": "the place-order workflow with reserve stock, take payment and book shipping",
|
|
525
|
+
"when": "the payment is declined",
|
|
526
|
+
"then": "the workflow releases the stock, ends as failed, and its history shows each step",
|
|
527
|
+
"hubWhen": {
|
|
528
|
+
"FLOWS": [
|
|
529
|
+
"orchestration"
|
|
530
|
+
]
|
|
531
|
+
}
|
|
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
|
+
},
|
|
552
|
+
{
|
|
553
|
+
"id": "sc-choreographed",
|
|
554
|
+
"type": "scenario",
|
|
555
|
+
"label": "Stuck flow reported",
|
|
556
|
+
"x": 520,
|
|
557
|
+
"y": 1300,
|
|
558
|
+
"given": "an order placed and its stock reserved",
|
|
559
|
+
"when": "no payment event follows within {{FLOW_MINUTES}} minutes",
|
|
560
|
+
"then": "the flow is reported stuck with its correlation id and the payment team is alerted",
|
|
561
|
+
"hubWhen": {
|
|
562
|
+
"FLOWS": [
|
|
563
|
+
"choreography"
|
|
564
|
+
],
|
|
565
|
+
"DEFAULT": [
|
|
566
|
+
"events",
|
|
567
|
+
"streams"
|
|
568
|
+
]
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"id": "sc-local-flows",
|
|
573
|
+
"type": "scenario",
|
|
574
|
+
"label": "Operation stays local",
|
|
575
|
+
"x": 520,
|
|
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",
|
|
580
|
+
"hubWhen": {
|
|
581
|
+
"FLOWS": [
|
|
582
|
+
"local"
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"id": "sc-contract-diff",
|
|
588
|
+
"type": "scenario",
|
|
589
|
+
"label": "Removed field refused",
|
|
590
|
+
"x": 520,
|
|
591
|
+
"y": 1560,
|
|
592
|
+
"given": "an event contract with a field consumers read",
|
|
593
|
+
"when": "a change removes that field",
|
|
594
|
+
"then": "the build fails naming the breaking change",
|
|
595
|
+
"hubWhen": {
|
|
596
|
+
"CONTRACTS": [
|
|
597
|
+
"spec"
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"id": "sc-pacts",
|
|
603
|
+
"type": "scenario",
|
|
604
|
+
"label": "Breaking deploy blocked",
|
|
605
|
+
"x": 520,
|
|
606
|
+
"y": 1690,
|
|
607
|
+
"given": "a consumer in production whose pact reads a field",
|
|
608
|
+
"when": "the provider removes the field and tries to deploy",
|
|
609
|
+
"then": "verification fails and can-i-deploy blocks the release",
|
|
610
|
+
"hubWhen": {
|
|
611
|
+
"CONTRACTS": [
|
|
612
|
+
"pact"
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"id": "adr-sync",
|
|
618
|
+
"type": "adr",
|
|
619
|
+
"label": "Synchronous calls by default",
|
|
620
|
+
"x": 780,
|
|
621
|
+
"y": 0,
|
|
622
|
+
"concern": "communication-style",
|
|
623
|
+
"status": "accepted",
|
|
624
|
+
"date": "",
|
|
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}}.",
|
|
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.",
|
|
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.",
|
|
629
|
+
"hubWhen": {
|
|
630
|
+
"DEFAULT": [
|
|
631
|
+
"sync"
|
|
632
|
+
]
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"id": "adr-commands",
|
|
637
|
+
"type": "adr",
|
|
638
|
+
"label": "Commands over queues by default",
|
|
639
|
+
"x": 780,
|
|
640
|
+
"y": 130,
|
|
641
|
+
"concern": "communication-style",
|
|
642
|
+
"status": "accepted",
|
|
643
|
+
"date": "",
|
|
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}}.",
|
|
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.",
|
|
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.",
|
|
648
|
+
"hubWhen": {
|
|
649
|
+
"DEFAULT": [
|
|
650
|
+
"commands"
|
|
651
|
+
]
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"id": "adr-events",
|
|
656
|
+
"type": "adr",
|
|
657
|
+
"label": "Published events by default",
|
|
658
|
+
"x": 780,
|
|
659
|
+
"y": 260,
|
|
660
|
+
"concern": "communication-style",
|
|
661
|
+
"status": "accepted",
|
|
662
|
+
"date": "",
|
|
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}}.",
|
|
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.",
|
|
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.",
|
|
667
|
+
"hubWhen": {
|
|
668
|
+
"DEFAULT": [
|
|
669
|
+
"events"
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"id": "adr-streams",
|
|
675
|
+
"type": "adr",
|
|
676
|
+
"label": "Event streams by default",
|
|
677
|
+
"x": 780,
|
|
678
|
+
"y": 390,
|
|
679
|
+
"concern": "communication-style",
|
|
680
|
+
"status": "accepted",
|
|
681
|
+
"date": "",
|
|
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}}.",
|
|
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.",
|
|
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.",
|
|
686
|
+
"hubWhen": {
|
|
687
|
+
"DEFAULT": [
|
|
688
|
+
"streams"
|
|
689
|
+
]
|
|
690
|
+
}
|
|
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
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"id": "adr-orchestration",
|
|
732
|
+
"type": "adr",
|
|
733
|
+
"label": "Flows run by an orchestrator",
|
|
734
|
+
"x": 780,
|
|
735
|
+
"y": 780,
|
|
736
|
+
"concern": "communication-style",
|
|
737
|
+
"status": "accepted",
|
|
738
|
+
"date": "",
|
|
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.",
|
|
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.",
|
|
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.",
|
|
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.",
|
|
743
|
+
"hubWhen": {
|
|
744
|
+
"FLOWS": [
|
|
745
|
+
"orchestration"
|
|
746
|
+
]
|
|
747
|
+
}
|
|
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
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"id": "adr-choreography",
|
|
774
|
+
"type": "adr",
|
|
775
|
+
"label": "Flows by choreography",
|
|
776
|
+
"x": 780,
|
|
777
|
+
"y": 1040,
|
|
778
|
+
"concern": "communication-style",
|
|
779
|
+
"status": "accepted",
|
|
780
|
+
"date": "",
|
|
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.",
|
|
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.",
|
|
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.",
|
|
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.",
|
|
785
|
+
"hubWhen": {
|
|
786
|
+
"FLOWS": [
|
|
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"
|
|
849
|
+
]
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
"id": "ff-depth",
|
|
854
|
+
"type": "fitness-fn",
|
|
855
|
+
"label": "Call chains within depth",
|
|
856
|
+
"x": 1040,
|
|
857
|
+
"y": 0,
|
|
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```"
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
"id": "ff-budget",
|
|
867
|
+
"type": "fitness-fn",
|
|
868
|
+
"label": "Calls within budget",
|
|
869
|
+
"x": 1040,
|
|
870
|
+
"y": 130,
|
|
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```",
|
|
890
|
+
"hubWhen": {
|
|
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"
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"id": "ff-command-reply",
|
|
916
|
+
"type": "fitness-fn",
|
|
917
|
+
"label": "Commands accepted and answered",
|
|
918
|
+
"x": 1040,
|
|
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```",
|
|
926
|
+
"hubWhen": {
|
|
927
|
+
"DEFAULT": [
|
|
928
|
+
"commands"
|
|
929
|
+
]
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"id": "ff-asyncapi",
|
|
934
|
+
"type": "fitness-fn",
|
|
935
|
+
"label": "Message contracts valid",
|
|
936
|
+
"x": 1040,
|
|
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```",
|
|
981
|
+
"hubWhen": {
|
|
982
|
+
"DEFAULT": [
|
|
983
|
+
"events",
|
|
984
|
+
"streams"
|
|
985
|
+
]
|
|
986
|
+
}
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
"id": "ff-propagation",
|
|
990
|
+
"type": "fitness-fn",
|
|
991
|
+
"label": "Events applied in time",
|
|
992
|
+
"x": 1040,
|
|
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```",
|
|
999
|
+
"hubWhen": {
|
|
1000
|
+
"DEFAULT": [
|
|
1001
|
+
"events",
|
|
1002
|
+
"streams"
|
|
1003
|
+
]
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
"id": "ff-retention",
|
|
1008
|
+
"type": "fitness-fn",
|
|
1009
|
+
"label": "Log keeps events",
|
|
1010
|
+
"x": 1040,
|
|
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```",
|
|
1018
|
+
"hubWhen": {
|
|
1019
|
+
"DEFAULT": [
|
|
1020
|
+
"streams"
|
|
1021
|
+
]
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
"id": "ff-openapi",
|
|
1026
|
+
"type": "fitness-fn",
|
|
1027
|
+
"label": "Call contracts linted",
|
|
1028
|
+
"x": 1040,
|
|
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```",
|
|
1036
|
+
"hubWhen": {
|
|
1037
|
+
"SYNC_API": [
|
|
1038
|
+
"rest"
|
|
1039
|
+
]
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
"id": "ff-buf",
|
|
1044
|
+
"type": "fitness-fn",
|
|
1045
|
+
"label": "Proto contracts checked",
|
|
1046
|
+
"x": 1040,
|
|
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```",
|
|
1054
|
+
"hubWhen": {
|
|
1055
|
+
"SYNC_API": [
|
|
1056
|
+
"grpc"
|
|
1057
|
+
]
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
"id": "ff-breaking",
|
|
1062
|
+
"type": "fitness-fn",
|
|
1063
|
+
"label": "No breaking contract change",
|
|
1064
|
+
"x": 1040,
|
|
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```",
|
|
1072
|
+
"hubWhen": {
|
|
1073
|
+
"CONTRACTS": [
|
|
1074
|
+
"spec"
|
|
1075
|
+
]
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
"id": "ff-pact",
|
|
1080
|
+
"type": "fitness-fn",
|
|
1081
|
+
"label": "Consumers' pacts pass",
|
|
1082
|
+
"x": 1040,
|
|
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```",
|
|
1090
|
+
"hubWhen": {
|
|
1091
|
+
"CONTRACTS": [
|
|
1092
|
+
"pact"
|
|
1093
|
+
]
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
"id": "ff-workflow",
|
|
1098
|
+
"type": "fitness-fn",
|
|
1099
|
+
"label": "Workflows compensate",
|
|
1100
|
+
"x": 1040,
|
|
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```",
|
|
1108
|
+
"hubWhen": {
|
|
1109
|
+
"FLOWS": [
|
|
1110
|
+
"orchestration"
|
|
1111
|
+
]
|
|
1112
|
+
}
|
|
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
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"id": "ff-stuck-flows",
|
|
1138
|
+
"type": "fitness-fn",
|
|
1139
|
+
"label": "Stuck flows alerted",
|
|
1140
|
+
"x": 1040,
|
|
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```",
|
|
1147
|
+
"hubWhen": {
|
|
1148
|
+
"FLOWS": [
|
|
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"
|
|
1172
|
+
]
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
"relations": [
|
|
1177
|
+
{
|
|
1178
|
+
"id": "req-default--derives--need",
|
|
1179
|
+
"sourceId": "req-default",
|
|
1180
|
+
"targetId": "need",
|
|
1181
|
+
"relationType": "derives"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
"id": "req-depth--derives--need",
|
|
1185
|
+
"sourceId": "req-depth",
|
|
1186
|
+
"targetId": "need",
|
|
1187
|
+
"relationType": "derives"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
"id": "req-contracts--derives--need",
|
|
1191
|
+
"sourceId": "req-contracts",
|
|
1192
|
+
"targetId": "need",
|
|
1193
|
+
"relationType": "derives"
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
"id": "req-deadline--derives--need",
|
|
1197
|
+
"sourceId": "req-deadline",
|
|
1198
|
+
"targetId": "need",
|
|
1199
|
+
"relationType": "derives"
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"id": "req-commands--derives--need",
|
|
1203
|
+
"sourceId": "req-commands",
|
|
1204
|
+
"targetId": "need",
|
|
1205
|
+
"relationType": "derives"
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
"id": "req-events--derives--need",
|
|
1209
|
+
"sourceId": "req-events",
|
|
1210
|
+
"targetId": "need",
|
|
1211
|
+
"relationType": "derives"
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
"id": "req-propagation--derives--need",
|
|
1215
|
+
"sourceId": "req-propagation",
|
|
1216
|
+
"targetId": "need",
|
|
1217
|
+
"relationType": "derives"
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
"id": "req-replay--derives--need",
|
|
1221
|
+
"sourceId": "req-replay",
|
|
1222
|
+
"targetId": "need",
|
|
1223
|
+
"relationType": "derives"
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
"id": "req-orchestrated--derives--need",
|
|
1227
|
+
"sourceId": "req-orchestrated",
|
|
1228
|
+
"targetId": "need",
|
|
1229
|
+
"relationType": "derives"
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
"id": "req-orchestrated-fallback--derives--need",
|
|
1233
|
+
"sourceId": "req-orchestrated-fallback",
|
|
1234
|
+
"targetId": "need",
|
|
1235
|
+
"relationType": "derives"
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
"id": "req-choreographed--derives--need",
|
|
1239
|
+
"sourceId": "req-choreographed",
|
|
1240
|
+
"targetId": "need",
|
|
1241
|
+
"relationType": "derives"
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
"id": "req-local-flows--derives--need",
|
|
1245
|
+
"sourceId": "req-local-flows",
|
|
1246
|
+
"targetId": "need",
|
|
1247
|
+
"relationType": "derives"
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
"id": "req-contract-diff--derives--need",
|
|
1251
|
+
"sourceId": "req-contract-diff",
|
|
1252
|
+
"targetId": "need",
|
|
1253
|
+
"relationType": "derives"
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
"id": "req-pacts--derives--need",
|
|
1257
|
+
"sourceId": "req-pacts",
|
|
1258
|
+
"targetId": "need",
|
|
1259
|
+
"relationType": "derives"
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
"id": "sc-default--verifies--req-default",
|
|
1263
|
+
"sourceId": "sc-default",
|
|
1264
|
+
"targetId": "req-default",
|
|
1265
|
+
"relationType": "verifies"
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
"id": "sc-depth--verifies--req-depth",
|
|
1269
|
+
"sourceId": "sc-depth",
|
|
1270
|
+
"targetId": "req-depth",
|
|
1271
|
+
"relationType": "verifies"
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
"id": "sc-contracts--verifies--req-contracts",
|
|
1275
|
+
"sourceId": "sc-contracts",
|
|
1276
|
+
"targetId": "req-contracts",
|
|
1277
|
+
"relationType": "verifies"
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
"id": "sc-deadline--verifies--req-deadline",
|
|
1281
|
+
"sourceId": "sc-deadline",
|
|
1282
|
+
"targetId": "req-deadline",
|
|
1283
|
+
"relationType": "verifies"
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
"id": "sc-commands--verifies--req-commands",
|
|
1287
|
+
"sourceId": "sc-commands",
|
|
1288
|
+
"targetId": "req-commands",
|
|
1289
|
+
"relationType": "verifies"
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
"id": "sc-events--verifies--req-events",
|
|
1293
|
+
"sourceId": "sc-events",
|
|
1294
|
+
"targetId": "req-events",
|
|
1295
|
+
"relationType": "verifies"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
"id": "sc-propagation--verifies--req-propagation",
|
|
1299
|
+
"sourceId": "sc-propagation",
|
|
1300
|
+
"targetId": "req-propagation",
|
|
1301
|
+
"relationType": "verifies"
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
"id": "sc-replay--verifies--req-replay",
|
|
1305
|
+
"sourceId": "sc-replay",
|
|
1306
|
+
"targetId": "req-replay",
|
|
1307
|
+
"relationType": "verifies"
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
"id": "sc-orchestrated--verifies--req-orchestrated",
|
|
1311
|
+
"sourceId": "sc-orchestrated",
|
|
1312
|
+
"targetId": "req-orchestrated",
|
|
1313
|
+
"relationType": "verifies"
|
|
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
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
"id": "sc-choreographed--verifies--req-choreographed",
|
|
1323
|
+
"sourceId": "sc-choreographed",
|
|
1324
|
+
"targetId": "req-choreographed",
|
|
1325
|
+
"relationType": "verifies"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
"id": "sc-local-flows--verifies--req-local-flows",
|
|
1329
|
+
"sourceId": "sc-local-flows",
|
|
1330
|
+
"targetId": "req-local-flows",
|
|
1331
|
+
"relationType": "verifies"
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
"id": "sc-contract-diff--verifies--req-contract-diff",
|
|
1335
|
+
"sourceId": "sc-contract-diff",
|
|
1336
|
+
"targetId": "req-contract-diff",
|
|
1337
|
+
"relationType": "verifies"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
"id": "sc-pacts--verifies--req-pacts",
|
|
1341
|
+
"sourceId": "sc-pacts",
|
|
1342
|
+
"targetId": "req-pacts",
|
|
1343
|
+
"relationType": "verifies"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
"id": "ff-depth--implements--adr-sync",
|
|
1347
|
+
"sourceId": "ff-depth",
|
|
1348
|
+
"targetId": "adr-sync",
|
|
1349
|
+
"relationType": "implements"
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
"id": "ff-depth--implements--adr-commands",
|
|
1353
|
+
"sourceId": "ff-depth",
|
|
1354
|
+
"targetId": "adr-commands",
|
|
1355
|
+
"relationType": "implements"
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
"id": "ff-depth--implements--adr-events",
|
|
1359
|
+
"sourceId": "ff-depth",
|
|
1360
|
+
"targetId": "adr-events",
|
|
1361
|
+
"relationType": "implements"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
"id": "ff-depth--implements--adr-streams",
|
|
1365
|
+
"sourceId": "ff-depth",
|
|
1366
|
+
"targetId": "adr-streams",
|
|
1367
|
+
"relationType": "implements"
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
"id": "ff-budget--implements--adr-sync",
|
|
1371
|
+
"sourceId": "ff-budget",
|
|
1372
|
+
"targetId": "adr-sync",
|
|
1373
|
+
"relationType": "implements"
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
"id": "ff-budget--implements--adr-commands",
|
|
1377
|
+
"sourceId": "ff-budget",
|
|
1378
|
+
"targetId": "adr-commands",
|
|
1379
|
+
"relationType": "implements"
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
"id": "ff-budget--implements--adr-events",
|
|
1383
|
+
"sourceId": "ff-budget",
|
|
1384
|
+
"targetId": "adr-events",
|
|
1385
|
+
"relationType": "implements"
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
"id": "ff-budget--implements--adr-streams",
|
|
1389
|
+
"sourceId": "ff-budget",
|
|
1390
|
+
"targetId": "adr-streams",
|
|
1391
|
+
"relationType": "implements"
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
"id": "ff-deadline--implements--adr-rest",
|
|
1395
|
+
"sourceId": "ff-deadline",
|
|
1396
|
+
"targetId": "adr-rest",
|
|
1397
|
+
"relationType": "implements"
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
"id": "ff-deadline-grpc--implements--adr-grpc",
|
|
1401
|
+
"sourceId": "ff-deadline-grpc",
|
|
1402
|
+
"targetId": "adr-grpc",
|
|
1403
|
+
"relationType": "implements"
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
"id": "ff-command-reply--implements--adr-commands",
|
|
1407
|
+
"sourceId": "ff-command-reply",
|
|
1408
|
+
"targetId": "adr-commands",
|
|
1409
|
+
"relationType": "implements"
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
"id": "ff-asyncapi--implements--adr-events",
|
|
1413
|
+
"sourceId": "ff-asyncapi",
|
|
1414
|
+
"targetId": "adr-events",
|
|
1415
|
+
"relationType": "implements"
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
"id": "ff-asyncapi--implements--adr-streams",
|
|
1419
|
+
"sourceId": "ff-asyncapi",
|
|
1420
|
+
"targetId": "adr-streams",
|
|
1421
|
+
"relationType": "implements"
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
"id": "ff-asyncapi-queues--implements--adr-commands",
|
|
1425
|
+
"sourceId": "ff-asyncapi-queues",
|
|
1426
|
+
"targetId": "adr-commands",
|
|
1427
|
+
"relationType": "implements"
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
"id": "ff-no-sync-calls--implements--adr-events",
|
|
1431
|
+
"sourceId": "ff-no-sync-calls",
|
|
1432
|
+
"targetId": "adr-events",
|
|
1433
|
+
"relationType": "implements"
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
"id": "ff-no-sync-calls--implements--adr-streams",
|
|
1437
|
+
"sourceId": "ff-no-sync-calls",
|
|
1438
|
+
"targetId": "adr-streams",
|
|
1439
|
+
"relationType": "implements"
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
"id": "ff-propagation--implements--adr-events",
|
|
1443
|
+
"sourceId": "ff-propagation",
|
|
1444
|
+
"targetId": "adr-events",
|
|
1445
|
+
"relationType": "implements"
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
"id": "ff-propagation--implements--adr-streams",
|
|
1449
|
+
"sourceId": "ff-propagation",
|
|
1450
|
+
"targetId": "adr-streams",
|
|
1451
|
+
"relationType": "implements"
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
"id": "ff-retention--implements--adr-streams",
|
|
1455
|
+
"sourceId": "ff-retention",
|
|
1456
|
+
"targetId": "adr-streams",
|
|
1457
|
+
"relationType": "implements"
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
"id": "ff-openapi--implements--adr-rest",
|
|
1461
|
+
"sourceId": "ff-openapi",
|
|
1462
|
+
"targetId": "adr-rest",
|
|
1463
|
+
"relationType": "implements"
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
"id": "ff-buf--implements--adr-grpc",
|
|
1467
|
+
"sourceId": "ff-buf",
|
|
1468
|
+
"targetId": "adr-grpc",
|
|
1469
|
+
"relationType": "implements"
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
"id": "ff-breaking--implements--adr-contract-diffs",
|
|
1473
|
+
"sourceId": "ff-breaking",
|
|
1474
|
+
"targetId": "adr-contract-diffs",
|
|
1475
|
+
"relationType": "implements"
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
"id": "ff-pact--implements--adr-consumer-contracts",
|
|
1479
|
+
"sourceId": "ff-pact",
|
|
1480
|
+
"targetId": "adr-consumer-contracts",
|
|
1481
|
+
"relationType": "implements"
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
"id": "ff-workflow--implements--adr-orchestration",
|
|
1485
|
+
"sourceId": "ff-workflow",
|
|
1486
|
+
"targetId": "adr-orchestration",
|
|
1487
|
+
"relationType": "implements"
|
|
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
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
"id": "ff-stuck-flows--implements--adr-choreography",
|
|
1497
|
+
"sourceId": "ff-stuck-flows",
|
|
1498
|
+
"targetId": "adr-choreography",
|
|
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"
|
|
1506
|
+
}
|
|
1507
|
+
]
|
|
1508
|
+
}
|