@hailstails/hone 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/ADOPTING.md +8 -8
  2. package/CHANGELOG.md +36 -0
  3. package/MIGRATING.md +40 -0
  4. package/README.md +28 -7
  5. package/api/audit.d.ts +1 -1
  6. package/api/testing.js +3 -3
  7. package/chunks/{chunk-H4V72FCW.js → chunk-2O46EB4E.js} +15 -1
  8. package/chunks/chunk-335ITLPO.js +7 -0
  9. package/chunks/{chunk-YSN46EB3.js → chunk-5U4VTFD5.js} +347 -664
  10. package/chunks/{chunk-PL2PNPAR.js → chunk-E6VR3VRV.js} +1 -6
  11. package/chunks/chunk-WF3PPYRR.js +27 -0
  12. package/core/check/tool-command.js +1120 -105
  13. package/core/mechanism-port/runner-result-types.d.ts +10 -0
  14. package/docs/adding-a-discipline-or-mechanism.md +5 -3
  15. package/docs/extending.md +2 -0
  16. package/docs/output-contract.md +64 -11
  17. package/mechanisms/audit/CD-27/test-body-logic.js +397 -46
  18. package/mechanisms/audit/runner/runner.js +5 -3
  19. package/mechanisms/audit/runner/typescript-parse.d.ts +2 -0
  20. package/mechanisms/audit/runner/walker-piece.d.ts +2 -1
  21. package/mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js +7 -4
  22. package/mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js +21 -11
  23. package/mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js +15 -5
  24. package/mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js +7 -3
  25. package/mechanisms/eslint/CD-41/README.md +1 -1
  26. package/mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js +100 -28
  27. package/mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js +8 -4
  28. package/mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js +8 -4
  29. package/mechanisms/eslint/runner/README.md +9 -2
  30. package/mechanisms/eslint/runner/runner.js +1410 -1384
  31. package/methods/assessment-template.md +2 -2
  32. package/methods/lenses/clean-architecture.md +7 -8
  33. package/methods/lenses/defended-on-intent.md +2 -2
  34. package/methods/lenses/di-discipline.md +14 -18
  35. package/methods/lenses/function-first.md +16 -18
  36. package/methods/lenses/test-discipline.md +1 -1
  37. package/package.json +1 -1
  38. package/rules/CD-1/CHECKS.md +6 -2
  39. package/rules/CD-1/README.md +6 -19
  40. package/rules/CD-10/CHECKS.md +5 -3
  41. package/rules/CD-10/README.md +6 -18
  42. package/rules/CD-11/CHECKS.md +4 -2
  43. package/rules/CD-11/README.md +6 -16
  44. package/rules/CD-12/CHECKS.md +4 -2
  45. package/rules/CD-12/README.md +6 -16
  46. package/rules/CD-13/CHECKS.md +4 -2
  47. package/rules/CD-13/README.md +6 -16
  48. package/rules/CD-14/CHECKS.md +3 -1
  49. package/rules/CD-14/README.md +6 -19
  50. package/rules/CD-15/CHECKS.md +5 -1
  51. package/rules/CD-15/README.md +5 -20
  52. package/rules/CD-16/CHECKS.md +3 -1
  53. package/rules/CD-16/README.md +6 -6
  54. package/rules/CD-17/CHECKS.md +3 -1
  55. package/rules/CD-17/README.md +6 -19
  56. package/rules/CD-18/CHECKS.md +4 -2
  57. package/rules/CD-18/README.md +6 -16
  58. package/rules/CD-19/CHECKS.md +8 -6
  59. package/rules/CD-19/README.md +6 -20
  60. package/rules/CD-2/CHECKS.md +7 -3
  61. package/rules/CD-2/README.md +6 -21
  62. package/rules/CD-20/CHECKS.md +3 -1
  63. package/rules/CD-20/README.md +6 -6
  64. package/rules/CD-21/CHECKS.md +4 -2
  65. package/rules/CD-21/README.md +6 -15
  66. package/rules/CD-22/CHECKS.md +4 -2
  67. package/rules/CD-22/README.md +6 -15
  68. package/rules/CD-23/CHECKS.md +5 -3
  69. package/rules/CD-23/README.md +6 -17
  70. package/rules/CD-24/CHECKS.md +3 -1
  71. package/rules/CD-24/README.md +6 -6
  72. package/rules/CD-25/CHECKS.md +5 -3
  73. package/rules/CD-25/README.md +5 -21
  74. package/rules/CD-26/CHECKS.md +5 -3
  75. package/rules/CD-26/README.md +6 -20
  76. package/rules/CD-27/CHECKS.md +394 -9
  77. package/rules/CD-27/README.md +6 -20
  78. package/rules/CD-27/discipline.json +130 -0
  79. package/rules/CD-28/CHECKS.md +4 -2
  80. package/rules/CD-28/README.md +6 -16
  81. package/rules/CD-29/CHECKS.md +4 -2
  82. package/rules/CD-29/README.md +6 -14
  83. package/rules/CD-3/CHECKS.md +3 -1
  84. package/rules/CD-3/README.md +6 -17
  85. package/rules/CD-30/CHECKS.md +4 -2
  86. package/rules/CD-30/README.md +6 -15
  87. package/rules/CD-31/CHECKS.md +4 -2
  88. package/rules/CD-31/README.md +6 -14
  89. package/rules/CD-32/CHECKS.md +3 -1
  90. package/rules/CD-32/README.md +2 -0
  91. package/rules/CD-33/CHECKS.md +3 -1
  92. package/rules/CD-33/README.md +2 -0
  93. package/rules/CD-34/CHECKS.md +3 -1
  94. package/rules/CD-34/README.md +2 -0
  95. package/rules/CD-39/CHECKS.md +3 -1
  96. package/rules/CD-39/README.md +2 -0
  97. package/rules/CD-4/CHECKS.md +4 -2
  98. package/rules/CD-4/README.md +6 -17
  99. package/rules/CD-40/CHECKS.md +3 -1
  100. package/rules/CD-40/README.md +6 -20
  101. package/rules/CD-41/CHECKS.md +14 -2
  102. package/rules/CD-41/README.md +6 -20
  103. package/rules/CD-41/discipline.json +14 -0
  104. package/rules/CD-42/CHECKS.md +3 -1
  105. package/rules/CD-42/README.md +6 -16
  106. package/rules/CD-43/CHECKS.md +3 -1
  107. package/rules/CD-43/README.md +6 -18
  108. package/rules/CD-44/CHECKS.md +3 -1
  109. package/rules/CD-44/README.md +6 -17
  110. package/rules/CD-45/CHECKS.md +4 -2
  111. package/rules/CD-45/README.md +6 -16
  112. package/rules/CD-46/CHECKS.md +3 -1
  113. package/rules/CD-46/README.md +2 -0
  114. package/rules/CD-47/CHECKS.md +4 -2
  115. package/rules/CD-47/README.md +4 -20
  116. package/rules/CD-5/CHECKS.md +4 -2
  117. package/rules/CD-5/README.md +6 -19
  118. package/rules/CD-6/CHECKS.md +3 -1
  119. package/rules/CD-6/README.md +6 -19
  120. package/rules/CD-7/CHECKS.md +3 -1
  121. package/rules/CD-7/README.md +6 -20
  122. package/rules/CD-7a/CHECKS.md +3 -1
  123. package/rules/CD-7a/README.md +6 -17
  124. package/rules/CD-8/CHECKS.md +3 -1
  125. package/rules/CD-8/README.md +6 -17
  126. package/rules/CD-9/CHECKS.md +4 -2
  127. package/rules/CD-9/README.md +6 -17
  128. package/rules/README.md +71 -54
  129. package/rules/SPIRIT.md +3 -3
  130. package/rules/cases.md +94 -0
  131. package/rules/numbers.md +155 -0
  132. package/rules/principles.md +89 -0
  133. package/rules/records.md +150 -0
  134. package/rules/rules.md +149 -0
  135. package/rules/sources.md +142 -0
  136. package/rules/typescript/checks.md +219 -0
  137. package/rules/typescript/recipes.md +361 -0
  138. package/rules/typescript/symptoms.json +1005 -0
  139. package/rules/typescript/symptoms.md +612 -0
  140. package/chunks/chunk-YLZ73C7O.js +0 -0
