@radicaltools/mcp 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/{chunk-Z7THA3L5.js → chunk-KEIZXREX.js} +68 -35
- package/dist/{elkLayout-TAUBPPVN.js → elkLayout-MFJXDTJG.js} +1 -1
- package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
- package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
- package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
- package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
- package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
- package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
- package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
- package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
- package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
- package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
- package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
- package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
- package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
- package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
- package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
- package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
- package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
- package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
- package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
- package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
- package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
- package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
- package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
- package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
- package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
- package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
- package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
- package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
- package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
- package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
- package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
- package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
- package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
- package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
- package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
- package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
- package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
- package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
- package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
- package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
- package/dist/index.js +1893 -468
- package/package.json +1 -1
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
"id": "concern-module-boundaries",
|
|
4
4
|
"category": "concern",
|
|
5
5
|
"name": "Module boundaries",
|
|
6
|
-
"description": "Keeping the parts of the code apart: which part may depend on which, through what, with no cycles; what they may share;
|
|
6
|
+
"description": "Keeping the parts of the code apart: which part may depend on which, through what, with no cycles; what they may share; and how the build enforces it on the code there is today. The snippets are TypeScript with dependency-cruiser; each tool line names the JVM, .NET and Python equivalent.",
|
|
7
7
|
"tags": [
|
|
8
8
|
"maintainability",
|
|
9
9
|
"modularity",
|
|
10
10
|
"dependencies",
|
|
11
11
|
"architecture rules",
|
|
12
12
|
"cycles",
|
|
13
|
-
"shared kernel"
|
|
14
|
-
"codeowners"
|
|
13
|
+
"shared kernel"
|
|
15
14
|
],
|
|
16
15
|
"requiredMetamodel": "c4-ddd-governance-builtin",
|
|
17
16
|
"concern": {
|
|
@@ -29,10 +28,22 @@
|
|
|
29
28
|
"title": "Ford, Parsons, Kua, Sadalage: Building Evolutionary Architectures, 2nd ed. (fitness functions)",
|
|
30
29
|
"url": "https://www.oreilly.com/library/view/building-evolutionary-architectures/9781492097532/"
|
|
31
30
|
},
|
|
31
|
+
{
|
|
32
|
+
"title": "Robert C. Martin: Clean Architecture (component principles: the Acyclic Dependencies Principle)",
|
|
33
|
+
"url": "https://www.oreilly.com/library/view/clean-architecture-a/9780134494272/"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"title": "Eric Evans: Domain-Driven Design (reference and summary; Shared Kernel)",
|
|
37
|
+
"url": "https://www.domainlanguage.com/ddd/"
|
|
38
|
+
},
|
|
32
39
|
{
|
|
33
40
|
"title": "Martin Fowler: BoundedContext",
|
|
34
41
|
"url": "https://martinfowler.com/bliki/BoundedContext.html"
|
|
35
42
|
},
|
|
43
|
+
{
|
|
44
|
+
"title": "Semantic Versioning 2.0.0",
|
|
45
|
+
"url": "https://semver.org/spec/v2.0.0.html"
|
|
46
|
+
},
|
|
36
47
|
{
|
|
37
48
|
"title": "Spring Modulith reference documentation",
|
|
38
49
|
"url": "https://docs.spring.io/spring-modulith/reference/"
|
|
@@ -61,12 +72,12 @@
|
|
|
61
72
|
{
|
|
62
73
|
"value": "allowlist",
|
|
63
74
|
"label": "each part lists what it may use",
|
|
64
|
-
"description": "Every part declares the parts it may depend on (Spring Modulith allowedDependencies, import-linter contracts
|
|
75
|
+
"description": "Every part declares the parts it may depend on (a module.json per part read by dependency-cruiser; Spring Modulith allowedDependencies, import-linter contracts elsewhere); everything else is forbidden. Pick it for up to about fifteen parts that are peers, such as the modules of a modular monolith, where each dependency deserves a decision."
|
|
65
76
|
},
|
|
66
77
|
{
|
|
67
78
|
"value": "levels",
|
|
68
79
|
"label": "parts ranked in levels",
|
|
69
|
-
"description": "Each part is tagged with a level (
|
|
80
|
+
"description": "Each part is tagged with a level (app, feature, data-access, domain, util) and may depend only on parts of lower levels, never on its own level's peers or higher. Pick it for a codebase with dozens of parts, where a list per part would be unmaintainable."
|
|
70
81
|
}
|
|
71
82
|
]
|
|
72
83
|
},
|
|
@@ -99,7 +110,7 @@
|
|
|
99
110
|
{
|
|
100
111
|
"value": "kernel",
|
|
101
112
|
"label": "a small shared kernel",
|
|
102
|
-
"description": "A few value types and contracts (money, identifiers, event schemas) live in one shared part that every user of it must approve changes to. Pick it when parts genuinely speak the same language about a few concepts."
|
|
113
|
+
"description": "A few value types and contracts (money, identifiers, event schemas) live in one shared part, src/shared-kernel, that every user of it must approve changes to. Pick it when parts genuinely speak the same language about a few concepts."
|
|
103
114
|
},
|
|
104
115
|
{
|
|
105
116
|
"value": "library",
|
|
@@ -113,25 +124,6 @@
|
|
|
113
124
|
}
|
|
114
125
|
]
|
|
115
126
|
},
|
|
116
|
-
{
|
|
117
|
-
"key": "OWNERS",
|
|
118
|
-
"title": "Ownership",
|
|
119
|
-
"label": "Does each part have a team that owns it?",
|
|
120
|
-
"hint": "Boundaries hold better when someone is responsible for each side: a change to a part asks its owners.",
|
|
121
|
-
"defaultValue": "team",
|
|
122
|
-
"options": [
|
|
123
|
-
{
|
|
124
|
-
"value": "team",
|
|
125
|
-
"label": "yes, one owning team per part",
|
|
126
|
-
"description": "Each part has an owning team in CODEOWNERS whose approval a change to it needs. Pick it when more than one team works in the code."
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"value": "collective",
|
|
130
|
-
"label": "no, one team owns the whole codebase",
|
|
131
|
-
"description": "One team owns everything and any member may change any part. Pick it for a single team of up to about eight people."
|
|
132
|
-
}
|
|
133
|
-
]
|
|
134
|
-
},
|
|
135
127
|
{
|
|
136
128
|
"key": "RATCHET_PERCENT",
|
|
137
129
|
"label": "By how much must the baseline of known violations shrink each quarter (%)?",
|
|
@@ -155,7 +147,7 @@
|
|
|
155
147
|
"y": 0,
|
|
156
148
|
"kind": "brief",
|
|
157
149
|
"source": "Hub concern pack: Module boundaries",
|
|
158
|
-
"description": "The code in this element must stay easy to understand, test and change as it grows and as people come and go. That needs parts with clear boundaries: a change to one part should not ripple through the others, each part should be testable on its own, and the rules about what may depend on what should hold because the build checks them, not because everyone remembers them."
|
|
150
|
+
"description": "The code in this element must stay easy to understand, test and change as it grows and as people come and go. That needs parts with clear boundaries: a change to one part should not ripple through the others, each part should be testable on its own, and the rules about what may depend on what should hold because the build checks them, not because everyone remembers them. The checks below share one layout: each part lives in src/modules/<name> with its published API in src/modules/<name>/index.ts and its declarations in src/modules/<name>/module.json; shared code, where allowed, lives in src/shared-kernel; the rules are in .dependency-cruiser.cjs and run as `npm run check:deps` (depcruise src --config .dependency-cruiser.cjs); known violations, where frozen, are in .dependency-cruiser-known-violations.json."
|
|
159
151
|
},
|
|
160
152
|
{
|
|
161
153
|
"id": "req-allowlist",
|
|
@@ -164,7 +156,7 @@
|
|
|
164
156
|
"x": 260,
|
|
165
157
|
"y": 0,
|
|
166
158
|
"ears_type": "ubiquitous",
|
|
167
|
-
"action": "let each part depend only on the parts it declares as allowed, with 0 undeclared dependencies between parts on the main branch outside the recorded baseline",
|
|
159
|
+
"action": "let each part depend only on the parts it declares in its module.json as allowed, with 0 undeclared dependencies between parts on the main branch outside the recorded baseline",
|
|
168
160
|
"rationale": "Declaring each dependency makes it a decision visible in review; rules that are not checked erode with every shortcut (Building Evolutionary Architectures, ch. 2; Spring Modulith, allowed dependencies).",
|
|
169
161
|
"hubWhen": {
|
|
170
162
|
"RULES": [
|
|
@@ -179,7 +171,7 @@
|
|
|
179
171
|
"x": 260,
|
|
180
172
|
"y": 130,
|
|
181
173
|
"ears_type": "ubiquitous",
|
|
182
|
-
"action": "let each part depend only on parts of a lower level, with 0 dependencies on a part of the same or a higher level on the main branch outside the recorded baseline",
|
|
174
|
+
"action": "let each part depend only on parts of a lower level than the one declared in its module.json, with 0 dependencies on a part of the same or a higher level on the main branch outside the recorded baseline",
|
|
183
175
|
"rationale": "Levels give a large number of parts one direction without a list per part (Nx, enforce module boundaries; ISO/IEC 25010 modularity).",
|
|
184
176
|
"hubWhen": {
|
|
185
177
|
"RULES": [
|
|
@@ -194,7 +186,7 @@
|
|
|
194
186
|
"x": 260,
|
|
195
187
|
"y": 260,
|
|
196
188
|
"ears_type": "ubiquitous",
|
|
197
|
-
"action": "let a part use another only through that part's published API (its
|
|
189
|
+
"action": "let a part use another only through that part's published API (its index.ts), with 0 imports of another part's internal files",
|
|
198
190
|
"rationale": "A part whose internals others reach into cannot change them alone, and cannot later be extracted (Fowler, BoundedContext; Spring Modulith, application modules)."
|
|
199
191
|
},
|
|
200
192
|
{
|
|
@@ -204,8 +196,8 @@
|
|
|
204
196
|
"x": 260,
|
|
205
197
|
"y": 390,
|
|
206
198
|
"ears_type": "ubiquitous",
|
|
207
|
-
"action": "keep the dependency graph between parts free of cycles, with 0 cycles
|
|
208
|
-
"rationale": "Parts in a cycle can only be understood, tested and released together, which makes them one part (Acyclic Dependencies Principle
|
|
199
|
+
"action": "keep the dependency graph between parts free of cycles, with 0 cycles that run through more than one part (a cycle inside one part is that part's own business)",
|
|
200
|
+
"rationale": "Parts in a cycle can only be understood, tested and released together, which makes them one part (Martin, Clean Architecture: the Acyclic Dependencies Principle; ISO/IEC 25010 modularity)."
|
|
209
201
|
},
|
|
210
202
|
{
|
|
211
203
|
"id": "req-fail",
|
|
@@ -232,7 +224,7 @@
|
|
|
232
224
|
"ears_type": "state-driven",
|
|
233
225
|
"precondition": "known violations remain in the recorded baseline",
|
|
234
226
|
"action": "fail any change that adds a violation outside the baseline, and shrink the baseline by at least {{RATCHET_PERCENT}}% each quarter",
|
|
235
|
-
"rationale": "An old codebase cannot be fixed at once; freezing what is there stops it getting worse while the baseline records the debt to pay down (
|
|
227
|
+
"rationale": "An old codebase cannot be fixed at once; freezing what is there stops it getting worse while the baseline records the debt to pay down (dependency-cruiser known violations; ArchUnit FreezingArchRule).",
|
|
236
228
|
"hubWhen": {
|
|
237
229
|
"ENFORCE": [
|
|
238
230
|
"ratchet"
|
|
@@ -246,7 +238,7 @@
|
|
|
246
238
|
"x": 260,
|
|
247
239
|
"y": 780,
|
|
248
240
|
"ears_type": "ubiquitous",
|
|
249
|
-
"action": "keep in the shared kernel only types and contracts used by at least two parts, with no
|
|
241
|
+
"action": "keep in the shared kernel only types and contracts used by at least two parts, with no dependency on a part and no third-party library beyond the allowed pure ones, at most {{KERNEL_PERCENT}}% of the source lines, and changes approved by the owners of every part that uses it as the Code review and branching pack decides ownership",
|
|
250
242
|
"rationale": "A shared kernel is shared on purpose and kept small; a growing \"common\" folder couples everything to everything (Evans, Domain-Driven Design, Shared Kernel).",
|
|
251
243
|
"hubWhen": {
|
|
252
244
|
"SHARED": [
|
|
@@ -262,7 +254,7 @@
|
|
|
262
254
|
"y": 910,
|
|
263
255
|
"ears_type": "event-driven",
|
|
264
256
|
"trigger": "shared code changes",
|
|
265
|
-
"action": "publish it as a new semantic version of its library, and
|
|
257
|
+
"action": "publish it as a new semantic version of its library, and move every consumer to the latest major version within 90 days of its release",
|
|
266
258
|
"rationale": "Versioned libraries let each part upgrade on its own schedule; bounding the lag keeps old versions from piling up (Semantic Versioning 2.0.0).",
|
|
267
259
|
"hubWhen": {
|
|
268
260
|
"SHARED": [
|
|
@@ -285,21 +277,6 @@
|
|
|
285
277
|
]
|
|
286
278
|
}
|
|
287
279
|
},
|
|
288
|
-
{
|
|
289
|
-
"id": "req-owners",
|
|
290
|
-
"type": "requirement",
|
|
291
|
-
"label": "Every part has an owner",
|
|
292
|
-
"x": 260,
|
|
293
|
-
"y": 1170,
|
|
294
|
-
"ears_type": "ubiquitous",
|
|
295
|
-
"action": "name an owning team in CODEOWNERS for 100% of the parts, and require that team's approval to merge a change to its part",
|
|
296
|
-
"rationale": "A boundary nobody owns is crossed by whoever is in a hurry; owners review what crosses theirs (Conway's law; GitHub CODEOWNERS).",
|
|
297
|
-
"hubWhen": {
|
|
298
|
-
"OWNERS": [
|
|
299
|
-
"team"
|
|
300
|
-
]
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
280
|
{
|
|
304
281
|
"id": "sc-allowlist",
|
|
305
282
|
"type": "scenario",
|
|
@@ -307,7 +284,7 @@
|
|
|
307
284
|
"x": 520,
|
|
308
285
|
"y": 0,
|
|
309
286
|
"given": "the ordering module, allowed to use catalog only",
|
|
310
|
-
"when": "a change makes it import
|
|
287
|
+
"when": "a change makes it import from billing",
|
|
311
288
|
"then": "the rule check reports the undeclared dependency naming both modules",
|
|
312
289
|
"hubWhen": {
|
|
313
290
|
"RULES": [
|
|
@@ -321,8 +298,8 @@
|
|
|
321
298
|
"label": "Upward dependency found",
|
|
322
299
|
"x": 520,
|
|
323
300
|
"y": 130,
|
|
324
|
-
"given": "a domain
|
|
325
|
-
"when": "the domain
|
|
301
|
+
"given": "a domain part and a feature part",
|
|
302
|
+
"when": "the domain part imports the feature part",
|
|
326
303
|
"then": "the rule check reports the dependency on a higher level",
|
|
327
304
|
"hubWhen": {
|
|
328
305
|
"RULES": [
|
|
@@ -337,7 +314,7 @@
|
|
|
337
314
|
"x": 520,
|
|
338
315
|
"y": 260,
|
|
339
316
|
"given": "two parts, each with a published API",
|
|
340
|
-
"when": "one imports the other
|
|
317
|
+
"when": "one imports a file of the other that is not its index",
|
|
341
318
|
"then": "the rule check reports it and the build fails"
|
|
342
319
|
},
|
|
343
320
|
{
|
|
@@ -358,7 +335,7 @@
|
|
|
358
335
|
"y": 520,
|
|
359
336
|
"given": "a pull request that adds a forbidden dependency",
|
|
360
337
|
"when": "the build runs",
|
|
361
|
-
"then": "the
|
|
338
|
+
"then": "the dependency check fails naming the rule and both parts, and the pull request cannot be merged",
|
|
362
339
|
"hubWhen": {
|
|
363
340
|
"ENFORCE": [
|
|
364
341
|
"fail"
|
|
@@ -373,7 +350,7 @@
|
|
|
373
350
|
"y": 650,
|
|
374
351
|
"given": "a baseline of known violations",
|
|
375
352
|
"when": "a change adds a new violation, and a quarter ends",
|
|
376
|
-
"then": "the change fails the build, and the baseline holds at least {{RATCHET_PERCENT}}% fewer violations than
|
|
353
|
+
"then": "the change fails the build, and the baseline holds at least {{RATCHET_PERCENT}}% fewer violations than at the previous quarter's tag",
|
|
377
354
|
"hubWhen": {
|
|
378
355
|
"ENFORCE": [
|
|
379
356
|
"ratchet"
|
|
@@ -387,7 +364,7 @@
|
|
|
387
364
|
"x": 520,
|
|
388
365
|
"y": 780,
|
|
389
366
|
"given": "the shared kernel",
|
|
390
|
-
"when": "a change
|
|
367
|
+
"when": "a change makes it import a part or a database driver, or the kernel passes {{KERNEL_PERCENT}}% of the lines",
|
|
391
368
|
"then": "the check fails and the change is moved into the part that uses it",
|
|
392
369
|
"hubWhen": {
|
|
393
370
|
"SHARED": [
|
|
@@ -403,7 +380,7 @@
|
|
|
403
380
|
"y": 910,
|
|
404
381
|
"given": "a shared library and its consumers",
|
|
405
382
|
"when": "a new major version is published",
|
|
406
|
-
"then": "within 90 days every consumer is on it
|
|
383
|
+
"then": "within 90 days every consumer is on it, and the lag check fails for any that is not",
|
|
407
384
|
"hubWhen": {
|
|
408
385
|
"SHARED": [
|
|
409
386
|
"library"
|
|
@@ -425,21 +402,6 @@
|
|
|
425
402
|
]
|
|
426
403
|
}
|
|
427
404
|
},
|
|
428
|
-
{
|
|
429
|
-
"id": "sc-owners",
|
|
430
|
-
"type": "scenario",
|
|
431
|
-
"label": "Owner approves change",
|
|
432
|
-
"x": 520,
|
|
433
|
-
"y": 1170,
|
|
434
|
-
"given": "a part owned by a team",
|
|
435
|
-
"when": "someone outside the team opens a pull request changing it",
|
|
436
|
-
"then": "the pull request cannot be merged until the owning team approves it",
|
|
437
|
-
"hubWhen": {
|
|
438
|
-
"OWNERS": [
|
|
439
|
-
"team"
|
|
440
|
-
]
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
405
|
{
|
|
444
406
|
"id": "adr-allowlist",
|
|
445
407
|
"type": "adr",
|
|
@@ -449,9 +411,9 @@
|
|
|
449
411
|
"concern": "module-boundaries",
|
|
450
412
|
"status": "accepted",
|
|
451
413
|
"date": "",
|
|
452
|
-
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; this pack keeps the boundaries between
|
|
453
|
-
"decision": "Each part (
|
|
454
|
-
"consequences": "• Every dependency between parts is a visible decision, reviewed when it is added.\n• The declarations are code to maintain: adding a dependency means changing
|
|
414
|
+
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; who owns each part is the Code review and branching pack; this pack keeps the boundaries between the parts.",
|
|
415
|
+
"decision": "Each part (src/modules/<name>) declares in its module.json the parts it may depend on (\"uses\") and exposes a published API in its index.ts; any other dependency, any import of another part's file but its index, and any cycle through more than one part fails the dependency check, which runs in every build ({{ENFORCE}}). Shared code: {{SHARED}}. The checker is dependency-cruiser with rules generated from the module.json files; on Spring Boot the same is Spring Modulith (@ApplicationModule(allowedDependencies = …) with ApplicationModules.verify()), on other JVM code ArchUnit slices, in Python import-linter contracts, on .NET NetArchTest. Pick the one that runs in the existing build, so a violation shows up like any failing test.",
|
|
416
|
+
"consequences": "• Every dependency between parts is a visible decision, reviewed when it is added.\n• The declarations are code to maintain: adding a dependency means changing one line in module.json and convincing a reviewer.\n• Boundaries hold only while the check runs in every build.\n• With many parts the lists become noise; levels scale better.",
|
|
455
417
|
"alternatives": "1. Levels: one rule for many parts, but less precise between peers.\n2. Only forbidding known-bad dependencies: easy to start, but anything not foreseen is allowed.\n3. No checked rules: fastest to start, and boundaries erode within months.",
|
|
456
418
|
"hubWhen": {
|
|
457
419
|
"RULES": [
|
|
@@ -468,9 +430,9 @@
|
|
|
468
430
|
"concern": "module-boundaries",
|
|
469
431
|
"status": "accepted",
|
|
470
432
|
"date": "",
|
|
471
|
-
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; this pack keeps the boundaries between
|
|
472
|
-
"decision": "Each part
|
|
473
|
-
"consequences": "• One rule covers dozens of parts; a new
|
|
433
|
+
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; who owns each part is the Code review and branching pack; this pack keeps the boundaries between the parts.",
|
|
434
|
+
"decision": "Each part (src/modules/<name>) declares its level in its module.json (util, domain, data-access, feature, app; or the levels the codebase needs) and may depend only on parts of lower levels and only through their index.ts; cycles through more than one part are forbidden. The dependency check runs in every build ({{ENFORCE}}). Shared code: {{SHARED}}. The checker is dependency-cruiser with rules generated from the levels; in an Nx workspace the same is @nx/enforce-module-boundaries with type tags, on the JVM ArchUnit's layeredArchitecture() over module packages, in Python import-linter's layers contract.",
|
|
435
|
+
"consequences": "• One rule covers dozens of parts; a new part only needs its level.\n• Peers at the same level cannot use each other, which pushes shared code down a level.\n• Says nothing about which domain may use which; add scope tags or an allowlist when that matters.\n• Boundaries hold only while the check runs in every build.",
|
|
474
436
|
"alternatives": "1. Per-part lists: precise, but unmaintainable for dozens of parts.\n2. Separate repositories per part: strong boundaries, slow cross-part changes.\n3. No checked rules: boundaries erode within months.",
|
|
475
437
|
"hubWhen": {
|
|
476
438
|
"RULES": [
|
|
@@ -478,17 +440,55 @@
|
|
|
478
440
|
]
|
|
479
441
|
}
|
|
480
442
|
},
|
|
443
|
+
{
|
|
444
|
+
"id": "adr-fail",
|
|
445
|
+
"type": "adr",
|
|
446
|
+
"label": "Every violation fails the build",
|
|
447
|
+
"x": 780,
|
|
448
|
+
"y": 260,
|
|
449
|
+
"concern": "module-boundaries",
|
|
450
|
+
"status": "accepted",
|
|
451
|
+
"date": "",
|
|
452
|
+
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; who owns each part is the Code review and branching pack; this pack keeps the boundaries between the parts.",
|
|
453
|
+
"decision": "The dependency check runs on every pull request as a job the main branch requires (the ruleset that protects main is the Code review and branching pack's), and any violation fails it: there is no baseline and no exception list. Existing violations, if any, are fixed before the check is switched on.",
|
|
454
|
+
"consequences": "• A violation never reaches main, so nobody comes to depend on one.\n• Switching the check on needs a clean codebase first; on an old one that is a project of its own.\n• A rule that turns out wrong blocks everyone until it is changed, which keeps the rules honest.",
|
|
455
|
+
"alternatives": "1. A frozen baseline with a ratchet: adoptable today on an old codebase, at the cost of carrying known violations.\n2. Warnings only: visible, and ignored within weeks.",
|
|
456
|
+
"hubWhen": {
|
|
457
|
+
"ENFORCE": [
|
|
458
|
+
"fail"
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"id": "adr-ratchet",
|
|
464
|
+
"type": "adr",
|
|
465
|
+
"label": "Known violations frozen, new ones fail",
|
|
466
|
+
"x": 780,
|
|
467
|
+
"y": 390,
|
|
468
|
+
"concern": "module-boundaries",
|
|
469
|
+
"status": "accepted",
|
|
470
|
+
"date": "",
|
|
471
|
+
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; who owns each part is the Code review and branching pack; this pack keeps the boundaries between the parts.",
|
|
472
|
+
"decision": "The dependency check runs on every pull request with today's violations frozen in .dependency-cruiser-known-violations.json (written once with the --baseline option, committed, never edited by hand): a new violation fails the build, a fixed one is removed from the baseline. The baseline shrinks by at least {{RATCHET_PERCENT}}% each quarter against the previous quarter's tag (quarter-<year>Q<n>), checked in the build. On the JVM the same is ArchUnit's FreezingArchRule with its store committed.",
|
|
473
|
+
"consequences": "• Adoptable today on an old codebase; the code stops getting worse at once.\n• The baseline is debt on record: paying it down is planned work, and the quarterly check makes skipping it visible.\n• A fixed violation that is not removed from the baseline hides nothing, since the check only ignores what is listed.",
|
|
474
|
+
"alternatives": "1. Every violation fails the build: cleaner, after fixing everything first.\n2. A deadline instead of a ratchet: all violations fixed by a date, usually missed.",
|
|
475
|
+
"hubWhen": {
|
|
476
|
+
"ENFORCE": [
|
|
477
|
+
"ratchet"
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
481
|
{
|
|
482
482
|
"id": "adr-shared-kernel",
|
|
483
483
|
"type": "adr",
|
|
484
484
|
"label": "A small shared kernel",
|
|
485
485
|
"x": 780,
|
|
486
|
-
"y":
|
|
486
|
+
"y": 520,
|
|
487
487
|
"concern": "module-boundaries",
|
|
488
488
|
"status": "accepted",
|
|
489
489
|
"date": "",
|
|
490
|
-
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; this pack keeps the boundaries between
|
|
491
|
-
"decision": "Code shared between parts lives in one shared kernel: value types and contracts (money, identifiers, event schemas) used by at least two parts, with no I/O
|
|
490
|
+
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; who owns each part is the Code review and branching pack; this pack keeps the boundaries between the parts.",
|
|
491
|
+
"decision": "Code shared between parts lives in one shared kernel, src/shared-kernel: value types and contracts (money, identifiers, event schemas) used by at least two parts, with no dependency on a part, no I/O or framework library (only the pure libraries on the kernel's allowlist), at most {{KERNEL_PERCENT}}% of the source lines. A change to the kernel is approved by the owners of every part that uses it, as the Code review and branching pack decides ownership.",
|
|
492
492
|
"consequences": "• Parts speak the same language about the few concepts they share.\n• Every kernel change is a change to every part that uses it, hence the approvals and the size limit.\n• Helpers that are convenient but not shared concepts stay in the parts and are sometimes duplicated.",
|
|
493
493
|
"alternatives": "1. Versioned internal libraries: each part upgrades on its own schedule.\n2. Nothing shared: no coupling through code, at the cost of duplication.\n3. A free-for-all \"common\" folder: easy, and it couples everything to everything.",
|
|
494
494
|
"hubWhen": {
|
|
@@ -502,12 +502,12 @@
|
|
|
502
502
|
"type": "adr",
|
|
503
503
|
"label": "Versioned internal libraries",
|
|
504
504
|
"x": 780,
|
|
505
|
-
"y":
|
|
505
|
+
"y": 650,
|
|
506
506
|
"concern": "module-boundaries",
|
|
507
507
|
"status": "accepted",
|
|
508
508
|
"date": "",
|
|
509
|
-
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; this pack keeps the boundaries between
|
|
510
|
-
"decision": "Code shared between parts is published as internal libraries with semantic versions to the internal registry (npm, Maven, NuGet or PyPI on Artifactory, GitHub Packages or a cloud artifact registry). Each part upgrades on its own schedule;
|
|
509
|
+
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; who owns each part is the Code review and branching pack; this pack keeps the boundaries between the parts.",
|
|
510
|
+
"decision": "Code shared between parts is published as internal libraries under the @shop scope with semantic versions to the internal registry (npm, Maven, NuGet or PyPI on Artifactory, GitHub Packages or a cloud artifact registry). Each part upgrades on its own schedule; how the update pull requests arrive is decided in the Dependency hygiene pack. No consumer stays on an older major version for more than 90 days after a new major is released; a weekly check in every consumer fails past that.",
|
|
511
511
|
"consequences": "• Parts released apart are not forced to upgrade together.\n• Several versions of a library live at once; fixes have to be released and picked up.\n• Library owners must keep compatibility within a major version and announce majors.",
|
|
512
512
|
"alternatives": "1. A shared kernel in the same repository: always one version, but every change hits every user at once.\n2. Nothing shared: no versions to manage, some duplication.",
|
|
513
513
|
"hubWhen": {
|
|
@@ -521,11 +521,11 @@
|
|
|
521
521
|
"type": "adr",
|
|
522
522
|
"label": "Parts share no code",
|
|
523
523
|
"x": 780,
|
|
524
|
-
"y":
|
|
524
|
+
"y": 780,
|
|
525
525
|
"concern": "module-boundaries",
|
|
526
526
|
"status": "accepted",
|
|
527
527
|
"date": "",
|
|
528
|
-
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; this pack keeps the boundaries between
|
|
528
|
+
"context": "The code in this element is cut into parts (modules, packages, libraries) and keeps changing. Without written and checked rules, every shortcut adds a dependency nobody decided on: one module reads another's internals, two packages import each other, and a \"common\" folder grows until every change touches everything. The forces: rules kept only in a wiki erode within months; a cycle makes two parts one, so neither can be tested, owned or released alone; sharing code saves typing but couples the teams that share it; a boundary nobody owns is crossed by whoever is in a hurry; and an old codebase cannot fix every violation at once. What the parts are (layers, rings, slices) is the Architecture style pack; who owns each part is the Code review and branching pack; this pack keeps the boundaries between the parts.",
|
|
529
529
|
"decision": "Parts share no source code of their own: small helpers are duplicated, and data crosses only through published APIs or events, with clients generated in each consumer from the provider's contract. Third-party libraries are allowed.",
|
|
530
530
|
"consequences": "• No team ever waits for another to change shared code.\n• Some duplication, and a bug in a copied helper is fixed in each copy.\n• Contracts carry the whole weight of the coupling, so they must be versioned and checked.",
|
|
531
531
|
"alternatives": "1. A small shared kernel: less duplication for genuinely shared concepts.\n2. Versioned internal libraries: sharing without lock-step upgrades.",
|
|
@@ -541,9 +541,12 @@
|
|
|
541
541
|
"label": "No dependency cycles",
|
|
542
542
|
"x": 1040,
|
|
543
543
|
"y": 0,
|
|
544
|
-
"
|
|
545
|
-
"
|
|
546
|
-
"
|
|
544
|
+
"characteristic": "maintainability",
|
|
545
|
+
"scope": "atomic",
|
|
546
|
+
"cadence": "triggered",
|
|
547
|
+
"trigger": "pull-request",
|
|
548
|
+
"invocation": "automated",
|
|
549
|
+
"description": "A dependency rule fails on any cycle that leaves a part's folder (a cycle among the files of one part is not counted); it is one of the rules in .dependency-cruiser.cjs that npm run check:deps runs. On the JVM the same is ArchUnit's slices().matching(\"..(*)..\").should().beFreeOfCycles(); for Python, import-linter's independence contract.\n\nThreshold: 0 cycles that run through more than one part on the main branch\n\nTool: dependency-cruiser; for the JVM: ArchUnit slices; for Python: import-linter; for .NET: NetArchTest\n\n```js\n// .dependency-cruiser.cjs: add the rule to forbidden\nmodule.exports = { forbidden: [{\n name: 'no-cycles-between-parts',\n comment: 'ADR Module boundaries: parts in a cycle are one part',\n severity: 'error',\n from: { path: '^src/modules/([^/]+)/' },\n to: { circular: true, via: { pathNot: '^src/modules/$1/' } }, // the cycle passes through another part\n}] }\n// package.json: \"check:deps\": \"depcruise src --config .dependency-cruiser.cjs\"\n```"
|
|
547
550
|
},
|
|
548
551
|
{
|
|
549
552
|
"id": "ff-public-api",
|
|
@@ -551,9 +554,12 @@
|
|
|
551
554
|
"label": "Only public APIs used",
|
|
552
555
|
"x": 1040,
|
|
553
556
|
"y": 130,
|
|
554
|
-
"
|
|
555
|
-
"
|
|
556
|
-
"
|
|
557
|
+
"characteristic": "maintainability",
|
|
558
|
+
"scope": "atomic",
|
|
559
|
+
"cadence": "triggered",
|
|
560
|
+
"trigger": "pull-request",
|
|
561
|
+
"invocation": "automated",
|
|
562
|
+
"description": "A dependency rule allows a part to import another only through its index (the published API); a deep import into another part's folder fails the build. Spring Modulith's verify() (named interfaces such as customer::api are its published packages) and Nx's module boundaries do the same in their stacks.\n\nThreshold: 0 imports from one part into another part's files other than its index.ts\n\nTool: dependency-cruiser; for Spring Boot: Spring Modulith verify(); for an Nx workspace: @nx/enforce-module-boundaries; for .NET: NetArchTest\n\n```js\n// .dependency-cruiser.cjs: add the rule to forbidden\nmodule.exports = { forbidden: [{\n name: 'only-through-public-api',\n comment: 'ADR Module boundaries: parts meet through their published API',\n severity: 'error',\n from: { path: '^src/modules/([^/]+)/' },\n to: { path: '^src/modules/', pathNot: ['^src/modules/$1/', '^src/modules/[^/]+/index\\\\.ts$'] },\n}] }\n```"
|
|
557
563
|
},
|
|
558
564
|
{
|
|
559
565
|
"id": "ff-allowlist",
|
|
@@ -561,9 +567,12 @@
|
|
|
561
567
|
"label": "Only declared dependencies",
|
|
562
568
|
"x": 1040,
|
|
563
569
|
"y": 260,
|
|
564
|
-
"
|
|
565
|
-
"
|
|
566
|
-
"
|
|
570
|
+
"characteristic": "maintainability",
|
|
571
|
+
"scope": "atomic",
|
|
572
|
+
"cadence": "triggered",
|
|
573
|
+
"trigger": "pull-request",
|
|
574
|
+
"invocation": "automated",
|
|
575
|
+
"description": "Each part declares what it may use in src/modules/<name>/module.json; the configuration reads the files and generates one forbidden rule per part that allows imports only of the declared parts' index files. A new dependency means a one-line change to module.json, visible in review.\n\nThreshold: 0 dependencies from a part on a part its module.json does not list\n\nTool: dependency-cruiser; for Spring Boot: Spring Modulith @ApplicationModule(allowedDependencies) with ApplicationModules.verify(); for Python: import-linter forbidden contracts\n\n```js\n// .dependency-cruiser.cjs — each part declares what it may use in src/modules/<name>/module.json: { \"uses\": [\"catalog\", \"customer\"] }\nconst { readdirSync, readFileSync } = require('node:fs')\nconst parts = readdirSync('src/modules')\nconst uses = Object.fromEntries(parts.map((p) => [p, JSON.parse(readFileSync(`src/modules/${p}/module.json`, 'utf8')).uses ?? []]))\n\nmodule.exports = {\n forbidden: parts.map((p) => ({\n name: `${p}-uses-only-declared-parts`,\n comment: 'ADR Declared dependencies only: add the part to module.json to use it',\n severity: 'error',\n from: { path: `^src/modules/${p}/` },\n to: { path: '^src/modules/', pathNot: [`^src/modules/${p}/`, ...uses[p].map((u) => `^src/modules/${u}/index\\\\.ts$`)] },\n })),\n options: { tsConfig: { fileName: 'tsconfig.json' } },\n}\n```",
|
|
567
576
|
"hubWhen": {
|
|
568
577
|
"RULES": [
|
|
569
578
|
"allowlist"
|
|
@@ -576,9 +585,12 @@
|
|
|
576
585
|
"label": "Dependencies point down levels",
|
|
577
586
|
"x": 1040,
|
|
578
587
|
"y": 390,
|
|
579
|
-
"
|
|
580
|
-
"
|
|
581
|
-
"
|
|
588
|
+
"characteristic": "maintainability",
|
|
589
|
+
"scope": "atomic",
|
|
590
|
+
"cadence": "triggered",
|
|
591
|
+
"trigger": "pull-request",
|
|
592
|
+
"invocation": "automated",
|
|
593
|
+
"description": "Each part declares its level in src/modules/<name>/module.json; the configuration generates one forbidden rule per part that refuses imports from parts of the same or a higher level. In an Nx workspace the same is the type tags of @nx/enforce-module-boundaries.\n\nThreshold: 0 dependencies from a part on a part of the same or a higher level\n\nTool: dependency-cruiser; for an Nx workspace: @nx/enforce-module-boundaries with depConstraints on type tags; for the JVM: ArchUnit layeredArchitecture(); for Python: import-linter layers contract\n\n```js\n// .dependency-cruiser.cjs — each part declares its level in src/modules/<name>/module.json: { \"level\": \"feature\" }\nconst { readdirSync, readFileSync } = require('node:fs')\nconst LEVELS = ['util', 'domain', 'data-access', 'feature', 'app'] // lowest first: a part may use lower levels only\nconst parts = readdirSync('src/modules')\nconst level = Object.fromEntries(parts.map((p) => [p, LEVELS.indexOf(JSON.parse(readFileSync(`src/modules/${p}/module.json`, 'utf8')).level)]))\n\nmodule.exports = {\n forbidden: parts.map((p) => ({\n name: `${p}-depends-down-levels-only`,\n comment: 'ADR Parts ranked in levels: a part uses parts of lower levels only',\n severity: 'error',\n from: { path: `^src/modules/${p}/` },\n to: { path: parts.filter((o) => o !== p && level[o] >= level[p]).map((o) => `^src/modules/${o}/`) },\n })).filter((rule) => rule.to.path.length > 0),\n options: { tsConfig: { fileName: 'tsconfig.json' } },\n}\n```",
|
|
582
594
|
"hubWhen": {
|
|
583
595
|
"RULES": [
|
|
584
596
|
"levels"
|
|
@@ -586,77 +598,92 @@
|
|
|
586
598
|
}
|
|
587
599
|
},
|
|
588
600
|
{
|
|
589
|
-
"id": "ff-
|
|
601
|
+
"id": "ff-fail",
|
|
590
602
|
"type": "fitness-fn",
|
|
591
|
-
"label": "
|
|
603
|
+
"label": "Violations fail the pull request",
|
|
592
604
|
"x": 1040,
|
|
593
605
|
"y": 520,
|
|
594
|
-
"
|
|
595
|
-
"
|
|
596
|
-
"
|
|
606
|
+
"characteristic": "maintainability",
|
|
607
|
+
"scope": "atomic",
|
|
608
|
+
"cadence": "triggered",
|
|
609
|
+
"trigger": "pull-request",
|
|
610
|
+
"invocation": "automated",
|
|
611
|
+
"description": "A workflow runs npm run check:deps on every pull request; dependency-cruiser's default err reporter exits non-zero on an error-severity violation and prints the rule with the from and to files. The job is listed among the checks the main branch requires, in the ruleset the Code review and branching pack keeps.\n\nThreshold: The dependency check runs on every pull request and its job fails on any violation, naming the rule and both files\n\nTool: dependency-cruiser in GitHub Actions; for the JVM: the ArchUnit tests in the build's test job\n\n```yaml\n# .github/workflows/boundaries.yml\nname: module boundaries\non: [pull_request]\njobs:\n check-deps:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - uses: actions/setup-node@v4.1.0 # pin by commit SHA in your repository\n with: { node-version-file: .nvmrc, cache: npm }\n - run: npm ci\n - run: npm run check:deps # depcruise src --config .dependency-cruiser.cjs; exits non-zero on a violation\n```",
|
|
597
612
|
"hubWhen": {
|
|
598
613
|
"ENFORCE": [
|
|
599
|
-
"
|
|
614
|
+
"fail"
|
|
600
615
|
]
|
|
601
616
|
}
|
|
602
617
|
},
|
|
603
618
|
{
|
|
604
|
-
"id": "ff-
|
|
619
|
+
"id": "ff-ratchet",
|
|
605
620
|
"type": "fitness-fn",
|
|
606
|
-
"label": "
|
|
621
|
+
"label": "Known violations frozen and shrinking",
|
|
607
622
|
"x": 1040,
|
|
608
623
|
"y": 650,
|
|
609
|
-
"
|
|
610
|
-
"
|
|
611
|
-
"
|
|
624
|
+
"characteristic": "maintainability",
|
|
625
|
+
"scope": "atomic",
|
|
626
|
+
"cadence": "triggered",
|
|
627
|
+
"trigger": "pull-request",
|
|
628
|
+
"invocation": "automated",
|
|
629
|
+
"description": "The dependency check runs with --ignore-known, so only violations not in the committed baseline fail; the baseline was written once with --baseline. A second step counts the baseline's entries against the file at the previous quarter's tag and fails when it has not shrunk enough. With ArchUnit the same is FreezingArchRule with its store committed and counted the same way.\n\nThreshold: 0 violations outside the baseline on every pull request; the baseline holds at least {{RATCHET_PERCENT}}% fewer entries than at the previous quarter's tag\n\nTool: dependency-cruiser (--baseline, --ignore-known) with jq and git in a shell step; for the JVM: ArchUnit FreezingArchRule with the archunit_store directory\n\n```bash\nset -euo pipefail\n# once, to freeze today's violations: npx depcruise src --config .dependency-cruiser.cjs --baseline (then commit the file)\nnpx depcruise src --config .dependency-cruiser.cjs --ignore-known # fails on violations outside .dependency-cruiser-known-violations.json\n\n# the baseline shrinks: compare with the previous quarter's tag (quarter-<year>Q<n>, set by the team)\nnow=$(jq length .dependency-cruiser-known-violations.json)\nprevious_tag=$(git describe --tags --match 'quarter-*' --abbrev=0 HEAD~1)\nthen=$(git show \"$previous_tag:.dependency-cruiser-known-violations.json\" | jq length)\necho \"known violations: $then at $previous_tag, $now now\"\n[ \"$((now * 100))\" -le \"$((then * (100 - {{RATCHET_PERCENT}})))\" ] || { echo \"the baseline has not shrunk by {{RATCHET_PERCENT}}% since $previous_tag\"; exit 1; }\n```",
|
|
612
630
|
"hubWhen": {
|
|
613
|
-
"
|
|
614
|
-
"
|
|
631
|
+
"ENFORCE": [
|
|
632
|
+
"ratchet"
|
|
615
633
|
]
|
|
616
634
|
}
|
|
617
635
|
},
|
|
618
636
|
{
|
|
619
|
-
"id": "ff-
|
|
637
|
+
"id": "ff-kernel",
|
|
620
638
|
"type": "fitness-fn",
|
|
621
|
-
"label": "
|
|
639
|
+
"label": "Shared kernel stays small",
|
|
622
640
|
"x": 1040,
|
|
623
641
|
"y": 780,
|
|
624
|
-
"
|
|
625
|
-
"
|
|
626
|
-
"
|
|
642
|
+
"characteristic": "maintainability",
|
|
643
|
+
"scope": "atomic",
|
|
644
|
+
"cadence": "triggered",
|
|
645
|
+
"trigger": "pull-request",
|
|
646
|
+
"invocation": "automated",
|
|
647
|
+
"description": "A dependency rule keeps the kernel free of the parts and of every package in node_modules except the pure ones on its allowlist (so a database driver, HTTP client or framework cannot slip in); a second step in the same job compares the kernel's line count with the whole and fails above the limit.\n\nThreshold: The shared kernel imports no part and no third-party package outside its allowlist, and holds at most {{KERNEL_PERCENT}}% of the source lines\n\nTool: dependency-cruiser and cloc with jq in a shell step; for the JVM: an ArchUnit rule over the kernel package and JaCoCo's line counts\n\n```js\n// .dependency-cruiser.cjs: add the rule to forbidden\nmodule.exports = { forbidden: [{\n name: 'kernel-depends-on-nothing',\n comment: 'ADR A small shared kernel: types and contracts only',\n severity: 'error',\n from: { path: '^src/shared-kernel/' },\n to: { path: ['^src/modules/', '^node_modules/'], pathNot: '^node_modules/(zod|uuid|decimal\\\\.js)/' }, // the pure libraries the kernel may use\n}] }\n// CI, in the same job: fail when the kernel passes the limit\n// kernel=$(cloc --json src/shared-kernel | jq '.SUM.code'); all=$(cloc --json src | jq '.SUM.code')\n// [ $((kernel * 100 / all)) -le {{KERNEL_PERCENT}} ]\n```",
|
|
627
648
|
"hubWhen": {
|
|
628
649
|
"SHARED": [
|
|
629
|
-
"
|
|
650
|
+
"kernel"
|
|
630
651
|
]
|
|
631
652
|
}
|
|
632
653
|
},
|
|
633
654
|
{
|
|
634
|
-
"id": "ff-
|
|
655
|
+
"id": "ff-library",
|
|
635
656
|
"type": "fitness-fn",
|
|
636
|
-
"label": "No
|
|
657
|
+
"label": "No consumer left behind",
|
|
637
658
|
"x": 1040,
|
|
638
659
|
"y": 910,
|
|
639
|
-
"
|
|
640
|
-
"
|
|
641
|
-
"
|
|
660
|
+
"characteristic": "maintainability",
|
|
661
|
+
"scope": "atomic",
|
|
662
|
+
"cadence": "triggered",
|
|
663
|
+
"trigger": "weekly",
|
|
664
|
+
"invocation": "automated",
|
|
665
|
+
"description": "A weekly job in every consumer lists its outdated packages, and for each internal library whose latest major is newer than the installed one reads the release date of that version from the registry; a lag over 90 days fails the job naming the library.\n\nThreshold: 0 internal libraries on which a consumer is a major version behind for more than 90 days after the newer major's release\n\nTool: npm (outdated, view) in a TypeScript script run with tsx from a scheduled GitHub Actions job; for Maven: versions:display-dependency-updates with the release dates from the repository index\n\n```ts\n// scripts/library-lag.ts — scheduled weekly in every consumer: npx tsx scripts/library-lag.ts\nimport { execFileSync } from 'node:child_process'\n\nconst SCOPE = '@shop/'\nconst MAX_DAYS = 90\n// npm outdated exits 1 when something is outdated; its JSON is still on stdout\nconst npm = (args: string[]): string => { try { return execFileSync('npm', args, { encoding: 'utf8' }) } catch (e: any) { return e.stdout } }\nconst major = (version: string) => Number(version.split('.')[0])\n\nconst outdated: Record<string, { current: string; latest: string }> = JSON.parse(npm(['outdated', '--json']) || '{}')\nconst late: string[] = []\nfor (const [name, info] of Object.entries(outdated)) {\n if (!name.startsWith(SCOPE) || major(info.latest) <= major(info.current)) continue\n const published: Record<string, string> = JSON.parse(npm(['view', name, 'time', '--json']))\n const days = Math.floor((Date.now() - Date.parse(published[info.latest])) / 86_400_000)\n if (days > MAX_DAYS) late.push(`${name}: on ${info.current}, ${info.latest} was released ${days} days ago`)\n}\nif (late.length) { console.error('internal libraries a major behind for over 90 days:\\n' + late.join('\\n')); process.exit(1) }\n```",
|
|
642
666
|
"hubWhen": {
|
|
643
667
|
"SHARED": [
|
|
644
|
-
"
|
|
668
|
+
"library"
|
|
645
669
|
]
|
|
646
670
|
}
|
|
647
671
|
},
|
|
648
672
|
{
|
|
649
|
-
"id": "ff-
|
|
673
|
+
"id": "ff-no-shared",
|
|
650
674
|
"type": "fitness-fn",
|
|
651
|
-
"label": "
|
|
675
|
+
"label": "No code shared between parts",
|
|
652
676
|
"x": 1040,
|
|
653
677
|
"y": 1040,
|
|
654
|
-
"
|
|
655
|
-
"
|
|
656
|
-
"
|
|
678
|
+
"characteristic": "maintainability",
|
|
679
|
+
"scope": "atomic",
|
|
680
|
+
"cadence": "triggered",
|
|
681
|
+
"trigger": "pull-request",
|
|
682
|
+
"invocation": "automated",
|
|
683
|
+
"description": "A dependency rule forbids any import from one part into another; generated API clients live in each consumer and are generated from the provider's published contract.\n\nThreshold: 0 imports from one part's folder into another's\n\nTool: dependency-cruiser; for the JVM: ArchUnit slices().should().notDependOnEachOther(); for .NET: NetArchTest\n\n```js\n// .dependency-cruiser.cjs: add the rule to forbidden\nmodule.exports = { forbidden: [{\n name: 'parts-share-nothing',\n comment: 'ADR Parts share no code',\n severity: 'error',\n from: { path: '^src/modules/([^/]+)/' },\n to: { path: '^src/modules/', pathNot: '^src/modules/$1/' },\n}] }\n```",
|
|
657
684
|
"hubWhen": {
|
|
658
|
-
"
|
|
659
|
-
"
|
|
685
|
+
"SHARED": [
|
|
686
|
+
"none"
|
|
660
687
|
]
|
|
661
688
|
}
|
|
662
689
|
}
|
|
@@ -716,12 +743,6 @@
|
|
|
716
743
|
"targetId": "need",
|
|
717
744
|
"relationType": "derives"
|
|
718
745
|
},
|
|
719
|
-
{
|
|
720
|
-
"id": "req-owners--derives--need",
|
|
721
|
-
"sourceId": "req-owners",
|
|
722
|
-
"targetId": "need",
|
|
723
|
-
"relationType": "derives"
|
|
724
|
-
},
|
|
725
746
|
{
|
|
726
747
|
"id": "sc-allowlist--verifies--req-allowlist",
|
|
727
748
|
"sourceId": "sc-allowlist",
|
|
@@ -776,12 +797,6 @@
|
|
|
776
797
|
"targetId": "req-no-shared",
|
|
777
798
|
"relationType": "verifies"
|
|
778
799
|
},
|
|
779
|
-
{
|
|
780
|
-
"id": "sc-owners--verifies--req-owners",
|
|
781
|
-
"sourceId": "sc-owners",
|
|
782
|
-
"targetId": "req-owners",
|
|
783
|
-
"relationType": "verifies"
|
|
784
|
-
},
|
|
785
800
|
{
|
|
786
801
|
"id": "ff-cycles--implements--adr-allowlist",
|
|
787
802
|
"sourceId": "ff-cycles",
|
|
@@ -819,15 +834,15 @@
|
|
|
819
834
|
"relationType": "implements"
|
|
820
835
|
},
|
|
821
836
|
{
|
|
822
|
-
"id": "ff-
|
|
823
|
-
"sourceId": "ff-
|
|
824
|
-
"targetId": "adr-
|
|
837
|
+
"id": "ff-fail--implements--adr-fail",
|
|
838
|
+
"sourceId": "ff-fail",
|
|
839
|
+
"targetId": "adr-fail",
|
|
825
840
|
"relationType": "implements"
|
|
826
841
|
},
|
|
827
842
|
{
|
|
828
|
-
"id": "ff-ratchet--implements--adr-
|
|
843
|
+
"id": "ff-ratchet--implements--adr-ratchet",
|
|
829
844
|
"sourceId": "ff-ratchet",
|
|
830
|
-
"targetId": "adr-
|
|
845
|
+
"targetId": "adr-ratchet",
|
|
831
846
|
"relationType": "implements"
|
|
832
847
|
},
|
|
833
848
|
{
|
|
@@ -847,18 +862,6 @@
|
|
|
847
862
|
"sourceId": "ff-no-shared",
|
|
848
863
|
"targetId": "adr-share-nothing",
|
|
849
864
|
"relationType": "implements"
|
|
850
|
-
},
|
|
851
|
-
{
|
|
852
|
-
"id": "ff-owners--implements--adr-allowlist",
|
|
853
|
-
"sourceId": "ff-owners",
|
|
854
|
-
"targetId": "adr-allowlist",
|
|
855
|
-
"relationType": "implements"
|
|
856
|
-
},
|
|
857
|
-
{
|
|
858
|
-
"id": "ff-owners--implements--adr-levels",
|
|
859
|
-
"sourceId": "ff-owners",
|
|
860
|
-
"targetId": "adr-levels",
|
|
861
|
-
"relationType": "implements"
|
|
862
865
|
}
|
|
863
866
|
]
|
|
864
867
|
}
|