@hailstails/hone 2.0.0-pre.4 → 2.0.0-pre.6

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 (135) hide show
  1. package/ADOPTING.md +10 -19
  2. package/CHANGELOG.md +46 -0
  3. package/MIGRATING.md +25 -14
  4. package/README.md +3 -4
  5. package/chunks/chunk-2U5EKYGS.js +14348 -0
  6. package/chunks/{chunk-FPIP7JEC.js → chunk-4AJQHZ7I.js} +1 -1
  7. package/chunks/chunk-4PHKVNM3.js +2377 -0
  8. package/chunks/{chunk-CXM5KBZX.js → chunk-6LTJRJOE.js} +1 -1
  9. package/chunks/{chunk-PVSC4SE3.js → chunk-BISP2JOL.js} +4 -6
  10. package/chunks/{chunk-BRANVR7K.js → chunk-FRE5IA3C.js} +1 -1
  11. package/chunks/{chunk-E4D5WDRX.js → chunk-GMLT3MHO.js} +252 -254
  12. package/chunks/chunk-M4VSJ27S.js +139 -0
  13. package/chunks/{chunk-YGMO5Z6U.js → chunk-P2VHWLK4.js} +182 -193
  14. package/chunks/{chunk-LD766VWU.js → chunk-U6W65ZOF.js} +31 -2
  15. package/chunks/{chunk-BKQ3K766.js → chunk-WPEOCLTP.js} +39 -33
  16. package/chunks/{chunk-A3RL4O5V.js → chunk-XNIXPQQ5.js} +35 -2
  17. package/docs/extending.md +2 -2
  18. package/methods/lenses/function-first.md +2 -2
  19. package/package.json +1 -1
  20. package/rules/README.md +5 -3
  21. package/rules/SPIRIT.md +1 -1
  22. package/rules/numbers.md +4 -4
  23. package/rules/principles/no-leak-across-a-boundary.md +1 -1
  24. package/rules/principles.md +1 -1
  25. package/rules/record-kinds/authorised-location.md +1 -1
  26. package/rules/records.md +11 -19
  27. package/rules/rules.md +5 -5
  28. package/rules/sources.md +6 -7
  29. package/rules/typescript/checks.md +55 -387
  30. package/rules/typescript/recipes/adapter-per-outside-party.md +10 -5
  31. package/rules/typescript/recipes/assert-to-narrow.md +114 -4
  32. package/rules/typescript/recipes/closure-factory.md +5 -5
  33. package/rules/typescript/recipes/companion-test-file.md +5 -3
  34. package/rules/typescript/recipes/composed-orchestrator.md +6 -4
  35. package/rules/typescript/recipes/composition-root.md +5 -3
  36. package/rules/typescript/recipes/{bounded-context-generic.md → constrained-context-generic.md} +6 -4
  37. package/rules/typescript/recipes/copy-never-write-in.md +6 -4
  38. package/rules/typescript/recipes/declared-not-bundled.md +5 -3
  39. package/rules/typescript/recipes/dependency-record.md +5 -3
  40. package/rules/typescript/recipes/domain-vocabulary-list.md +5 -3
  41. package/rules/typescript/recipes/entity-module.md +8 -5
  42. package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +5 -3
  43. package/rules/typescript/recipes/extension-outside-the-vendored-code.md +5 -3
  44. package/rules/typescript/recipes/failure-asserted-as-a-value.md +44 -4
  45. package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +8 -5
  46. package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +5 -3
  47. package/rules/typescript/recipes/functional-iteration.md +8 -3
  48. package/rules/typescript/recipes/guard-clauses.md +5 -3
  49. package/rules/typescript/recipes/integration-test-owns-its-scratch.md +5 -3
  50. package/rules/typescript/recipes/integration-test-suffix.md +5 -3
  51. package/rules/typescript/recipes/it-each-over-typed-rows.md +117 -0
  52. package/rules/typescript/recipes/map-out-at-the-adapter.md +36 -4
  53. package/rules/typescript/recipes/meaning-in-names-not-comments.md +5 -5
  54. package/rules/typescript/recipes/named-exported-type.md +5 -3
  55. package/rules/typescript/recipes/narrow-ports.md +5 -3
  56. package/rules/typescript/recipes/one-argument-object.md +8 -3
  57. package/rules/typescript/recipes/{port-in-the-domain.md → port-in-a-module-of-its-own.md} +7 -5
  58. package/rules/typescript/recipes/ports-in-the-argument.md +5 -3
  59. package/rules/typescript/recipes/repo-scripts-only.md +5 -3
  60. package/rules/typescript/recipes/result-union.md +5 -5
  61. package/rules/typescript/recipes/screaming-folders.md +5 -5
  62. package/rules/typescript/recipes/shared-strict-base-config.md +5 -5
  63. package/rules/typescript/recipes/stub-with-vi-fn.md +130 -0
  64. package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +5 -3
  65. package/rules/typescript/recipes/whole-words.md +5 -3
  66. package/rules/typescript/recipes/whole-written-out-expectation.md +284 -4
  67. package/rules/typescript/recipes/world-values-through-a-port.md +5 -3
  68. package/rules/typescript/recipes/zod-at-the-producers-adapter.md +8 -3
  69. package/rules/typescript/recipes.md +567 -21
  70. package/rules/typescript/symptoms/ambient-randomness.md +1 -1
  71. package/rules/typescript/symptoms/answer-set-in-a-hook.md +1 -1
  72. package/rules/typescript/symptoms/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site.md +1 -1
  73. package/rules/typescript/symptoms/{assertion-outside-a-test.md → assertion-outside-a-test-body.md} +1 -1
  74. package/rules/typescript/symptoms/branch-in-a-test/test-body.md +10 -184
  75. package/rules/typescript/symptoms/branch-in-a-test.md +11 -1
  76. package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +1 -1
  77. package/rules/typescript/symptoms/{code-or-prose-read-as-text.md → code-or-prose-read-as-text-in-a-test.md} +2 -2
  78. package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +26 -117
  79. package/rules/typescript/symptoms/computed-value-in-a-test.md +1 -1
  80. package/rules/typescript/symptoms/date-used-directly.md +1 -1
  81. package/rules/typescript/symptoms/default-for-a-required-value.md +1 -1
  82. package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +1 -18
  83. package/rules/typescript/symptoms/double-with-a-body.md +1 -1
  84. package/rules/typescript/symptoms/{export-from-a-test-file.md → export-from-a-test.md} +1 -1
  85. package/rules/typescript/symptoms/failure-shaped-as-success.md +1 -1
  86. package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +1 -1
  87. package/rules/typescript/symptoms/inner-layer-imports-outer.md +1 -1
  88. package/rules/typescript/symptoms/library-class-built-in-place.md +1 -1
  89. package/rules/typescript/symptoms/loop-keyword/loop-statement.md +1 -1
  90. package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +1 -0
  91. package/rules/typescript/symptoms/outside-import-past-a-boundary.md +5 -4
  92. package/rules/typescript/symptoms/outside-type-in-a-signature.md +2 -2
  93. package/rules/typescript/symptoms/{port-outside-the-domain.md → port-beside-its-adapter.md} +2 -2
  94. package/rules/typescript/symptoms/port-named-for-a-mechanism.md +1 -1
  95. package/rules/typescript/symptoms/process-global-used-in-place.md +1 -1
  96. package/rules/typescript/symptoms/rebinding/test-body.md +1 -18
  97. package/rules/typescript/symptoms/rebinding.md +11 -1
  98. package/rules/typescript/symptoms/schema-past-its-adapter.md +2 -2
  99. package/rules/typescript/symptoms/text-past-its-reader/test-body.md +2 -17
  100. package/rules/typescript/symptoms/text-past-its-reader.md +1 -1
  101. package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +1 -25
  102. package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +1 -1
  103. package/rules/typescript/symptoms/unasserted-call.md +1 -1
  104. package/rules/typescript/symptoms.md +35 -35
  105. package/src/application/conformance/conformance-testing-types.d.ts +2 -0
  106. package/src/domain/language-layer/authored-item-types.d.ts +21 -5
  107. package/src/domain/runner/runner-result-types.d.ts +1 -2
  108. package/src/eslint-plugin.js +40 -38
  109. package/src/hone.js +15 -13638
  110. package/src/infrastructure/disciplines-file/version-one-names.json +4 -5
  111. package/src/infrastructure/engines/eslint/runner/runner.js +56 -70
  112. package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/assertion-site.js +1 -1
  113. package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +39 -65
  114. package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/raw-read.js +1 -1
  115. package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/test-file-export.js +1 -1
  116. package/src/infrastructure/engines/walker/runner/runner.js +10 -10
  117. package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +3 -3
  118. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +15 -3
  119. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +118 -4
  120. package/src/measure-engines.process.js +80 -0
  121. package/src/testing.d.ts +1 -0
  122. package/src/testing.js +111 -26
  123. package/chunks/chunk-7FVSZ2VL.js +0 -1304
  124. package/chunks/chunk-BIDD2YWP.js +0 -398
  125. package/rules/record-kinds/boundary-record.md +0 -9
  126. package/rules/typescript/recipes/iteach-over-typed-rows.md +0 -18
  127. package/rules/typescript/recipes/stub-with-vifn.md +0 -20
  128. /package/rules/typescript/symptoms/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read.md +0 -0
  129. /package/rules/typescript/symptoms/{export-from-a-test-file → export-from-a-test}/test-file-export.md +0 -0
  130. /package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/assertion-site.examples.json +0 -0
  131. /package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/piece.json +0 -0
  132. /package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/piece.json +0 -0
  133. /package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/raw-read.examples.json +0 -0
  134. /package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/piece.json +0 -0
  135. /package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/test-file-export.examples.json +0 -0
