@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
@@ -2,29 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Iteration is a transformation, expressed with `map`, `reduce`, `flatMap`, `filter`, or `Array.from` — so it reads as data flowing through a pipeline rather than as mutable imperative stepping. Pure side-effect iteration (logging, registering listeners) uses `forEach` with a callback that returns void. The two imperative shapes this rule replaces are element iteration (`for…of`) and counted iteration (`for (let i = 0; …; i++)`): the first becomes a functional traversal, and the second becomes `Array.from({ length }, mapper)` where the index is derived from position rather than incremented by a manual counter that can drift out of bounds.
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
- **Async stream consumption is iteration this rule does not reach.** Draining an `AsyncIterable` — pulling `await iterator.next()` until exhaustion, or the `for await…of` that desugars to it — is permitted at sites declared as authorised locations for CD-15. The functional forms cannot express it: `map`/`reduce`/`flatMap` over an `AsyncIterable` require materialising the whole stream, which destroys the bounded-residency property that streaming exists to provide. This is a structural fact about the language, not debt — a drain loop at a declared site is fully compliant, carries no paydown obligation, and takes an authorised-location entry, never a carve-out. Everything the rule does reach still binds inside such a loop: the body is a transformation, accumulator updates are whole-value replacements rather than in-place mutation, and synchronous iteration over materialised collections stays functional.
7
+ **Verdict.** Cases of [No hidden effects](../principles.md#no-hidden-effects).
8
+
9
+ **Read.** [No hidden effects](../principles.md#no-hidden-effects), Makes a new value from what it has ([cases](../cases.md#no-hidden-effects)) and [Functional iteration](../typescript/recipes.md#functional-iteration).
8
10
 
9
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).
10
12
 
11
13
  ## Spirit
12
14
 
13
- **What the friction is for.** A loop says how to step; a transformation says what is produced. The friction makes naming the transformation the easy path, and removes counters that drift and accumulators changed in place.
14
-
15
- **What a finding points at.** Match the sites against these causes.
16
- - *A transformation hidden in control flow.* The body builds one result from each element. Express it as a map, filter or reduce.
17
- - *Several jobs in one pass.* One loop filters, reshapes and records. Split it into named steps.
18
- - *Effects mixed with computation.* The loop computes and writes at once. Compute the result first, then perform the effects at the edge.
19
- - *A stream being drained.* Consuming an async stream is a limit of the language, not debt. Record the site as an authorised location; it is fully compliant.
20
-
21
- **Where to go.** Iteration reads as data flowing through named transformations, with effects at the end.
22
-
23
- **Reactions to distrust.**
24
- - "Loops are faster." Usually unmeasured, and the rule makes no performance carve-out. Measure before arguing it.
25
- - "It's just tests." A loop in a test is several cases in one. Use one parameterised test over the rows (CD-27).
26
- - "A loop is clearer here." Clearer to the writer, who knows what it builds. Name what it builds.
27
-
28
- **Principles behind it.**
29
- - *Replace Loop with Pipeline* (Martin Fowler, *Refactoring*, second edition). A collection pipeline names each step of the processing.
30
- - *Functional core, imperative shell* (Gary Bernhardt). The transformation is pure; effects run at the edge on its result.
15
+ Start from the symptom a finding names: [Loop keyword](../typescript/symptoms.md#loop-keyword). Each symptom names the cases it may indicate and the rules they point at. The why is on [No hidden effects](../principles.md#no-hidden-effects).
@@ -1,6 +1,8 @@
1
1
  # CD-16 checks
2
2
 
3
- Read [the rule and its spirit](README.md) first. This page is the mechanics.
3
+ Symptom: [Loop keyword](../typescript/symptoms.md#loop-keyword).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics.
4
6
 
5
7
  ## How it is checked
6
8
 
@@ -2,14 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Collapsed into [CD-15](../CD-15/README.md) — counted-loop iteration and
6
- element iteration are two faces of the same intent (iteration is functional
7
- transformation, not imperative looping). CD-15 now carries both. This id is
8
- retained as a redirect so existing citations resolve; it is not independently
9
- enforced.
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
+
7
+ **Verdict.** Merges with CD-15.
8
+
9
+ **Read.** [No hidden effects](../principles.md#no-hidden-effects) and [Functional iteration](../typescript/recipes.md#functional-iteration).
10
10
 
11
11
  Review lens: [function-first](../../methods/lenses/function-first.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).
12
12
 
13
13
  ## Spirit
14
14
 
15
- See [CD-15's Spirit section](../CD-15/README.md#spirit). A counted loop is the same signal as any other loop, plus a manual index that can drift out of bounds.
15
+ Start from the symptom a finding names: [Loop keyword](../typescript/symptoms.md#loop-keyword). Each symptom names the cases it may indicate and the rules they point at. The why is on [No hidden effects](../principles.md#no-hidden-effects).
@@ -1,6 +1,8 @@
1
1
  # CD-17 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: [Date used directly](../typescript/symptoms.md#date-used-directly).
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,27 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Time is an injected capability, not an ambient global: domain code never calls the runtime's now-primitives directly, it reads the current instant through a clock port. Real time enters through exactly one clock abstraction; tests inject a fake clock and advance it deterministically. Bare time construction anywhere else makes behaviour impossible to replace with a test double, and non-deterministic.
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: [di-discipline](../../methods/lenses/di-discipline.md), [test-discipline](../../methods/lenses/test-discipline.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 under Handed what it uses and One reason per module.
10
8
 
11
- **What the friction is for.** Code that reads the time itself behaves differently depending on when it runs. The friction makes time an input, so logic is deterministic and tests can set and advance time on demand.
9
+ **Read.** [Handed what it uses](../rules.md#handed-what-it-uses), [One reason per module](../rules.md#one-reason-per-module), Needs the current time, a random value, a new id or an outside ordering ([cases](../cases.md#external-behaviour-sits-at-a-boundary)) and [World values through a port](../typescript/recipes.md#world-values-through-a-port).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Decisions that read the clock.* Business logic asks for the current time in the middle of a calculation. Pass the instant in, or inject the clock.
15
- - *Time stamped in many places.* Many sites stamp records or events. One clock port at the edge; the instant travels inward as data.
16
- - *Tests that wait or depend on wall time.* Flaky or slow tests point at a missing clock port. Inject a fake clock and advance it.
17
- - *Tests that build their own instants.* A test making dates for itself is choosing time outside the clock. Take instants from the fake clock.
18
-
19
- **Where to go.** One clock abstraction reads real time. Everything else receives an instant or the clock. Tests set the time they need.
11
+ Review lens: [di-discipline](../../methods/lenses/di-discipline.md), [test-discipline](../../methods/lenses/test-discipline.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
- - "It's just a log timestamp." It is still output nobody can pin in a test. Read it through the clock.
23
- - "It's just tests." The rule covers tests. A test that reads real time cannot be repeated exactly.
24
- - "Exclude that folder." Then that folder's behaviour depends on the hour it runs. Find the clock port it is missing.
13
+ ## Spirit
25
14
 
26
- **Principles behind it.**
27
- - *Dependency Inversion Principle* (Robert C. Martin, SOLID). Time is a detail; the logic depends on a clock abstraction it is given.
28
- - *Functional core, imperative shell* (Gary Bernhardt). Reading the clock is an effect at the shell. The core receives the instant as a value and stays pure.
15
+ Start from the symptom a finding names: [Date used directly](../typescript/symptoms.md#date-used-directly). Each symptom names the cases it may indicate and the rules they point at. The why is on [External behaviour sits at a boundary](../principles.md#external-behaviour-sits-at-a-boundary), [One place decides](../principles.md#one-place-decides) and [Tests are ours](../principles.md#tests-are-ours).
@@ -1,6 +1,8 @@
1
1
  # CD-18 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: [Process global used in place](../typescript/symptoms.md#process-global-used-in-place).
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
- Process-lifecycle side effects — signal handlers, exit, kill, high-resolution timing — are a capability that arrives through an injected port, not reached for ambiently on the runtime's process global. Confining them behind a port makes lifecycle behaviour composable and replaceable with a test double in tests, instead of a hidden dependency on the running process.
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: [di-discipline](../../methods/lenses/di-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.** Cases under [Ports declared inside](../rules.md#ports-declared-inside).
10
8
 
11
- **What the friction is for.** Exiting, handling signals and reading process timers are side effects on the running program. The friction makes them a port the code receives, so lifecycle behaviour can be composed and tested.
9
+ **Read.** [Ports declared inside](../rules.md#ports-declared-inside) and [World values through a port](../typescript/recipes.md#world-values-through-a-port).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Exit called deep inside.* A function ends the process instead of returning. Return the outcome; let the entry point decide to exit.
15
- - *Signal handling scattered.* Several modules register handlers. Gather lifecycle in one port wired at startup.
16
- - *Timing read from the process.* Code measures time through the process global. Inject it.
17
-
18
- **Where to go.** Lifecycle operations arrive through one injected port. Only the composition root touches the real process.
11
+ Review lens: [di-discipline](../../methods/lenses/di-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
- - "It's a CLI, exit is normal." Exit at the entry point. Everywhere else, return.
13
+ ## Spirit
22
14
 
23
- **Principles behind it.**
24
- - *Dependency Inversion Principle* (Robert C. Martin, SOLID). Code depends on a lifecycle abstraction, not the runtime global.
25
- - *Functional core, imperative shell* (Gary Bernhardt). The decision to stop is a value; stopping happens at the shell.
15
+ Start from the symptom a finding names: [Process global used in place](../typescript/symptoms.md#process-global-used-in-place). Each symptom names the cases it may indicate and the rules they point at. The why is on [External behaviour sits at a boundary](../principles.md#external-behaviour-sits-at-a-boundary).
@@ -1,6 +1,8 @@
1
1
  # CD-19 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: [Outside import past a boundary](../typescript/symptoms.md#outside-import-past-a-boundary).
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
 
@@ -15,7 +17,7 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: wha
15
17
  - The source rule covers every third-party dependency; the check covers only the listed packages. The rest is left to review.
16
18
 
17
19
  ## Settings
18
- List each package the repository confines behind a wrapping port in `disciplines.json`, then record each wrapping file as an `authorised-location`:
20
+ List each outside dependency the repository confines to its adapter in `disciplines.json`, then record each adapter file as an `authorised-location`:
19
21
 
20
22
  ```json
21
23
  "clauseSettings": {
@@ -32,13 +34,13 @@ import { v4 } from "uuid";
32
34
 
33
35
  ## How to fix
34
36
  ```ts
35
- import { createFileReader } from "./file-reader.ts";
36
- import { createIdGenerator } from "./id-generator.ts";
37
+ import type { FileReader } from "./file-reader.ts";
38
+ import type { IdGenerator } from "./id-generator.ts";
37
39
  ```
38
- Import your own port. Only the wrapping file imports the library.
40
+ Import your own port and take it in the unit's argument. Only the adapter for that outside party imports the library.
39
41
 
40
42
  ## Exceptions
41
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the wrapping boundary for that dependency. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
43
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the adapter for that outside dependency. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
42
44
 
43
45
  ```json
44
46
  { "version": 1, "exceptions": [
@@ -2,28 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Every dependency on code the project does not own — a third-party library or the runtime's own standard library alike — is confined to a single wrapping port at the boundary; the rest of the codebase depends on that port, never the vendor or platform surface, runtime or type-only. A dependency swap then touches one file, the vendor's types never leak inward, and each confined capability is nameable and replaceable with a test double. There is no inline carve-out: a stdlib call in the middle of business logic is as much a violation as a scattered library import. Opening a new wrapping site for a new dependency is a deliberate, recorded decision.
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.** Splits: Outside dependencies stay at boundaries; Ports declared inside; construction and ids cases.
10
8
 
11
- **What the friction is for.** Depending on code you do not own hands that code a say in the shape of yours. The friction makes depending on your own port the easy path, so a swap touches one file, vendor types stay out, and every capability has a name and a test double.
9
+ **Read.** [Outside dependencies stay at boundaries](../rules.md#outside-dependencies-stay-at-boundaries), [Ports declared inside](../rules.md#ports-declared-inside), Builds the real implementations ([cases](../cases.md#one-place-decides)), Needs the current time, a random value, a new id or an outside ordering ([cases](../cases.md#external-behaviour-sits-at-a-boundary)), [World values through a port](../typescript/recipes.md#world-values-through-a-port) and [Adapter per outside party](../typescript/recipes.md#adapter-per-outside-party).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *A capability with no name.* Many files import the same library or runtime module. Name the capability, wrap it once, inject it.
15
- - *A port that leaks.* A wrapper exists but passes vendor types or objects through, so callers import the vendor anyway. Make the port speak your types.
16
- - *Decisions doing I/O.* A runtime call sits in the middle of business logic. Separate the decision from the effect; the effect arrives through a port.
17
- - *Construction spread everywhere.* Each module builds its own dependencies. Move construction to one composition root that passes ports in.
18
-
19
- **Where to go.** Each external capability has one wrapping file, recorded as its authorised location. Everything else imports your port. Opening a new wrapper is a recorded decision, not an inline one.
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
- - "It's only the standard library." The same reasons apply: it cannot be replaced in a test and it ties logic to a platform. The rule makes no stdlib carve-out.
23
- - "Wrapping is boilerplate." One small file per capability, against the whole codebase knowing a vendor's surface.
24
- - "Exclude that folder." An excluded folder is a boundary nobody designed. Design it, then authorise the one file.
13
+ ## Spirit
25
14
 
26
- **Principles behind it.**
27
- - *Dependency Inversion Principle* (Robert C. Martin, SOLID). Your code depends on an abstraction you own; the vendor detail depends on it, not the other way round.
28
- - *Ports and adapters* (Alistair Cockburn, hexagonal architecture). The application talks through ports; one adapter per outside system translates. Swapping the system means swapping the adapter.
29
- - *Functional core, imperative shell* (Gary Bernhardt). Decisions stay pure; effects live at the edge and arrive through ports.
15
+ Start from the symptom a finding names: [Outside import past a boundary](../typescript/symptoms.md#outside-import-past-a-boundary) and [Outside type in a signature](../typescript/symptoms.md#outside-type-in-a-signature). Each symptom names the cases it may indicate and the rules they point at. The why is on [External behaviour sits at a boundary](../principles.md#external-behaviour-sits-at-a-boundary).
@@ -1,6 +1,8 @@
1
1
  # CD-2 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: [Claimed type](../typescript/symptoms.md#claimed-type).
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
 
@@ -36,9 +38,11 @@ const name = user.name!;
36
38
  ## How to fix
37
39
  ```ts
38
40
  const user = userSchema.parse(response);
39
- const name = user.name ?? "anonymous";
41
+ const name = user.name;
40
42
  ```
41
- Parse or narrow the value so the type follows from a check rather than from an assertion. For a value that may be absent, handle the absent case with a check, a fallback or an early return; for a binding assigned later, initialise it where it is declared or make it a `const` built from what it needs.
43
+ Parse or narrow the value so the type follows from a check rather than from an assertion. For a value that may be absent, handle the absent case with a check or an early return; for a binding assigned later, initialise it where it is declared or make it a `const` built from what it needs.
44
+
45
+ In a test file, `CD-27#test-body-logic` flags an `if` check at either edition, and its edition 2 flags the `??` fallback: there, `assert.isDefined` a value that may be missing before reading it, as [CD-27's allowed forms](../CD-27/CHECKS.md#a-short-circuit) show.
42
46
 
43
47
  When handing a value across a boundary truly forces a cast, such as a library that types its schemas loosely or a database driver that returns unparsed rows, put the cast in the one adapter file at that boundary and record that file as an `authorised-location` with a why-chain. With clean boundaries that is one file and one record; casts scattered across many files are the sign the boundary is missing.
44
48
 
@@ -2,29 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- A type assertion tells the compiler the value is something the compiler cannot see — it is a claim the type system can no longer check. Casting is therefore permitted only at a closed, enumerated list of sites where an external boundary genuinely forces it, each one an exception record for the file at that boundary. Everywhere else a cast is a design smell: the type is wrong, so fix the type rather than assert over it. Adding a site to the permitted list is a deliberate, recorded amendment, not an inline decision.
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.** Keeps: [Declared, not asserted](../rules.md#declared-not-asserted).
10
8
 
11
- **What the friction is for.** A cast is a claim the compiler cannot check. The friction makes the honest route, parsing the value or fixing its type, the easy one. The few claims that remain are visible and sit in known places.
9
+ **Read.** [Declared, not asserted](../rules.md#declared-not-asserted) and [Fix the declaration, not the value](../typescript/recipes.md#fix-the-declaration-not-the-value).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Parsing skipped at a boundary.* Raw input is asserted into shape instead of checked. Parse it once where it enters and the type follows.
15
- - *A declared type that is wrong.* The code builds something its type does not describe. Fix the declaration and the cast goes.
16
- - *A boundary that is missing.* Casts cluster around one library or data source across many files. Make one wrapping file the boundary and keep the rest cast-free.
17
- - *A return type wider than its use.* A function returns a broad type and every caller narrows it. Return the narrow type.
18
- - *A parameter type wider than its use.* A function asks for a whole record but reads two fields. It shows in tests, where someone casts a two-field object through to the full type rather than build it all. The function asks for more than it needs. Accept only the fields it uses; the test then builds those two fields honestly.
19
-
20
- **Where to go.** Casts live only in a few named boundary files, each recorded as an authorised location. Clean boundaries make that cheap; that is what authorised locations are for. Everywhere else the type follows from a check.
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).
21
12
 
22
- **Reactions to distrust.**
23
- - "It's just tests." Tests are violations too. A test that casts is building a value its type does not allow. Either build it properly, or the unit asks for more than it uses.
24
- - "Add a permission for this shape." Measure first. A permission can hide a real defect, such as database rows that were never parsed.
25
- - "The library forces it." It forces one site. Put that site in the wrapping file.
13
+ ## Spirit
26
14
 
27
- **Principles behind it.**
28
- - *Parse, don't validate* (Alexis King). A parse produces the type; a cast only claims it. Parse once at the boundary and the claim is never needed.
29
- - *Interface Segregation Principle* (Robert C. Martin, SOLID). Depend only on what you use. A parameter that asks for exactly the fields it reads needs no cast to satisfy, in production or in tests.
30
- - *Ports and adapters* (Alistair Cockburn, hexagonal architecture). The adapter at the edge is where outside shapes are translated, so it is the one place an unavoidable assertion belongs.
15
+ Start from the symptom a finding names: [Claimed type](../typescript/symptoms.md#claimed-type). 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-20 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: [Outside import past a boundary](../typescript/symptoms.md#outside-import-past-a-boundary).
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
  ## How it is checked
6
8
 
@@ -2,14 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Collapsed into [CD-19](../CD-19/README.md) — confining the
6
- runtime's own standard library behind a wrapping port is the same intent as
7
- confining a third-party dependency (CD-20 was originally split out of CD-19). CD-19
8
- now covers both third-party and stdlib dependencies. This id is retained as a
9
- redirect so existing citations resolve; it is not independently enforced.
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
+
7
+ **Verdict.** Merges with CD-19.
8
+
9
+ **Read.** [Outside dependencies stay at boundaries](../rules.md#outside-dependencies-stay-at-boundaries), [Ports declared inside](../rules.md#ports-declared-inside) and [Adapter per outside party](../typescript/recipes.md#adapter-per-outside-party).
10
10
 
11
11
  Review lens: [di-discipline](../../methods/lenses/di-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).
12
12
 
13
13
  ## Spirit
14
14
 
15
- See [CD-19's Spirit section](../CD-19/README.md#spirit). A runtime standard-library import is the same signal as any other unwrapped dependency: a capability with no port.
15
+ Start from the symptom a finding names: [Outside import past a boundary](../typescript/symptoms.md#outside-import-past-a-boundary). Each symptom names the cases it may indicate and the rules they point at. The why is on [External behaviour sits at a boundary](../principles.md#external-behaviour-sits-at-a-boundary).
@@ -1,6 +1,8 @@
1
1
  # CD-21 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: [Composition root](../typescript/recipes.md#composition-root). The outcome it protects is seen by [Adapter built outside the root](../typescript/symptoms.md#adapter-built-outside-the-root).
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
- A port is not just an interface — it ships its own default production implementation, co-located in the same module. Wiring is then trivial and there is exactly one canonical construction site per capability; production wires the default, tests supply their own test doubles. A port with no default factory is an incomplete capability.
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: [di-discipline](../../methods/lenses/di-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.** Cases: built at the entry point.
10
8
 
11
- **What the friction is for.** A port with no default implementation leaves every caller to work out how to build one. The friction makes the production wiring sit beside the port, so there is one obvious way to construct each capability.
9
+ **Read.** Builds the real implementations ([cases](../cases.md#one-place-decides)) and [Composition root](../typescript/recipes.md#composition-root).
12
10
 
13
- **What a finding points at.** Match the ports against these causes.
14
- - *Construction scattered.* Several places build the real implementation differently. Move it into a default factory beside the port.
15
- - *A port invented only for tests.* It has test doubles but no real implementation. Either give it a default or question whether it is a port.
16
-
17
- **Where to go.** Each port's module exports its default production factory. Production wires the default; tests pass test doubles.
11
+ Review lens: [di-discipline](../../methods/lenses/di-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
- - "The composition root builds it." It still calls one canonical factory, not its own construction.
13
+ ## Spirit
21
14
 
22
- **Principles behind it.**
23
- - *Composition root.* All wiring happens in one place, from canonical factories.
24
- - *Dependency Inversion Principle* (Robert C. Martin, SOLID). Callers depend on the port; the default is one implementation of it.
15
+ Start from the symptom a finding names: [Adapter built outside the root](../typescript/symptoms.md#adapter-built-outside-the-root). Each symptom names the cases it may indicate and the rules they point at. The why is on [One place decides](../principles.md#one-place-decides).
@@ -1,6 +1,8 @@
1
1
  # CD-22 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: [Bounded context generic](../typescript/recipes.md#bounded-context-generic). The outcome it protects is seen by [Default for a required value](../typescript/symptoms.md#default-for-a-required-value).
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
- Middleware carries the context it consumes through a constrained generic that each layer widens, not an open property bag — so a capability the middleware reads from context (time, logging, correlation) is guaranteed present by the type rather than defensively re-checked or defaulted. A middleware that reads a context field but leaves its context generic unbounded is the violation.
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: [di-discipline](../../methods/lenses/di-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.** Recipe for [Declared, not asserted](../rules.md#declared-not-asserted).
10
8
 
11
- **What the friction is for.** Middleware that reads from an open property bag has to check whether what it needs is there. The friction makes the type guarantee it, so capabilities are present by construction.
9
+ **Read.** [Declared, not asserted](../rules.md#declared-not-asserted) and [Bounded context generic](../typescript/recipes.md#bounded-context-generic).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Context read defensively.* Middleware checks or defaults a field like the clock or logger. Constrain its context type so the field must exist.
15
- - *Layers that add capabilities untyped.* Earlier layers add fields the type never records. Widen the generic at each layer.
16
-
17
- **Where to go.** Each middleware declares the context it needs through a constrained generic. A missing capability is a compile error.
11
+ Review lens: [di-discipline](../../methods/lenses/di-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
- - "A default is safer." A default hides wiring mistakes until they matter.
13
+ ## Spirit
21
14
 
22
- **Principles behind it.**
23
- - *Make illegal states unrepresentable* (Yaron Minsky). A context type that requires the field cannot be built without it.
24
- - *Explicit dependencies.* A unit states what it needs in its signature, not by reaching into a shared bag.
15
+ Start from the symptom a finding names: [Default for a required value](../typescript/symptoms.md#default-for-a-required-value). 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-23 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: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test).
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
 
@@ -24,11 +26,11 @@ This is `src/price.ts` with no `src/price.test.ts` beside it.
24
26
  Add `src/price.test.ts` next to the file, with at least one test of its behaviour.
25
27
 
26
28
  ## Exceptions
27
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file only wires exports together and has no behaviour of its own to test. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
29
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. The form accepts an `authorised-location` for this clause, as for any; in spirit a unit that only wires has a test of its wiring, and a reviewer refuses one. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
28
30
 
29
31
  ```json
30
32
  { "version": 1, "exceptions": [
31
- { "kind": "authorised-location", "clause": "CD-23#export-test-sibling", "file": "src/index.ts", "reason": "..." }
33
+ { "kind": "file-carve-out", "clause": "CD-23#export-test-sibling", "file": "src/legacy/report.ts" }
32
34
  ] }
33
35
  ```
34
36
 
@@ -2,25 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Every source file ships a test sibling that sits beside it, sharing its name — there are no source files without a test, and no tests in a separate parallel tree. This is the real coverage floor: not a percentage, but the guarantee that every unit has at least one co-located test stating what it is for. Co-location makes the test the unit's visible contract and keeps the two changing together, where a parallel test tree lets them drift apart.
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. 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.** Keeps: [Tested where it's owned](../rules.md#tested-where-its-owned).
10
8
 
11
- **What the friction is for.** A unit nobody can test alone is a unit nobody understands alone. The friction makes "write the test beside it" part of writing the unit, so every unit has a stated purpose and the two change together.
9
+ **Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Companion test file](../typescript/recipes.md#companion-test-file).
12
10
 
13
- **What a finding points at.** Match the files against these causes.
14
- - *A unit too tangled to test.* The test was skipped because the unit reaches its dependencies directly. Inject them, and the unit can be tested alone.
15
- - *A file that is not a unit.* It holds loose pieces with no single purpose. Split it into units that each have one.
16
- - *Tests in a parallel tree.* The tests exist but live elsewhere and drift. Move each beside its unit.
17
- - *Tested only through something bigger.* The unit is covered only by an integration test. Give it its own.
18
-
19
- **Where to go.** Every unit has a sibling test that states what it is for, and the two are edited together.
11
+ Review lens: [test-discipline](../../methods/lenses/test-discipline.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
- - "It's covered by the integration tests." Covered is not specified. A failure there does not say which unit broke.
23
- - "It's too simple to test." Then the test is short. It still states the purpose.
13
+ ## Spirit
24
14
 
25
- **Principles behind it.**
26
- - *Listen to the tests* (Steve Freeman and Nat Pryce, *Growing Object-Oriented Software, Guided by Tests*). Difficulty testing a unit is feedback about its design.
15
+ Start from the symptom a finding names: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test). 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-24 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: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test).
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
  ## How it is checked
6
8
 
@@ -2,14 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Collapsed into [CD-23](../CD-23/README.md) — "every file is unit-tested"
6
- and "tests are co-located" are one intent: every unit has a co-located test
7
- sibling. The enforcing walker already computes them as a single check. CD-23 now
8
- carries both. This id is retained as a redirect so existing citations resolve; it
9
- is not independently enforced.
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
+
7
+ **Verdict.** Merges with CD-23.
8
+
9
+ **Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Companion test file](../typescript/recipes.md#companion-test-file).
10
10
 
11
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).
12
12
 
13
13
  ## Spirit
14
14
 
15
- See [CD-23's Spirit section](../CD-23/README.md#spirit). "Every file is unit-tested" and "tests are co-located" are one signal: a unit without its own stated purpose.
15
+ Start from the symptom a finding names: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test). 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-25 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: [Double with a body](../typescript/symptoms.md#double-with-a-body).
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
 
@@ -24,10 +26,10 @@ const clock = { now: vi.fn(() => 1) };
24
26
  ```ts
25
27
  const clock = { now: vi.fn().mockReturnValue(1) };
26
28
  ```
27
- Return a canned value: that double is a stub. If the double needs logic, the seam is probably too wide, or the double is a fake that belongs in a shared in-memory implementation of the port with its own tests.
29
+ Return a canned value: that double is a stub. If the double needs logic, the seam is probably too wide.
28
30
 
29
31
  ## Exceptions
30
- A double that legitimately needs behaviour is a fake: write it once as an in-memory implementation of the port, in its own module with its own tests, and pass it in. That is the home for the behaviour, not an exception for a test file. For debt in one file, add a `file-carve-out` entry to `discipline-exceptions.json` at the repository root: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
32
+ For debt in one file, add a `file-carve-out` entry to `discipline-exceptions.json` at the repository root: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
31
33
 
32
34
  ```json
33
35
  { "version": 1, "exceptions": [