@hailstails/hone 1.4.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 (121) hide show
  1. package/ADOPTING.md +8 -8
  2. package/CHANGELOG.md +14 -0
  3. package/MIGRATING.md +17 -0
  4. package/README.md +10 -10
  5. package/api/testing.js +2 -2
  6. package/chunks/{chunk-FEWCJU7H.js → chunk-2O46EB4E.js} +6 -0
  7. package/chunks/{chunk-6SM3HKWO.js → chunk-5U4VTFD5.js} +88 -51
  8. package/core/check/tool-command.js +379 -56
  9. package/core/mechanism-port/runner-result-types.d.ts +4 -0
  10. package/docs/adding-a-discipline-or-mechanism.md +2 -0
  11. package/docs/extending.md +1 -0
  12. package/docs/output-contract.md +17 -6
  13. package/mechanisms/audit/CD-27/test-body-logic.js +5 -2
  14. package/mechanisms/audit/runner/runner.js +5 -3
  15. package/mechanisms/eslint/runner/runner.js +7 -3
  16. package/methods/assessment-template.md +2 -2
  17. package/methods/lenses/clean-architecture.md +7 -8
  18. package/methods/lenses/defended-on-intent.md +2 -2
  19. package/methods/lenses/di-discipline.md +10 -13
  20. package/methods/lenses/function-first.md +16 -18
  21. package/package.json +1 -1
  22. package/rules/CD-1/CHECKS.md +4 -2
  23. package/rules/CD-1/README.md +6 -19
  24. package/rules/CD-10/CHECKS.md +5 -3
  25. package/rules/CD-10/README.md +6 -18
  26. package/rules/CD-11/CHECKS.md +4 -2
  27. package/rules/CD-11/README.md +6 -16
  28. package/rules/CD-12/CHECKS.md +4 -2
  29. package/rules/CD-12/README.md +6 -16
  30. package/rules/CD-13/CHECKS.md +4 -2
  31. package/rules/CD-13/README.md +6 -16
  32. package/rules/CD-14/CHECKS.md +3 -1
  33. package/rules/CD-14/README.md +6 -19
  34. package/rules/CD-15/CHECKS.md +3 -1
  35. package/rules/CD-15/README.md +5 -20
  36. package/rules/CD-16/CHECKS.md +3 -1
  37. package/rules/CD-16/README.md +6 -6
  38. package/rules/CD-17/CHECKS.md +3 -1
  39. package/rules/CD-17/README.md +6 -19
  40. package/rules/CD-18/CHECKS.md +4 -2
  41. package/rules/CD-18/README.md +6 -16
  42. package/rules/CD-19/CHECKS.md +8 -6
  43. package/rules/CD-19/README.md +6 -20
  44. package/rules/CD-2/CHECKS.md +5 -3
  45. package/rules/CD-2/README.md +6 -21
  46. package/rules/CD-20/CHECKS.md +3 -1
  47. package/rules/CD-20/README.md +6 -6
  48. package/rules/CD-21/CHECKS.md +4 -2
  49. package/rules/CD-21/README.md +6 -15
  50. package/rules/CD-22/CHECKS.md +4 -2
  51. package/rules/CD-22/README.md +6 -15
  52. package/rules/CD-23/CHECKS.md +5 -3
  53. package/rules/CD-23/README.md +6 -17
  54. package/rules/CD-24/CHECKS.md +3 -1
  55. package/rules/CD-24/README.md +6 -6
  56. package/rules/CD-25/CHECKS.md +3 -1
  57. package/rules/CD-25/README.md +5 -21
  58. package/rules/CD-26/CHECKS.md +5 -3
  59. package/rules/CD-26/README.md +6 -20
  60. package/rules/CD-27/CHECKS.md +16 -7
  61. package/rules/CD-27/README.md +6 -20
  62. package/rules/CD-28/CHECKS.md +4 -2
  63. package/rules/CD-28/README.md +6 -16
  64. package/rules/CD-29/CHECKS.md +4 -2
  65. package/rules/CD-29/README.md +6 -14
  66. package/rules/CD-3/CHECKS.md +3 -1
  67. package/rules/CD-3/README.md +6 -17
  68. package/rules/CD-30/CHECKS.md +4 -2
  69. package/rules/CD-30/README.md +6 -15
  70. package/rules/CD-31/CHECKS.md +4 -2
  71. package/rules/CD-31/README.md +6 -14
  72. package/rules/CD-32/CHECKS.md +3 -1
  73. package/rules/CD-32/README.md +2 -0
  74. package/rules/CD-33/CHECKS.md +3 -1
  75. package/rules/CD-33/README.md +2 -0
  76. package/rules/CD-34/CHECKS.md +3 -1
  77. package/rules/CD-34/README.md +2 -0
  78. package/rules/CD-39/CHECKS.md +3 -1
  79. package/rules/CD-39/README.md +2 -0
  80. package/rules/CD-4/CHECKS.md +4 -2
  81. package/rules/CD-4/README.md +6 -17
  82. package/rules/CD-40/CHECKS.md +3 -1
  83. package/rules/CD-40/README.md +6 -20
  84. package/rules/CD-41/CHECKS.md +4 -2
  85. package/rules/CD-41/README.md +6 -22
  86. package/rules/CD-42/CHECKS.md +3 -1
  87. package/rules/CD-42/README.md +6 -16
  88. package/rules/CD-43/CHECKS.md +3 -1
  89. package/rules/CD-43/README.md +6 -18
  90. package/rules/CD-44/CHECKS.md +3 -1
  91. package/rules/CD-44/README.md +6 -17
  92. package/rules/CD-45/CHECKS.md +4 -2
  93. package/rules/CD-45/README.md +6 -16
  94. package/rules/CD-46/CHECKS.md +3 -1
  95. package/rules/CD-46/README.md +2 -0
  96. package/rules/CD-47/CHECKS.md +4 -2
  97. package/rules/CD-47/README.md +4 -20
  98. package/rules/CD-5/CHECKS.md +4 -2
  99. package/rules/CD-5/README.md +6 -19
  100. package/rules/CD-6/CHECKS.md +3 -1
  101. package/rules/CD-6/README.md +6 -19
  102. package/rules/CD-7/CHECKS.md +3 -1
  103. package/rules/CD-7/README.md +6 -20
  104. package/rules/CD-7a/CHECKS.md +3 -1
  105. package/rules/CD-7a/README.md +6 -17
  106. package/rules/CD-8/CHECKS.md +3 -1
  107. package/rules/CD-8/README.md +6 -17
  108. package/rules/CD-9/CHECKS.md +4 -2
  109. package/rules/CD-9/README.md +6 -17
  110. package/rules/README.md +71 -54
  111. package/rules/SPIRIT.md +3 -3
  112. package/rules/cases.md +94 -0
  113. package/rules/numbers.md +155 -0
  114. package/rules/principles.md +89 -0
  115. package/rules/records.md +150 -0
  116. package/rules/rules.md +149 -0
  117. package/rules/sources.md +142 -0
  118. package/rules/typescript/checks.md +219 -0
  119. package/rules/typescript/recipes.md +361 -0
  120. package/rules/typescript/symptoms.json +1005 -0
  121. package/rules/typescript/symptoms.md +612 -0