@@ -1,10 +1,18 @@
1
1
  import {
2
2
  ownedNameText
3
- } from "./chunk-FPIP7JEC.js";
3
+ } from "./chunk-4AJQHZ7I.js";
4
4
  import {
5
5
  checkAddressTextOf,
6
6
  sameClauseAddress
7
- } from "./chunk-BKQ3K766.js";
7
+ } from "./chunk-WPEOCLTP.js";
8
+
9
+ // src/domain/settings/settings-file.ts
10
+ var SETTINGS_FILE_NAME = "hone.config.json";
11
+ var VERSION_ONE_SETTINGS_FILE_NAME = "disciplines.json";
12
+ var RENAMED_SETTINGS = [
13
+ { name: "confinedOutsideDependencies", pieceName: "confinedPackages" }
14
+ ];
15
+ var eslintConfigLookupOf = (request) => request.declared === void 0 ? { lookup: "detected" } : { lookup: "declared", value: request.declared };
8
16
 
9
17
  // src/domain/language-layer/check-address.ts
10
18
  var NO_CHECK = { found: "none" };
@@ -34,6 +42,20 @@ var checkNamedAt = (request) => {
34
42
  return found.found === "check" ? { named: "check", check: found.check } : { named: "not-of-the-clause", address };
35
43
  };
36
44
 
45
+ // src/domain/repository/repo-path-of.ts
46
+ var brandedAsRepoPath = (text) => text;
47
+ var repoPathOf = (text) => {
48
+ const plain = text;
49
+ return brandedAsRepoPath(plain);
50
+ };
51
+ var repoPathBeneath = (request) => brandedAsRepoPath(`${request.parent}/${request.segment}`);
52
+
53
+ // src/domain/repository/projection-outputs.ts
54
+ var projectionOutputsOf = (request) => ({
55
+ configuration: `hone.${request.engineName}.mjs`,
56
+ declaration: `hone.${request.engineName}.d.mts`
57
+ });
58
+
37
59
  // src/domain/settings/every-ok.ts