@@ -99,6 +99,118 @@
99
99
  2
100
100
  ],
101
101
  "edition": "2"
102
+ },
103
+ {
104
+ "name": "join on node:path with several segments",
105
+ "fileName": "node-path.test.ts",
106
+ "source": "import path from \"node:path\";\nexpect(path.join(\"a\", \"b\", \"c\")).toBe(\"a/b/c\");\n",
107
+ "expectedLines": [
108
+ 2
109
+ ]
110
+ },
111
+ {
112
+ "name": "a library helper given an object",
113
+ "fileName": "library.test.ts",
114
+ "source": "import _ from \"lodash\";\nexpect(_.find([{ id: \"a\" }], { id: \"a\" }, 0, 1)).toEqual({ id: \"a\" });\n",
115
+ "expectedLines": [
116
+ 2
117
+ ]
118
+ },
119
+ {
120
+ "name": "Object.entries given an object",
121
+ "fileName": "object-entries.test.ts",
122
+ "source": "expect(Object.entries({ a: 1 })).toEqual([[\"a\", 1]]);\n",
123
+ "expectedLines": [
124
+ 1
125
+ ]
126
+ },
127
+ {
128
+ "name": "join on a dynamic import of node:path",
129
+ "fileName": "dynamic-path.test.ts",
130
+ "source": "const path = await import(\"node:path\");\nexpect(path.join(\"a\", \"b\", \"c\")).toBe(\"a/b/c\");\n",
131
+ "expectedLines": [
132
+ 2
133
+ ]
134
+ },
135
+ {
136
+ "name": "join on a required node:path",
137
+ "fileName": "required-path.test.ts",
138
+ "source": "const path = require(\"node:path\");\nexpect(path.join(\"a\", \"b\", \"c\")).toBe(\"a/b/c\");\n",
139
+ "expectedLines": [
140
+ 2
141
+ ]
142
+ },
143
+ {
144
+ "name": "join on an import-equals of node:path",
145
+ "fileName": "import-equals-path.test.ts",
146
+ "source": "import path = require(\"node:path\");\nexpect(path.join(\"a\", \"b\", \"c\")).toBe(\"a/b/c\");\n",
147
+ "expectedLines": [
148
+ 2
149
+ ]
150
+ },
151
+ {
152
+ "name": "join on a member destructured from node:path",
153
+ "fileName": "posix-path.test.ts",
154
+ "source": "import path from \"node:path\";\nconst { posix } = path;\nexpect(posix.join(\"a\", \"b\", \"c\")).toBe(\"a/b/c\");\n",
155
+ "expectedLines": [
156
+ 3
157
+ ]
158
+ },
159
+ {
160
+ "name": "join on node:path held in an object literal",
161
+ "fileName": "held-path.test.ts",
162
+ "source": "import path from \"node:path\";\nconst deps = { path };\nexpect(deps.path.join(\"a\", \"b\", \"c\")).toBe(\"a/b/c\");\n",
163
+ "expectedLines": [
164
+ 3
165
+ ]
166
+ },
167
+ {
168
+ "name": "entries on an alias of Object",
169
+ "fileName": "object-alias.test.ts",
170
+ "source": "const o = Object;\nexpect(o.entries({ a: 1 })).toEqual([[\"a\", 1]]);\n",
171
+ "expectedLines": [
172
+ 2
173
+ ]
174
+ },
175
+ {
176
+ "name": "find given an object as this",
177
+ "fileName": "find-this.test.ts",
178
+ "source": "declare const rows: readonly { readonly id: string }[];\ndeclare const isA: (row: { readonly id: string }) => boolean;\nexpect(rows.find(isA, {})).toEqual({ id: \"a\" });\n",
179
+ "expectedLines": [
180
+ 3
181
+ ]
182
+ },
183
+ {
184
+ "name": "split given a splitter object",
185
+ "fileName": "split-protocol.test.ts",
186
+ "source": "declare const text: string;\ndeclare const splitter: (text: string) => string[];\nexpect(text.split({ [Symbol.split]: splitter })).toEqual([\"a\"]);\n",
187
+ "expectedLines": [
188
+ 3
189
+ ]
190
+ },
191
+ {
192
+ "name": "includes given an object",
193
+ "fileName": "includes-object.test.ts",
194
+ "source": "const rows = [{ id: \"a\" }];\nexpect(rows.includes({ id: \"a\" })).toBe(false);\n",
195
+ "expectedLines": [
196
+ 2
197
+ ]
198
+ },
199
+ {
200
+ "name": "reduce given an object to start from",
201
+ "fileName": "reduce-object.test.ts",
202
+ "source": "declare const sum: (total: { readonly total: number }, row: number) => { readonly total: number };\nexpect([1].reduce(sum, { total: 0 })).toEqual({ total: 1 });\n",
203
+ "expectedLines": [
204
+ 2
205
+ ]
206
+ },
207
+ {
208
+ "name": "a port method given a variable",
209
+ "fileName": "port-variable.test.ts",
210
+ "source": "declare const paths: { readonly join: (request: { readonly segments: readonly string[] }) => string };\nconst request = { segments: [\"a\"] };\nexpect(paths.join(request)).toBe(\"a\");\n",
211
+ "expectedLines": [
212
+ 3
213
+ ]
102
214
  }
