@radicaltools/cli 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 +353 -33
- 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 +12712 -7144
- package/package.json +5 -3
|
@@ -0,0 +1,1197 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hub": {
|
|
3
|
+
"id": "concern-error-handling-logging",
|
|
4
|
+
"category": "concern",
|
|
5
|
+
"name": "Error handling and logging conventions",
|
|
6
|
+
"description": "How the code signals, propagates and records failures: the error style, where errors are handled, what never reaches a caller, how a log line is shaped, and what must never be in one. What an HTTP API's error body looks like is decided in the Errors pack.",
|
|
7
|
+
"tags": [
|
|
8
|
+
"maintainability",
|
|
9
|
+
"error handling",
|
|
10
|
+
"exceptions",
|
|
11
|
+
"result types",
|
|
12
|
+
"logging",
|
|
13
|
+
"redaction",
|
|
14
|
+
"information leakage"
|
|
15
|
+
],
|
|
16
|
+
"requiredMetamodel": "c4-ddd-governance-builtin",
|
|
17
|
+
"concern": {
|
|
18
|
+
"id": "error-handling-logging",
|
|
19
|
+
"trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
|
|
20
|
+
"why": "code lives in these elements and fails in production, so how a failure is signalled, where it is handled and how it is recorded has to be decided once for everyone who writes in them; one decision usually covers a whole repository and is bound to every element built from it.",
|
|
21
|
+
"group": "coding"
|
|
22
|
+
},
|
|
23
|
+
"sources": [
|
|
24
|
+
{
|
|
25
|
+
"title": "RFC 9457, Problem Details for HTTP APIs",
|
|
26
|
+
"url": "https://www.rfc-editor.org/rfc/rfc9457"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"title": "OWASP Logging Cheat Sheet",
|
|
30
|
+
"url": "https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"title": "OWASP Error Handling Cheat Sheet",
|
|
34
|
+
"url": "https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"title": "OWASP Top 10 2021, A09: Security Logging and Monitoring Failures",
|
|
38
|
+
"url": "https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"title": "Microsoft .NET: Best practices for exceptions",
|
|
42
|
+
"url": "https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"title": "Joe Duffy: The Error Model",
|
|
46
|
+
"url": "https://joeduffyblog.com/2016/02/07/the-error-model/"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"title": "The Rust Programming Language, chapter 9: Error Handling",
|
|
50
|
+
"url": "https://doc.rust-lang.org/book/ch09-00-error-handling.html"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"title": "Martin Fowler: Replacing Throwing Exceptions with Notification",
|
|
54
|
+
"url": "https://martinfowler.com/articles/replaceThrowWithNotification.html"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"title": "pino documentation: Redaction",
|
|
58
|
+
"url": "https://getpino.io/#/docs/redaction"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"title": "structlog documentation",
|
|
62
|
+
"url": "https://www.structlog.org/en/stable/"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"title": "The Twelve-Factor App, XI. Logs",
|
|
66
|
+
"url": "https://12factor.net/logs"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"title": "Google SRE book, chapter 6: Monitoring Distributed Systems",
|
|
70
|
+
"url": "https://sre.google/sre-book/monitoring-distributed-systems/"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"title": "ISO/IEC 25010, Maintainability: analysability",
|
|
74
|
+
"url": "https://iso25000.com/index.php/en/iso-25000-standards/iso-25010"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"templateParams": [
|
|
78
|
+
{
|
|
79
|
+
"key": "STYLE",
|
|
80
|
+
"title": "Error style",
|
|
81
|
+
"label": "How does code signal a failure?",
|
|
82
|
+
"hint": "The style decides whether an expected failure is visible in a function's signature, how much ceremony each call carries, and what the language and its linters can check for you.",
|
|
83
|
+
"defaultValue": "exceptions",
|
|
84
|
+
"options": [
|
|
85
|
+
{
|
|
86
|
+
"value": "exceptions",
|
|
87
|
+
"label": "exceptions with a small domain hierarchy",
|
|
88
|
+
"description": "One base error class, typed subclasses for the expected failures (NotFound, Validation, Conflict, UpstreamUnavailable), and unexpected ones left to propagate untouched to the edge. Pick it as the default in Java, C#, Python, TypeScript and Kotlin, where the libraries throw anyway and the frameworks map exceptions to responses."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"value": "result",
|
|
92
|
+
"label": "explicit result types for expected failures",
|
|
93
|
+
"description": "A function that can fail in an expected way returns a Result or Either (Rust Result, Go error values, Kotlin Result, neverthrow or fp-ts in TypeScript), and exceptions or panics are kept for bugs. Pick it in Rust and Go, or in a TypeScript or Kotlin codebase whose team wants failures in the type signature and is ready to handle one at every call."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"value": "codes",
|
|
97
|
+
"label": "error codes from a catalogue",
|
|
98
|
+
"description": "Every error is a code from one catalogue (code, HTTP status, message), returned as a value and never invented at the call site. Pick it for C and embedded code, protocol-driven code bases, and APIs whose clients key on stable codes and need them documented."
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"key": "BOUNDARY",
|
|
104
|
+
"title": "Where handled",
|
|
105
|
+
"label": "Where are errors handled?",
|
|
106
|
+
"hint": "Handling in one place keeps inner code honest and the log free of repeats; handling per layer keeps a layer's callers free of its dependencies' error types.",
|
|
107
|
+
"defaultValue": "edge",
|
|
108
|
+
"options": [
|
|
109
|
+
{
|
|
110
|
+
"value": "edge",
|
|
111
|
+
"label": "one handler at the edge",
|
|
112
|
+
"description": "One middleware, exception filter or handler at the edge (HTTP, queue consumer, CLI main) maps every error to a response, logs it once and ends the request; inner code only throws or returns. Pick it for services and web apps of one or two layers, where a 404 or 409 is the same decision everywhere."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"value": "layered",
|
|
116
|
+
"label": "translation at every layer",
|
|
117
|
+
"description": "Each layer catches the errors of the layer below and raises its own, with the original as the cause: a repository turns a driver error into a persistence error, the domain turns that into a domain error, the API maps domain errors to responses. Pick it when the domain must not depend on the drivers' error types, or when a layer is reused behind several edges (HTTP, messaging, batch)."
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"key": "LOGS",
|
|
123
|
+
"title": "Log shape",
|
|
124
|
+
"label": "How is a log line shaped?",
|
|
125
|
+
"hint": "A line is read by machines first: parsed, indexed, counted, searched by request id. Fields it does not have cannot be searched. The Observability pack takes this shape as given.",
|
|
126
|
+
"defaultValue": "structured",
|
|
127
|
+
"options": [
|
|
128
|
+
{
|
|
129
|
+
"value": "structured",
|
|
130
|
+
"label": "structured JSON lines",
|
|
131
|
+
"description": "One JSON object per line with a fixed set of fields (timestamp, level as a word, message, service, the correlation id, and an error object with type, message and stack), written by pino, structlog, Serilog, zap or a JSON encoder for logback. Pick it for anything that runs as a service and whose logs are shipped and searched."
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"value": "text",
|
|
135
|
+
"label": "fixed-layout text lines",
|
|
136
|
+
"description": "One human-readable line per event in a fixed layout (time, level, correlation id in brackets, message, key=value fields), parsed with one regular expression. Pick it for CLIs, build tools and small utilities whose logs are read by a person on a terminal, not indexed."
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"key": "REDACTION",
|
|
142
|
+
"title": "Redaction",
|
|
143
|
+
"label": "How are secrets and personal data kept out of logs?",
|
|
144
|
+
"hint": "Redaction by hand at each call fails the first time someone logs an object whole; it has to live in the logger. The Observability pack takes this as given.",
|
|
145
|
+
"defaultValue": "denylist",
|
|
146
|
+
"options": [
|
|
147
|
+
{
|
|
148
|
+
"value": "allowlist",
|
|
149
|
+
"label": "an allow-list of logged fields",
|
|
150
|
+
"description": "The logger drops every field that is not on its list and every object goes through a serializer that picks the fields allowed for its type; nothing is ever logged whole. Pick it when logs leave the organisation (a SaaS log backend), when the data is regulated (health, payments), or after one leak too many."
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"value": "denylist",
|
|
154
|
+
"label": "a deny-list of redacted paths",
|
|
155
|
+
"description": "The logger redacts known secret and personal-data fields by path (password, token, authorization, cookie, e-mail, IBAN) wherever they appear, and everything else is allowed. Pick it as the baseline for an internal log store, where a new field is more often useful than dangerous."
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"key": "BASE_ERROR",
|
|
161
|
+
"label": "Name of the base error class or error type",
|
|
162
|
+
"defaultValue": "AppError"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"key": "CORRELATION_FIELD",
|
|
166
|
+
"label": "Name of the correlation field in every log line and error response",
|
|
167
|
+
"defaultValue": "traceId"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"key": "LEVELS",
|
|
171
|
+
"label": "Log levels in use, highest first (comma-separated, lower case)",
|
|
172
|
+
"defaultValue": "error, warn, info, debug"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"key": "REDACTED_FIELDS",
|
|
176
|
+
"label": "Fields that must never appear in a log line (comma-separated)",
|
|
177
|
+
"defaultValue": "password, token, authorization, cookie, email, iban"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"key": "MAX_MESSAGE_CHARS",
|
|
181
|
+
"label": "Longest allowed log message (characters); the rest goes in fields",
|
|
182
|
+
"defaultValue": "200",
|
|
183
|
+
"type": "number"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"nodes": [
|
|
188
|
+
{
|
|
189
|
+
"id": "need",
|
|
190
|
+
"type": "need",
|
|
191
|
+
"label": "Failures explained, not leaked",
|
|
192
|
+
"x": 0,
|
|
193
|
+
"y": 0,
|
|
194
|
+
"kind": "brief",
|
|
195
|
+
"source": "Hub concern pack: Error handling and logging conventions",
|
|
196
|
+
"description": "When something goes wrong in the element, the person investigating must find every line about that request by one id, see the first cause rather than the last symptom, and tell a bug from an expected refusal at a glance. The caller must get an answer it can act on, with nothing in it about how the element is built. Nobody reading the logs, inside or outside the team, may learn a password, a token or a customer's personal data from them. All of this must hold in code written by many people, so a tool must hold it."
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "req-no-swallow",
|
|
200
|
+
"type": "requirement",
|
|
201
|
+
"label": "No error swallowed",
|
|
202
|
+
"x": 260,
|
|
203
|
+
"y": 0,
|
|
204
|
+
"ears_type": "unwanted-behaviour",
|
|
205
|
+
"unwanted_condition": "code catches an error it cannot recover from",
|
|
206
|
+
"action": "rethrow or return it to the caller with the original attached as the cause, so that 0 catch blocks are empty and 0 catch blocks consist of a log call alone",
|
|
207
|
+
"rationale": "A swallowed error turns a failure into a wrong result that surfaces later, somewhere else, with no trace back to the cause (Microsoft, Best practices for exceptions: do not catch what you cannot handle; Duffy, The Error Model)."
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": "req-cause",
|
|
211
|
+
"type": "requirement",
|
|
212
|
+
"label": "Errors carry their cause",
|
|
213
|
+
"x": 260,
|
|
214
|
+
"y": 130,
|
|
215
|
+
"ears_type": "event-driven",
|
|
216
|
+
"trigger": "an error is wrapped in another error",
|
|
217
|
+
"action": "attach the original as the cause (Error.cause, inner exception, __cause__ via raise from, source() in Rust, %w in Go) so that the whole chain and the first stack trace are kept and logged",
|
|
218
|
+
"rationale": "The last error says what failed for the caller; the first says why; a wrap that drops the original leaves the investigator with the symptom only (Microsoft, Best practices for exceptions: inner exceptions; ISO 25010 analysability)."
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"id": "req-hierarchy",
|
|
222
|
+
"type": "requirement",
|
|
223
|
+
"label": "Expected failures typed",
|
|
224
|
+
"x": 260,
|
|
225
|
+
"y": 260,
|
|
226
|
+
"ears_type": "ubiquitous",
|
|
227
|
+
"action": "raise every expected failure as a subclass of {{BASE_ERROR}} that names the case (not found, validation, conflict, upstream unavailable) and carries a stable code, keep the hierarchy under ten classes, throw only Error instances, and let unexpected errors propagate untouched to the boundary",
|
|
228
|
+
"rationale": "A small hierarchy lets the boundary map the expected cases without a chain of string matches, and treats what is not in it as a bug (Microsoft, Best practices for exceptions: derive from Exception, use the predefined types; Fowler, Notification: exceptions for the unexpected).",
|
|
229
|
+
"hubWhen": {
|
|
230
|
+
"STYLE": [
|
|
231
|
+
"exceptions"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"id": "req-result",
|
|
237
|
+
"type": "requirement",
|
|
238
|
+
"label": "Expected failures returned",
|
|
239
|
+
"x": 260,
|
|
240
|
+
"y": 390,
|
|
241
|
+
"ears_type": "ubiquitous",
|
|
242
|
+
"action": "return every expected failure as a Result (or Either, or an error value) in the function's signature, with an error type that names the case and carries a stable code, treat an ignored Result as a build error, and reserve exceptions or panics for bugs and broken invariants",
|
|
243
|
+
"rationale": "With the failure in the signature the compiler, not the reviewer, finds the caller who forgot it; exceptions stay for what no caller can handle (Rust book, chapter 9: recoverable errors with Result; Duffy, The Error Model).",
|
|
244
|
+
"hubWhen": {
|
|
245
|
+
"STYLE": [
|
|
246
|
+
"result"
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"id": "req-codes",
|
|
252
|
+
"type": "requirement",
|
|
253
|
+
"label": "Errors come from the catalogue",
|
|
254
|
+
"x": 260,
|
|
255
|
+
"y": 520,
|
|
256
|
+
"ears_type": "ubiquitous",
|
|
257
|
+
"action": "signal every error with a code from the one catalogue in the repository (code, status, message template), 0 codes invented at a call site, and never remove or rename a code once released (a code can only be added or deprecated)",
|
|
258
|
+
"rationale": "Clients key on codes; a code that changes meaning or vanishes breaks them silently, and a code made up inline is one the catalogue cannot document (RFC 9457, section 3.2: extension members for stable codes; OWASP Error Handling Cheat Sheet).",
|
|
259
|
+
"hubWhen": {
|
|
260
|
+
"STYLE": [
|
|
261
|
+
"codes"
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"id": "req-edge",
|
|
267
|
+
"type": "requirement",
|
|
268
|
+
"label": "Handled once at the edge",
|
|
269
|
+
"x": 260,
|
|
270
|
+
"y": 650,
|
|
271
|
+
"ears_type": "event-driven",
|
|
272
|
+
"trigger": "an error reaches the edge of the element (HTTP handler, queue consumer, CLI main, scheduled job)",
|
|
273
|
+
"action": "map it in the one error handler to the response shape, log it exactly once with its cause chain and the {{CORRELATION_FIELD}}, and answer; no other code in the element imports the response mapping or an HTTP framework",
|
|
274
|
+
"rationale": "One handler means one place where a mapping is right or wrong, and one log line per failure; inner code that knows status codes cannot be reused behind another edge (OWASP Error Handling Cheat Sheet: global handler; Fowler, Notification).",
|
|
275
|
+
"hubWhen": {
|
|
276
|
+
"BOUNDARY": [
|
|
277
|
+
"edge"
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"id": "req-layered",
|
|
283
|
+
"type": "requirement",
|
|
284
|
+
"label": "Each layer owns its errors",
|
|
285
|
+
"x": 260,
|
|
286
|
+
"y": 780,
|
|
287
|
+
"ears_type": "ubiquitous",
|
|
288
|
+
"action": "translate the errors of the layer below into its own error types at every layer boundary (driver error → persistence error → domain error → API response), with the original as the cause, so that 0 driver or framework error types cross into the domain or application layer",
|
|
289
|
+
"rationale": "A domain that catches a vendor's exception is coupled to that vendor; translation at each boundary keeps a layer's callers free of its dependencies' types while the cause chain keeps the detail (Microsoft, Best practices for exceptions: wrapping; Duffy, The Error Model).",
|
|
290
|
+
"hubWhen": {
|
|
291
|
+
"BOUNDARY": [
|
|
292
|
+
"layered"
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"id": "req-log-once",
|
|
298
|
+
"type": "requirement",
|
|
299
|
+
"label": "Each error logged once",
|
|
300
|
+
"x": 260,
|
|
301
|
+
"y": 910,
|
|
302
|
+
"ears_type": "unwanted-behaviour",
|
|
303
|
+
"unwanted_condition": "an error is caught by a layer that rethrows it",
|
|
304
|
+
"action": "pass it on without logging it there, so that 0 catch blocks both log and rethrow, and one failure produces exactly 1 error-level log line, written where the error is finally handled",
|
|
305
|
+
"rationale": "An error logged at every layer on its way up is five lines, five alerts and one event; the one line at the handler has the full cause chain anyway (Sonar rule S2139; OWASP Logging Cheat Sheet)."
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"id": "req-correlation",
|
|
309
|
+
"type": "requirement",
|
|
310
|
+
"label": "Every line carries the request id",
|
|
311
|
+
"x": 260,
|
|
312
|
+
"y": 1040,
|
|
313
|
+
"ears_type": "ubiquitous",
|
|
314
|
+
"action": "put the {{CORRELATION_FIELD}} of the current request, message or job in every log line, taken from the incoming trace context or request id or created at the edge, through the logger's context (async-local storage, MDC, contextvars), never by hand at each call",
|
|
315
|
+
"rationale": "The id is how one request's lines are found among millions and joined across elements; a line without it is noise at the moment it is needed (OWASP Logging Cheat Sheet: event attributes; The Twelve-Factor App, XI)."
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"id": "req-structured",
|
|
319
|
+
"type": "requirement",
|
|
320
|
+
"label": "Lines are JSON with fixed fields",
|
|
321
|
+
"x": 260,
|
|
322
|
+
"y": 1170,
|
|
323
|
+
"ears_type": "ubiquitous",
|
|
324
|
+
"action": "write every log line as one JSON object on standard output through the one configured logger (never console or print), with the fields timestamp, level (as a word from {{LEVELS}}), message, service, {{CORRELATION_FIELD}} and, for errors, an error object with type, message, stack and cause; the message is a constant phrase of at most {{MAX_MESSAGE_CHARS}} characters and variable data goes in fields",
|
|
325
|
+
"rationale": "A fixed shape is parsed, indexed and counted without regular expressions, and a constant message groups one event across millions of lines (The Twelve-Factor App, XI; structlog and pino documentation).",
|
|
326
|
+
"hubWhen": {
|
|
327
|
+
"LOGS": [
|
|
328
|
+
"structured"
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"id": "req-text",
|
|
334
|
+
"type": "requirement",
|
|
335
|
+
"label": "Lines follow one layout",
|
|
336
|
+
"x": 260,
|
|
337
|
+
"y": 1300,
|
|
338
|
+
"ears_type": "ubiquitous",
|
|
339
|
+
"action": "write every log line through the one configured logger (never console or print) in the layout \"ISO-8601 time, LEVEL in upper case, [{{CORRELATION_FIELD}}], message, key=value fields\", one event per line with the message at most {{MAX_MESSAGE_CHARS}} characters and stack traces indented on the following lines",
|
|
340
|
+
"rationale": "A fixed layout is readable on a terminal and still parsed by one regular expression when it has to be; free-form lines are neither (OWASP Logging Cheat Sheet: event format).",
|
|
341
|
+
"hubWhen": {
|
|
342
|
+
"LOGS": [
|
|
343
|
+
"text"
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"id": "req-no-secrets",
|
|
349
|
+
"type": "requirement",
|
|
350
|
+
"label": "No secrets or personal data logged",
|
|
351
|
+
"x": 260,
|
|
352
|
+
"y": 1430,
|
|
353
|
+
"ears_type": "ubiquitous",
|
|
354
|
+
"action": "keep {{REDACTED_FIELDS}} and every other secret, credential and personal-data value out of log lines by {{REDACTION}} configured in the logger itself, with 0 log calls that pass a whole request, response, headers or body object",
|
|
355
|
+
"rationale": "Logs are read by more people and tools than the database and copied to places with weaker access; a secret or personal datum in them is a breach, and redaction done by hand at each call fails on the first whole object logged (OWASP Logging Cheat Sheet: data to exclude; OWASP Top 10 A09; pino, Redaction)."
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"id": "req-no-leak",
|
|
359
|
+
"type": "requirement",
|
|
360
|
+
"label": "Nothing internal reaches a caller",
|
|
361
|
+
"x": 260,
|
|
362
|
+
"y": 1560,
|
|
363
|
+
"ears_type": "unwanted-behaviour",
|
|
364
|
+
"unwanted_condition": "an error reaches a caller at any edge of the element (an HTTP response, a reply or dead-letter message, a CLI's output)",
|
|
365
|
+
"action": "keep every stack trace, exception class name, SQL statement, file path and internal host name or address out of what the caller receives, so that 0 of them appear with production settings; they go to the one log line of that failure only",
|
|
366
|
+
"rationale": "A stack trace tells an attacker the framework, the file layout and sometimes the SQL; the caller needs a code and an id, the investigator the log line. This holds whatever the error body looks like, so it belongs to the handler, not to the format (OWASP Error Handling Cheat Sheet; OWASP Top 10 A09)."
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"id": "req-levels",
|
|
370
|
+
"type": "requirement",
|
|
371
|
+
"label": "Levels mean something",
|
|
372
|
+
"x": 260,
|
|
373
|
+
"y": 1690,
|
|
374
|
+
"ears_type": "ubiquitous",
|
|
375
|
+
"action": "use the levels {{LEVELS}} by meaning: error only for a failure that lost work or needs a person to act, warn for a failure handled or degraded, info for business events and lifecycle, debug for diagnosis and off in production; a request answered with a 4xx status is logged at warn or info, never error",
|
|
376
|
+
"rationale": "Alerts and dashboards count by level; a 404 logged at error buries the real failures and teaches everyone to ignore the level (Google SRE book, chapter 6: as simple as possible, no simpler; OWASP Logging Cheat Sheet)."
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"id": "sc-no-swallow",
|
|
380
|
+
"type": "scenario",
|
|
381
|
+
"label": "Swallowing refused",
|
|
382
|
+
"x": 520,
|
|
383
|
+
"y": 0,
|
|
384
|
+
"given": "a change that adds an empty catch block and one that adds a catch block holding only a log call",
|
|
385
|
+
"when": "the linters run on the pull request",
|
|
386
|
+
"then": "each fails naming its block, and the change is not merged until the error is rethrown, returned or handled with a stated recovery"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"id": "sc-cause",
|
|
390
|
+
"type": "scenario",
|
|
391
|
+
"label": "Dropped cause refused",
|
|
392
|
+
"x": 520,
|
|
393
|
+
"y": 130,
|
|
394
|
+
"given": "a catch block that throws a new error without passing the caught one as its cause",
|
|
395
|
+
"when": "the linter runs on the pull request",
|
|
396
|
+
"then": "it fails naming the throw (preserve-caught-error in TypeScript, B904 in Python, S1166 on the JVM)"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"id": "sc-hierarchy",
|
|
400
|
+
"type": "scenario",
|
|
401
|
+
"label": "Hierarchy holds",
|
|
402
|
+
"x": 520,
|
|
403
|
+
"y": 260,
|
|
404
|
+
"given": "the error classes exported from src/errors",
|
|
405
|
+
"when": "the hierarchy test runs",
|
|
406
|
+
"then": "every class extends {{BASE_ERROR}} and carries a non-empty code, there are at most ten of them, and a thrown non-Error anywhere in src fails the lint",
|
|
407
|
+
"hubWhen": {
|
|
408
|
+
"STYLE": [
|
|
409
|
+
"exceptions"
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"id": "sc-result",
|
|
415
|
+
"type": "scenario",
|
|
416
|
+
"label": "Ignored result refused",
|
|
417
|
+
"x": 520,
|
|
418
|
+
"y": 390,
|
|
419
|
+
"given": "a call to a function returning a Result whose value is never matched or unwrapped",
|
|
420
|
+
"when": "the build runs",
|
|
421
|
+
"then": "it fails naming the call; once the error branch is handled or returned, it passes",
|
|
422
|
+
"hubWhen": {
|
|
423
|
+
"STYLE": [
|
|
424
|
+
"result"
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"id": "sc-codes",
|
|
430
|
+
"type": "scenario",
|
|
431
|
+
"label": "Unknown code refused",
|
|
432
|
+
"x": 520,
|
|
433
|
+
"y": 520,
|
|
434
|
+
"given": "a change that returns a code that is not in the catalogue",
|
|
435
|
+
"when": "the catalogue test runs",
|
|
436
|
+
"then": "it fails naming the code; a change that renames an existing code fails the catalogue snapshot",
|
|
437
|
+
"hubWhen": {
|
|
438
|
+
"STYLE": [
|
|
439
|
+
"codes"
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"id": "sc-edge",
|
|
445
|
+
"type": "scenario",
|
|
446
|
+
"label": "Only the edge maps",
|
|
447
|
+
"x": 520,
|
|
448
|
+
"y": 650,
|
|
449
|
+
"given": "a module outside src/http that imports the error handler, and a domain module that imports the HTTP framework",
|
|
450
|
+
"when": "the dependency rules run",
|
|
451
|
+
"then": "both fail the build naming the module and the import",
|
|
452
|
+
"hubWhen": {
|
|
453
|
+
"BOUNDARY": [
|
|
454
|
+
"edge"
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"id": "sc-layered",
|
|
460
|
+
"type": "scenario",
|
|
461
|
+
"label": "Driver error stays below",
|
|
462
|
+
"x": 520,
|
|
463
|
+
"y": 780,
|
|
464
|
+
"given": "a domain class that depends on a driver exception type, and a persistence adapter method that declares one",
|
|
465
|
+
"when": "the architecture test runs",
|
|
466
|
+
"then": "it fails naming both; a domain exception that does not extend {{BASE_ERROR}} fails it too",
|
|
467
|
+
"hubWhen": {
|
|
468
|
+
"BOUNDARY": [
|
|
469
|
+
"layered"
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"id": "sc-log-once",
|
|
475
|
+
"type": "scenario",
|
|
476
|
+
"label": "Log-and-rethrow refused",
|
|
477
|
+
"x": 520,
|
|
478
|
+
"y": 910,
|
|
479
|
+
"given": "a catch block that logs the error and throws it on",
|
|
480
|
+
"when": "the Semgrep rules run on the pull request",
|
|
481
|
+
"then": "it fails naming the block (S2139 on the JVM)"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"id": "sc-correlation",
|
|
485
|
+
"type": "scenario",
|
|
486
|
+
"label": "Every line correlated",
|
|
487
|
+
"x": 520,
|
|
488
|
+
"y": 1040,
|
|
489
|
+
"given": "the log output of a full test run",
|
|
490
|
+
"when": "each line is read",
|
|
491
|
+
"then": "every line carries a {{CORRELATION_FIELD}} of 16 to 36 hex characters (dashes allowed); one without fails the test"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"id": "sc-structured",
|
|
495
|
+
"type": "scenario",
|
|
496
|
+
"label": "Every line parses",
|
|
497
|
+
"x": 520,
|
|
498
|
+
"y": 1170,
|
|
499
|
+
"given": "the log output of a full test run",
|
|
500
|
+
"when": "each line is parsed as JSON",
|
|
501
|
+
"then": "every line parses, has a level from {{LEVELS}}, the {{CORRELATION_FIELD}} and a message of at most {{MAX_MESSAGE_CHARS}} characters",
|
|
502
|
+
"hubWhen": {
|
|
503
|
+
"LOGS": [
|
|
504
|
+
"structured"
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"id": "sc-text",
|
|
510
|
+
"type": "scenario",
|
|
511
|
+
"label": "Every line matches",
|
|
512
|
+
"x": 520,
|
|
513
|
+
"y": 1300,
|
|
514
|
+
"given": "the log output of a full test run",
|
|
515
|
+
"when": "each line is matched against the layout",
|
|
516
|
+
"then": "every line matches, with a level from {{LEVELS}} in upper case and the {{CORRELATION_FIELD}} in brackets",
|
|
517
|
+
"hubWhen": {
|
|
518
|
+
"LOGS": [
|
|
519
|
+
"text"
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"id": "sc-no-secrets",
|
|
525
|
+
"type": "scenario",
|
|
526
|
+
"label": "Secrets logged clean",
|
|
527
|
+
"x": 520,
|
|
528
|
+
"y": 1430,
|
|
529
|
+
"given": "a log call with each of {{REDACTED_FIELDS}} at the top level and one level down, and a log call passing a whole request object",
|
|
530
|
+
"when": "the logger test and the Semgrep rules run",
|
|
531
|
+
"then": "the written line holds only redaction markers (or only the allowed fields), and the whole-object call fails the lint"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"id": "sc-no-leak",
|
|
535
|
+
"type": "scenario",
|
|
536
|
+
"label": "Unexpected error answered clean",
|
|
537
|
+
"x": 520,
|
|
538
|
+
"y": 1560,
|
|
539
|
+
"given": "a route and a CLI command that throw a TypeError, with the element configured as in production",
|
|
540
|
+
"when": "each is called",
|
|
541
|
+
"then": "the HTTP body and the CLI's output match no stack-trace pattern, exception class name, source path, SQL or internal address"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"id": "sc-levels",
|
|
545
|
+
"type": "scenario",
|
|
546
|
+
"label": "4xx is not an error",
|
|
547
|
+
"x": 520,
|
|
548
|
+
"y": 1690,
|
|
549
|
+
"given": "the log output of a full test run, with requests answered 404 and a request that hit a database outage",
|
|
550
|
+
"when": "the log-shape test reads the lines",
|
|
551
|
+
"then": "no line with a 4xx status is at error level, and the outage line is"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"id": "adr-exceptions",
|
|
555
|
+
"type": "adr",
|
|
556
|
+
"label": "Exceptions with a small domain hierarchy",
|
|
557
|
+
"x": 780,
|
|
558
|
+
"y": 0,
|
|
559
|
+
"concern": "error-handling-logging",
|
|
560
|
+
"status": "accepted",
|
|
561
|
+
"date": "",
|
|
562
|
+
"context": "Code in this element fails: a dependency times out, input is wrong, a record is gone, a bug is hit. The forces: a failure that is swallowed becomes a wrong answer nobody can explain; one that is logged at every layer on its way up becomes five lines about one event; a caller that is handed a stack trace learns the file layout, the framework and sometimes the SQL; a log line without the request's id cannot be found when it matters; logs are read widely and copied to places with weaker access, so a password or an e-mail address in them is a leak; expected failures (not found, rejected, conflict) and unexpected ones (bugs, outages) need different handling, and a style that does not separate them handles both badly; and every convention here is kept by hundreds of hands, so it holds only if a tool checks it. What is done with the lines once written (shipping, retention, alerting, traces) is the Observability concern's decision, not this one's; that pack takes the shape and redaction decided here as given. What an HTTP API's error body looks like (its format, codes and field errors) is the Errors pack's decision; what must never reach a caller at any edge is this one's. The snippets assume one repository layout: source in src/ with the edge in src/http, the inner code in src/domain and src/application, the error types in src/errors, the logger in src/logger.js, and tests in test/; the TypeScript snippets name the Python, JVM, Go and .NET equivalents.",
|
|
563
|
+
"decision": "Expected failures are thrown as subclasses of one base class {{BASE_ERROR}} in src/errors (NotFoundError, ValidationError, ConflictError, UpstreamUnavailableError, each with a stable code and an HTTP status hint; under ten classes in all); unexpected errors (TypeError, NullPointerException, driver errors nobody translated) are not caught below the boundary. Every wrap passes the original as the cause (Error.cause, inner exception, raise … from). Errors are handled by: {{BOUNDARY}}; the handler maps {{BASE_ERROR}} subclasses by their code, treats everything else as 500 and logs each failure once at the level its meaning asks for ({{LEVELS}}). An HTTP caller sees the error body the Errors pack decides (RFC 9457 problem details unless it says otherwise), and no caller at any edge sees a stack trace, class name, SQL, path or internal host. Log lines are {{LOGS}} with the {{CORRELATION_FIELD}} from the logger's context (AsyncLocalStorage, MDC, contextvars), and {{REDACTED_FIELDS}} are kept out by {{REDACTION}} in the logger (pino redact or serializers, structlog processors, Serilog destructuring policies, logback masking). Conventions are held by the linters: ESLint (no-empty, preserve-caught-error, only-throw-error), Semgrep (log-and-continue, log-and-rethrow, whole objects), Ruff (BLE, TRY, LOG), Error Prone and Sonar on the JVM; in .NET the Roslyn analyzers CA1031 (do not catch general exceptions) and CA2200 (rethrow to preserve the stack), configured as errors in .editorconfig.",
|
|
564
|
+
"consequences": "• Little ceremony: the happy path reads straight, and the frameworks already map exceptions to responses.\n• A function's signature does not say what it can fail with; reviewers and the hierarchy carry that knowledge.\n• An exception used for an expected case that is frequent (a cache miss, a validation on every field) costs stack capture; batch validation is reported as a notification object, not thrown field by field.\n• The hierarchy must stay small (under ten classes, checked) or it becomes a second type system nobody keeps up.",
|
|
565
|
+
"alternatives": "1. Result types: failures in the signature, at the cost of handling at every call and fighting libraries that throw.\n2. Error codes from a catalogue: stable for clients, but codes compared by hand everywhere inside the code.\n3. Catch-all handlers per controller: the same mapping written many times, drifting apart.",
|
|
566
|
+
"hubWhen": {
|
|
567
|
+
"STYLE": [
|
|
568
|
+
"exceptions"
|
|
569
|
+
]
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"id": "adr-result",
|
|
574
|
+
"type": "adr",
|
|
575
|
+
"label": "Result types for expected failures",
|
|
576
|
+
"x": 780,
|
|
577
|
+
"y": 130,
|
|
578
|
+
"concern": "error-handling-logging",
|
|
579
|
+
"status": "accepted",
|
|
580
|
+
"date": "",
|
|
581
|
+
"context": "Code in this element fails: a dependency times out, input is wrong, a record is gone, a bug is hit. The forces: a failure that is swallowed becomes a wrong answer nobody can explain; one that is logged at every layer on its way up becomes five lines about one event; a caller that is handed a stack trace learns the file layout, the framework and sometimes the SQL; a log line without the request's id cannot be found when it matters; logs are read widely and copied to places with weaker access, so a password or an e-mail address in them is a leak; expected failures (not found, rejected, conflict) and unexpected ones (bugs, outages) need different handling, and a style that does not separate them handles both badly; and every convention here is kept by hundreds of hands, so it holds only if a tool checks it. What is done with the lines once written (shipping, retention, alerting, traces) is the Observability concern's decision, not this one's; that pack takes the shape and redaction decided here as given. What an HTTP API's error body looks like (its format, codes and field errors) is the Errors pack's decision; what must never reach a caller at any edge is this one's. The snippets assume one repository layout: source in src/ with the edge in src/http, the inner code in src/domain and src/application, the error types in src/errors, the logger in src/logger.js, and tests in test/; the TypeScript snippets name the Python, JVM, Go and .NET equivalents.",
|
|
582
|
+
"decision": "A function that can fail in an expected way returns a Result: Result<T, E> and the ? operator in Rust (thiserror for error types, anyhow only at the binary's edge), error values with %w and errors.Is/As in Go, kotlin.Result or Arrow's Either in Kotlin, neverthrow (or fp-ts Either) in TypeScript. The error type of each module names its cases and carries a stable code; wraps keep the source. Exceptions and panics are for bugs and broken invariants only and are never caught except at the boundary. An ignored Result fails the build (unused_must_use, errcheck, neverthrow/must-use-result). Errors are handled by: {{BOUNDARY}}; the handler maps the error cases to responses and logs each failure once at the level its meaning asks for ({{LEVELS}}). An HTTP caller sees the error body the Errors pack decides (RFC 9457 problem details unless it says otherwise), and no caller at any edge sees a stack trace, class name, SQL, path or internal host. Log lines are {{LOGS}} with the {{CORRELATION_FIELD}} from the logger's context, and {{REDACTED_FIELDS}} are kept out by {{REDACTION}} in the logger (zap or slog handlers, tracing layers, pino redact or serializers).",
|
|
583
|
+
"consequences": "• Every expected failure is in the signature; forgetting one is a compile error, not an incident.\n• Every call that can fail is handled or passed on explicitly, which is more code and a style the whole team must share.\n• Libraries that throw (HTTP clients, ORMs, JSON parsers) are wrapped at the module boundary into Results, and that wrapping is where bugs hide.\n• Unexpected errors still need the boundary handler, so the element has two mechanisms, not one.",
|
|
584
|
+
"alternatives": "1. Exceptions with a hierarchy: less ceremony, failures invisible in signatures.\n2. Error codes from a catalogue: values too, but untyped; a Result's error type can carry the catalogue code.\n3. Results everywhere, bugs included: panics wrapped as values hide what should crash loudly.",
|
|
585
|
+
"hubWhen": {
|
|
586
|
+
"STYLE": [
|
|
587
|
+
"result"
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"id": "adr-codes",
|
|
593
|
+
"type": "adr",
|
|
594
|
+
"label": "Error codes from a catalogue",
|
|
595
|
+
"x": 780,
|
|
596
|
+
"y": 260,
|
|
597
|
+
"concern": "error-handling-logging",
|
|
598
|
+
"status": "accepted",
|
|
599
|
+
"date": "",
|
|
600
|
+
"context": "Code in this element fails: a dependency times out, input is wrong, a record is gone, a bug is hit. The forces: a failure that is swallowed becomes a wrong answer nobody can explain; one that is logged at every layer on its way up becomes five lines about one event; a caller that is handed a stack trace learns the file layout, the framework and sometimes the SQL; a log line without the request's id cannot be found when it matters; logs are read widely and copied to places with weaker access, so a password or an e-mail address in them is a leak; expected failures (not found, rejected, conflict) and unexpected ones (bugs, outages) need different handling, and a style that does not separate them handles both badly; and every convention here is kept by hundreds of hands, so it holds only if a tool checks it. What is done with the lines once written (shipping, retention, alerting, traces) is the Observability concern's decision, not this one's; that pack takes the shape and redaction decided here as given. What an HTTP API's error body looks like (its format, codes and field errors) is the Errors pack's decision; what must never reach a caller at any edge is this one's. The snippets assume one repository layout: source in src/ with the edge in src/http, the inner code in src/domain and src/application, the error types in src/errors, the logger in src/logger.js, and tests in test/; the TypeScript snippets name the Python, JVM, Go and .NET equivalents.",
|
|
601
|
+
"decision": "One catalogue in the repository (src/errors/catalogue.ts, or a generated enum from it) defines every error: a stable upper-case code (ORDER_NOT_FOUND), the HTTP status or exit status, a message template with named placeholders and a type URI. Code signals an error by returning or raising an error value built from a catalogue entry (fail('ORDER_NOT_FOUND', { orderId }) in TypeScript or Python, an error struct with the code in Go, an enum in C), never an ad-hoc string; a code that is not in the catalogue fails a test, and a renamed or removed code fails the catalogue snapshot (codes are added or deprecated, never changed). Errors are handled by: {{BOUNDARY}}; the handler maps the catalogue entry to the status and to the error body the Errors pack decides (RFC 9457 problem details unless it says otherwise), with the catalogue's code as the stable code wherever that pack gives callers codes (its api/errors/codes.yaml is generated from this catalogue, so there is one list), and logs each failure once at the level its meaning asks for ({{LEVELS}}), with the code as a field. Log lines are {{LOGS}} with the {{CORRELATION_FIELD}} from the logger's context, and {{REDACTED_FIELDS}} are kept out by {{REDACTION}} in the logger. Unexpected errors map to one catalogue entry (INTERNAL) and keep their cause in the log only.",
|
|
602
|
+
"consequences": "• Clients and support share one documented list; a code never changes meaning.\n• The catalogue is a shared file everyone edits; ownership and review of it must be clear or it fills with near-duplicates.\n• Codes are compared as values inside the code too, which is weaker than types; a generated enum limits typos.\n• Message templates in one place are easy to translate and easy to leave stale.",
|
|
603
|
+
"alternatives": "1. Exceptions with a hierarchy: the type is the code; works until a client needs the list.\n2. Result types with an error enum per module: typed, but there is no one list across the element.\n3. Codes invented at call sites: what a catalogue replaces; nobody can list them.",
|
|
604
|
+
"hubWhen": {
|
|
605
|
+
"STYLE": [
|
|
606
|
+
"codes"
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"id": "adr-edge",
|
|
612
|
+
"type": "adr",
|
|
613
|
+
"label": "Errors handled once at the edge",
|
|
614
|
+
"x": 780,
|
|
615
|
+
"y": 390,
|
|
616
|
+
"concern": "error-handling-logging",
|
|
617
|
+
"status": "accepted",
|
|
618
|
+
"date": "",
|
|
619
|
+
"context": "Code in this element fails: a dependency times out, input is wrong, a record is gone, a bug is hit. The forces: a failure that is swallowed becomes a wrong answer nobody can explain; one that is logged at every layer on its way up becomes five lines about one event; a caller that is handed a stack trace learns the file layout, the framework and sometimes the SQL; a log line without the request's id cannot be found when it matters; logs are read widely and copied to places with weaker access, so a password or an e-mail address in them is a leak; expected failures (not found, rejected, conflict) and unexpected ones (bugs, outages) need different handling, and a style that does not separate them handles both badly; and every convention here is kept by hundreds of hands, so it holds only if a tool checks it. What is done with the lines once written (shipping, retention, alerting, traces) is the Observability concern's decision, not this one's; that pack takes the shape and redaction decided here as given. What an HTTP API's error body looks like (its format, codes and field errors) is the Errors pack's decision; what must never reach a caller at any edge is this one's. The snippets assume one repository layout: source in src/ with the edge in src/http, the inner code in src/domain and src/application, the error types in src/errors, the logger in src/logger.js, and tests in test/; the TypeScript snippets name the Python, JVM, Go and .NET equivalents.",
|
|
620
|
+
"decision": "One error handler per kind of edge owns the mapping from errors to the outside: an Express or Fastify error handler, a NestJS exception filter, a Spring @ControllerAdvice, an ASP.NET exception handler middleware, a FastAPI exception handler; a queue consumer's and a scheduled job's outer loop do the same for their failures (acknowledge, retry or dead-letter by error kind). The handler maps the error to what its edge answers (for HTTP, the error body the Errors pack decides (RFC 9457 problem details unless it says otherwise)), logs it exactly once with the cause chain and the {{CORRELATION_FIELD}}, and never leaks a stack trace in production. Domain and application code import no HTTP framework and know no status code; a dependency rule (dependency-cruiser, ArchUnit, import-linter) keeps it so.",
|
|
621
|
+
"consequences": "• One place to get the mapping right, one log line per failure, and inner code reusable behind another edge.\n• The handler needs the error's kind to map it, so the error style must carry it (a subclass, a Result case or a code).\n• A library's raw error that reaches the handler untranslated becomes a 500, which is right for a bug and wrong for an expected case someone forgot to type.",
|
|
622
|
+
"alternatives": "1. Translation per layer: keeps driver types out of the domain, at the cost of error classes per layer.\n2. Try/catch in every controller action: the same mapping written many times.",
|
|
623
|
+
"hubWhen": {
|
|
624
|
+
"BOUNDARY": [
|
|
625
|
+
"edge"
|
|
626
|
+
]
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"id": "adr-layered",
|
|
631
|
+
"type": "adr",
|
|
632
|
+
"label": "Errors translated layer by layer",
|
|
633
|
+
"x": 780,
|
|
634
|
+
"y": 520,
|
|
635
|
+
"concern": "error-handling-logging",
|
|
636
|
+
"status": "accepted",
|
|
637
|
+
"date": "",
|
|
638
|
+
"context": "Code in this element fails: a dependency times out, input is wrong, a record is gone, a bug is hit. The forces: a failure that is swallowed becomes a wrong answer nobody can explain; one that is logged at every layer on its way up becomes five lines about one event; a caller that is handed a stack trace learns the file layout, the framework and sometimes the SQL; a log line without the request's id cannot be found when it matters; logs are read widely and copied to places with weaker access, so a password or an e-mail address in them is a leak; expected failures (not found, rejected, conflict) and unexpected ones (bugs, outages) need different handling, and a style that does not separate them handles both badly; and every convention here is kept by hundreds of hands, so it holds only if a tool checks it. What is done with the lines once written (shipping, retention, alerting, traces) is the Observability concern's decision, not this one's; that pack takes the shape and redaction decided here as given. What an HTTP API's error body looks like (its format, codes and field errors) is the Errors pack's decision; what must never reach a caller at any edge is this one's. The snippets assume one repository layout: source in src/ with the edge in src/http, the inner code in src/domain and src/application, the error types in src/errors, the logger in src/logger.js, and tests in test/; the TypeScript snippets name the Python, JVM, Go and .NET equivalents.",
|
|
639
|
+
"decision": "Each layer defines its own error types and translates the ones from below at its boundary: the persistence adapter catches driver errors (SQLException, DataAccessException, pg errors) and raises persistence errors (DuplicateKey, Unavailable); the domain and application layers raise their own (OrderNotFound, OrderAlreadyPaid), all extending {{BASE_ERROR}}, and wrap persistence errors they cannot handle; the API adapter maps domain errors to the error body the Errors pack decides (RFC 9457 problem details unless it says otherwise) and logs each failure once with the cause chain and the {{CORRELATION_FIELD}}. Every translation keeps the original as the cause. An architecture test (ArchUnit, dependency-cruiser, import-linter) fails when the domain or application layer depends on a driver or framework error type, and the linters fail a translation that drops the cause.",
|
|
640
|
+
"consequences": "• The domain depends on no vendor's types and the same application layer serves HTTP, messaging and batch edges.\n• More error classes and more code at each boundary; a lazy translation that drops the cause is the common bug, so the linters check for it.\n• Logging still happens once, at the edge; a layer that logs what it translates doubles the lines.",
|
|
641
|
+
"alternatives": "1. Handled once at the edge: less code, but the domain sees driver errors unless it never catches at all.\n2. One flat hierarchy shared by all layers: fewer classes, but the domain imports the persistence errors.",
|
|
642
|
+
"hubWhen": {
|
|
643
|
+
"BOUNDARY": [
|
|
644
|
+
"layered"
|
|
645
|
+
]
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"id": "ff-eslint-errors",
|
|
650
|
+
"type": "fitness-fn",
|
|
651
|
+
"label": "TypeScript error rules",
|
|
652
|
+
"x": 1040,
|
|
653
|
+
"y": 0,
|
|
654
|
+
"characteristic": "maintainability",
|
|
655
|
+
"scope": "atomic",
|
|
656
|
+
"cadence": "triggered",
|
|
657
|
+
"trigger": "pull-request",
|
|
658
|
+
"invocation": "automated",
|
|
659
|
+
"description": "ESLint (9.35 or later for preserve-caught-error) runs as a required check: an empty catch, a rethrow that drops the cause, a thrown non-Error, an unhandled rejected promise and a console call each fail the build. For .NET the matching Roslyn analyzers are CA1031 and CA2200 as errors in .editorconfig.\n\nThreshold: 0 violations of no-empty (catch included), preserve-caught-error, only-throw-error, no-floating-promises and no-console in src on every pull request\n\nTool: ESLint with typescript-eslint; Roslyn analyzers for .NET\n\n```js\n// eslint.config.js\nimport tseslint from 'typescript-eslint'\nexport default tseslint.config({\n files: ['src/**/*.ts'],\n languageOptions: { parserOptions: { projectService: true } },\n rules: {\n 'no-empty': ['error', { allowEmptyCatch: false }], // no swallowed errors\n 'preserve-caught-error': 'error', // new Error(msg, { cause }) when rethrowing (ESLint 9.35+)\n '@typescript-eslint/only-throw-error': 'error', // throw Error instances only (no-throw-literal, typed)\n '@typescript-eslint/no-floating-promises': 'error', // a dropped rejection is a swallowed error\n 'no-console': 'error', // the logger, never console\n },\n})\n```"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"id": "ff-ruff-errors",
|
|
663
|
+
"type": "fitness-fn",
|
|
664
|
+
"label": "Python error rules",
|
|
665
|
+
"x": 1040,
|
|
666
|
+
"y": 130,
|
|
667
|
+
"characteristic": "maintainability",
|
|
668
|
+
"scope": "atomic",
|
|
669
|
+
"cadence": "triggered",
|
|
670
|
+
"trigger": "pull-request",
|
|
671
|
+
"invocation": "automated",
|
|
672
|
+
"description": "Ruff runs as a required check with the exception and logging rule families: a blind except that does not re-raise (BLE001, which covers a catch that only logs), a try-except-pass, a raise inside except without from, logging.error instead of logging.exception, an f-string in a log call and a print each fail the build.\n\nThreshold: 0 violations of the BLE, TRY, LOG, G, T20, S110 and B904 rules in src on every pull request\n\nTool: Ruff\n\n```toml\n# pyproject.toml\n[tool.ruff.lint]\nextend-select = [\n \"BLE\", # BLE001: blind except Exception without re-raise (a catch that only logs included)\n \"TRY\", # TRY002 raise bare Exception, TRY003 message built inline, TRY201 \"raise e\" where a bare raise re-raises,\n # TRY203 useless try/except, TRY300 else clause, TRY400 logging.exception, TRY401 redundant exception in message\n \"LOG\", # logging module misuse, e.g. LOG015 root logger calls\n \"G\", # G004: f-string in a log call; data goes in extra=, not the message\n \"T20\", # T201 print, T203 pprint: the logger, never print\n \"S110\", # try-except-pass\n \"B904\", # raise ... from err inside except: keep the cause\n]\n[tool.ruff.lint.per-file-ignores]\n\"tests/**\" = [\"T20\", \"BLE001\"]\n```"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"id": "ff-java-errors",
|
|
676
|
+
"type": "fitness-fn",
|
|
677
|
+
"label": "Java error rules",
|
|
678
|
+
"x": 1040,
|
|
679
|
+
"y": 260,
|
|
680
|
+
"characteristic": "maintainability",
|
|
681
|
+
"scope": "atomic",
|
|
682
|
+
"cadence": "triggered",
|
|
683
|
+
"trigger": "pull-request",
|
|
684
|
+
"invocation": "automated",
|
|
685
|
+
"description": "Error Prone runs in the compiler with its exception patterns raised to errors; the SonarQube quality profile sets the matching rules to Blocker so the quality gate on new code fails on an empty catch, a dropped cause, log-and-rethrow, a caught Throwable, a thrown generic exception or System.out.\n\nThreshold: 0 Error Prone errors from the exception patterns at compile time; 0 open Sonar issues of S108, S1166, S2139, S1181, S112, S106 on new code\n\nTool: Error Prone (javac plugin) and SonarQube\n\n```xml\n<!-- pom.xml: maven-compiler-plugin -->\n<compilerArgs>\n <arg>-XDcompilePolicy=simple</arg>\n <arg>--should-stop=ifError=FLOW</arg>\n <arg>-Xplugin:ErrorProne\n -Xep:EmptyCatch:ERROR\n -Xep:UnusedException:ERROR\n -Xep:CatchAndPrintStackTrace:ERROR\n -Xep:SystemOut:ERROR\n -Xep:Finally:ERROR</arg>\n</compilerArgs>\n<!-- SonarQube quality profile, severity Blocker:\n S108 empty block S1166 exception handlers should preserve the original exception\n S2139 logged and rethrown S1181 Throwable and Error should not be caught\n S112 generic exception thrown S106 System.out used to log -->\n```"
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"id": "ff-semgrep-logging",
|
|
689
|
+
"type": "fitness-fn",
|
|
690
|
+
"label": "No console, print, whole objects, log-and-continue or log-and-rethrow",
|
|
691
|
+
"x": 1040,
|
|
692
|
+
"y": 390,
|
|
693
|
+
"characteristic": "maintainability",
|
|
694
|
+
"scope": "atomic",
|
|
695
|
+
"cadence": "triggered",
|
|
696
|
+
"trigger": "pull-request",
|
|
697
|
+
"invocation": "automated",
|
|
698
|
+
"description": "Semgrep runs on src with five rules: console in TypeScript, print in Python, a log call passed a whole request, response, headers or body object (as a bare argument or as a property of the first object), a catch whose body is a single log call (the error is swallowed), and a catch that logs and rethrows (the error would be logged twice).\n\nThreshold: 0 Semgrep findings of the five logging rules in src on every pull request\n\nTool: Semgrep\n\n```yaml\n# .semgrep/logging.yml (semgrep --config .semgrep/ --error src/)\nrules:\n - id: no-console\n languages: [typescript, javascript]\n severity: ERROR\n message: Use the logger; console lines have no level, no correlation id and no redaction\n pattern: console.$M(...)\n - id: no-print\n languages: [python]\n severity: ERROR\n message: Use the logger, not print\n pattern: print(...)\n - id: no-whole-object-logged\n languages: [typescript, javascript, python]\n severity: ERROR\n message: Never log a whole request, response, headers or body; log the fields the serializer allows\n patterns:\n - pattern-either:\n - pattern: '$LOG.$LEVEL(..., $OBJ, ...)'\n - pattern: '$LOG.$LEVEL({ ..., $OBJ: $V, ... }, ...)'\n - metavariable-regex:\n metavariable: $LEVEL\n regex: '^(error|warn|warning|info|debug|exception)$'\n - metavariable-regex:\n metavariable: $OBJ\n regex: '^(req|request|res|response|ctx|event|body|headers)$'\n - id: log-and-continue\n languages: [typescript, javascript]\n severity: ERROR\n message: A catch that only logs swallows the error; rethrow it, return it, or handle it with a stated recovery\n pattern: |\n try { ... } catch ($E) { $LOG.$LEVEL(...); }\n - id: log-and-rethrow\n languages: [typescript, javascript]\n severity: ERROR\n message: Log once, where the error is handled; a catch that logs and rethrows logs it twice\n pattern: |\n try { ... } catch ($E) { ... $LOG.$LEVEL(...); ... throw ...; }\n```"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"id": "ff-redact-denylist",
|
|
702
|
+
"type": "fitness-fn",
|
|
703
|
+
"label": "Secret paths redacted in the logger",
|
|
704
|
+
"x": 1040,
|
|
705
|
+
"y": 520,
|
|
706
|
+
"characteristic": "security",
|
|
707
|
+
"scope": "atomic",
|
|
708
|
+
"cadence": "triggered",
|
|
709
|
+
"trigger": "pull-request",
|
|
710
|
+
"invocation": "automated",
|
|
711
|
+
"description": "The logger is built once by a factory with a redact list of the known secret and personal-data paths and level labels as words; the exported logger and the test's logger come from the same factory, so the test logs an object holding each path at the top level and one level down into a stream and asserts that the written line holds only the marker. structlog: a processor that walks event_dict for the same keys; Serilog: Destructurama.Attributed or a masking enricher with the same list.\n\nThreshold: Every path of {{REDACTED_FIELDS}} is in the logger's redact list; a unit test logging each of them at the top level and one level down sees only the redaction marker\n\nTool: pino (redact) with a Vitest test; structlog processors for Python\n\n```js\n// src/logger.js\nimport pino from 'pino'\nexport const PATHS = '{{REDACTED_FIELDS}}'.split(/,\\s*/)\nexport const createLogger = (stream) => pino({\n level: process.env.LOG_LEVEL ?? 'info',\n formatters: { level: (label) => ({ level: label }) }, // \"level\":\"error\", not pino's number\n redact: { paths: [...PATHS, ...PATHS.map((p) => `*.${p}`), 'req.headers.authorization', 'req.headers.cookie'], censor: '[REDACTED]' },\n}, stream)\nexport const logger = createLogger(pino.destination(1))\n\n// test/logger.test.js\nimport { expect, it } from 'vitest'\nimport { PATHS, createLogger } from '../src/logger.js'\nit('redacts every listed path at the top level and one level down', () => {\n const lines = []\n const log = createLogger({ write: (l) => lines.push(l) })\n log.info({ ...Object.fromEntries(PATHS.map((p) => [p, 'secret-1'])), user: Object.fromEntries(PATHS.map((p) => [p, 'secret-2'])) }, 'sign-in')\n expect(lines[0]).not.toMatch(/secret-[12]/)\n expect((lines[0].match(/\\[REDACTED\\]/g) ?? []).length).toBe(PATHS.length * 2)\n})\n```",
|
|
712
|
+
"hubWhen": {
|
|
713
|
+
"REDACTION": [
|
|
714
|
+
"denylist"
|
|
715
|
+
]
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"id": "ff-redact-allowlist",
|
|
720
|
+
"type": "fitness-fn",
|
|
721
|
+
"label": "Only allowed fields leave the logger",
|
|
722
|
+
"x": 1040,
|
|
723
|
+
"y": 650,
|
|
724
|
+
"characteristic": "security",
|
|
725
|
+
"scope": "atomic",
|
|
726
|
+
"cadence": "triggered",
|
|
727
|
+
"trigger": "pull-request",
|
|
728
|
+
"invocation": "automated",
|
|
729
|
+
"description": "The logger's formatter drops every top-level field that is not on the allow-list, and each object type has a serializer that picks its allowed fields, so nothing is logged whole; the exported logger and the test's logger come from the same factory, and the test logs an unknown field and a whole user record into a stream and asserts that only the allowed fields are written. structlog: a processor that filters event_dict to the same list.\n\nThreshold: 100 % of top-level log fields are on the allow-list and every object field goes through a serializer; a unit test logging an unknown field and a whole user object sees neither\n\nTool: pino (formatters and serializers) with a Vitest test; structlog processors for Python\n\n```js\n// src/logger.js\nimport pino from 'pino'\nconst ALLOWED = new Set(['level', 'time', 'msg', 'service', '{{CORRELATION_FIELD}}', 'err', 'req', 'user', 'order', 'durationMs', 'code', 'status'])\nconst pick = (keys) => (o) => Object.fromEntries(keys.filter((k) => o?.[k] !== undefined).map((k) => [k, o[k]]))\nexport const createLogger = (stream) => pino({\n base: { service: 'order-api' },\n formatters: {\n level: (label) => ({ level: label }), // \"level\":\"error\", not pino's number\n log: (o) => Object.fromEntries(Object.entries(o).filter(([k]) => ALLOWED.has(k))),\n },\n serializers: {\n req: (r) => ({ id: r.id, method: r.method, path: String(r.url).split('?')[0] }), // no headers, no body\n user: pick(['id', 'role']), // never name, email, phone\n order: pick(['id', 'status', 'total']),\n err: pino.stdSerializers.err,\n },\n}, stream)\nexport const logger = createLogger(pino.destination(1))\n\n// test/logger.test.js\nimport { expect, it } from 'vitest'\nimport { createLogger } from '../src/logger.js'\nit('writes only allowed fields, never a whole object', () => {\n const lines = []\n createLogger({ write: (l) => lines.push(l) }).info({ user: { id: 7, email: 'a@b.c' }, password: 'x' }, 'sign-in')\n expect(lines[0]).toContain('\"user\":{\"id\":7')\n expect(lines[0]).not.toMatch(/a@b\\.c|password/)\n})\n```",
|
|
730
|
+
"hubWhen": {
|
|
731
|
+
"REDACTION": [
|
|
732
|
+
"allowlist"
|
|
733
|
+
]
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"id": "ff-log-shape",
|
|
738
|
+
"type": "fitness-fn",
|
|
739
|
+
"label": "Every log line well-formed, correlated and levelled",
|
|
740
|
+
"x": 1040,
|
|
741
|
+
"y": 780,
|
|
742
|
+
"characteristic": "maintainability",
|
|
743
|
+
"scope": "atomic",
|
|
744
|
+
"cadence": "triggered",
|
|
745
|
+
"trigger": "pull-request",
|
|
746
|
+
"invocation": "automated",
|
|
747
|
+
"description": "The test run writes its logs to a file; a test afterwards reads every line and asserts the shape: JSON lines must parse, hold the fields, carry a level word from the list and never pair a 4xx status with level error; text lines must match the fixed layout built from the same levels and limit. One malformed, uncorrelated or mislevelled line fails the build.\n\nThreshold: 100 % of the lines written during a full test run parse as {{LOGS}}, carry a level from {{LEVELS}}, a {{CORRELATION_FIELD}} of 16 to 36 hex characters and a message of at most {{MAX_MESSAGE_CHARS}} characters; 0 JSON lines with a 4xx status at level error\n\nTool: Vitest (a test over the test run's log file); the same test under pytest for Python\n\n```ts\n// test/log-shape.test.ts (the app writes LOG_FILE=test-logs/app.log during the run)\nimport { readFileSync } from 'node:fs'\nimport { expect, it } from 'vitest'\nconst FIELD = '{{CORRELATION_FIELD}}'\nconst LEVELS = '{{LEVELS}}'.split(/,\\s*/)\nconst MAX = {{MAX_MESSAGE_CHARS}}\nconst ID = /^[0-9a-f-]{16,36}$/ // a trace id, or a UUID with dashes\nconst TEXT = new RegExp(`^\\\\d{4}-\\\\d\\\\d-\\\\d\\\\dT\\\\S+ (${LEVELS.map((l) => l.toUpperCase()).join('|')}) \\\\[[0-9a-f-]{16,36}\\\\] .{1,${MAX}}(\\\\s\\\\w+=\\\\S+)*$`)\nit('every log line of the test run is well-formed, correlated and levelled by meaning', () => {\n const lines = readFileSync('test-logs/app.log', 'utf8').split('\\n').filter((l) => l && !l.startsWith(' ')) // indented = stack trace\n expect(lines.length).toBeGreaterThan(0)\n for (const line of lines) {\n if (line.startsWith('{')) {\n const o = JSON.parse(line)\n expect(LEVELS, line).toContain(o.level)\n expect(o[FIELD], line).toMatch(ID)\n expect(String(o.msg ?? o.message).length, line).toBeLessThanOrEqual(MAX)\n if (typeof o.status === 'number' && o.status >= 400 && o.status < 500) expect(o.level, `a 4xx logged at error: ${line}`).not.toBe('error')\n } else expect(line).toMatch(TEXT)\n }\n})\n```"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
"id": "ff-no-stack-to-caller",
|
|
751
|
+
"type": "fitness-fn",
|
|
752
|
+
"label": "Nothing internal reaches a caller",
|
|
753
|
+
"x": 1040,
|
|
754
|
+
"y": 910,
|
|
755
|
+
"characteristic": "security",
|
|
756
|
+
"scope": "atomic",
|
|
757
|
+
"cadence": "triggered",
|
|
758
|
+
"trigger": "pull-request",
|
|
759
|
+
"invocation": "automated",
|
|
760
|
+
"description": "An integration test starts the element with production settings, calls a route that throws an unexpected error, runs the CLI's test-only command that throws the same, and asserts that neither the HTTP body nor the CLI output matches a stack-trace, class-name, path, SQL or address pattern. Drop the CLI test where the element has none; a queue consumer's test applies the same pattern to the reason it writes on a dead-lettered message. The shape of the HTTP error body is checked in the Errors pack.\n\nThreshold: 0 stack-trace patterns, exception class names, source paths, SQL or internal addresses in the body of a 500 response or in the output of a failing CLI command, with production settings\n\nTool: Vitest with supertest; the same test with httpx under pytest for Python\n\n```ts\n// test/http/error-response.test.ts (NODE_ENV=production in this file's setup)\nimport { spawnSync } from 'node:child_process'\nimport request from 'supertest'\nimport { expect, it } from 'vitest'\nimport { app } from '../../src/app' // registers GET /__boom in tests only: throws new TypeError('kaput')\n\nconst LEAKS = /\\n\\s+at |TypeError|kaput|\\/src\\/|node_modules|\\.ts:\\d+|SELECT |INSERT |localhost|10\\.\\d+\\.\\d+\\.\\d+/\n\nit('an unexpected error reaches an HTTP caller as a clean 500', async () => {\n const res = await request(app).get('/__boom')\n expect(res.status).toBe(500)\n expect(res.text).not.toMatch(LEAKS)\n})\nit('an unexpected error reaches a CLI user as a clean message', () => {\n const run = spawnSync('node', ['dist/cli.js', '__boom'], { env: { ...process.env, NODE_ENV: 'production' }, encoding: 'utf8' }) // test-only command: throws new TypeError('kaput')\n expect(run.status).not.toBe(0)\n expect(run.stdout + run.stderr).not.toMatch(LEAKS)\n})\n```"
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
"id": "ff-error-hierarchy",
|
|
764
|
+
"type": "fitness-fn",
|
|
765
|
+
"label": "Error classes extend the base and stay few",
|
|
766
|
+
"x": 1040,
|
|
767
|
+
"y": 1040,
|
|
768
|
+
"characteristic": "maintainability",
|
|
769
|
+
"scope": "atomic",
|
|
770
|
+
"cadence": "triggered",
|
|
771
|
+
"trigger": "pull-request",
|
|
772
|
+
"invocation": "automated",
|
|
773
|
+
"description": "A test imports every export of src/errors, instantiates each class and asserts that it is an instance of {{BASE_ERROR}} and of Error, that its code is a non-empty string, and that the module exports at most ten classes; only-throw-error in the lint keeps thrown values to Error instances. On the JVM the same is an ArchUnit rule over classes ending in Exception; in Python a test over the subclasses of the base.\n\nThreshold: Every class exported from src/errors extends {{BASE_ERROR}} and carries a non-empty string code; at most 10 classes\n\nTool: Vitest (a test over src/errors); ArchUnit for the JVM\n\n```ts\n// test/errors/hierarchy.test.ts\nimport { expect, it } from 'vitest'\nimport * as errors from '../../src/errors'\nimport { {{BASE_ERROR}} } from '../../src/errors'\n\nconst classes = Object.entries(errors).filter(([, v]) => typeof v === 'function' && v.prototype instanceof Error && v !== {{BASE_ERROR}}) as Array<[string, new (message?: string) => Error & { code?: unknown }]>\n\nit('exports at most ten error classes', () => {\n expect(classes.length, classes.map(([n]) => n).join(', ')).toBeLessThanOrEqual(10)\n})\nit.each(classes)('%s extends {{BASE_ERROR}} and carries a code', (name, Cls) => {\n const e = new Cls('x')\n expect(e, `${name} does not extend {{BASE_ERROR}}`).toBeInstanceOf({{BASE_ERROR}})\n expect(typeof e.code === 'string' && e.code.length > 0, `${name} has no stable code`).toBe(true)\n})\n```",
|
|
774
|
+
"hubWhen": {
|
|
775
|
+
"STYLE": [
|
|
776
|
+
"exceptions"
|
|
777
|
+
]
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"id": "ff-edge-imports",
|
|
782
|
+
"type": "fitness-fn",
|
|
783
|
+
"label": "Only the edge maps errors to responses",
|
|
784
|
+
"x": 1040,
|
|
785
|
+
"y": 1170,
|
|
786
|
+
"characteristic": "maintainability",
|
|
787
|
+
"scope": "atomic",
|
|
788
|
+
"cadence": "triggered",
|
|
789
|
+
"trigger": "pull-request",
|
|
790
|
+
"invocation": "automated",
|
|
791
|
+
"description": "A dependency rule fails the build when any module outside the edge imports the error-to-response mapping, or when domain or application code imports the HTTP framework (and so could build a response or know a status code). On the JVM the same rule is an ArchUnit test; in Python, import-linter.\n\nThreshold: 0 modules outside src/http import the error handler or the response mapping; 0 domain or application modules import an HTTP framework\n\nTool: dependency-cruiser; ArchUnit for the JVM; import-linter for Python\n\n```js\n// .dependency-cruiser.cjs\nmodule.exports = {\n forbidden: [\n {\n name: 'only-the-edge-maps-errors',\n comment: 'ADR Errors handled once at the edge: only src/http knows the response shape and status codes',\n severity: 'error',\n from: { path: '^src/', pathNot: '^src/http/' },\n to: { path: '^src/http/(error-handler|problem)\\\\.ts$' },\n },\n {\n name: 'inner-code-knows-no-http',\n comment: 'domain and application code throws or returns; it does not build responses',\n severity: 'error',\n from: { path: '^src/(domain|application)/' },\n to: { path: 'node_modules/(express|fastify|@nestjs/common|hono|koa)' },\n },\n ],\n}\n```",
|
|
792
|
+
"hubWhen": {
|
|
793
|
+
"BOUNDARY": [
|
|
794
|
+
"edge"
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"id": "ff-layer-errors",
|
|
800
|
+
"type": "fitness-fn",
|
|
801
|
+
"label": "Driver errors stay below the domain",
|
|
802
|
+
"x": 1040,
|
|
803
|
+
"y": 1300,
|
|
804
|
+
"characteristic": "maintainability",
|
|
805
|
+
"scope": "atomic",
|
|
806
|
+
"cadence": "triggered",
|
|
807
|
+
"trigger": "pull-request",
|
|
808
|
+
"invocation": "automated",
|
|
809
|
+
"description": "An ArchUnit test fails the build when a domain or application class depends on a driver or framework exception type, when a persistence adapter method declares a driver exception, or when a domain exception does not extend {{BASE_ERROR}}. In TypeScript the same rules are dependency-cruiser rules on the driver packages (pg, mysql2, mongodb, undici) from src/domain and src/application.\n\nThreshold: 0 dependencies from the domain or application packages on driver, persistence or HTTP-client exception types; 0 public persistence-adapter methods declaring a driver exception; every domain exception extends {{BASE_ERROR}}\n\nTool: ArchUnit (JUnit 5); dependency-cruiser for TypeScript\n\n```java\n// src/test/java/com/shop/orders/LayerErrorsTest.java\n@AnalyzeClasses(packages = \"com.shop.orders\")\nclass LayerErrorsTest {\n @ArchTest\n static final ArchRule domain_sees_no_driver_errors = noClasses()\n .that().resideInAnyPackage(\"..domain..\", \"..application..\")\n .should().dependOnClassesThat().resideInAnyPackage(\n \"java.sql..\", \"org.springframework.dao..\", \"jakarta.persistence..\", \"org.springframework.web.client..\");\n\n @ArchTest\n static final ArchRule adapters_translate_driver_errors = methods()\n .that().areDeclaredInClassesThat().resideInAPackage(\"..adapter.persistence..\").and().arePublic()\n .should().notDeclareThrowableOfType(java.sql.SQLException.class);\n\n @ArchTest\n static final ArchRule domain_errors_extend_the_base = classes()\n .that().resideInAPackage(\"..domain..\").and().haveSimpleNameEndingWith(\"Exception\")\n .should().beAssignableTo({{BASE_ERROR}}.class);\n}\n```",
|
|
810
|
+
"hubWhen": {
|
|
811
|
+
"BOUNDARY": [
|
|
812
|
+
"layered"
|
|
813
|
+
]
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"id": "ff-result-must-use",
|
|
818
|
+
"type": "fitness-fn",
|
|
819
|
+
"label": "No Result ignored",
|
|
820
|
+
"x": 1040,
|
|
821
|
+
"y": 1430,
|
|
822
|
+
"characteristic": "maintainability",
|
|
823
|
+
"scope": "atomic",
|
|
824
|
+
"cadence": "triggered",
|
|
825
|
+
"trigger": "pull-request",
|
|
826
|
+
"invocation": "automated",
|
|
827
|
+
"description": "The linter of the language makes a dropped Result a build error: neverthrow/must-use-result in TypeScript, unused_must_use plus clippy's unwrap_used and expect_used in Rust, errcheck, errorlint and wrapcheck in golangci-lint (v2 configuration).\n\nThreshold: 0 Results left unhandled in src: the build fails on an unused Result, an unchecked error value or an unwrap outside tests\n\nTool: eslint-plugin-neverthrow (TypeScript); clippy (Rust); golangci-lint (Go)\n\n```js\n// eslint.config.js (added for the result style)\nimport neverthrow from 'eslint-plugin-neverthrow'\nexport default [{\n files: ['src/**/*.ts'],\n plugins: { neverthrow },\n rules: { 'neverthrow/must-use-result': 'error' }, // a Result never matched or unwrapped is a dropped error\n}]\n\n// Rust, src/lib.rs: #![deny(unused_must_use, clippy::unwrap_used, clippy::expect_used)] (allowed under #[cfg(test)])\n// Go, .golangci.yml (v2):\n// version: \"2\"\n// linters:\n// enable: [errcheck, errorlint, wrapcheck]\n// settings: { errcheck: { check-blank: true, check-type-assertions: true } }\n```",
|
|
828
|
+
"hubWhen": {
|
|
829
|
+
"STYLE": [
|
|
830
|
+
"result"
|
|
831
|
+
]
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
"id": "ff-codes-catalogue",
|
|
836
|
+
"type": "fitness-fn",
|
|
837
|
+
"label": "Every code is in the catalogue and stable",
|
|
838
|
+
"x": 1040,
|
|
839
|
+
"y": 1560,
|
|
840
|
+
"characteristic": "compatibility",
|
|
841
|
+
"scope": "atomic",
|
|
842
|
+
"cadence": "triggered",
|
|
843
|
+
"trigger": "pull-request",
|
|
844
|
+
"invocation": "automated",
|
|
845
|
+
"description": "A test collects every code used in src, checks each against the catalogue, snapshots the sorted list of codes so that a removed or renamed code is a reviewed change, and checks that every entry has a status, a type URI (absolute, or a relative reference /problems/… where the Errors pack keeps codes as identifiers) and a message template under the length limit.\n\nThreshold: 100 % of codes used in src exist in the catalogue; the sorted list of codes matches its snapshot, so a rename or removal fails the build\n\nTool: Vitest (a test over the error catalogue); the same test under pytest for Python\n\n```ts\n// test/errors/catalogue.test.ts\nimport { execSync } from 'node:child_process'\nimport { expect, it } from 'vitest'\nimport { CATALOGUE } from '../../src/errors/catalogue' // { ORDER_NOT_FOUND: { status: 404, type: 'https://…/errors/order-not-found', message: 'Order {orderId} not found' }, … }\n\nconst used = new Set(execSync(\"grep -rhoE \\\"fail\\\\('[A-Z_]+'\\\" src | grep -oE '[A-Z_]+'\").toString().trim().split('\\n'))\n\nit('every code used in src is in the catalogue', () => {\n for (const code of used) expect(CATALOGUE, `${code} is not in the catalogue`).toHaveProperty(code)\n})\nit('codes are added or deprecated, never renamed or removed', () => {\n expect(Object.keys(CATALOGUE).sort()).toMatchSnapshot()\n})\nit('every entry has a status, a type URI and a short message', () => {\n for (const [code, e] of Object.entries(CATALOGUE)) {\n expect(e.status, code).toBeGreaterThanOrEqual(400)\n expect(e.type, code).toMatch(/^(https?:\\/\\/|\\/)/)\n expect(e.message.length, code).toBeLessThanOrEqual({{MAX_MESSAGE_CHARS}})\n }\n})\n```",
|
|
846
|
+
"hubWhen": {
|
|
847
|
+
"STYLE": [
|
|
848
|
+
"codes"
|
|
849
|
+
]
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
],
|
|
853
|
+
"relations": [
|
|
854
|
+
{
|
|
855
|
+
"id": "req-no-swallow--derives--need",
|
|
856
|
+
"sourceId": "req-no-swallow",
|
|
857
|
+
"targetId": "need",
|
|
858
|
+
"relationType": "derives"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
"id": "req-cause--derives--need",
|
|
862
|
+
"sourceId": "req-cause",
|
|
863
|
+
"targetId": "need",
|
|
864
|
+
"relationType": "derives"
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
"id": "req-hierarchy--derives--need",
|
|
868
|
+
"sourceId": "req-hierarchy",
|
|
869
|
+
"targetId": "need",
|
|
870
|
+
"relationType": "derives"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"id": "req-result--derives--need",
|
|
874
|
+
"sourceId": "req-result",
|
|
875
|
+
"targetId": "need",
|
|
876
|
+
"relationType": "derives"
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
"id": "req-codes--derives--need",
|
|
880
|
+
"sourceId": "req-codes",
|
|
881
|
+
"targetId": "need",
|
|
882
|
+
"relationType": "derives"
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
"id": "req-edge--derives--need",
|
|
886
|
+
"sourceId": "req-edge",
|
|
887
|
+
"targetId": "need",
|
|
888
|
+
"relationType": "derives"
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
"id": "req-layered--derives--need",
|
|
892
|
+
"sourceId": "req-layered",
|
|
893
|
+
"targetId": "need",
|
|
894
|
+
"relationType": "derives"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
"id": "req-log-once--derives--need",
|
|
898
|
+
"sourceId": "req-log-once",
|
|
899
|
+
"targetId": "need",
|
|
900
|
+
"relationType": "derives"
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
"id": "req-correlation--derives--need",
|
|
904
|
+
"sourceId": "req-correlation",
|
|
905
|
+
"targetId": "need",
|
|
906
|
+
"relationType": "derives"
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"id": "req-structured--derives--need",
|
|
910
|
+
"sourceId": "req-structured",
|
|
911
|
+
"targetId": "need",
|
|
912
|
+
"relationType": "derives"
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"id": "req-text--derives--need",
|
|
916
|
+
"sourceId": "req-text",
|
|
917
|
+
"targetId": "need",
|
|
918
|
+
"relationType": "derives"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
"id": "req-no-secrets--derives--need",
|
|
922
|
+
"sourceId": "req-no-secrets",
|
|
923
|
+
"targetId": "need",
|
|
924
|
+
"relationType": "derives"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
"id": "req-no-leak--derives--need",
|
|
928
|
+
"sourceId": "req-no-leak",
|
|
929
|
+
"targetId": "need",
|
|
930
|
+
"relationType": "derives"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"id": "req-levels--derives--need",
|
|
934
|
+
"sourceId": "req-levels",
|
|
935
|
+
"targetId": "need",
|
|
936
|
+
"relationType": "derives"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
"id": "sc-no-swallow--verifies--req-no-swallow",
|
|
940
|
+
"sourceId": "sc-no-swallow",
|
|
941
|
+
"targetId": "req-no-swallow",
|
|
942
|
+
"relationType": "verifies"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
"id": "sc-cause--verifies--req-cause",
|
|
946
|
+
"sourceId": "sc-cause",
|
|
947
|
+
"targetId": "req-cause",
|
|
948
|
+
"relationType": "verifies"
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
"id": "sc-hierarchy--verifies--req-hierarchy",
|
|
952
|
+
"sourceId": "sc-hierarchy",
|
|
953
|
+
"targetId": "req-hierarchy",
|
|
954
|
+
"relationType": "verifies"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
"id": "sc-result--verifies--req-result",
|
|
958
|
+
"sourceId": "sc-result",
|
|
959
|
+
"targetId": "req-result",
|
|
960
|
+
"relationType": "verifies"
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
"id": "sc-codes--verifies--req-codes",
|
|
964
|
+
"sourceId": "sc-codes",
|
|
965
|
+
"targetId": "req-codes",
|
|
966
|
+
"relationType": "verifies"
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
"id": "sc-edge--verifies--req-edge",
|
|
970
|
+
"sourceId": "sc-edge",
|
|
971
|
+
"targetId": "req-edge",
|
|
972
|
+
"relationType": "verifies"
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
"id": "sc-layered--verifies--req-layered",
|
|
976
|
+
"sourceId": "sc-layered",
|
|
977
|
+
"targetId": "req-layered",
|
|
978
|
+
"relationType": "verifies"
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
"id": "sc-log-once--verifies--req-log-once",
|
|
982
|
+
"sourceId": "sc-log-once",
|
|
983
|
+
"targetId": "req-log-once",
|
|
984
|
+
"relationType": "verifies"
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
"id": "sc-correlation--verifies--req-correlation",
|
|
988
|
+
"sourceId": "sc-correlation",
|
|
989
|
+
"targetId": "req-correlation",
|
|
990
|
+
"relationType": "verifies"
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
"id": "sc-structured--verifies--req-structured",
|
|
994
|
+
"sourceId": "sc-structured",
|
|
995
|
+
"targetId": "req-structured",
|
|
996
|
+
"relationType": "verifies"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
"id": "sc-text--verifies--req-text",
|
|
1000
|
+
"sourceId": "sc-text",
|
|
1001
|
+
"targetId": "req-text",
|
|
1002
|
+
"relationType": "verifies"
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
"id": "sc-no-secrets--verifies--req-no-secrets",
|
|
1006
|
+
"sourceId": "sc-no-secrets",
|
|
1007
|
+
"targetId": "req-no-secrets",
|
|
1008
|
+
"relationType": "verifies"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
"id": "sc-no-leak--verifies--req-no-leak",
|
|
1012
|
+
"sourceId": "sc-no-leak",
|
|
1013
|
+
"targetId": "req-no-leak",
|
|
1014
|
+
"relationType": "verifies"
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
"id": "sc-levels--verifies--req-levels",
|
|
1018
|
+
"sourceId": "sc-levels",
|
|
1019
|
+
"targetId": "req-levels",
|
|
1020
|
+
"relationType": "verifies"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"id": "ff-eslint-errors--implements--adr-exceptions",
|
|
1024
|
+
"sourceId": "ff-eslint-errors",
|
|
1025
|
+
"targetId": "adr-exceptions",
|
|
1026
|
+
"relationType": "implements"
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
"id": "ff-eslint-errors--implements--adr-result",
|
|
1030
|
+
"sourceId": "ff-eslint-errors",
|
|
1031
|
+
"targetId": "adr-result",
|
|
1032
|
+
"relationType": "implements"
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
"id": "ff-eslint-errors--implements--adr-codes",
|
|
1036
|
+
"sourceId": "ff-eslint-errors",
|
|
1037
|
+
"targetId": "adr-codes",
|
|
1038
|
+
"relationType": "implements"
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
"id": "ff-ruff-errors--implements--adr-exceptions",
|
|
1042
|
+
"sourceId": "ff-ruff-errors",
|
|
1043
|
+
"targetId": "adr-exceptions",
|
|
1044
|
+
"relationType": "implements"
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
"id": "ff-ruff-errors--implements--adr-result",
|
|
1048
|
+
"sourceId": "ff-ruff-errors",
|
|
1049
|
+
"targetId": "adr-result",
|
|
1050
|
+
"relationType": "implements"
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"id": "ff-ruff-errors--implements--adr-codes",
|
|
1054
|
+
"sourceId": "ff-ruff-errors",
|
|
1055
|
+
"targetId": "adr-codes",
|
|
1056
|
+
"relationType": "implements"
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
"id": "ff-java-errors--implements--adr-exceptions",
|
|
1060
|
+
"sourceId": "ff-java-errors",
|
|
1061
|
+
"targetId": "adr-exceptions",
|
|
1062
|
+
"relationType": "implements"
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
"id": "ff-java-errors--implements--adr-result",
|
|
1066
|
+
"sourceId": "ff-java-errors",
|
|
1067
|
+
"targetId": "adr-result",
|
|
1068
|
+
"relationType": "implements"
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
"id": "ff-java-errors--implements--adr-codes",
|
|
1072
|
+
"sourceId": "ff-java-errors",
|
|
1073
|
+
"targetId": "adr-codes",
|
|
1074
|
+
"relationType": "implements"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
"id": "ff-semgrep-logging--implements--adr-exceptions",
|
|
1078
|
+
"sourceId": "ff-semgrep-logging",
|
|
1079
|
+
"targetId": "adr-exceptions",
|
|
1080
|
+
"relationType": "implements"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
"id": "ff-semgrep-logging--implements--adr-result",
|
|
1084
|
+
"sourceId": "ff-semgrep-logging",
|
|
1085
|
+
"targetId": "adr-result",
|
|
1086
|
+
"relationType": "implements"
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
"id": "ff-semgrep-logging--implements--adr-codes",
|
|
1090
|
+
"sourceId": "ff-semgrep-logging",
|
|
1091
|
+
"targetId": "adr-codes",
|
|
1092
|
+
"relationType": "implements"
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
"id": "ff-redact-denylist--implements--adr-exceptions",
|
|
1096
|
+
"sourceId": "ff-redact-denylist",
|
|
1097
|
+
"targetId": "adr-exceptions",
|
|
1098
|
+
"relationType": "implements"
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
"id": "ff-redact-denylist--implements--adr-result",
|
|
1102
|
+
"sourceId": "ff-redact-denylist",
|
|
1103
|
+
"targetId": "adr-result",
|
|
1104
|
+
"relationType": "implements"
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
"id": "ff-redact-denylist--implements--adr-codes",
|
|
1108
|
+
"sourceId": "ff-redact-denylist",
|
|
1109
|
+
"targetId": "adr-codes",
|
|
1110
|
+
"relationType": "implements"
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
"id": "ff-redact-allowlist--implements--adr-exceptions",
|
|
1114
|
+
"sourceId": "ff-redact-allowlist",
|
|
1115
|
+
"targetId": "adr-exceptions",
|
|
1116
|
+
"relationType": "implements"
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
"id": "ff-redact-allowlist--implements--adr-result",
|
|
1120
|
+
"sourceId": "ff-redact-allowlist",
|
|
1121
|
+
"targetId": "adr-result",
|
|
1122
|
+
"relationType": "implements"
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
"id": "ff-redact-allowlist--implements--adr-codes",
|
|
1126
|
+
"sourceId": "ff-redact-allowlist",
|
|
1127
|
+
"targetId": "adr-codes",
|
|
1128
|
+
"relationType": "implements"
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
"id": "ff-log-shape--implements--adr-exceptions",
|
|
1132
|
+
"sourceId": "ff-log-shape",
|
|
1133
|
+
"targetId": "adr-exceptions",
|
|
1134
|
+
"relationType": "implements"
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"id": "ff-log-shape--implements--adr-result",
|
|
1138
|
+
"sourceId": "ff-log-shape",
|
|
1139
|
+
"targetId": "adr-result",
|
|
1140
|
+
"relationType": "implements"
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
"id": "ff-log-shape--implements--adr-codes",
|
|
1144
|
+
"sourceId": "ff-log-shape",
|
|
1145
|
+
"targetId": "adr-codes",
|
|
1146
|
+
"relationType": "implements"
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
"id": "ff-no-stack-to-caller--implements--adr-exceptions",
|
|
1150
|
+
"sourceId": "ff-no-stack-to-caller",
|
|
1151
|
+
"targetId": "adr-exceptions",
|
|
1152
|
+
"relationType": "implements"
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
"id": "ff-no-stack-to-caller--implements--adr-result",
|
|
1156
|
+
"sourceId": "ff-no-stack-to-caller",
|
|
1157
|
+
"targetId": "adr-result",
|
|
1158
|
+
"relationType": "implements"
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
"id": "ff-no-stack-to-caller--implements--adr-codes",
|
|
1162
|
+
"sourceId": "ff-no-stack-to-caller",
|
|
1163
|
+
"targetId": "adr-codes",
|
|
1164
|
+
"relationType": "implements"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"id": "ff-error-hierarchy--implements--adr-exceptions",
|
|
1168
|
+
"sourceId": "ff-error-hierarchy",
|
|
1169
|
+
"targetId": "adr-exceptions",
|
|
1170
|
+
"relationType": "implements"
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
"id": "ff-edge-imports--implements--adr-edge",
|
|
1174
|
+
"sourceId": "ff-edge-imports",
|
|
1175
|
+
"targetId": "adr-edge",
|
|
1176
|
+
"relationType": "implements"
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
"id": "ff-layer-errors--implements--adr-layered",
|
|
1180
|
+
"sourceId": "ff-layer-errors",
|
|
1181
|
+
"targetId": "adr-layered",
|
|
1182
|
+
"relationType": "implements"
|
|
1183
|
+
},
|
|
1184
|
+
{
|
|
1185
|
+
"id": "ff-result-must-use--implements--adr-result",
|
|
1186
|
+
"sourceId": "ff-result-must-use",
|
|
1187
|
+
"targetId": "adr-result",
|
|
1188
|
+
"relationType": "implements"
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
"id": "ff-codes-catalogue--implements--adr-codes",
|
|
1192
|
+
"sourceId": "ff-codes-catalogue",
|
|
1193
|
+
"targetId": "adr-codes",
|
|
1194
|
+
"relationType": "implements"
|
|
1195
|
+
}
|
|
1196
|
+
]
|
|
1197
|
+
}
|