38
60
  var everyOk = (request) => request.entries.reduce(
39
61
  (sofar, entry) => {
@@ -53,5 +75,12 @@ export {
53
75
  checkAt,
54
76
  checksOf,
55
77
  checkNamedAt,
78
+ repoPathOf,
79
+ repoPathBeneath,
80
+ projectionOutputsOf,
81
+ SETTINGS_FILE_NAME,
82
+ VERSION_ONE_SETTINGS_FILE_NAME,
83
+ RENAMED_SETTINGS,
84
+ eslintConfigLookupOf,
56
85
  everyOk
57
86
  };
@@ -391,39 +391,6 @@ var TOOL_IDENTITY = identified({
391
391
  unrelatedNpmPackage: "hone"
392
392
  });
393
393
 
394
- // src/domain/rule-set/clause-address.ts
395
- var TOOL_RULE_SET = TOOL_IDENTITY.ownRuleSet;
396
- var CLAUSE_ADDRESS_TEXT = /^(?:(?<ruleSet>[^/#]+)\/)?(?<discipline>[^/#]+)#(?<clause>[^/#]+)$/;
397
- var clauseAddressPartsOf = (request) => {
398
- const parts = CLAUSE_ADDRESS_TEXT.exec(request.text)?.groups;
399
- const discipline = parts?.discipline;
400
- const clause = parts?.clause;
401
- if (discipline === void 0 || clause === void 0) {
402
- return "not-a-clause-address";
403
- }
404
- return {
405
- ruleSet: parts?.ruleSet === void 0 || parts.ruleSet === TOOL_RULE_SET ? TOOL_RULE_SET : { name: parts.ruleSet },
406
- discipline,
407
- clause
408
- };
409
- };
410
- var ruleSetOf = (request) => {
411
- if (request.ruleSet === TOOL_RULE_SET) {
412
- return TOOL_RULE_SET;
413
- }
414
- return isRuleSetName(request.ruleSet.name) && request.ruleSet.name !== TOOL_RULE_SET ? { name: request.ruleSet.name } : void 0;
415
- };
416
- var clauseAddressOf = (request) => {
417
- const parts = clauseAddressPartsOf(request);
418
- if (parts === "not-a-clause-address") {
419
- return parts;
420
- }
421
- const ruleSet = ruleSetOf({ ruleSet: parts.ruleSet });
422
- return ruleSet !== void 0 && isDisciplineId(parts.discipline) && isClauseId(parts.clause) ? { ruleSet, discipline: parts.discipline, clause: parts.clause } : "not-a-clause-address";
423
- };
424
- var clauseAddressText = (request) => request.address.ruleSet === TOOL_RULE_SET ? `${request.address.discipline}#${request.address.clause}` : `${request.address.ruleSet.name}/${request.address.discipline}#${request.address.clause}`;
425
- var sameClauseAddress = (request) => clauseAddressText({ address: request.left }) === clauseAddressText({ address: request.right }) ? "same" : "different";
426
-
427
394
  // src/application/ports/host/module-extension.ts
428
395
  var BUILT_MODULE_EXTENSION = ".js";
429
396
  var SOURCE_MODULE_EXTENSION = ".ts";
@@ -454,6 +421,11 @@ var runnerModuleSegmentsOf = (request) => [
454
421
  "runner",
455
422
  `runner${request.moduleExtension}`
456
423
  ];
424
+ var createMeasurementEntrySegments = (request) => [
425
+ request.installRoot,
426
+ "src",
427
+ `measure-engines.process${request.moduleExtension}`
428
+ ];
457
429
 
458
430
  // src/domain/repository/repo-path.ts
459
431
  var UNWALKABLE_SEGMENTS = ["", ".", ".."];
@@ -476,6 +448,39 @@ var parsedJson = (request) => {
476
448
  }
477
449
  };
478
450
 
451
+ // src/domain/rule-set/clause-address.ts
452
+ var TOOL_RULE_SET = TOOL_IDENTITY.ownRuleSet;
453
+ var CLAUSE_ADDRESS_TEXT = /^(?:(?<ruleSet>[^/#]+)\/)?(?<discipline>[^/#]+)#(?<clause>[^/#]+)$/;
454
+ var clauseAddressPartsOf = (request) => {
455
+ const parts = CLAUSE_ADDRESS_TEXT.exec(request.text)?.groups;
456
+ const discipline = parts?.discipline;
457
+ const clause = parts?.clause;
458
+ if (discipline === void 0 || clause === void 0) {
459
+ return "not-a-clause-address";
460
+ }
461
+ return {
462
+ ruleSet: parts?.ruleSet === void 0 || parts.ruleSet === TOOL_RULE_SET ? TOOL_RULE_SET : { name: parts.ruleSet },
463
+ discipline,
464
+ clause
465
+ };
466
+ };
467
+ var ruleSetOf = (request) => {
468
+ if (request.ruleSet === TOOL_RULE_SET) {
469
+ return TOOL_RULE_SET;
470
+ }
471
+ return isRuleSetName(request.ruleSet.name) && request.ruleSet.name !== TOOL_RULE_SET ? { name: request.ruleSet.name } : void 0;
472
+ };
473
+ var clauseAddressOf = (request) => {
474
+ const parts = clauseAddressPartsOf(request);
475
+ if (parts === "not-a-clause-address") {
476
+ return parts;
477
+ }
478
+ const ruleSet = ruleSetOf({ ruleSet: parts.ruleSet });
479
+ return ruleSet !== void 0 && isDisciplineId(parts.discipline) && isClauseId(parts.clause) ? { ruleSet, discipline: parts.discipline, clause: parts.clause } : "not-a-clause-address";
480
+ };
481
+ var clauseAddressText = (request) => request.address.ruleSet === TOOL_RULE_SET ? `${request.address.discipline}#${request.address.clause}` : `${request.address.ruleSet.name}/${request.address.discipline}#${request.address.clause}`;
482
+ var sameClauseAddress = (request) => clauseAddressText({ address: request.left }) === clauseAddressText({ address: request.right }) ? "same" : "different";
483
+
479
484
  // src/domain/language-layer/catalogue-name.ts
480
485
  var CATALOGUE_NAME = "[a-z][a-z0-9]*(?:-[a-z0-9]+)*";
481
486
  var WHOLE_CATALOGUE_NAME = new RegExp(`^${CATALOGUE_NAME}$`);
@@ -998,6 +1003,7 @@ export {
998
1003
  installRootAboveEntry,
999
1004
  installFormOf,
1000
1005
  runnerModuleSegmentsOf,
1006
+ createMeasurementEntrySegments,
1001
1007
  versionOneEngineNameOf,
1002
1008
  NOT_INSTALLED,
1003
1009
  gatheredPeerFailure,
@@ -1,9 +1,12 @@
1
+ import {
2
+ ownedNameText
3
+ } from "./chunk-4AJQHZ7I.js";
1
4
  import {
2
5
  NOT_INSTALLED,
3
6
  TOOL_IDENTITY,
4
7
  installRootAboveEntry,
5
8
  versionOneEngineNameOf
6
- } from "./chunk-BKQ3K766.js";
9
+ } from "./chunk-WPEOCLTP.js";
7
10
 
8
11
  // src/infrastructure/command-line/installation/install-root.ts
9
12
  var DIRECTORIES_ABOVE_ENTRY = {
@@ -37,6 +40,29 @@ var installRootAbove = (request) => {
37
40
  var installRootOf = (request) => installRootAbove({ ...request, entry: "command" });
38
41
  var installRootOfApiEntry = (request) => installRootAbove({ ...request, entry: "api" });
39
42
 
43
+ // src/infrastructure/printed-report/symptoms/symptom-lines.ts
44
+ var symptomUnheldText = (request) => `${ownedNameText(request.failure.symptom)}: the catalogue and the records disagree, since a check, sighting or record names this symptom and no catalogue holds it`;
45
+ var lowerFirst = (request) => `${request.text.charAt(0).toLowerCase()}${request.text.slice(1)}`;
46
+ var pointedTitleOf = (request) => request.point.kind === "rule" ? request.point.rule.title : request.point.principle.title;
47
+ var indicatedCaseText = (request) => {
48
+ const caseText = lowerFirst({ text: request.indication.case.title });
49
+ return request.indication.situation === void 0 ? caseText : `${caseText}: ${request.indication.situation}`;
50
+ };
51
+ var indicationText = (request) => `${indicatedCaseText(request)} \u2192 ${request.indication.points.map((point) => pointedTitleOf({ point })).join(", ")}`;
52
+ var recipeSentence = (request) => {
53
+ const titles = request.recipes.map((recipe) => recipe.title);
54
+ if (titles.length === 0) {
55
+ return "";
56
+ }
57
+ return ` ${titles.length === 1 ? "Recipe" : "Recipes"}: ${titles.join("; ")}.`;
58
+ };
59
+ var symptomSourceOf = (request) => request.symptom.sourceFile ?? `${request.page}#${request.symptom.name}`;
60
+ var symptomLine = (request) => {
61
+ const { symptom } = request;
62
+ const indications = symptom.mayIndicate.map((indication) => indicationText({ indication })).join("; ");
63
+ return `${symptom.name}: ${symptom.title}. May indicate: ${indications}. The breach usually sits ${symptom.breachUsuallySits}.${recipeSentence(symptom)} Read ${symptomSourceOf(request)}`;
64
+ };
65
+
40
66
  // src/infrastructure/printed-report/load-failures/load-failure-text.ts
41
67
  var escapedLineBreaks = (request) => request.text.replaceAll("\n", "\\n").replaceAll("\r", "\\r");
42
68
  var JUDGEMENT_CLAUSE_LISTED_REPAIR = "a judgement clause is enforced by review and is left out of clauses, adopted or not; remove it";
@@ -134,11 +160,18 @@ var loadFailureFields = (request) => {
134
160
  ];
135
161
  }
136
162
  };
137
- var loadFailureDetail = (request) => [request.failure.kind, ...loadFailureFields(request)].map((text) => escapedLineBreaks({ text })).join(" ");
163
+ var loadFailureDetail = (request) => {
164
+ const { failure } = request;
165
+ if (failure.kind === "symptom-unheld") return symptomUnheldText({ failure });
166
+ return [failure.kind, ...loadFailureFields({ failure })].map((text) => escapedLineBreaks({ text })).join(" ");
167
+ };
138
168
  var loadFailureText = (request) => `load failure: ${loadFailureDetail(request)}
139
169
  `;
140
170
 
141
171
  export {
172
+ symptomUnheldText,
173
+ symptomSourceOf,
174
+ symptomLine,
142
175
  installRootOf,
143
176
  installRootOfApiEntry,
144
177
  loadFailureDetail,
package/docs/extending.md CHANGED
@@ -7,6 +7,6 @@ The `acme` rule set Hone's install proof runs is a working example: [delivery/in
7
7
  ## Start one
8
8
 
9
9
  1. Pick a folder, name it under `ruleSets` in `hone.config.json`, and select its checks as `<rule set>/<symptom>#<check>`.
10
- 2. Write each symptom and check as an item under the folder's `rules/`, laid out as Hone's own [rules](../rules/README.md). `@hailstails/hone/rule-set` types each item's facts.
11
- 3. Write each check's piece under `engines/<engine>/<symptom>/<check>/`, with its examples beside it. Use ESLint for what a lint rule can see, and the walker (`@hailstails/hone/walker`) for files and names ESLint never reads.
10
+ 2. Write each symptom and check as an item under the folder's `rules/`, laid out as Hone's own [rules](../rules/README.md). `@hailstails/hone/rule-set` types each item's facts. A case's name must be its title in lower case with hyphens, leaving out any part in brackets. A symptom's indication may point only at a principle or rule its case owes. A recipe's `serves` lists each rule or principle it serves, and a symptom may list a recipe, and a recipe's example may answer a check's form, only where one of them is indicated by the symptom.
11
+ 3. Write each check's piece under `engines/<engine>/<symptom>/<check>/`, with its examples beside it. Use ESLint for what a lint rule can see, and the walker (`@hailstails/hone/walker`) for files and names ESLint never reads. A remedy a piece reports names its `fix` and the `form` it matched, and no page.
12
12
  4. Test each piece against its examples with `checkConformanceOf` from `@hailstails/hone/testing`, naming the rule set and its root. An empty list means the piece meets every example.
@@ -72,7 +72,7 @@ one of three buckets:
72
72
 
73
73
  - **justified.** The declaration is the single permitted authored class at its
74
74
  named site, OR it is a `new X(...)` for an external-library class in
75
- the adapter for the party it reaches, with a boundary record, AND the instance
75
+ the adapter for the party it reaches, with an authorised location, AND the instance
76
76
  is held inside the closure and never re-exported as a class. Cite the carve-out; no replacement.
77
77
  - **closure-candidate.** The class carries genuine instance state that is
78
78
  *mutated* across method calls (counters, caches, accumulating buffers,
@@ -137,7 +137,7 @@ an event `forEach` handler by shape.
137
137
 
138
138
  Every raw outside-dependency import (runtime *or* type-only) and every `new X(...)`
139
139
  for an external-library class is a candidate. For each: is the importing or
140
- instantiating file the adapter for the party it reaches, with a boundary record?
140
+ instantiating file the adapter for the party it reaches, with an authorised location?
141
141
  If yes → justified. If not, the import is in the wrong place — a function-first
142
142
  finding with a DI/port cross-reference (the raw import escaping its adapter is
143
143
  both a structural and a boundary-discipline defect; name the boundary lens as the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailstails/hone",
3
- "version": "2.0.0-pre.4",
3
+ "version": "2.0.0-pre.6",
4
4
  "description": "Checks a repository against the disciplines it selects, applies its recorded exceptions and prints one verdict.",
5
5
  "keywords": [
6
6
  "code-quality",
package/rules/README.md CHANGED
@@ -36,7 +36,7 @@ Two tests for a rule:
36
36
 
37
37
  ## Names, not numbers
38
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; each check's mechanics are on its own page under its symptom.
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. Each check's mechanics are on its own page under its symptom.
40
40
 
41
41
  [Every CD](numbers.md#every-numbered-discipline) lists each numbered discipline with its title, clauses, files checked and review lens.
42
42
 
@@ -169,6 +169,10 @@ Where a reason is marked **proposed**, it is not yet accepted.
169
169
 
170
170
  Outside dependency: what was called a package. An internal package is our own code.
171
171
 
172
+ ## Recipes: Examples
173
+
174
+ A recipe's examples show the method. Each names the check and form it answers. The first block is a flagged form, and each block after it is the method applied. Every block after the first passes every check Hone ships at every edition, and compiles under the compiler options [strictness-weakened](typescript/symptoms/strictness-weakened.md) requires. Statements outside an `it` stand for the body of one test. `assert`, `expect`, `it` and `vi` come from `vitest`, and a `declare const` line stands for the unit under test or what it is handed.
175
+
172
176
  ## Recipes: No hidden effects
173
177
 
174
178
  The principle decides.
@@ -275,8 +279,6 @@ They have two editions. Edition 1 runs by default. Edition 2 adds what each chec
275
279
  }
276
280
  ```
277
281
 
278
- Each check's "Allowed forms in a test" sections show 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 [strictness-weakened](typescript/symptoms/strictness-weakened.md) requires. A test reads each check's 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.
279
-
280
282
  ## Checks: Settings
281
283
 
282
284
  A setting fails only if it changes what a rule requires. It does not fail when it:
package/rules/SPIRIT.md CHANGED
@@ -43,7 +43,7 @@ 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. [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.
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, narrow integration tests, 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
 
package/rules/numbers.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Every CD
2
2
 
3
- Rules, principles, cases, recipes and symptoms are named, not numbered. This is the one page that gives the old numbers: each CD, its verdict, and where it went. Selections, records and findings still use the numbered clause addresses.
3
+ Rules, principles, cases, recipes and symptoms are named, not numbered. This is the one page that gives the old numbers: each CD, its verdict, and where it went.
4
4
 
5
5
  | Verdict | Meaning |
6
6
  |---|---|
@@ -26,7 +26,7 @@ Rules, principles, cases, recipes and symptoms are named, not numbered. This is
26
26
  | CD-9 | Keeps | [Failures are values](rules/failures-are-values.md) |
27
27
  | CD-10 | Splits | [Failures are values](rules/failures-are-values.md); [Straight-through tests](rules/straight-through-tests.md); throw-only-error a [check](typescript/symptoms/thrown-non-error/throw-only-error.md) |
28
28
  | CD-11 | Recipe | [Result union](typescript/recipes/result-union.md), for [Failures are values](rules/failures-are-values.md) |
29
- | CD-12 | Recipe | [Port in the domain](typescript/recipes/port-in-the-domain.md), for [Ports declared inside](rules/ports-declared-inside.md) |
29
+ | CD-12 | Recipe | [Port in a module of its own](typescript/recipes/port-in-a-module-of-its-own.md), for [Ports declared inside](rules/ports-declared-inside.md) |
30
30
  | CD-13 | Keeps | [Ports declared inside](rules/ports-declared-inside.md) |
31
31
  | CD-14 | Splits | no-class recipe [Closure factory](typescript/recipes/closure-factory.md); [Outside dependencies stay at boundaries](rules/outside-dependencies-stay-at-boundaries.md); state a [case](cases/keeps-state-or-settings-across-calls.md) |
32
32
  | CD-15 | Cases | of [No hidden effects](principles/no-hidden-effects.md) |
@@ -36,7 +36,7 @@ Rules, principles, cases, recipes and symptoms are named, not numbered. This is
36
36
  | CD-19 | Splits | [Outside dependencies stay at boundaries](rules/outside-dependencies-stay-at-boundaries.md); [Ports declared inside](rules/ports-declared-inside.md); [construction](cases/builds-the-real-implementations.md) and [ids](cases/needs-the-current-time-a-random-value-a-new-id-or-an-outside-ordering.md) cases |
37
37
  | CD-20 | Merges | with CD-19 |
38
38
  | CD-21 | Cases | [built at the entry point](cases/builds-the-real-implementations.md) |
39
- | CD-22 | Recipe | [Bounded context generic](typescript/recipes/bounded-context-generic.md), for [Declared, not asserted](rules/declared-not-asserted.md) |
39
+ | CD-22 | Recipe | [Constrained context generic](typescript/recipes/constrained-context-generic.md), for [Declared, not asserted](rules/declared-not-asserted.md) |
40
40
  | CD-23 | Keeps | [Tested where it's owned](rules/tested-where-its-owned.md) |
41
41
  | CD-24 | Merges | with CD-23 |
42
42
  | CD-25 | Keeps | [Written-out answers](rules/written-out-answers.md) |
@@ -97,7 +97,7 @@ Each mechanical clause and the [symptom](typescript/symptoms.md) it sees.
97
97
 
98
98
  The test-logic check, CD-27#test-body-logic, also sees the `let` form of [Answer set in a hook](typescript/symptoms/answer-set-in-a-hook.md), and `try`, a form of [Throw or catch in a test](typescript/symptoms/throw-or-catch-in-a-test.md).
99
99
 
100
- Review clauses that demand a method (CD-4, CD-9, CD-11, CD-12, CD-21 and CD-22) map to their [recipes](typescript/recipes.md). The outcome each protects is seen by Schema past its adapter, Throw between our units, Failure shaped as success, Port outside the domain, Adapter built outside the root and Default for a required value.
100
+ Review clauses that demand a method (CD-4, CD-9, CD-11, CD-12, CD-21 and CD-22) map to their [recipes](typescript/recipes.md). The outcome each protects is seen by Schema past its adapter, Throw between our units, Failure shaped as success, Port beside its adapter, Adapter built outside the root and Default for a required value.
101
101
 
102
102
  Sensitive data and citation clauses (CD-32, CD-33, CD-34 and CD-39) are outside the 2.0 model, as safety (CD-32, CD-33 and CD-34) and process (CD-39): they are outside Hone's catalogue, with no item, symptom or check, and no Hone lens applies them.
103
103
 
@@ -13,7 +13,7 @@
13
13
  - **Reason to change:** The shape of the data we receive changes.
14
14
  - **Breach:** In the adapter that is missing or passes the outside form inward. Shows far inward: presence checks, re-parsing, casts.
15
15
  - **Outside data:** anything read at a boundary, our own stored rows and files included.
16
- - **Record:** an externally defined model adopted as the definitive thing. Evans's *Conformist*. It is a statement on a [boundary record](../record-kinds/boundary-record.md).
16
+ - **Record:** an externally defined model adopted as the definitive thing. Evans's *Conformist*. It is the root of an [authorised location](../record-kinds/authorised-location.md)'s why-chain.
17
17
  - **Source:** This is Evans's anticorruption layer, applied to failures as well as data, in both directions.
18
18
  - **Quoted reasons:** "we always map to our own type to decouple even if they are basically the same contents." "Throws are not about start up. They are about speaking the language of the caller at the boundary."
19
19
  - **Review:** validation runs once at the boundary and its types do not leak inward
@@ -29,7 +29,7 @@
29
29
  - **Reason to change:** The shape of the data we receive changes.
30
30
  - **Breach:** In the adapter that is missing or passes the outside form inward. Shows far inward: presence checks, re-parsing, casts.
31
31
  - **Outside data:** anything read at a boundary, our own stored rows and files included.
32
- - **Record:** an externally defined model adopted as the definitive thing. Evans's *Conformist*. It is a statement on a [boundary record](record-kinds/boundary-record.md).
32
+ - **Record:** an externally defined model adopted as the definitive thing. Evans's *Conformist*. It is the root of an [authorised location](record-kinds/authorised-location.md)'s why-chain.
33
33
  - **Source:** This is Evans's anticorruption layer, applied to failures as well as data, in both directions.
34
34
  - **Quoted reasons:** "we always map to our own type to decouple even if they are basically the same contents." "Throws are not about start up. They are about speaking the language of the caller at the boundary."
35
35
  - **Review:** validation runs once at the boundary and its types do not leak inward
@@ -6,7 +6,7 @@
6
6
  }
7
7
  ```
8
8
 
9
- - **Recorded in:** **An authorised location** is in `hone-records/authorised-locations/<symptom>.json`: `answers`, `file`, `case` and `owes`, naming the case the file is and the principle it owes, and a `whyChain`. It says the symptom is correct in that file. `hone authorise` writes one from the arguments it is given. Each file is a document `{ "version": 2, "records": [...] }`; `answers` names the symptom, or `<symptom>#<check>` to reach one check of it.
9
+ - **Recorded in:** **An authorised location** is in `hone-records/authorised-locations/<symptom>.json`: `answers`, `file`, `case` and `owes`, naming the case the file is and the principle it owes, and a `whyChain`. It says the symptom is correct in that file. `hone authorise` writes one from the arguments it is given. Each file is a document `{ "version": 2, "records": [...] }`; `answers` names `<symptom>#<check>`. Where the symptom's correct use binds an outside party, `outsideParty` names the package or `node:` module.
10
10
  An `authorised-location` follows the why-chain contract: exactly five `{ "why", "because", "evidence" }` steps chained cause to cause, then `rootCause`, `rootEvidence`, `readback` and `owner`. The contract lists what Hone refuses and what review still judges:
11
11
 
12
12
  ```json
package/rules/records.md CHANGED
@@ -6,15 +6,15 @@ Today's record formats are listed [beside the kinds](#todays-formats-and-the-kin
6
6
 
7
7
  ## The kinds
8
8
 
9
- Five kinds cover everything. They are the model Hone's records take on with 2.0, which is not released yet: Deviation and Dependency record have no format today, and the others are written today in the formats [beside the kinds](#todays-formats-and-the-kinds), which say what each still lacks.
9
+ Four kinds cover everything. They are the model Hone's records take on with 2.0, which is not released yet: Deviation and Dependency record have no format today, and the others are written today in the formats [beside the kinds](#todays-formats-and-the-kinds), which say what each still lacks.
10
10
 
11
11
  ### Authorised location
12
12
 
13
13
  - **Answers:** A symptom whose correct use a case makes right at one place. Each symptom's correct uses are on [the symptoms page](typescript/symptoms.md).
14
- - **States:** The symptom; the site; the case that makes it correct here and the rule or principle that case owes; a why-chain whose root, if it changed, would remove the need; an owner. In the model it is never refused for what it claims: what it lacks is [noted](#what-is-noted-never-refused), and a note changes no verdict. A why that only restates the symptom is [refused](#what-is-refused).
14
+ - **States:** The symptom and check; the site; for Outside import past a boundary, the outside party; the case that makes it correct here and the rule or principle that case owes; a why-chain whose root, if it changed, would remove the need; an owner. It is refused on a symptom with no authorised-location correct use. Otherwise what it lacks is [noted](#what-is-noted-never-refused), and a note changes no verdict. A why that only restates the symptom is [refused](#what-is-refused).
15
15
  - **Scope:** One symptom at one site: a file, or a span within it.
16
16
  - **Stale or paid when:** Stale when the symptom is no longer at the site. A vendored edit is also re-tested when the vendored version moves. A person removes it.
17
- - **Industry name:** suppression with justification; a MISRA deviation permit. A suppression with a stated justification, as .NET and MISRA permits do.
17
+ - **Industry name:** suppression with justification, as .NET's `SuppressMessage` justification does.
18
18
 
19
19
  ### Deviation
20
20
 
@@ -22,24 +22,16 @@ Five kinds cover everything. They are the model Hone's records take on with 2.0,
22
22
  - **Must state:** The recipe by name; the reason it was chosen, as its recipe states it; why that reason does not hold at this site, with evidence; how the rule still holds.
23
23
  - **Scope:** One recipe at one site.
24
24
  - **Stale or paid when:** Stale when the symptom is gone. Review owes "the reason holds again".
25
- - **Industry name:** a MISRA deviation record. Aviation's alternative means of compliance, held to a stricter proof.
25
+ - **Industry name:** a deviation record: aviation's alternative means of compliance, held to a stricter proof.
26
26
 
27
27
  ### Debt
28
28
 
29
29
  - **Answers:** Any symptom at a site, a known breach not yet paid.
30
30
  - **Must state:** The symptom and the site. Nothing more: "All debt is debt. Reason doesn't matter."
31
31
  - **Scope:** One symptom in one file.
32
- - **Stale or paid when:** Forfeited once the file is touched, so the change pays it. Stale when the symptom is gone. Removed by the tool when the file is gone, or when its check measured the file and found the debt paid.
32
+ - **Stale or paid when:** Forfeited once the file is touched, so the change pays it. Moving a file without changing its content does not touch it. Stale when the symptom is gone. Removed by the tool when the file is gone, or when its check measured the file and found the debt paid.
33
33
  - **Industry name:** a baseline with a ratchet. Record-debt is the baseline, and forfeit-on-touch is the ratchet. A lint baseline, as in ESLint bulk suppressions, that ratchets down.
34
34
 
35
- ### Boundary record
36
-
37
- - **Answers:** The symptoms a boundary makes correct inside an adapter: Date used directly, Ambient randomness, Process global used in place, Outside import past a boundary, Library class built in place, Outside type in a signature, Text past its reader in the producer's adapter. With a **Conformist** statement, also Schema past its adapter and Outside type in a signature beyond the adapter.
38
- - **Must state:** The outside party, the port or ports it fulfils, and the module. For Conformist: the outside model adopted as ours, and why it is "a persisted concept that pushes into other boundaries as the definitive thing".
39
- - **Scope:** One module: a file or a folder.
40
- - **Stale or paid when:** Stale when the module no longer reaches that outside party. A person removes it.
41
- - **Industry name:** an architecture decision record (Nygard). Evans's anticorruption layer, recorded.
42
-
43
35
  ### Dependency record
44
36
 
45
37
  - **Answers:** Outside dependencies justified, and Dependency without a record.
@@ -55,7 +47,7 @@ Only the tool, and only debt, for findings the base revision already held ("reco
55
47
  ### Merged into the kinds, or not a kind
56
48
 
57
49
  - **Site-level record for one symptom:** merged. Every kind names a symptom, not a whole clause, so a record can say "this symptom, here".
58
- - **Conformist:** merged into Boundary record. It is a decision about one outside party's model crossing a boundary.
50
+ - **Conformist:** a Conformist statement is the root of an authorised location's why-chain.
59
51
  - **Drift record:** merged into Authorised location, on the symptom Edit inside vendored code. Its case: "justified as additional drift as impossible to apply as an extension instead". It states when it should be dropped.
60
52
  - **Inline suppression:** not a kind. It is where a record shows at the site. An inline disable or a tool directive is held only by a record of its symptom at that site.
61
53
  - **Tracked pointer:** not a record. It is an allowed annotation.
@@ -72,7 +64,7 @@ Only the tool, and only debt, for findings the base revision already held ("reco
72
64
 
73
65
  ## What is refused
74
66
 
75
- In the model, an authorised location is never refused for what it claims; what it lacks is [noted](#what-is-noted-never-refused). Its why-chain must still be a reason. A record file that cannot be read at all is refused, whatever it holds. Every other record must contain what its kind states. Anything less is refused, as follows.
67
+ An authorised location is refused on a symptom with no authorised-location correct use; otherwise what it lacks is [noted](#what-is-noted-never-refused). Its why-chain must still be a reason. A record file that cannot be read at all is refused, whatever it holds. Every other record must contain what its kind states. Anything less is refused, as follows.
76
68
 
77
69
  | Refused | Why | Does Hone refuse it from the form today? |
78
70
  |---|---|---|
@@ -83,15 +75,15 @@ In the model, an authorised location is never refused for what it claims; what i
83
75
  | Debt written by the tool for a file the base did not hold | today's `new-file` | Yes, as today. |
84
76
  | A record standing in for a design fix, where friction points at the design | "if we have such a complex test that needs exemption we have a code architecture problem" | No; review. A machine can show records clustering on one symptom or one cause. Only review rules on it. |
85
77
  | An option that weakens the whole run (`--rule`, `-c`) | today | Yes, as today: it cannot be recorded. |
78
+ | An authorised location on a symptom with no authorised-location correct use | No correct use, so nothing to authorise. | Yes, by `hone authorise` and the reader. One carried from version 1 is kept. |
86
79
 
87
80
  This is a list of what each record must contain. It is not a ladder of exceptions.
88
81
 
89
82
  ## What is noted, never refused
90
83
 
91
- An authorised location answers a check that is wrong at that place, so the form accepts it for any symptom: "while authorised location in spirit isn't supposed to be allowed. It's mechanically always allowed as our checks for symptoms is never assumed perfect." In the model, what it lacks is a note beside it. A note changes no verdict; review rules on it.
84
+ An authorised location answers a check that is wrong at that place, so the form accepts it for any symptom with an authorised-location correct use: "while authorised location in spirit isn't supposed to be allowed. It's mechanically always allowed as our checks for symptoms is never assumed perfect." In the model, what it lacks is a note beside it. A note changes no verdict; review rules on it.
92
85
 
93
86
  - **A case that is missing, or not in the [case list](cases.md).** A thought-through use names its case. Whether the case is true is left to review. Today's tool does not read a case name.
94
- - **A symptom that no case makes correct, such as a branch in a test.** "who the heck added an authorised location for an if in a test?" In spirit it is not allowed.
95
87
  ## The cost side
96
88
 
97
89
  **What holds today:**
@@ -116,7 +108,7 @@ Which kind answers each symptom is on [the symptoms page](typescript/symptoms.md
116
108
  | Method | Kind |
117
109
  |---|---|
118
110
  | A fake | Deviation from Stub with vi.fn |
119
- | A hermetic setup in an integration test | Not a record: it is the recipe |
111
+ | A fresh scratch in an integration test | Not a record: it is the recipe |
120
112
  | A real file, subprocess or temp directory in a unit test | Debt. It breaks Tested where it's owned, which is a rule, not a recipe. |
121
113
  | A stream drain | Authorised location |
122
114
  | A throw at the edge | Authorised location |
@@ -128,7 +120,7 @@ Records today are written in these formats. Each answers one of the kinds.
128
120
 
129
121
  | Today | Kind | What differs from the kind |
130
122
  |---|---|---|
131
- | `authorised-location` (clause, file, reason, whyChain) | Authorised location, or Boundary record for sites of Outside import past a boundary | Names a clause, not a symptom. The site is a file. It does not name the case and the rule owed. |
123
+ | `authorised-location` (clause, file, reason, whyChain) | Authorised location, one per outside party for Outside import past a boundary | Names a clause, not a symptom. The site is a file. It does not name the case, the rule owed or the outside party. |
132
124
  | `file-carve-out` (clause, file, optional reason) | Debt | Names a clause, not a symptom. One record on the test-logic clause covers up to four symptoms. |
133
125
  | `clause-wide-carve-out` | Not a record: the clause is not adopted | Today it is a record that keeps the clause running, with its why-chain; with 2.0 it becomes the check marked not adopted. |
134
126
  | `provenance` (imported) | The same kind, imported | Nothing. |
package/rules/rules.md CHANGED
@@ -23,7 +23,7 @@ The clock, random values, new ids and outside ordering are a case: the principle
23
23
  - **Review:** process signals, exit, kill and high-resolution timing arrive through an injected port
24
24
 
25
25
  - **Cases served:** Builds the real implementations; Causes an effect (writes, logs, sends, exits); Needs the current time, a random value, a new id or an outside ordering; Uses a system or service outside the program.
26
- - **Recipes:** [Composition root](typescript/recipes.md#composition-root), [Port in the domain](typescript/recipes.md#port-in-the-domain), [World values through a port](typescript/recipes.md#world-values-through-a-port).
26
+ - **Recipes:** [Composition root](typescript/recipes.md#composition-root), [Port in a module of its own](typescript/recipes.md#port-in-a-module-of-its-own), [World values through a port](typescript/recipes.md#world-values-through-a-port).
27
27
 
28
28
  ## One place decides
29
29
 
@@ -61,7 +61,7 @@ The clock, random values, new ids and outside ordering are a case: the principle
61
61
  Building every real implementation in one place at start-up is a case: Doer or orchestrator plus Ports declared inside give it. DRY is held here: "dry is true but it must be held with reasons to change not "same functional code right now"".
62
62
 
63
63
  - **Cases served:** Puts code in a file or folder; Reads data from outside (request, file, environment, stored row, response); Reuses behaviour from another unit or type; Sends data out of the program.
64
- - **Recipes:** [Screaming folders](typescript/recipes.md#screaming-folders).
64
+ - **Recipes:** [Entity module](typescript/recipes.md#entity-module), [Screaming folders](typescript/recipes.md#screaming-folders).
65
65
 
66
66
  ## Our code reads in the common language
67
67
 
@@ -75,7 +75,7 @@ One word everywhere keeps "no meaning rests on position". A unit whose signature
75
75
  Casing is a check under this rule. Writing basic logic in the language's own constructs is a case; the principle gives it.
76
76
 
77
77
  - **Cases served:** Explains something in prose; Names something.
78
- - **Recipes:** [Domain vocabulary list](typescript/recipes.md#domain-vocabulary-list), [Meaning in names, not comments](typescript/recipes.md#meaning-in-names-not-comments), [Whole words](typescript/recipes.md#whole-words).
78
+ - **Recipes:** [Domain vocabulary list](typescript/recipes.md#domain-vocabulary-list), [Meaning in names, not comments](typescript/recipes.md#meaning-in-names-not-comments), [One argument object](typescript/recipes.md#one-argument-object), [Whole words](typescript/recipes.md#whole-words).
79
79
 
80
80
  ## Outside risk is carried on purpose
81
81
 
@@ -163,7 +163,7 @@ Both halves answer one reason to change, which test owns a behaviour, so it stay
163
163
  - **Source:** King's parse, don't validate.
164
164
 
165
165
  - **Cases served:** Gives a value its type (declares it, or needs it narrower).
166
- - **Recipes:** [Bounded context generic](typescript/recipes.md#bounded-context-generic), [Fix the declaration, not the value](typescript/recipes.md#fix-the-declaration-not-the-value), [Named, exported type](typescript/recipes.md#named-exported-type), [Shared strict base config](typescript/recipes.md#shared-strict-base-config).
166
+ - **Recipes:** [Assert to narrow](typescript/recipes.md#assert-to-narrow), [Constrained context generic](typescript/recipes.md#constrained-context-generic), [Fix the declaration, not the value](typescript/recipes.md#fix-the-declaration-not-the-value), [Named, exported type](typescript/recipes.md#named-exported-type), [Shared strict base config](typescript/recipes.md#shared-strict-base-config), [Zod at the producer's adapter](typescript/recipes.md#zod-at-the-producers-adapter).
167
167
 
168
168
  ### Failures are values
169
169
 
@@ -172,7 +172,7 @@ Both halves answer one reason to change, which test owns a behaviour, so it stay
172
172
  - **Review:** expected operational failures are returned as a Result with a tagged error union, not thrown
173
173
 
174
174
  - **Cases served:** An operation can fail.
175
- - **Recipes:** [Result union](typescript/recipes.md#result-union).
175
+ - **Recipes:** [Failure mapping at the adapter](typescript/recipes.md#failure-mapping-at-the-adapter), [Result union](typescript/recipes.md#result-union).
176
176
 
177
177
  ### Kinds are named
178
178
 
package/rules/sources.md CHANGED
@@ -52,9 +52,9 @@ A CONFLICTS source sits beside an item's main source, never in place of it. Stri
52
52
 
53
53
  | Item | Source and its claim | Relation |
54
54
  |---|---|---|
55
- | [Stub with vi.fn](typescript/recipes.md#stub-with-vifn) | Meszaros, [Test Stub](http://xunitpatterns.com/Test%20Stub.html). Martin, [The Little Mocker (2014)](https://blog.cleancoder.com/uncle-bob/2014/05/14/TheLittleMocker.html). GOOS §4.6: "Mock objects are still stubs"; adding behaviour signals misplaced responsibility. | SAME |
55
+ | [Stub with vi.fn](typescript/recipes.md#stub-with-vi-fn) | Meszaros, [Test Stub](http://xunitpatterns.com/Test%20Stub.html). Martin, [The Little Mocker (2014)](https://blog.cleancoder.com/uncle-bob/2014/05/14/TheLittleMocker.html). GOOS §4.6: "Mock objects are still stubs"; adding behaviour signals misplaced responsibility. | SAME |
56
56
  | [Ports in the argument](typescript/recipes.md#ports-in-the-argument) | Fowler 2004, DI article (constructor injection); Seemann, [Pure DI (2014)](https://blog.ploeh.dk/2014/06/10/pure-di/). | NARROWER: one of Fowler's three injection forms |
57
- | [it.each over typed rows](typescript/recipes.md#iteach-over-typed-rows) | Meszaros, [Parameterized Test](http://xunitpatterns.com/Parameterized%20Test.html). | STRICTER: rows typed and hard-coded |
57
+ | [it.each over typed rows](typescript/recipes.md#it-each-over-typed-rows) | Meszaros, [Parameterized Test](http://xunitpatterns.com/Parameterized%20Test.html). | STRICTER: rows typed and hard-coded |
58
58
  | [Assert to narrow](typescript/recipes.md#assert-to-narrow) | Meszaros, [Guard Assertion](http://xunitpatterns.com/Guard%20Assertion.html): "Replace an if statement in a test with an assertion…" | SAME |
59
59
  | [Whole written-out expectation](typescript/recipes.md#whole-written-out-expectation) | Meszaros, Literal Value. | SAME |
60
60
  | [Failure asserted as a value](typescript/recipes.md#failure-asserted-as-a-value) | Follows from Failures are values. No test-pattern name found. | NO SOURCE |
@@ -71,7 +71,7 @@ A CONFLICTS source sits beside an item's main source, never in place of it. Stri
71
71
  | [Copy, never write in](typescript/recipes.md#copy-never-write-in) | Fowler, [ValueObject](https://martinfowler.com/bliki/ValueObject.html): value objects should be immutable. | SAME |
72
72
  | [Closure factory](typescript/recipes.md#closure-factory) | Crockford, [Private Members in JavaScript](https://www.crockford.com/javascript/private.html): privileged methods over closure state. | SAME (conflict: Evans's mutable entities) |
73
73
  | [Adapter per outside party](typescript/recipes.md#adapter-per-outside-party) | Cockburn, Hexagonal Architecture. | SAME |
74
- | [Port in the domain](typescript/recipes.md#port-in-the-domain) | Martin DIP 1996; Martin 2012: the output port sits in the inner circle, implemented outside. Evans 2013: ACL-backed repository. | SAME on ownership |
74
+ | [Port in a module of its own](typescript/recipes.md#port-in-a-module-of-its-own) | Martin DIP 1996; Martin 2012: the output port sits in the inner circle, implemented outside. Evans 2013: ACL-backed repository. | SAME on ownership |
75
75
  | [World values through a port](typescript/recipes.md#world-values-through-a-port) | Seemann, [Volatile Dependencies](https://learn.microsoft.com/en-us/archive/blogs/ploeh/volatile-dependencies): time and randomness are volatile and go behind an abstraction. | STRICTER: Seemann exempts stable dependencies; ours does not |
76
76
  | [Composition root](typescript/recipes.md#composition-root) | Seemann, [Composition Root (2011)](https://blog.ploeh.dk/2011/07/28/CompositionRoot/). | SAME |
77
77
  | [Zod at the producer's adapter](typescript/recipes.md#zod-at-the-producers-adapter) | King 2019; Evans 2013: "ideally the translator should just translate". | SAME |
@@ -80,7 +80,7 @@ A CONFLICTS source sits beside an item's main source, never in place of it. Stri
80
80
  | [Result union](typescript/recipes.md#result-union) | Wlaschin, Against ROP. | SAME |
81
81
  | [Named, exported type](typescript/recipes.md#named-exported-type) | No source found. | NO SOURCE |
82
82
  | [Fix the declaration, not the value](typescript/recipes.md#fix-the-declaration-not-the-value) | No source found; nearest is King 2019. | NO SOURCE |
83
- | [Bounded context generic](typescript/recipes.md#bounded-context-generic) | No source found. | NO SOURCE |
83
+ | [Constrained context generic](typescript/recipes.md#constrained-context-generic) | No source found. | NO SOURCE |
84
84
  | [Shared strict base config](typescript/recipes.md#shared-strict-base-config) | No source found; a tool feature, not a named practice. | NO SOURCE |
85
85
  | [Tagged union and exhaustive switch](typescript/recipes.md#tagged-union-and-exhaustive-switch) | TypeScript Handbook, [Narrowing: exhaustiveness checking](https://www.typescriptlang.org/docs/handbook/2/narrowing.html): a `default` branch assigns to `never`. | STRICTER: this recipe has no `default` branch |
86
86
  | [Domain vocabulary list](typescript/recipes.md#domain-vocabulary-list) | Fowler, UbiquitousLanguage. | SAME |
@@ -99,7 +99,7 @@ A CONFLICTS source sits beside an item's main source, never in place of it. Stri
99
99
  | [Authorised location](records.md#authorised-location) | Microsoft, [SuppressMessageAttribute.Justification](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.suppressmessageattribute.justification): "the justification for suppressing the code analysis message". | SAME |
100
100
  | [Deviation](records.md#deviation) | EASA, [FAQ 19026](https://www.easa.europa.eu/en/faq/19026): an alternative means of compliance must show it meets "the intent of the IR". | STRICTER: a deviation must show the recipe's reason fails at this site; meeting the rule another way is not enough |
101
101
  | [Debt](records.md#debt) | ESLint, [bulk suppressions](https://eslint.org/docs/latest/use/suppressions): existing violations "will not be reported", new ones are. Martin, [The Boy Scout Rule](https://github.com/97-things/97-things-every-programmer-should-know/blob/master/en/thing_08/README.md): leave it "a little bit better". | STRICTER: touching the file forfeits the whole file's debt |
102
- | [Boundary record](records.md#boundary-record) | Evans 2013: an ACL presents a clean interface in the downstream model; the ACL-backed repository. | SAME |
102
+ | [Authorised location for an outside party](records.md#authorised-location) | Evans 2013: an ACL presents a clean interface in the downstream model; the ACL-backed repository. | SAME |
103
103
  | [Dependency record](records.md#dependency-record) | Nygard 2011; NTIA SBOM. | SAME |
104
104
 
105
105
  ## The model
@@ -111,7 +111,7 @@ A CONFLICTS source sits beside an item's main source, never in place of it. Stri
111
111
  | Symptom | Fowler, [CodeSmell](https://martinfowler.com/bliki/CodeSmell.html): "a surface indication that usually corresponds to a deeper problem". | SAME |
112
112
  | Check | Thoughtworks Radar, [Architectural fitness function](https://www.thoughtworks.com/radar/techniques/architectural-fitness-function): "provides an objective integrity assessment of some architectural characteristics". | SAME |
113
113
  | Case | Fowler, [Writing Software Patterns](https://martinfowler.com/articles/writingPatterns.html): the Coplien form has "Problem, Context, Forces, and Solution". | SAME |
114
- | Record | Nygard 2011, ADR; MISRA deviation records. | SAME |
114
+ | Record | Nygard 2011, ADR. | SAME |
115
115
  | Cross-language rules with a language layer | [SEI CERT coding standards](https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/front-matter/introduction/how-this-coding-standard-is-organized): per-language standards, each with noncompliant and compliant examples. | SAME (parallel) |
116
116
  | Two addresses per finding | No source found. | NO SOURCE |
117
117
  | The chain: symptom, case, why, reason to change | No source found. Pieces only: smell to deeper problem (Fowler); problem and context (pattern form). | NO SOURCE |
@@ -136,7 +136,6 @@ None of these is closed off.
136
136
  - **Open-Closed**: would extend Upstream stays untouched to our own modules.
137
137
  - **Liskov substitution**: would extend Ports declared inside, so any adapter honours the port's contract.
138
138
  - **Tell, Don't Ask** ([Fowler](https://martinfowler.com/bliki/TellDontAsk.html)): would extend Doer or orchestrator.
139
- - **The use-case ring**: would extend External behaviour sits at a boundary, adding a layer between the domain and the adapters.
140
139
  - **Walking skeleton** (GOOS): would extend Tests are ours, with an end-to-end slice first.
141
140
  - **Humble Object** ([Meszaros](http://xunitpatterns.com/Humble%20Object.html)): would extend Tested where it's owned, keeping the untestable shell thin.
142
141
  - **Domain events**: would extend No hidden effects, making a change an explicit value.