103
215
  ],
104
216
  "allow": [
@@ -139,6 +251,24 @@
139
251
  "source": "const calls = [[1]];\nexpect(calls[0]).toEqual([1]);\n",
140
252
  "expectedLines": [],
141
253
  "edition": "2"
254
+ },
255
+ {
256
+ "name": "the adopter's own port method given an object",
257
+ "fileName": "own-port.test.ts",
258
+ "source": "declare const paths: { readonly join: (request: { readonly segments: readonly string[] }) => string };\nexpect(paths.join({ segments: [\"a\", \"b\"] })).toBe(\"a/b\");\n",
259
+ "expectedLines": []
260
+ },
261
+ {
262
+ "name": "the adopter's own method given more arguments than any built-in of its name takes",
263
+ "fileName": "own-arity.test.ts",
264
+ "source": "declare const screen: { readonly keys: (text: string, literal: boolean, submit: boolean) => void };\nscreen.keys(\"x\", true, true);\n",
265
+ "expectedLines": []
266
+ },
267
+ {
268
+ "name": "the adopter's own port imported from a relative module",
269
+ "fileName": "own-import.test.ts",
270
+ "source": "import { paths } from \"./paths.ts\";\nexpect(paths.join({ segments: [\"a\"] })).toBe(\"a\");\n",
271
+ "expectedLines": []
142
272
  }
