@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
@@ -2,27 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- A name states the concept the value represents, not its shape or its category. Shorthand (single letters, truncations) and filler words (data, info, value, result, manager, handler) force the reader to reconstruct meaning the name should have carried — at every scope, including callback parameters and destructures. The name is the documentation.
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: [naming](../../methods/lenses/naming.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: [One word everywhere](../rules.md#one-word-everywhere); casing a check.
10
8
 
11
- **What the friction is for.** A reader meets a name far more often than its definition. The friction makes stating the concept the easy path, so meaning lives where it is read.
9
+ **Read.** [One word everywhere](../rules.md#one-word-everywhere) and [Whole words](../typescript/recipes.md#whole-words).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *A concept not yet understood.* `data` or `result` because the writer did not know what the value was. Find out, then name it.
15
- - *A function returning a mix.* `result` is the only honest name because the function returns several things. Split it.
16
- - *No shared vocabulary.* The team has no agreed words for the domain, so names fall back to shapes. Agree the terms and use them in code.
17
- - *A framework's habit copied inward.* `req`, `res`, `e` from library examples. Name it for what it is in your code.
18
-
19
- **Where to go.** Every name states the concept, in the domain's words, at every scope.
11
+ Review lens: [naming](../../methods/lenses/naming.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
- - "Everyone knows what `i` means." They know it is an index, not an index of what.
23
- - "Short scopes don't need long names." The rule covers every scope. The reader of a short scope still has to reconstruct the meaning.
24
- - "It's the library's convention." Conventions belong at the boundary. Inside, use your words.
13
+ ## Spirit
25
14
 
26
- **Principles behind it.**
27
- - *Intention-revealing names* (Robert C. Martin, *Clean Code*). A name should say why the thing exists and what it does, so no comment is needed.
28
- - *Ubiquitous language* (Eric Evans, *Domain-Driven Design*). The code uses the same words as the people who know the domain.
15
+ Start from the symptom a finding names: [Shorthand name](../typescript/symptoms.md#shorthand-name) and [Name off its casing](../typescript/symptoms.md#name-off-its-casing). Each symptom names the cases it may indicate and the rules they point at. The why is on [Our code reads in the common language](../principles.md#our-code-reads-in-the-common-language).
@@ -1,6 +1,8 @@
1
1
  # CD-7 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: [Drawer path](../typescript/symptoms.md#drawer-path) and [Name off its casing](../typescript/symptoms.md#name-off-its-casing).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -2,28 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- A file or folder is named for the abstraction it holds, not for a category of things. A junk-drawer name (utils, helpers, common, shared, types, misc) signals a missing primitive: the code inside wants a real home named for what it does. Category names accrete unrelated code because anything can be justified into them.
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: [naming](../../methods/lenses/naming.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: One reason per module; One word everywhere; filename case a check.
10
8
 
11
- **What the friction is for.** A name is the first design decision a reader meets. A category name accepts anything, so code drifts into it without anyone deciding where it belongs. The friction forces the question "what is this?" at the moment it is cheapest to answer.
9
+ **Read.** [One reason per module](../rules.md#one-reason-per-module), [One word everywhere](../rules.md#one-word-everywhere) and [Screaming folders](../typescript/recipes.md#screaming-folders).
12
10
 
13
- **What a finding points at.** Match the paths against these causes.
14
- - *A concept nobody named.* The drawer holds functions that all serve one idea the codebase never named, such as money, dates or identifiers. Name the idea and give it a module.
15
- - *Shared by accident.* Code moved to a common place because two callers needed it. Decide whether it belongs to one of them or is a concept of its own.
16
- - *Shapes separated from their owners.* A types file holds shapes far from the code that uses them. Put each shape beside the code it describes.
17
- - *Folders sorted by kind.* The tree groups things by what they are, not by what they do. Group by capability.
18
-
19
- **Where to go.** Every file and folder name says what it holds, so a reader finds code by asking what it does. The rename is the small part; finding the concept behind it is the work.
11
+ Review lens: [naming](../../methods/lenses/naming.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 name." The name is where the missing concept shows. A synonym such as "core" or "base" keeps the drawer.
23
- - "The framework requires that path." Then authorise that path. What you add under it still needs a real home.
24
- - "We'll sort it later." Category folders only grow.
13
+ ## Spirit
25
14
 
26
- **Principles behind it.**
27
- - *Screaming architecture* (Robert C. Martin). The folder structure should tell a reader what the system does, not which kinds of file it contains.
28
- - *Single Responsibility Principle* (Robert C. Martin, SOLID). A module has one reason to change. A drawer of unrelated helpers has as many reasons as it has helpers.
29
- - *Primitive Obsession* (a code smell in Fowler's *Refactoring*). Helpers that all handle one raw value, such as an amount or a date string, usually mark a domain type nobody created.
15
+ Start from the symptom a finding names: [Drawer path](../typescript/symptoms.md#drawer-path) and [Name off its casing](../typescript/symptoms.md#name-off-its-casing). 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) and [Our code reads in the common language](../principles.md#our-code-reads-in-the-common-language).
@@ -1,6 +1,8 @@
1
1
  # CD-7a 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: [Type derived from code](../typescript/symptoms.md#type-derived-from-code).
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 type the code produces is named and exported, and callers use that named type. Deriving a type from a factory's inferred return couples the type to the implementation, hides it from find-usages, and breaks the moment the factory's internals shift. The single carve-out is an external library symbol whose package exports no named return type.
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.** Symptom of [Outside dependencies stay at boundaries](../rules.md#outside-dependencies-stay-at-boundaries).
10
8
 
11
- **What the friction is for.** A type derived from what a function happens to return changes whenever the implementation does. The friction makes naming the type the easy path, so the contract is declared, findable, and stable.
9
+ **Read.** [Outside dependencies stay at boundaries](../rules.md#outside-dependencies-stay-at-boundaries) and [Named, exported type](../typescript/recipes.md#named-exported-type).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *A contract nobody wrote down.* The factory's output was never named, so callers derive it. Name and export the type, and let the factory declare it returns that.
15
- - *Implementation details leaking out.* The derived type exposes everything the factory builds. Declare only what callers should rely on.
16
- - *A library with a named type you missed.* The package exports the type already. Use it.
17
-
18
- **Where to go.** Every type the code produces has a name, and callers use the name.
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
- - "Deriving keeps it in sync." It keeps it in sync with whatever the implementation does, including mistakes.
22
- - "Naming it is duplication." The name is the contract; the implementation is one way to meet it.
13
+ ## Spirit
23
14
 
24
- **Principles behind it.**
25
- - *Program to an interface, not an implementation* (Gamma, Helm, Johnson and Vlissides, *Design Patterns*). Callers depend on a declared contract, not on the shape the implementation produces.
26
- - *Intention-revealing names* (Robert C. Martin, *Clean Code*). A named type says what the value is for.
15
+ Start from the symptom a finding names: [Type derived from code](../typescript/symptoms.md#type-derived-from-code). 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) and [The type checker proves it](../principles.md#the-type-checker-proves-it).
@@ -1,6 +1,8 @@
1
1
  # CD-8 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: [Default on a closed union](../typescript/symptoms.md#default-on-a-closed-union).
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
- A switch over a closed discriminated union carries no `default:` arm. Exhaustiveness is the type system's job: with no default, adding a variant surfaces as a compile error at every switch that has not handled it. A `default:` swallows that signal and lets the new variant slip through silently at runtime.
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.** Symptom of [Kinds are named](../rules.md#kinds-are-named).
10
8
 
11
- **What the friction is for.** When a new case is added, every place that must handle it should fail to compile until it does. A catch-all arm switches that off. The friction keeps the compiler finding those places for you.
9
+ **Read.** [Kinds are named](../rules.md#kinds-are-named) and [Tagged union and exhaustive switch](../typescript/recipes.md#tagged-union-and-exhaustive-switch).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *A catch-all kept "for safety".* The union is closed, so the arm can only hide future cases. Remove it and let the compiler check exhaustiveness.
15
- - *Input that was never parsed.* The value might be anything because it came from outside unchecked. Parse it at the boundary into the closed union; then the switch is closed.
16
- - *Several cases sharing one arm.* Default is used as "everything else does the same". List those cases by name.
17
-
18
- **Where to go.** Every switch over a closed union names every case. Adding a case lights up every place that must decide what to do with it.
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
- - "What if a value we don't know arrives?" Then the value was not parsed. That is a boundary problem, not a switch problem.
22
- - "Listing every case is verbose." The list is what the compiler checks.
13
+ ## Spirit
23
14
 
24
- **Principles behind it.**
25
- - *Exhaustiveness checking.* The compiler proves every case is handled; a catch-all arm withdraws the proof.
26
- - *Make illegal states unrepresentable* (Yaron Minsky). Once the input is a closed union, an unknown case cannot exist to be defaulted.
15
+ Start from the symptom a finding names: [Default on a closed union](../typescript/symptoms.md#default-on-a-closed-union). 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-9 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: [Result union](../typescript/recipes.md#result-union). The outcome it protects is seen by [Throw between our units](../typescript/symptoms.md#throw-between-our-units).
4
+
5
+ Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
4
6
 
5
7
  ## Clauses
6
8
 
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
10
12
 
11
13
  ## How it is checked
12
14
 
13
- Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the rule](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
15
+ Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
@@ -2,25 +2,14 @@
2
2
 
3
3
  ## Rule
4
4
 
5
- Every expected, operational failure is modelled as data — a result-shaped return carrying a tagged error union that enumerates each way the operation can fail — not raised as an exception. Infrastructure failure is an operational outcome, not an escape into throwing. Callers dispatch on the error as a value, so no failure path is invisible in the type.
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: [errors-as-data](../../methods/lenses/errors-as-data.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.** Keeps: [Failures are values](../rules.md#failures-are-values).
10
8
 
11
- **What the friction is for.** A failure the type does not mention is a failure the caller will not handle. The friction makes returning failures as values the easy path, so every way an operation can fail is visible and handled.
9
+ **Read.** [Failures are values](../rules.md#failures-are-values) and [Result union](../typescript/recipes.md#result-union).
12
10
 
13
- **What a finding points at.** Match the sites against these causes.
14
- - *Failures thrown because they were never listed.* Name each way the operation fails as a tagged variant.
15
- - *Infrastructure treated as exceptional.* Timeouts and missing records are thrown. They are ordinary outcomes; return them.
16
- - *Library exceptions leaking.* Catch at the wrapping boundary and return a result.
17
- - *Callers that ignore failure.* A result is unwrapped without looking at the error. Handle each variant.
18
-
19
- **Where to go.** Every operation that can fail returns a result with a tagged error union, and callers dispatch on it.
11
+ Review lens: [errors-as-data](../../methods/lenses/errors-as-data.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).
20
12
 
21
- **Reactions to distrust.**
22
- - "Exceptions are simpler." Simpler to write, because they skip the handling. The handling is the point.
13
+ ## Spirit
23
14
 
24
- **Principles behind it.**
25
- - *Railway oriented programming* (Scott Wlaschin). Success and failure travel as two tracks of one value.
26
- - *Make illegal states unrepresentable* (Yaron Minsky). A tagged error union lists exactly the failures that can occur.
15
+ Start from the symptom a finding names: [Throw between our units](../typescript/symptoms.md#throw-between-our-units) and [Failure shaped as success](../typescript/symptoms.md#failure-shaped-as-success). 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).
package/rules/README.md CHANGED
@@ -1,54 +1,71 @@
1
- # Disciplines
2
-
3
- Each discipline has two pages. Its `README.md` holds the rule and its spirit: what the friction is for, what a finding usually points at, the direction to go and the principles behind it. Its `CHECKS.md` holds the mechanics: the clauses, what each check flags, and how to record an exception. Read the rule first. [The spirit of the rules](SPIRIT.md) explains the approach for the whole set.
4
-
5
- Adopters select clauses in `disciplines.json`. Selecting one clause adopts its discipline, so every mechanical clause of an adopted discipline must be selected, each through a mechanism its CHECKS.md lists, or listed as `"not-adopted"`; the check reports the rest as uncovered. Clauses marked (review) are judgement clauses: they cannot be selected and are applied in review with the discipline's review lens, as [ADOPTING.md](../ADOPTING.md#9-apply-the-judgement-rules) describes.
6
-
7
- | ID | Title | Clauses | Files checked | Review lens |
8
- | --- | --- | --- | --- | --- |
9
- | [CD-1](CD-1/README.md) | No any, ever | `CD-1#any-cast`, `CD-1#explicit-any`, `CD-1#implicit-any-let` | `.ts`, `.tsx` | [type-soundness](../methods/lenses/type-soundness.md) |
10
- | [CD-2](CD-2/README.md) | Closed enumerated list of permitted cast sites | `CD-2#cast-expressions`, `CD-2#non-null-assertions` | `.ts`, `.tsx` | [type-soundness](../methods/lenses/type-soundness.md) |
11
- | [CD-3](CD-3/README.md) | Strict mode flags inherited, never overridden | `CD-3#strict`, `#no-unchecked-indexed-access`, `#exact-optional-property-types`, `#no-implicit-override`, `#no-fallthrough-cases-in-switch`, `#no-property-access-from-index-signature`, `#use-unknown-in-catch-variables` | `tsconfig.json` | [type-soundness](../methods/lenses/type-soundness.md) |
12
- | [CD-4](CD-4/README.md) | Zod at every external boundary | `CD-4#boundary-validation` (review) | — | [zod-boundary](../methods/lenses/zod-boundary.md) |
13
- | [CD-5](CD-5/README.md) | No comments, no JSDoc | `CD-5#comments-directives` | `.ts`, `.tsx` | [naming](../methods/lenses/naming.md) |
14
- | [CD-6](CD-6/README.md) | Meaningful names always — no shorthand, no filler words | `CD-6#identifier-names`, `CD-6#naming-convention` | `.ts`, `.tsx` | [naming](../methods/lenses/naming.md) |
15
- | [CD-7](CD-7/README.md) | No categorical filenames or folder names | `CD-7#categorical-paths`, `CD-7#filename-case` | `.ts`, `.tsx` paths | [naming](../methods/lenses/naming.md) |
16
- | [CD-7a](CD-7a/README.md) | No ReturnType<typeof X> for our own codebase | `CD-7a#factory-return-types` | `.ts`, `.tsx` | [type-soundness](../methods/lenses/type-soundness.md) |
17
- | [CD-8](CD-8/README.md) | No default on switch over a closed discriminated union | `CD-8#switch-defaults` | `.ts`, `.tsx` | [type-soundness](../methods/lenses/type-soundness.md) |
18
- | [CD-9](CD-9/README.md) | All operational failures return Result<T, E> | `CD-9#result-failures` (review) | — | [errors-as-data](../methods/lenses/errors-as-data.md) |
19
- | [CD-10](CD-10/README.md) | Throws permitted in exactly two contexts | `CD-10#throws-in-tests`, `CD-10#throw-only-error` | `*.test.ts`, `*.test.tsx` | [errors-as-data](../methods/lenses/errors-as-data.md) |
20
- | [CD-11](CD-11/README.md) | Operational error envelopes are plain data, not classes | `CD-11#error-envelopes` (review) | — | [errors-as-data](../methods/lenses/errors-as-data.md) |
21
- | [CD-12](CD-12/README.md) | Repositories are the primary storage abstraction | `CD-12#repository-ports` (review) | — | [clean-architecture](../methods/lenses/clean-architecture.md) |
22
- | [CD-13](CD-13/README.md) | Kernel layer boundaries are non-negotiable | `CD-13#layer-boundaries` (review) | — | [clean-architecture](../methods/lenses/clean-architecture.md) |
23
- | [CD-14](CD-14/README.md) | Zero class authoring; classes only at external-library call sites | `CD-14#class-syntax`, `CD-14#static-only-class`, `CD-14#library-construction` (review) | TypeScript, not `.d.ts` | [function-first](../methods/lenses/function-first.md) |
24
- | [CD-15](CD-15/README.md) | Iteration is functional transformation, never an imperative loop | `CD-15#loops` | `.ts`, `.tsx` | [function-first](../methods/lenses/function-first.md) |
25
- | [CD-16](CD-16/README.md) | No counted for loops | see CD-15 | — | [function-first](../methods/lenses/function-first.md) |
26
- | [CD-17](CD-17/README.md) | Clock is the only time source | `CD-17#clock-sources` | `.ts`, `.tsx` | [di-discipline](../methods/lenses/di-discipline.md), [test-discipline](../methods/lenses/test-discipline.md) |
27
- | [CD-18](CD-18/README.md) | Process-lifecycle operations arrive through an injected port | `CD-18#process-lifecycle-ports` (review) | — | [di-discipline](../methods/lenses/di-discipline.md) |
28
- | [CD-19](CD-19/README.md) | External dependencies confined to wrapping ports at the boundary | `CD-19#import-boundaries` | `.ts`, `.tsx` | [function-first](../methods/lenses/function-first.md) |
29
- | [CD-20](CD-20/README.md) | Runtime stdlib imports arrive through injected ports | see CD-19 | — | [di-discipline](../methods/lenses/di-discipline.md) |
30
- | [CD-21](CD-21/README.md) | Every injected port ships a default production factory | `CD-21#default-factories` (review) | — | [di-discipline](../methods/lenses/di-discipline.md) |
31
- | [CD-22](CD-22/README.md) | Middleware generic context constraint | `CD-22#middleware-context` (review) | — | [di-discipline](../methods/lenses/di-discipline.md) |
32
- | [CD-23](CD-23/README.md) | Every unit has a co-located test sibling | `CD-23#export-test-sibling` | production `.ts`, `.tsx` | [test-discipline](../methods/lenses/test-discipline.md) |
33
- | [CD-24](CD-24/README.md) | Every file is unit-tested | see CD-23 | — | [test-discipline](../methods/lenses/test-discipline.md) |
34
- | [CD-25](CD-25/README.md) | Unit tests replace everything outside the unit with test doubles | `CD-25#dependency-isolation` | `*.test.ts`, `*.test.tsx` | [di-discipline](../methods/lenses/di-discipline.md), [test-discipline](../methods/lenses/test-discipline.md) |
35
- | [CD-26](CD-26/README.md) | No module-mocking — module-mock means DI is wrong | `CD-26#module-mocking` | `*.test.ts`, `*.test.tsx` | [di-discipline](../methods/lenses/di-discipline.md), [test-discipline](../methods/lenses/test-discipline.md) |
36
- | [CD-27](CD-27/README.md) | Tests are zero-everything — zero logic, zero branches, zero unpredictability | `CD-27#test-body-logic`, `CD-27#focused-tests`, `CD-27#skipped-tests` | `*.test.ts`, `*.test.tsx` | [test-discipline](../methods/lenses/test-discipline.md) |
37
- | [CD-28](CD-28/README.md) | Tests assert only what the unit is directly responsible for | `CD-28#unit-responsibility` (review) | — | [test-discipline](../methods/lenses/test-discipline.md) |
38
- | [CD-29](CD-29/README.md) | Component/integration tests are the minimum, not the bulk | `CD-29#test-pyramid` (review) | — | [test-discipline](../methods/lenses/test-discipline.md) |
39
- | [CD-30](CD-30/README.md) | Integration tests catch composition bugs only | `CD-30#composition-only` (review) | — | [test-discipline](../methods/lenses/test-discipline.md) |
40
- | [CD-31](CD-31/README.md) | No coverage thresholds | `CD-31#no-coverage-thresholds` (review) | — | [test-discipline](../methods/lenses/test-discipline.md) |
41
- | [CD-32](CD-32/README.md) | PII strings redact-by-default in structured logs | `CD-32#pii-redaction` (review) | — | [clean-architecture](../methods/lenses/clean-architecture.md) |
42
- | [CD-33](CD-33/README.md) | Sensitive types brand-redact unconditionally | `CD-33#sensitive-brands` (review) | — | [clean-architecture](../methods/lenses/clean-architecture.md) |
43
- | [CD-34](CD-34/README.md) | Secrets never enter the repo | `CD-34#no-repo-secrets` (review) | — | [clean-architecture](../methods/lenses/clean-architecture.md) |
44
- | [CD-39](CD-39/README.md) | Cite principles by Roman numeral and rules by ID | `CD-39#cite-by-id` (review) | — | none |
45
- | [CD-40](CD-40/README.md) | Single-object-argument functions | `CD-40#parameter-count`, `CD-40#named-object-argument` (review) | files the ESLint run includes | [function-first](../methods/lenses/function-first.md) |
46
- | [CD-41](CD-41/README.md) | Orchestrators contain only orchestration | `CD-41#cognitive-complexity`, `CD-41#function-length`, `CD-41#orchestration-only` (review) | files the ESLint run includes | [decomposition](../methods/lenses/decomposition.md) |
47
- | [CD-42](CD-42/README.md) | Unhappy paths are early returns; happy path is the final return | `CD-42#useless-else` | files the ESLint run includes | [decomposition](../methods/lenses/decomposition.md) |
48
- | [CD-43](CD-43/README.md) | Booleans are evaluative, not declarative | `CD-43#boolean-signatures` | `.ts`, `.tsx` | [type-soundness](../methods/lenses/type-soundness.md) |
49
- | [CD-44](CD-44/README.md) | Functions must not mutate fields of parameters they receive | `CD-44#parameter-mutation`, `CD-44#parameter-reassignment` | `.ts`, `.tsx` | [decomposition](../methods/lenses/decomposition.md) |
50
- | [CD-45](CD-45/README.md) | Zod runs exactly once per external-boundary crossing | `CD-45#parse-once` (review) | — | [zod-boundary](../methods/lenses/zod-boundary.md) |
51
- | [CD-46](CD-46/README.md) | Touching a carved-out file revokes its carve-out — leave it clean | applied to every file carve-out | — | none |
52
- | [CD-47](CD-47/README.md) | Tests are hermetic — no real side effects on anything real | `CD-47#hermetic-git-spawns` | `*.test.{ts,tsx,mjs,js}`, `*.spec.{ts,mjs}` | [test-discipline](../methods/lenses/test-discipline.md) |
53
-
54
- Exceptions are recorded in `discipline-exceptions.json`; see [the package README](../README.md#discipline-exceptionsjson).
1
+ # How to read the rules
2
+
3
+ A finding names a symptom. Read it along the chain:
4
+
5
+ **symptom → case → why → reason to change**
6
+
7
+ A [symptom](typescript/symptoms.md) is what was seen in the code. It points at the [cases](cases.md) it may indicate: what the code was trying to do. Each case owes one or more whys, its [principles](principles.md), and each principle names its reason to change. The [rules](rules.md) under a principle say what must hold, and the [recipes](typescript/recipes.md) are the known methods that make a rule hold.
8
+
9
+ ## Why these rules are strict
10
+
11
+ "my rules are stricter than most because leaving any trade off or judgement based calls to llm leads to the easiest option locally. Which is almost never the better choice."
12
+
13
+ So no principle or rule leaves a trade-off or a judgement call to the reader. It states what must hold. The room for a correct exception is a record, never softness in the text. Being stricter than a cited source is intended.
14
+
15
+ ## The model
16
+
17
+ | Kind | What it is | Industry name |
18
+ |---|---|---|
19
+ | [Principle](principles.md) | A why. What it protects and its reason to change. | Rationale |
20
+ | [Case](cases.md) | What the code is trying to do ("this needs the current time"). Where the why is owed. | Problem in context |
21
+ | [Rule](rules.md) | What must hold. Carries no exceptions. | Requirement |
22
+ | [Recipe](typescript/recipes.md) | A known method that makes a rule hold, with the reason it was chosen. "It's as binding as it's reasoning. The proof of burden is on the deviation to show that the reason it was chosen no longer holds." | Acceptable means of compliance; pattern |
23
+ | [Symptom](typescript/symptoms.md) | Something seen in code. Suspect by default. May point at several rules. | Code smell |
24
+ | [Check](typescript/checks.md) | How a symptom is found. Imperfect by design. | Enforcement; fitness function |
25
+ | [Record](records.md) | A thought-through use, known debt, or a design decision. | Deviation record; ADR |
26
+
27
+ "Reasons to change" is not on the list. It is the test used to place a boundary and to decide whether two things are one.
28
+
29
+ ## The language boundary
30
+
31
+ Principles, cases and rules are cross-language. Recipes, symptoms and checks are written for one language; TypeScript is the one today, under [typescript](typescript/symptoms.md).
32
+
33
+ Two tests for a rule:
34
+ 1. It names no language feature. If it only makes sense because of a quirk of the language, it is a symptom or a recipe for that language.
35
+ 2. The other rules together do not already give it. If they do, it is a case.
36
+
37
+ ## Names, not numbers
38
+
39
+ Rules, principles, cases, recipes and symptoms are named, not numbered. A name's id is the name, hyphenated. [Every CD](numbers.md) maps each old number to its new names. Selections, records and findings still use the numbered clause addresses, and each numbered folder still holds its discipline's `CHECKS.md`.
40
+
41
+ The numbered `README.md` pages are the earlier form of these rules. Where they differ, the pages here govern. Findings still link to the numbered pages until they are replaced; [Every CD](numbers.md#every-numbered-discipline) lists each one with its title, clauses, files checked and review lens.
42
+
43
+ ## Words used the same way everywhere
44
+
45
+ - **Business logic:** all code outside a recorded boundary.
46
+ - **Unit:** one function.
47
+ - **Port:** an interface of ours that business logic is handed.
48
+ - **Adapter:** a unit inside a recorded boundary that fulfils a port.
49
+ - **Passed in:** given as an argument or to the factory that built the unit. Never imported.
50
+ - **One decision:** one reason to change.
51
+ - **Outside dependency:** what was called a package. An internal package is our own code.
52
+
53
+ ## The pages
54
+
55
+ | Page | What it holds |
56
+ |---|---|
57
+ | [principles.md](principles.md) | The principles, each with what must hold, what it protects, its reason to change and where a breach sits |
58
+ | [cases.md](cases.md) | The cases under each principle, the whys each owes, and what to do |
59
+ | [rules.md](rules.md) | The named rules |
60
+ | [records.md](records.md) | The record kinds, and today's record formats beside them |
61
+ | [sources.md](sources.md) | The sources behind each principle, rule, recipe and record kind |
62
+ | [typescript/recipes.md](typescript/recipes.md) | The recipes for TypeScript |
63
+ | [typescript/symptoms.md](typescript/symptoms.md) | The symptoms in TypeScript, and how near today's checks come |
64
+ | [typescript/checks.md](typescript/checks.md) | Each check, its margin and its settings |
65
+ | [numbers.md](numbers.md) | Every CD number and its new names |
66
+
67
+ ## Selecting checks
68
+
69
+ Adopters select clauses in `disciplines.json`. Selecting one clause adopts its discipline, so every mechanical clause of an adopted discipline must be selected, each through a mechanism its `CHECKS.md` lists, or listed as `"not-adopted"`; the check reports the rest as uncovered. Review clauses are judgement clauses: they cannot be selected and are applied in review with the discipline's review lens, as [ADOPTING.md](../ADOPTING.md#9-apply-the-judgement-rules) describes.
70
+
71
+ Exceptions are recorded in `discipline-exceptions.json`; see [the package README](../README.md#discipline-exceptionsjson). [The spirit of the rules](SPIRIT.md) explains what the friction is for.
package/rules/SPIRIT.md CHANGED
@@ -13,7 +13,7 @@ A finding is rarely about the line it names. It is a signal about the design aro
13
13
  Take this chain, in order.
14
14
 
15
15
  1. **Measure.** Count the sites for the failing clause. Group them by folder, by the value or dependency involved, and by who wrote them when.
16
- 2. **Ask what each group points at.** Read the rule's Spirit section and match each group against its usual causes. Most groups share one cause.
16
+ 2. **Ask what each group points at.** Read the symptom's "May indicate" and "Breach usually sits" lines on [the symptoms page](typescript/symptoms.md) and match each group against them. Most groups share one cause.
17
17
  3. **Then decide.** Name the cause, where it lives, the forward goal, and the first step that unlocks it. Fix the cause and the sites go with it.
18
18
 
19
19
  Exclusions and settings are not the first move. Reaching for one before step 2 hides the signal before anyone has read it. A count that looks like noise is usually one missing boundary seen from many places.
@@ -43,8 +43,8 @@ Tests are not exempt. A test that needs a cast, a test double with logic, a modu
43
43
 
44
44
  ## Older than these rules
45
45
 
46
- Each rule encodes lessons programmers learned before us and wrote down under names you can look up: the SOLID principles, ports and adapters, "parse, don't validate", making illegal states unrepresentable, the test pyramid, the kinds of test double, and others. Each rule page names the principles behind it, with one line on how each applies. Read them to learn the pattern and the reasoning, not only the rule.
46
+ Each rule encodes lessons programmers learned before us and wrote down under names you can look up: the SOLID principles, ports and adapters, "parse, don't validate", making illegal states unrepresentable, the test pyramid, the kinds of test double, and others. [The sources page](sources.md) names the source behind each principle, rule and recipe, and how the item relates to it. Read them to learn the pattern and the reasoning, not only the rule.
47
47
 
48
48
  ## Who does what
49
49
 
50
- Each rule's Spirit section names the usual causes behind its findings and the direction each points, so a reader can tell which one they have. The repository's own assessment then sharpens that to what is specific to the codebase and its intentions: which cause applies, where, the forward goal and the steps. It does not repeat the rule.
50
+ Each symptom on [the symptoms page](typescript/symptoms.md) names the cases it may indicate and where the breach usually sits, so a reader can tell which one they have. The repository's own assessment then sharpens that to what is specific to the codebase and its intentions: which cause applies, where, the forward goal and the steps. It does not repeat the rule.
package/rules/cases.md ADDED
@@ -0,0 +1,94 @@
1
+ # Cases
2
+
3
+ A case is what the code is trying to do. It is where the why is owed. A case may owe more than one why. "Owes" lists principles by short name; the first one decides what to do.
4
+
5
+ Short names: Tests ([Tests are ours](principles.md#tests-are-ours)), One place ([One place decides](principles.md#one-place-decides)), Effects ([No hidden effects](principles.md#no-hidden-effects)), Boundary ([External behaviour sits at a boundary](principles.md#external-behaviour-sits-at-a-boundary)), Leak ([No leak across a boundary](principles.md#no-leak-across-a-boundary)), Checker ([The type checker proves it](principles.md#the-type-checker-proves-it)), Language ([Our code reads in the common language](principles.md#our-code-reads-in-the-common-language)), Outside risk ([Outside risk is carried on purpose](principles.md#outside-risk-is-carried-on-purpose)).
6
+
7
+ Cases name no language, tool or library.
8
+
9
+ ## Tests are ours
10
+
11
+ | Case | Owes | What to do |
12
+ |---|---|---|
13
+ | Uses what a collaborator gives back | Tests; One place | Every collaborator whose result it uses, our own units included, is passed in. The test stubs it with a written-out value and asserts only what the unit returns and calls. A stub that needs logic means the port or the collaborator holds too much: fix that. |
14
+ | States what the unit gives back, for one case or several | Tests; One place | Each test is one complete, distinct case. The expected value is written out, never worked out. Several cases are each written out; nothing in the test builds or picks them. No throw or catch in a test. |
15
+ | Checks a value that may be one of several outcomes | Tests; Checker | An assertion proves which outcome it is, so the type narrows; then the test reads it plainly. No condition, optional read or cast. |
16
+ | Gives each unit its test | Tests; One place | Every unit has its own test in the companion file, and it runs. A unit that only wires has a test of its wiring. No coverage figure stands in. |
17
+ | Tests across units or against a real system | Tests; One place | Each behaviour is tested at the level that owns it. An integration test checks only a binding to the outside, or that units join. It is the only place a file on disk or a real subsystem belongs, and only the one its binding needs. It inherits nothing from the machine. |
18
+
19
+ ## One place decides
20
+
21
+ | Case | Owes | What to do |
22
+ |---|---|---|
23
+ | Coordinates other units | One place; Tests | It picks which of our units run, in what order, and passes their results on. Branching, computing or reshaping between calls is its own unit. A unit that only forwards one call decides nothing: fold it in. A test suite's body is a list of cases, not a coordinator. |
24
+ | Does one job | One place; Checker | One decision. It calls no other unit of business logic; it may call ports passed in to it. A second question, a mode picked by a true-or-false argument, or a mix of results is a second unit. |
25
+ | Checks conditions before its work | One place; Checker | Each condition that ends the work returns at once, at one level. The work is the last return, never nested in a condition. |
26
+ | Builds the real implementations | One place; Boundary | One place, at start-up, builds every real implementation and passes it in. Nothing else builds one. |
27
+ | Reuses behaviour from another unit or type | One place; Language | Two callers share a unit only when it is one decision for both. Shared behaviour is a call to that unit, never inheritance. |
28
+ | Puts code in a file or folder | One place; Language | A module holds what changes for one reason, named for that domain concept. A domain type lives with its logic; a file of types alone holds only port declarations. A drawer of unrelated pieces, test helpers included, has no home. |
29
+
30
+ ## No hidden effects
31
+
32
+ | Case | Owes | What to do |
33
+ |---|---|---|
34
+ | Makes a new value from what it has | Effects; One place | It returns a new value. Nothing it was given or already made changes after it is made. A stream is drained only in its source's adapter, at a recorded site. |
35
+ | Causes an effect (writes, logs, sends, exits) | Effects; Boundary, One place | The effect is a call on a port passed in, and its test checks that call. |
36
+ | Keeps state or settings across calls | Effects; Checker | Settings are passed in when the unit is built. State that changes between calls lives only in an adapter, behind a port. |
37
+
38
+ ## External behaviour sits at a boundary
39
+
40
+ | Case | Owes | What to do |
41
+ |---|---|---|
42
+ | Needs the current time, a random value, a new id or an outside ordering | Boundary; One place, Tests | One unit makes the value and does nothing else. Every other unit is passed the value, not its source. The source is a port; its stub returns a written-out value. |
43
+ | Uses a system or service outside the program | Boundary; Leak, One place | Business logic is handed a port named for the capability, not the mechanism, speaking only our types. One implementation per capability touches it and may fill several narrow ports. The protocol is its own adapter. Each adapter is a recorded boundary. |
44
+
45
+ ## No leak across a boundary
46
+
47
+ | Case | Owes | What to do |
48
+ |---|---|---|
49
+ | Reads data from outside (request, file, environment, stored row, response) | Leak; Boundary, Checker | The reader for whoever produced it parses it once, at the boundary, into a type of our own. A required value that is missing is a failure, never a default. A test never sets the environment. Past the reader, units and their tests use objects, never text. |
50
+ | Sends data out of the program | Leak; One place | Business logic hands the adapter our own value. Only the adapter maps it to the receiver's form. |
51
+
52
+ ## The type checker proves it
53
+
54
+ | Case | Owes | What to do |
55
+ |---|---|---|
56
+ | An operation can fail | Checker; Boundary | Every way it fails is a named variant in its return type. Nothing is thrown, ends the process, becomes true or false, or is swapped for a default or an empty value. Callers handle each variant. |
57
+ | A value is one of several kinds or states | Checker; Language | A closed union of our own, a name per kind, no catch-all. Absence or a true-or-false that stands for a state is a named kind. |
58
+ | Gives a value its type (declares it, or needs it narrower) | Checker; One place, Leak | It admits exactly what the code relies on, named, never derived from an implementation. To narrow it, fix the declaration or the parse; nothing asserts over it, tests included. A doer takes only the fields it reads. |
59
+ | Sets how strictly the checker works | Checker | One setting, the strictest, for every unit. None weakens it. |
60
+
61
+ ## Our code reads in the common language
62
+
63
+ | Case | Owes | What to do |
64
+ |---|---|---|
65
+ | Names something | Language; One place | The domain's word, the same everywhere, at every scope. Values that travel together are named fields, never a position. If only a generic word fits, split it. An outside contract's names stay in its boundary. |
66
+ | Explains something in prose | Language; Checker | The meaning goes in a name or a type. The only annotations are a pointer to a tracked issue and a tool directive. |
67
+ | Writes basic logic (branching, matching, transforming, results) | Language; Outside risk | In the language's own constructs. No outside dependency's vocabulary stands in for it. |
68
+
69
+ Meaning by name, never by position: a unit whose signature is ours takes one argument; a callback shaped by an outside API takes what that API passes.
70
+
71
+ ## Outside risk is carried on purpose
72
+
73
+ | Case | Owes | What to do |
74
+ |---|---|---|
75
+ | Takes an outside dependency | Outside risk; Language, Boundary, One place | A record names the native way weighed and why it was not enough. It is used only inside the recorded boundary that needs it, with no wrapper, and its types and vocabulary never reach business logic. It never makes one of our decisions. |
76
+
77
+ Outside dependency: what was called a package. An internal package is our own code. An internal package falls under One place decides and the layering, not this case.
78
+
79
+ ### Proposed cases
80
+
81
+ Proposed, not accepted.
82
+
83
+ | Case | Owes | What to do |
84
+ |---|---|---|
85
+ | Ships code for others | Outside risk | What we ship is visible to an adopter's scanner. It is the case of the proposed rule [Shipped risk declared](rules.md#shipped-risk-declared). |
86
+ | An adopter is not handed our risk | Outside risk | A case under [Outside dependencies justified](rules.md#outside-dependencies-justified). A peer dependency is a direct dependency of ours, so it needs a record. The risk it weighs is carried by whoever runs it, the adopter included. |
87
+
88
+ ## Outside the cases
89
+
90
+ - **Sensitive data:** safety is their why; no principle forces them.
91
+ - **Records and debt:** see [records](records.md).
92
+ - **A named ban:** no record makes it correct. Existing use is still held as debt, like any symptom.
93
+ - **How rules and checks are written:** spirit pure, strict wording, checks imperfect by design.
94
+ - **Process:** root cause over a guard, no deferring, no ask-me exits, no parallel machinery.