@@ -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
 
@@ -2,30 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- A unit test replaces everything outside the unit under test with a test double, injected through the unit's own seam — no real I/O, no real collaborators. The test exercises exactly one unit's logic, with every dependency a controlled double, so a failure points at that unit and nowhere else.
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
- **Test doubles.** These rules use Gerard Meszaros's names from *xUnit Test Patterns*, and only in these senses. A *dummy* is passed but never used. A *stub* returns canned answers. A *spy* is a stub that also records how it was called, for the test to assert afterwards. A *mock* is set up with expectations and verifies them itself. A *fake* is a working, lightweight implementation, such as an in-memory repository. The doubles a unit test uses are dummies, stubs and spies, with their answers written out. A double that needs behaviour of its own is a finding about the unit's seam or its collaborator.
7
+ **Verdict.** Keeps: [Written-out answers](../rules.md#written-out-answers).
8
+
9
+ **Read.** [Written-out answers](../rules.md#written-out-answers) and [Stub with vi.fn](../typescript/recipes.md#stub-with-vifn).
8
10
 
9
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).
10
12
 
11
13
  ## Spirit
12
14
 
13
- **What the friction is for.** A unit test should fail for one reason: this unit is wrong. The friction makes a stub with a canned answer the easiest double to write, so a failure points at one place and the unit's seams stay narrow.
14
-
15
- **What a finding points at.** Match the sites against these causes.
16
- - *A seam wider than its use.* The double needs logic because the port does many things or takes rich input. Narrow the port, and its inputs, to what this unit uses; a stub then answers its one question.
17
- - *Behaviour hiding in a collaborator.* The double re-implements logic the unit relies on. That logic is a unit of its own with its own tests; a stub returns its result.
18
- - *Real I/O in a unit test.* Files, on-disk fixtures, network, the clock. A dependency was reached for, not injected. Inject a port and give the test a stub.
19
- - *An integration test with a unit suffix.* It wires several units over real backings. Move it to the integration layer, and keep that layer thin.
20
-
21
- **Where to go.** Unit tests give every collaborator a stub or spy with canned answers. On-disk fixtures are integration test tools: used at a bare minimum, only where the composition under test demands a real backing.
22
-
23
- **Reactions to distrust.**
24
- - "It's just tests." The test is the unit's first consumer. A collaborator that is hard to replace with a double is a design finding.
25
- - "The double must be realistic." Realism belongs in the few integration tests. A unit case needs one fixed answer.
26
- - "A fixture file is easier." Easier once. Each one ties the test to real I/O and to data the reader cannot see in the test.
27
-
28
- **Principles behind it.**
29
- - *Test doubles* (Gerard Meszaros, *xUnit Test Patterns*). Doubles come in kinds; the stub is the simplest double that answers, and a canned answer keeps the test about the unit rather than about the double.
30
- - *Interface Segregation Principle* (Robert C. Martin, SOLID). A port shaped to one consumer's needs is trivial to stub; a stub that needs logic is reporting a port that serves too many needs.
31
- - *The test pyramid* (Mike Cohn). Many fast isolated unit tests, few integration tests. Real backings and fixtures belong to the thin upper layer.
15
+ Start from the symptom a finding names: [Double with a body](../typescript/symptoms.md#double-with-a-body). 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-26 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: [Module or global patched](../typescript/symptoms.md#module-or-global-patched).
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
 
@@ -25,11 +27,11 @@ const subject = createSubject({ store: storeStub });
25
27
  Pass the collaborator in as a dependency and hand the test a stub.
26
28
 
27
29
  ## Exceptions
28
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs to intercept a module. 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).
30
+ 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 [Module or global patched](../typescript/symptoms.md#module-or-global-patched) has no correct use, and a reviewer refuses one. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
29
31
 
30
32
  ```json
31
33
  { "version": 1, "exceptions": [
32
- { "kind": "authorised-location", "clause": "CD-26#module-mocking", "file": "src/legacy/payments.test.ts", "reason": "..." }
34
+ { "kind": "file-carve-out", "clause": "CD-26#module-mocking", "file": "src/legacy/payments.test.ts" }
33
35
  ] }
34
36
  ```
35
37
 
@@ -2,28 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Test doubles are supplied through the unit's own injected dependencies, never by intercepting the module system. A module-mock, the test runner's name for replacing a module through the module system and not a mock in [the test-double sense](../CD-25/README.md#rule), is a signal that the dependency injection is wrong: if a unit reaches for a collaborator the test cannot substitute through the signature, the collaborator should have been a port. Fix the seam, don't mock the module.
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.** Symptom of Written-out answers, Ports declared inside.
10
8
 
11
- **What the friction is for.** If a test can only control a dependency by intercepting imports, production cannot swap it either. The friction makes passing the collaborator in the easy route, so the unit is the same code under test and in production.
9
+ **Read.** [Written-out answers](../rules.md#written-out-answers), [Ports declared inside](../rules.md#ports-declared-inside) and [Ports in the argument](../typescript/recipes.md#ports-in-the-argument).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *A collaborator imported, not received.* The unit reaches its dependency through an import. Make it a port the unit receives in its argument.
15
- - *No place that wires.* Nothing builds the real dependencies and passes them in, so imports are the only wiring there is. Create one composition root.
16
- - *A port too big to stub.* Replacing the whole module is easier than writing doubles for a wide port. Narrow the port to what this unit uses.
17
- - *Ambient capabilities.* Time, randomness, environment or the filesystem read directly. Same cause; see CD-17 and CD-19.
18
-
19
- **Where to go.** Every collaborator arrives through the unit's own signature. Tests hand in test doubles exactly the way production hands in the real thing. Start with the module mocked most often; one port at a time.
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 tests." The module-mock is the test reporting the design. The fix is in the unit.
23
- - "The framework's docs mock modules." A framework idiom does not make the seam right. Wrap the framework behind a port.
24
- - "Rewiring is too big." It is one port at a time, and each one removes a module-mock for good.
13
+ ## Spirit
25
14
 
26
- **Principles behind it.**
27
- - *Dependency Inversion Principle* (Robert C. Martin, SOLID). The unit depends on an abstraction it is given, not on a concrete module it imports.
28
- - *Dependency injection and the composition root.* Dependencies are built in one place and passed in, so any of them can be replaced without touching the unit.
29
- - *Ports and adapters* (Alistair Cockburn, hexagonal architecture). A test is one more adapter plugged into the same port.
15
+ Start from the symptom a finding names: [Module or global patched](../typescript/symptoms.md#module-or-global-patched). 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) and [External behaviour sits at a boundary](../principles.md#external-behaviour-sits-at-a-boundary).
@@ -1,6 +1,8 @@
1
1
  # CD-27 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
+ Symptoms: [Branch in a test](../typescript/symptoms.md#branch-in-a-test), [Computed value in a test](../typescript/symptoms.md#computed-value-in-a-test), [Rebinding](../typescript/symptoms.md#rebinding), [Text past its reader](../typescript/symptoms.md#text-past-its-reader) and [Test switched off](../typescript/symptoms.md#test-switched-off). The test-logic check also sees the `let` form of [Answer set in a hook](../typescript/symptoms.md#answer-set-in-a-hook), and `try`, a form of [Throw or catch in a test](../typescript/symptoms.md#throw-or-catch-in-a-test).
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
 
@@ -35,7 +37,7 @@ Edition 2 also flags:
35
37
  - `??`, `||` and `&&`, and their assignment forms `??=`, `||=` and `&&=`.
36
38
  - Optional chaining: `a?.b`, `a?.[key]` and `f?.()`.
37
39
  - `switch` statements.
38
- - Computing calls on a built-in namespace: `JSON.stringify`, `JSON.parse`, `Object.assign`, `Object.fromEntries`, `Array.from` and any `Math` method. A finding on `JSON.stringify` or `JSON.parse` points at [CD-19](../CD-19/README.md); see [Serialising or parsing JSON](#serialising-or-parsing-json).
40
+ - Computing calls on a built-in namespace: `JSON.stringify`, `JSON.parse`, `Object.assign`, `Object.fromEntries`, `Array.from` and any `Math` method. A finding on `JSON.stringify` or `JSON.parse` names [Serialising or parsing JSON](#serialising-or-parsing-json).
39
41
 
40
42
  Neither edition flags element access such as `calls[0]`, calls to free functions, a method called through a computed key, such as `rows["map"]`, or text built with a template literal. Helper files that tests import are not checked; only the test files themselves are.
41
43
 
@@ -68,7 +70,7 @@ Write the expected value out. A method call in the act step is flagged too, so m
68
70
  Each finding ends with `fix:` and the page and section for what it flagged, such as `(node_modules/@hailstails/hone/rules/CD-27/CHECKS.md#an-optional-chain-after-an-index)`.
69
71
 
70
72
  ## Allowed forms in a test
71
- Each section shows a flagged form first, then the forms to write instead, or the rule the finding points at. Every form to write instead passes every audit and ESLint clause Hone ships, at each edition its check declares, and compiles under the compiler options CD-3 requires. A test reads this page and holds every block on it to that. `assert`, `expect`, `it` and `vi` come from `vitest`, and a `declare const` line stands for the unit under test.
73
+ Each section shows a flagged form first, then the forms to write instead. Every form to write instead passes every audit and ESLint clause Hone ships, at each edition its check declares, and compiles under the compiler options CD-3 requires. A test reads this page and holds every block on it to that. `assert`, `expect`, `it` and `vi` come from `vitest`, and a `declare const` line stands for the unit under test.
72
74
 
73
75
  ### Branching with if
74
76
  ```ts
@@ -359,7 +361,14 @@ it.each([
359
361
  declare const render: (row: { readonly id: string }) => string;
360
362
  expect(JSON.parse(render({ id: "a" }))).toEqual({ id: "a" });
361
363
  ```
362
- A finding on `JSON.stringify` or `JSON.parse` names this section. [CD-19](../CD-19/README.md) is the rule for the runtime's standard library.
364
+ A finding on `JSON.stringify` or `JSON.parse` names this section. Assert the object the unit gives back, written out:
365
+
366
+ ```ts
367
+ declare const rowOf: (row: { readonly id: string }) => { readonly id: string };
368
+ expect(rowOf({ id: "a" })).toEqual({ id: "a" });
369
+ ```
370
+
371
+ A unit that gives back only text should hand over an object, leaving the text to the adapter at its edge.
363
372
 
364
373
  ### Merging objects
365
374
  ```ts
@@ -437,14 +446,14 @@ expect(isInstalled({ kindOf })).toBe("installed");
437
446
  expect(kindOf).toHaveBeenCalledExactlyOnceWith("bin/hone.js");
438
447
  ```
439
448
 
440
- [CD-25](../CD-25/README.md) is the rule for test doubles.
449
+ The recipe is [Stub with vi.fn](../typescript/recipes.md#stub-with-vifn).
441
450
 
442
451
  ## Exceptions
443
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs logic. 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).
452
+ 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 [Branch in a test](../typescript/symptoms.md#branch-in-a-test) and [Computed value in a test](../typescript/symptoms.md#computed-value-in-a-test) have no correct use, and a reviewer refuses one. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
444
453
 
445
454
  ```json
446
455
  { "version": 1, "exceptions": [
447
- { "kind": "authorised-location", "clause": "CD-27#test-body-logic", "file": "src/legacy/report.test.ts", "reason": "..." }
456
+ { "kind": "file-carve-out", "clause": "CD-27#test-body-logic", "file": "src/legacy/report.test.ts" }
448
457
  ] }
449
458
  ```
450
459
 
@@ -2,28 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Test bodies are zero-logic straight lines: no branching, no loops, no try, no ternary, no computed expectations — just arrange, act, assert against hardcoded values. Logic in a test is untested code testing code; variability is supplied by a stub and pinned, never accommodated with a conditional.
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.** Splits: Straight-through tests; Tested where it's owned.
10
8
 
11
- **What the friction is for.** A test is the unit's specification, and it is read when it fails. Logic in a test is code with no test of its own. The friction makes a straight line with written-out expectations the easy test, so a failure can be trusted and read in one pass.
9
+ **Read.** [Straight-through tests](../rules.md#straight-through-tests), [Tested where it's owned](../rules.md#tested-where-its-owned), [Assert to narrow](../typescript/recipes.md#assert-to-narrow), [it.each over typed rows](../typescript/recipes.md#iteach-over-typed-rows) and [Whole written-out expectation](../typescript/recipes.md#whole-written-out-expectation).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Output that is hard to predict.* Expectations are computed because the result varies with time, randomness or ordering. Inject the source of variation and pin it with a stub.
15
- - *Several cases in one test.* A branch or a conditional picks between cases. Write one test per case, or one parameterised test over a table of rows.
16
- - *The unit's logic repeated in the test.* The test derives the answer the way the unit does. Write the answer out. If that is hard, the unit returns too much for one case or does too much.
17
- - *Failures caught to inspect them.* A try in a test means the unit throws where it could return its failure as data. Assert on the returned result.
18
- - *Tests switched off or focused.* A skip or an only hides a failing, slow or flaky case. Fix it or delete it.
19
-
20
- **Where to go.** Every test is arrange, act, assert, against literal values. Variation comes from injected stubs. N cases are N tests or one table.
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).
21
12
 
22
- **Reactions to distrust.**
23
- - "It's just a helper in the test." A helper with logic is untested code deciding whether other code passes.
24
- - "Written-out values are brittle." They break when behaviour changes. That is their job.
25
- - "The expected value is too big to write." Then the test asserts more than the unit's own responsibility, or the unit does too much.
13
+ ## Spirit
26
14
 
27
- **Principles behind it.**
28
- - *Conditional Test Logic* (a test smell in Gerard Meszaros, *xUnit Test Patterns*). A test with branches can pass without checking what it claims to check.
29
- - *Arrange, act, assert.* One setup, one action, one check: the shape that makes a test a readable specification.
15
+ Start from the symptom a finding names: [Branch in a test](../typescript/symptoms.md#branch-in-a-test), [Computed value in a test](../typescript/symptoms.md#computed-value-in-a-test), [Rebinding](../typescript/symptoms.md#rebinding), [Text past its reader](../typescript/symptoms.md#text-past-its-reader) and [Test switched off](../typescript/symptoms.md#test-switched-off). 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-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).