143
273
  ]
144
274
  }
@@ -1,6 +1,8 @@
1
1
  # CD-28 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Symptom: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
10
12
 
11
13
  ## How it is checked
12
14
 
13
- Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the rule](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
15
+ Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
@@ -2,24 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- A test asserts the unit's own direct responsibility — its returned output and the calls it makes to its collaborators — not the transitive internals of those collaborators. Asserting through a dependency couples the test to code the unit does not own and makes it fail for the wrong reasons.
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
6
6
 
7
- Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
8
-
9
- ## Spirit
7
+ **Verdict.** Merges into [Written-out answers](../rules.md#written-out-answers).
10
8
 
11
- **What the friction is for.** A test that checks what a collaborator does breaks when that collaborator changes, even if this unit did not. The friction keeps each test on its own unit, so a failure means this unit broke.
9
+ **Read.** [Written-out answers](../rules.md#written-out-answers).
12
10
 
13
- **What a finding points at.** Match the tests against these causes.
14
- - *Assertions reaching through stubs.* The test checks what a stub returned, not what the unit did with it. Assert the unit's output and the calls it made.
15
- - *A real collaborator in the test.* The test asserts results produced by code it does not own. Replace it with a stub.
16
- - *A unit that passes values through.* The only thing to check is a delegate's output. The unit may have no responsibility of its own; question it.
17
-
18
- **Where to go.** Each test asserts the unit's own output and the exact calls it makes. Collaborators have their own tests.
11
+ Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
19
12
 
20
- **Reactions to distrust.**
21
- - "Testing through gives more confidence." It gives confidence about the collaborator, and blame in the wrong place when it fails.
13
+ ## Spirit
22
14
 
23
- **Principles behind it.**
24
- - *Defect localisation.* A test that can fail only when its own unit is wrong points straight at the fault.
25
- - *Fragile Test* (a test smell in Gerard Meszaros, *xUnit Test Patterns*). Tests that depend on more than the unit break for reasons unrelated to it.
15
+ Start from the symptom a finding names: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner) and [Unasserted call](../typescript/symptoms.md#unasserted-call). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
@@ -1,6 +1,8 @@
1
1
  # CD-29 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Symptom: [Integration-heavy suite](../typescript/symptoms.md#integration-heavy-suite).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
10
12
 
11
13
  ## How it is checked
12
14
 
13
- Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the rule](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
15
+ Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
@@ -2,22 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Integration tests are the thin layer of the pyramid, not its bulk: many unit tests at the base, few component tests in the middle, a thin smoke layer on top. Inverting the pyramid — leaning on slow, broad integration tests to catch what unit tests should — is forbidden.
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
6
6
 
7
- Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
8
-
9
- ## Spirit
7
+ **Verdict.** Merges into [Tested where it's owned](../rules.md#tested-where-its-owned).
10
8
 
11
- **What the friction is for.** Broad tests are slow and say little about where a fault is. The friction keeps most tests small and fast, so the suite runs often and failures point at one unit.
9
+ **Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Integration test suffix](../typescript/recipes.md#integration-test-suffix).
12
10
 
13
- **What a finding points at.** Match the suite against these causes.
14
- - *Units that cannot be tested alone.* Integration tests carry the load because units take no injected dependencies. Inject them; unit tests follow.
15
- - *Logic tested through the system.* Business rules are checked end to end. Move each rule's cases to the unit that owns it.
16
-
17
- **Where to go.** Many unit tests, few component tests, a thin smoke layer.
11
+ Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
18
12
 
19
- **Reactions to distrust.**
20
- - "Integration tests catch real bugs." They catch wiring bugs. Logic bugs belong to unit tests that run in milliseconds.
13
+ ## Spirit
21
14
 
22
- **Principles behind it.**
23
- - *The test pyramid* (Mike Cohn). Many fast unit tests at the base, fewer broader tests above.
15
+ Start from the symptom a finding names: [Integration-heavy suite](../typescript/symptoms.md#integration-heavy-suite). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
@@ -1,6 +1,8 @@
1
1
  # CD-3 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Symptom: [Strictness weakened](../typescript/symptoms.md#strictness-weakened).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -2,25 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Every unit compiles under one shared, maximally-strict compiler configuration; no unit weakens it locally. A relaxed flag in one corner (disabling strictness, unchecked indexing, exact-optional handling, catch-variable typing) creates a zone where the type system quietly stops protecting you, and that zone spreads. Strictness is inherited, never overridden.
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
6
6
 
7
- Review lens: [type-soundness](../../methods/lenses/type-soundness.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
8
-
9
- ## Spirit
7
+ **Verdict.** Cases: strictest checker setting.
10
8
 
11
- **What the friction is for.** Every relaxed compiler flag is a zone where the types quietly stop protecting you. The friction keeps one strict standard everywhere, so no corner of the codebase becomes the place errors hide.
9
+ **Read.** Sets how strictly the checker works ([cases](../cases.md#the-type-checker-proves-it)) and [Shared strict base config](../typescript/recipes.md#shared-strict-base-config).
12
10
 
13
- **What a finding points at.** Match the configs against these causes.
14
- - *Errors switched off instead of fixed.* A flag was relaxed because turning it on produced many errors. Those errors are the real finding; fix them by area.
15
- - *A package that was never brought up to standard.* Legacy or imported code was given its own looser config. Raise it, starting with the flag that hides the most.
16
- - *Types wrong at a boundary.* Indexed or optional access errors cluster around outside data. Parse that data into exact types at the boundary.
17
-
18
- **Where to go.** Every unit inherits the one strict configuration and overrides nothing.
11
+ Review lens: [type-soundness](../../methods/lenses/type-soundness.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
19
12
 
20
- **Reactions to distrust.**
21
- - "This flag is too strict for our code." It reports the cases your code does not handle. Handle them.
22
- - "Just for this package." A relaxed corner spreads: code moves, and the looser rules move with it.
13
+ ## Spirit
23
14
 
24
- **Principles behind it.**
25
- - *Broken windows* (Andrew Hunt and David Thomas, *The Pragmatic Programmer*). One tolerated lapse signals that lapses are acceptable, and more follow.
26
- - *Fail fast.* A strict compiler reports the defect when it is written, not when it runs.
15
+ Start from the symptom a finding names: [Strictness weakened](../typescript/symptoms.md#strictness-weakened). Each symptom names the cases it may indicate and the rules they point at. The why is on [The type checker proves it](../principles.md#the-type-checker-proves-it).
@@ -1,6 +1,8 @@
1
1
  # CD-30 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Symptom: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
10
12
 
11
13
  ## How it is checked
12
14
 
13
- Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the rule](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
15
+ Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
@@ -2,23 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- An integration test exists to catch composition bugs — wiring, contracts between units — not unit-level logic bugs. If an integration test is the first thing to fail on a logic error, the missing test is a unit test; add it at the base rather than diagnosing through the composed system.
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
6
6
 
7
- Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
8
-
9
- ## Spirit
7
+ **Verdict.** Merges into [Tested where it's owned](../rules.md#tested-where-its-owned).
10
8
 
11
- **What the friction is for.** An integration test that finds a logic bug is doing a unit test's job slowly and vaguely. The friction keeps integration tests on wiring, so each layer catches what it is best at.
9
+ **Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Integration test suffix](../typescript/recipes.md#integration-test-suffix).
12
10
 
13
- **What a finding points at.** Match the tests against these causes.
14
- - *A missing unit test.* A logic bug surfaced first in integration. Add the unit test at the base.
15
- - *Integration tests asserting logic.* The test checks calculations, not connections. Move those cases down.
16
-
17
- **Where to go.** Integration tests check that units connect correctly. Unit tests check what each unit computes.
11
+ Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
18
12
 
19
- **Reactions to distrust.**
20
- - "It's more realistic." Realism costs speed and precision. Spend it on wiring only.
13
+ ## Spirit
21
14
 
22
- **Principles behind it.**
23
- - *The test pyramid* (Mike Cohn). Each layer has a job; broad tests are few because they localise faults poorly.
24
- - *Defect localisation.* A failing test should point at the fault. A logic failure in an integration test points at the whole system.
15
+ Start from the symptom a finding names: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
@@ -1,6 +1,8 @@
1
1
  # CD-31 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Symptom: [Coverage gate](../typescript/symptoms.md#coverage-gate).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
10
12
 
11
13
  ## How it is checked
12
14
 
13
- Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the rule](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
15
+ Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
@@ -2,22 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Coverage is a diagnostic to read, not a gate to pass. A percentage threshold rewards tests written to move a number; the real floor is the every-file test sibling. Chasing a coverage figure produces assertion-free tests that raise the metric and protect nothing.
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
6
6
 
7
- Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
8
-
9
- ## Spirit
7
+ **Verdict.** Check of [Tested where it's owned](../rules.md#tested-where-its-owned).
10
8
 
11
- **What the friction is for.** A coverage target rewards running code, not checking it. Without the target, nothing rewards a test that moves the number and checks nothing. The floor comes from every unit having its own test, and coverage stays something to read.
9
+ **Read.** [Tested where it's owned](../rules.md#tested-where-its-owned).
12
10
 
13
- **What a finding points at.** Match the configuration against these causes.
14
- - *A number standing in for a floor.* The threshold exists because nothing guaranteed every unit a test. The every-file sibling rule is that floor.
15
- - *Tests written to move the number.* Tests with no real assertions appear. Remove them; read coverage as a diagnostic.
16
-
17
- **Where to go.** Coverage is read to find untested behaviour, never gated.
11
+ Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
18
12
 
19
- **Reactions to distrust.**
20
- - "Without a target, coverage will drop." The sibling rule holds the floor; the number is for reading.
13
+ ## Spirit
21
14
 
22
- **Principles behind it.**
23
- - *Goodhart's law*, in Marilyn Strathern's phrasing: "When a measure becomes a target, it ceases to be a good measure."
15
+ Start from the symptom a finding names: [Coverage gate](../typescript/symptoms.md#coverage-gate). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
@@ -1,6 +1,8 @@
1
1
  # CD-32 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Outside the cases: no symptom. [Every CD](../numbers.md) says where each number went.
4
+
5
+ Read [the rule and its spirit](README.md) first; the [named pages](../README.md) govern where they differ. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Rule
4
4
 
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) says where each number went.
6
+
5
7
  Structured logs redact personally-identifying data by default; a field becomes loggable only by explicitly opting in as safe. Redaction is the default so a new field is never accidentally leaked into logs — safety is the resting state, exposure the deliberate exception.
6
8
 
7
9
  Review lens: [clean-architecture](../../methods/lenses/clean-architecture.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
@@ -1,6 +1,8 @@
1
1
  # CD-33 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Outside the cases: no symptom. [Every CD](../numbers.md) says where each number went.
4
+
5
+ Read [the rule and its spirit](README.md) first; the [named pages](../README.md) govern where they differ. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Rule
4
4
 
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) says where each number went.
6
+
5
7
  A value whose type is branded sensitive redacts unconditionally wherever it surfaces — logs, errors, serialisation — with no opt-out. Branding sensitivity into the type means the redaction travels with the value by construction, rather than depending on every call site remembering to hide it.
6
8
 
7
9
  Review lens: [clean-architecture](../../methods/lenses/clean-architecture.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
@@ -1,6 +1,8 @@
1
1
  # CD-34 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Outside the cases: no symptom. [Every CD](../numbers.md) says where each number went.
4
+
5
+ Read [the rule and its spirit](README.md) first; the [named pages](../README.md) govern where they differ. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Rule
4
4
 
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) says where each number went.
6
+
5
7
  Secrets live only in the environment or a secrets manager — never in source, never in logs, never in URL query parameters. A committed secret is compromised the moment it lands in history, whatever happens to it later; the repository is not a place a secret can safely exist.
6
8
 
7
9
  Review lens: [clean-architecture](../../methods/lenses/clean-architecture.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
@@ -1,6 +1,8 @@
1
1
  # CD-39 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Outside the cases: no symptom. [Every CD](../numbers.md) says where each number went.
4
+
5
+ Read [the rule and its spirit](README.md) first; the [named pages](../README.md) govern where they differ. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Rule
4
4
 
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ. Rules are referred to by name; a clause address is still how a check is cited today, as [Every CD](../numbers.md) says.
6
+
5
7
  Reviews and rationale cite specific rules by their identifier, not vague appeals to "the standards". A citation anchors a finding to the named rule and its intent, so remediation is precise and the disagreement, if any, is about the rule rather than about taste.
6
8
 
7
9
  Review lens: none. A reviewer applies the rule text directly. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
@@ -1,6 +1,8 @@
1
1
  # CD-4 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
3
+ Recipe: [Zod at the producer's adapter](../typescript/recipes.md#zod-at-the-producers-adapter). The outcome it protects is seen by [Schema past its adapter](../typescript/symptoms.md#schema-past-its-adapter).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
10
12
 
11
13
  ## How it is checked
12
14
 
13
- Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the rule](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
15
+ Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
@@ -2,25 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Every crossing from the untyped outside world — HTTP, environment, files, database rows, inter-process input — is validated by a schema at the seam and handed inward as plain typed data. The boundary is the one place the program does not yet know the shape of its input; parse it there, once, so everything deeper can trust its types.
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
6
6
 
7
- Review lens: [zod-boundary](../../methods/lenses/zod-boundary.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
8
-
9
- ## Spirit
7
+ **Verdict.** Recipe for the No leak case: [Zod at the producer's adapter](../typescript/recipes.md#zod-at-the-producers-adapter).
10
8
 
11
- **What the friction is for.** The boundary is the one place the program does not know the shape of what it receives. The friction makes checking it there the easy path, so everything inside can trust its types.
9
+ **Read.** [Zod at the producer's adapter](../typescript/recipes.md#zod-at-the-producers-adapter) and Reads data from outside ([cases](../cases.md#no-leak-across-a-boundary)).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Input trusted on arrival.* A request, file, environment value, or database row is used as if typed. Parse it with a schema at the seam.
15
- - *No clear seam.* Outside data enters in many places. Gather each source behind one adapter that parses it.
16
- - *Checks scattered inward.* Inner code tests fields for presence. That means nothing parsed at the edge; move the check there.
17
-
18
- **Where to go.** Every outside source has one seam that parses it into plain typed data. Nothing inside checks shape again.
11
+ Review lens: [zod-boundary](../../methods/lenses/zod-boundary.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
19
12
 
20
- **Reactions to distrust.**
21
- - "It's our own database." It is still outside the type system. Rows can be anything the schema has ever allowed.
22
- - "The client already validates." The server cannot rely on code it does not run.
13
+ ## Spirit
23
14
 
24
- **Principles behind it.**
25
- - *Parse, don't validate* (Alexis King). Parsing produces a typed value once; validation leaves the raw value to be checked again.
26
- - *Ports and adapters* (Alistair Cockburn, hexagonal architecture). Each outside system enters through one adapter, which is where its data is translated.
15
+ Start from the symptom a finding names: [Schema past its adapter](../typescript/symptoms.md#schema-past-its-adapter). Each symptom names the cases it may indicate and the rules they point at. The why is on [No leak across a boundary](../principles.md#no-leak-across-a-boundary).
@@ -1,6 +1,8 @@
1
1
  # CD-40 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
3
+ Symptom: [Positional parameters](../typescript/symptoms.md#positional-parameters).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -2,28 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- A function takes a single named-field object argument rather than a positional parameter list, so every call site reads as a labelled contract instead of a sequence of unlabelled values whose meaning depends on order. Named fields also make adding or reordering parameters a safe, non-breaking change.
5
+ This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
6
6
 
7
- Review lens: [function-first](../../methods/lenses/function-first.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
8
-
9
- ## Spirit
7
+ **Verdict.** Cases of One word everywhere, Handed what it uses.
10
8
 
11
- **What the friction is for.** Positional arguments make meaning depend on order, and nothing checks the order. The friction makes a labelled call the easy one, and turns what each function needs into a named shape a reader can see.
9
+ **Read.** [One word everywhere](../rules.md#one-word-everywhere), [Handed what it uses](../rules.md#handed-what-it-uses) and [One argument object](../typescript/recipes.md#one-argument-object).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Values that travel together without a name.* The same group of arguments passes through several functions. Name the group as one type.
15
- - *A function with several jobs.* It has many parameters because it serves many concerns. Split it.
16
- - *Flags steering behaviour.* An argument switches between modes. Split the function, or make the mode a named union.
17
- - *Asking for more than it uses.* Converting to one object invites passing a whole record. Take only the fields the function reads; tests then build only those.
18
-
19
- **Where to go.** Every function takes one object whose fields are named and minimal. Adding a field breaks no caller.
11
+ Review lens: [function-first](../../methods/lenses/function-first.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
20
12
 
21
- **Reactions to distrust.**
22
- - "Two parameters is fine." The rule asks for one named object. Two positional values already have an order to get wrong.
23
- - "The library dictates this callback." Then the callback is the boundary. Hand off to a single-object function on its first line.
24
- - "An object is more typing." It is a few characters at the call site, against every reader guessing the order.
13
+ ## Spirit
25
14
 
26
- **Principles behind it.**
27
- - *Function arguments* (Robert C. Martin, *Clean Code*). Each extra argument is something the reader must hold in mind and the caller can get wrong.
28
- - *Introduce Parameter Object* (Martin Fowler, *Refactoring*). The refactoring that names a group of values that travel together.
29
- - *Interface Segregation Principle* (Robert C. Martin, SOLID). The object asks for exactly the fields used, no more.
15
+ Start from the symptom a finding names: [Positional parameters](../typescript/symptoms.md#positional-parameters). Each symptom names the cases it may indicate and the rules they point at. The why is on [Our code reads in the common language](../principles.md#our-code-reads-in-the-common-language) and [One place decides](../principles.md#one-place-decides).