@hailstails/hone 0.1.0-pre.6 → 0.1.0-pre.8

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 (48) hide show
  1. package/ADOPTING.md +25 -9
  2. package/CHANGELOG.md +130 -0
  3. package/MIGRATING.md +55 -16
  4. package/README.md +30 -15
  5. package/api/audit.d.ts +3 -0
  6. package/api/audit.js +10 -0
  7. package/api/rule-set.js +0 -0
  8. package/api/testing.d.ts +5 -0
  9. package/api/testing.js +211 -0
  10. package/chunks/{chunk-LOYT2AGY.js → chunk-MYX7GAVM.js} +2 -1
  11. package/chunks/{chunk-MVK5KFJI.js → chunk-NRXSM7BY.js} +1 -0
  12. package/chunks/{chunk-XB4PCY3Q.js → chunk-P3NLETF5.js} +1 -1
  13. package/chunks/{chunk-ET5EBSJX.js → chunk-POZL7G62.js} +1 -1
  14. package/chunks/chunk-XXLMIBLS.js +2172 -0
  15. package/core/check/tool-command.js +71 -2111
  16. package/core/conformance/conformance-testing-types.d.ts +28 -0
  17. package/core/conformance/conformance-types.d.ts +7 -0
  18. package/docs/extending.md +20 -8
  19. package/docs/output-contract.md +4 -4
  20. package/mechanisms/audit/CD-19/import-boundaries.js +1 -1
  21. package/mechanisms/audit/runner/README.md +2 -2
  22. package/mechanisms/audit/runner/runner.js +3 -3
  23. package/mechanisms/eslint/runner/runner.js +3 -3
  24. package/package.json +8 -3
  25. package/rules/CD-10/CHECKS.md +2 -2
  26. package/rules/CD-14/CHECKS.md +2 -2
  27. package/rules/CD-15/CHECKS.md +2 -2
  28. package/rules/CD-17/CHECKS.md +2 -2
  29. package/rules/CD-19/CHECKS.md +2 -2
  30. package/rules/CD-2/CHECKS.md +2 -2
  31. package/rules/CD-23/CHECKS.md +2 -2
  32. package/rules/CD-25/CHECKS.md +2 -2
  33. package/rules/CD-26/CHECKS.md +2 -2
  34. package/rules/CD-27/CHECKS.md +2 -2
  35. package/rules/CD-3/CHECKS.md +2 -2
  36. package/rules/CD-40/CHECKS.md +2 -2
  37. package/rules/CD-41/CHECKS.md +2 -2
  38. package/rules/CD-42/CHECKS.md +2 -2
  39. package/rules/CD-43/CHECKS.md +2 -2
  40. package/rules/CD-44/CHECKS.md +2 -2
  41. package/rules/CD-47/CHECKS.md +2 -2
  42. package/rules/CD-5/CHECKS.md +2 -2
  43. package/rules/CD-6/CHECKS.md +2 -2
  44. package/rules/CD-7/CHECKS.md +2 -2
  45. package/rules/CD-7a/CHECKS.md +2 -2
  46. package/rules/CD-8/CHECKS.md +2 -2
  47. package/api/audit.mjs +0 -1
  48. package/api/rule-set.mjs +0 -1
@@ -0,0 +1,28 @@
1
+ import type { RunnerClause } from "../mechanism-port/runner-module-types.js";
2
+ import type { RepoPath } from "../values/repo-path-types.js";
3
+ import type { Result } from "../values/result.js";
4
+ import type { ConformanceFailure } from "./conformance-types.js";
5
+ export type { ConformanceFailure } from "./conformance-types.js";
6
+ export type ClauseRequest = {
7
+ readonly ruleSetRoot: string;
8
+ readonly clause: string;
9
+ };
10
+ export type ConformanceSetupFailureKind = "address-invalid" | "file-invalid" | "rule-set-unloadable" | "clause-not-mechanical" | "runner-unloadable" | "runner-refused";
11
+ export type ConformanceSetupFailure = {
12
+ readonly kind: ConformanceSetupFailureKind;
13
+ readonly detail: string;
14
+ };
15
+ export type CaseUnderTest = {
16
+ readonly name: string;
17
+ readonly file: RepoPath;
18
+ readonly source: string;
19
+ };
20
+ export type ClauseUnderTest = {
21
+ readonly clause: RunnerClause;
22
+ readonly cases: readonly CaseUnderTest[];
23
+ };
24
+ export type ClauseConformanceOf = (request: ClauseRequest) => Promise<Result<readonly ConformanceFailure[], ConformanceSetupFailure>>;
25
+ export type ClauseUnderTestOf = (request: ClauseRequest) => Result<ClauseUnderTest, ConformanceSetupFailure>;
26
+ export type RepoPathOf = (request: {
27
+ readonly file: string;
28
+ }) => Result<RepoPath, ConformanceSetupFailure>;
@@ -0,0 +1,7 @@
1
+ import type { ClauseAddress } from "../values/clause-address-types.js";
2
+ export type ConformanceFailure = {
3
+ readonly clause: ClauseAddress;
4
+ readonly caseName: string;
5
+ readonly expectedLines: readonly number[];
6
+ readonly flaggedLines: readonly number[];
7
+ };
package/docs/extending.md CHANGED
@@ -93,7 +93,7 @@ verdict: fail
93
93
  - `id` matches the folder name. IDs are two to four capital letters, a dash and a number, with an optional lower-case letter after it.
94
94
  - Each clause lists the mechanisms that can check it. Selecting one clause adopts the whole discipline, so its other mechanical clauses must be selected too.
95
95
  - `anchor` is `{ "kind": "keyword", "keyword": "..." }` or `{ "kind": "file" }`.
96
- - `cases` say what the clause must flag and what it must leave alone. They are the clause's contract. `hone check` does not run them against a team's pieces today, and will: see [What is stable](#what-is-stable).
96
+ - `cases` say what the clause must flag and what it must leave alone. They are the clause's contract. `hone check` does not run them against a team's pieces; the team runs them in its own tests: see [Test a piece](#test-a-piece).
97
97
  - A clause with `"kind": "judgement"`, a `summary` and `"enforcedBy": "review"` is applied in review and cannot be selected.
98
98
  - `"exceptions": "refused"` on a clause stops any exception record from exempting it.
99
99
 
@@ -218,6 +218,8 @@ export const check: WalkerPiece = {
218
218
  - `prepare` runs once with the selected clauses, the repository's file list and TypeScript's syntax API. `prepareFile` runs once per tracked file and returns `skipped`, `complete` with its hits, or `syntax` with observers that walk the file's syntax tree. `finish` returns hits that need the whole repository.
219
219
  - A hit passes back the clause's `address` unchanged, a 1-based line and 0-based column, and a short snippet.
220
220
  - When the piece cannot run, for example on settings it does not accept, return a failed result whose error is a `PieceFailure`: `kind` `piece-invalid`, the clause's `pieceRoot` and a `detail`. `hone check` then stops with a load failure naming the piece folder.
221
+ - When the piece cannot parse a file, return a failed result whose error is `kind` `file-unparseable`, the `file` and a `detail`. `hone check` then stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
222
+ - To read JSON with comments, such as a `tsconfig.json`, call TypeScript's own parser on the syntax API: `syntaxApi.parseConfigFileTextToJson(file, text)` returns the parsed value as `config` and sets `error` when it cannot parse the text. A piece does not import a JSON parser of its own; see [What is stable](#what-is-stable).
221
223
 
222
224
  ### Settings a repository can change
223
225
 
@@ -266,7 +268,7 @@ Hone loads piece modules with Node, which strips the types from a `.ts` file as
266
268
 
267
269
  ## Type-check the rule set
268
270
 
269
- `@hailstails/hone/rule-set` and `@hailstails/hone/audit` hold types only. Import them with `import type`. A `tsconfig` for the rule set that matches how Node runs it, `tools/disciplines/acme/tsconfig.pieces.json`:
271
+ `@hailstails/hone/rule-set` holds types only. `@hailstails/hone/audit` holds the walker piece types and one value, `folderScope`. Import types with `import type`. A `tsconfig` for the rule set that matches how Node runs it, `tools/disciplines/acme/tsconfig.pieces.json`:
270
272
 
271
273
  ```json
272
274
  {
@@ -306,7 +308,17 @@ A wrong field then fails the type check, for example `Type 'number' is not assig
306
308
 
307
309
  Test an ESLint rule with ESLint's own `RuleTester`, importing the rule the plugin exports, such as `noConsoleCalls`, and giving it the clause's `flag` cases as `invalid` and its `allow` cases as `valid`. Run on its own with `node`, `RuleTester` prints nothing when the cases hold and throws on the first that does not; under a test runner that defines `describe` and `it`, it reports each case as a test.
308
310
 
309
- Test an audit piece end to end: commit a file that breaks the rule, run `hone check` and expect its finding, then remove the file and expect a pass. A unit test of `check` itself is harder today: clause addresses and file paths are types that only Hone creates, so a test cannot build them without a cast, and CD-2 flags that cast in a test file as anywhere else.
311
+ Test an audit piece with `@hailstails/hone/testing`. `clauseConformanceOf` loads the installed audit runner, binds the clause from the rule set as `hone check` binds it, and runs every `flag` and `allow` case through the piece:
312
+
313
+ ```ts
314
+ import { clauseConformanceOf } from "@hailstails/hone/testing";
315
+
316
+ const conformance = await clauseConformanceOf({ ruleSetRoot: "tools/disciplines/acme", clause: "acme/ACME-2#scratch-files" });
317
+ ```
318
+
319
+ A relative `ruleSetRoot` is read from the working directory. `{ outcome: "ok", value: [] }` means the piece met every case. Each entry in a longer list names a case, the lines it expects and the lines the piece flagged. `{ outcome: "failed", error: { kind, detail } }` means the cases could not run, for example `rule-set-unloadable` for a clause the audit mechanism may not check.
320
+
321
+ Checks of your own call the piece directly. `clauseUnderTestOf` returns the same bound clause and each case's `name`, `file` and `source`, ready for `check.prepare` and `prepareFile`; `repoPathOf` makes the `RepoPath` for any other file, such as one whose `readText` fails with `file-unreadable`. `folderScope` from `@hailstails/hone/audit` tells a piece whether a file sits in a generated folder. Hone does not run these tests; the team runs them with its own test runner.
310
322
 
311
323
  ## Exceptions
312
324
 
@@ -325,22 +337,22 @@ Without that setting the entry also needs a `whyChain`, and without one it is re
325
337
 
326
338
  ## What is stable
327
339
 
328
- Three requirements are decided and not yet built. Each will make some rule sets that pass today fail:
340
+ Two requirements are decided and not yet built. Each will make some rule sets that pass today fail:
329
341
 
330
- - **Cases are enforced.** `hone check` will run each selected team clause's `cases` against its piece, and fail the run as `nonconforming` when the piece misses a `flag` case or flags an `allow` case.
331
342
  - **A rule page is required.** A selected team discipline without `rules/<ID>/README.md` will fail to load.
332
- - **Pieces keep to import boundaries.** A team piece will be refused if it imports from anywhere but its own piece folder, its discipline's `rules/<ID>` folder, `@hailstails/hone/rule-set`, `@hailstails/hone/audit` and its mechanism's toolchain package (`eslint` or `typescript`), with values only from its own piece folder.
343
+ - **Pieces keep to import boundaries.** A team piece will be refused if it imports from anywhere but its own piece folder, its discipline's `rules/<ID>` folder, `@hailstails/hone/rule-set`, `@hailstails/hone/audit` and its mechanism's toolchain package (`eslint` or `typescript`), with values only from its own piece folder and `folderScope` from `@hailstails/hone/audit`. The rule is about a piece's run-time code: a piece's own tests may also import `@hailstails/hone/testing`.
333
344
 
334
- To be ready now: give every mechanical clause cases that its piece meets, write each discipline's `README.md`, and import nothing from Hone but its two public type entries.
345
+ To be ready now: write each discipline's `README.md`, and import nothing from Hone in a piece but types from `@hailstails/hone/rule-set` and `@hailstails/hone/audit` and `folderScope`.
335
346
 
336
347
  | Part | Status |
337
348
  | --- | --- |
338
349
  | `ruleSets`, the address `[<ruleSet>/]<ID>#<clause>`, `hone` reserved | Stable |
339
350
  | The folder layout `rules/<ID>/` and `mechanisms/<mechanism>/<ID>/` | Stable, with `rules/<ID>/README.md` becoming required |
340
- | `discipline.json` and `piece.json` version 1, and the ESLint piece `settings` with the namespace rule | Stable file formats; `cases` becoming enforced |
351
+ | `discipline.json` and `piece.json` version 1, and the ESLint piece `settings` with the namespace rule | Stable file formats |
341
352
  | `@hailstails/hone/rule-set` | Stable |
342
353
  | Exception records for team clauses | Stable |
343
354
  | `@hailstails/hone/audit` and the walker piece contract | Experimental: may change in a minor release |
355
+ | `@hailstails/hone/testing` | Experimental: may change in a minor release |
344
356
  | A rule set named by a package name, such as `"acme": "@acme/disciplines"` | Not supported: name its repository path instead, as under [TypeScript pieces under Node](#typescript-pieces-under-node) |
345
357
  | A new mechanism from outside Hone | Not supported |
346
358
 
@@ -10,8 +10,8 @@ Hone prints everything to standard output: the report, the help, the version, `h
10
10
 
11
11
  The exit code is the signal a hook should act on:
12
12
 
13
- - `0`: `hone check` printed `verdict: pass`, `hone project` wrote or confirmed every projection, or help or the version was printed;
14
- - `1`: `hone check` printed `verdict: fail` as its last line. Exit `1` always comes with that line, and with nothing else;
13
+ - `0`: `hone check` printed `verdict: pass` or `verdict: pass (partial assessment)`, `hone project` wrote or confirmed every projection, or help or the version was printed;
14
+ - `1`: `hone check` printed `verdict: fail` or `verdict: fail (partial assessment)` as its last line. Exit `1` always comes with one of those lines, and with nothing else;
15
15
  - `2`: Hone could not decide. It printed exactly one line, starting with `load failure: `, and no verdict. That covers a command typed wrongly, an input that could not be loaded, a mechanism that failed, and an error Hone did not expect, which prints as `unexpected-error`.
16
16
 
17
17
  A 1.0 hook can rely on this: run `hone check`, block on any non-zero exit, and show standard output as it came.
@@ -62,7 +62,7 @@ In the tables below, a word in angle brackets, such as `<clause>`, stands for a
62
62
  | `<comment>`, `<script>`, `<option>`, `<source>` | the native exception's comment, the `package.json` script name and the option in it, or where an imported record came from | may hold a space |
63
63
  | `<detail>`, `<given>`, `<values>`, `<rule set>`, `<other rule set>`, `<clause with its rule set>`, `<version found>`, `<other package>`, `<range>` | text from the input, a tool or the command as typed | may hold a space |
64
64
 
65
- Paths are printed with forward slashes. A path inside the `--repo` folder is printed relative to it, in the report and in load failures alike. A path outside it is printed absolute, such as `C:/Users/me/shared/rule.json` on Windows. A load failure from before `--repo` is resolved names the folder as typed (`<dir>`). A load failure reading the installed package's own `package.json`, which only `hone --version` reads, prints its absolute path. A path inside a `<detail>` is printed however the tool that wrote the detail printed it.
65
+ Paths are printed with forward slashes. A path inside the `--repo` folder is printed relative to it, in the report and in load failures alike. A path outside it is printed absolute, such as `C:/Users/me/shared/rule.json` on Windows. A load failure from before `--repo` is resolved names the folder as typed (`<dir>`). A path into Hone's own package, such as a `<rule page>`, the `<adoption guide>`, a `<piece folder>` or the `<install folder>`, is printed through the repository's `node_modules/@hailstails/hone` when that folder holds the same `package.json` as the package that is running, as it does under pnpm, which runs the package from its store under `node_modules/.pnpm`. When the repository root has no such folder, as when the package is installed only in a workspace package, installed globally or run from a source checkout, the path is printed where the running package is, by the rules above. A load failure reading the installed package's own `package.json`, which only `hone --version` reads, prints its absolute path. A path inside a `<detail>` is printed however the tool that wrote the detail printed it.
66
66
 
67
67
  ## Commands
68
68
 
@@ -73,7 +73,7 @@ hone --help
73
73
  hone --version
74
74
  ```
75
75
 
76
- Each option is followed by its value as the next argument; a value that starts with `-` is read as a missing value. `--help` or `-h` after a command prints that command's help instead of running it, and `hone --help <command>` prints the same. `hone --help` and `hone --version` take nothing else after them.
76
+ Each option is followed by its value as the next argument; a value that starts with `-` is read as a missing value. A bare `--` where an option is expected is skipped and the options after it are still read, so `pnpm run <script> -- <options>` works whether or not the package manager passes the `--` on; a `--` where a value is expected is a missing value, like any value that starts with `-`. `--help` or `-h` after a command prints that command's help instead of running it, and `hone --help <command>` prints the same. `hone --help` and `hone --version` take nothing else after them.
77
77
 
78
78
  `hone --help` prints:
79
79
 
@@ -68,7 +68,7 @@ var check = {
68
68
  const record = (specifier) => {
69
69
  if (specifier === void 0 || !syntaxApi.isStringLiteralLike(specifier) || !specifier.text.startsWith("node:")) return;
70
70
  const anchor = anchorAt({ position: specifier.getStart(sourceFile) });
71
- const snippet = `bare node: stdlib import - use the kernel port package: ${specifier.text}`;
71
+ const snippet = `bare node: stdlib import - confined; only a wrapping file this repository records as an authorised location may import it: ${specifier.text}`;
72
72
  nodeHits.push(...clauses.map((clause) => ({ clause: clause.address, anchor, snippet })));
73
73
  };
74
74
  return {
@@ -19,7 +19,7 @@ The audit runner is Hone's standalone mechanism for checks that read a project's
19
19
  - `observe-walker-file.ts` offers one file to every prepared piece, parses it once if any piece asks for syntax, walks it, and collects the hits.
20
20
  - `create-walker-runner.ts` builds the runner from its ports: file text, module loading, paths and parsing.
21
21
  - `typescript-parse.ts` binds the parse port to TypeScript. It parses with parent pointers set, so a piece can walk a node's ancestors through `node.parent`.
22
- - `jsonc-parse.ts` parses JSON with comments, for pieces that read configuration such as `tsconfig.json`.
22
+ - `jsonc-parse.ts` parses JSON with comments for Hone's own pieces, such as the one that reads `tsconfig.json`. It is not one of the package's public entries. A team's piece reads such a file with TypeScript's own parser on the syntax API `prepare` hands it, `syntaxApi.parseConfigFileTextToJson(file, text)`, which returns the parsed value as `config` and sets `error` when it cannot parse the text.
23
23
  - `runner.ts` is the runner core loads, wired to the default ports.
24
24
  - `piece-type-packages.json` lists the packages a piece may import types from. It is not the runtime list above.
25
25
 
@@ -37,4 +37,4 @@ After every file, the prepared check's `finish` may return repository-wide hits,
37
37
 
38
38
  `conform` runs each case of a clause's `discipline.json` as a one-file repository holding only that case.
39
39
 
40
- A piece that throws, or returns a value outside its schema, makes the run fail as `piece-invalid`.
40
+ A piece that throws, or returns a value outside its schema, makes the run fail as `piece-invalid`. A piece that cannot parse a file returns a failed result whose error is `{ kind: "file-unparseable", file, detail }`, and the check stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
@@ -6,12 +6,12 @@ import {
6
6
  import {
7
7
  hitSchema,
8
8
  runnerResultSchema
9
- } from "../../../chunks/chunk-LOYT2AGY.js";
9
+ } from "../../../chunks/chunk-MYX7GAVM.js";
10
10
  import {
11
11
  createDefaultPackageLocationPort,
12
12
  installRootOfRunnerEntry,
13
13
  toolchainBoundStandaloneRunner
14
- } from "../../../chunks/chunk-XB4PCY3Q.js";
14
+ } from "../../../chunks/chunk-P3NLETF5.js";
15
15
  import {
16
16
  gatheredOutcomes
17
17
  } from "../../../chunks/chunk-LDQUT742.js";
@@ -24,7 +24,7 @@ import {
24
24
  loadedPeer,
25
25
  moduleExtensionOf,
26
26
  moduleFileForm
27
- } from "../../../chunks/chunk-MVK5KFJI.js";
27
+ } from "../../../chunks/chunk-NRXSM7BY.js";
28
28
  import {
29
29
  external_exports,
30
30
  sameClauseAddress
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  eslintConfigLookupSchema,
3
3
  parsedJson
4
- } from "../../../chunks/chunk-ET5EBSJX.js";
4
+ } from "../../../chunks/chunk-POZL7G62.js";
5
5
  import {
6
6
  createDefaultPackageLocationPort,
7
7
  installRootOfRunnerEntry,
8
8
  toolchainBoundEmbeddedRunner
9
- } from "../../../chunks/chunk-XB4PCY3Q.js";
9
+ } from "../../../chunks/chunk-P3NLETF5.js";
10
10
  import {
11
11
  gatheredOutcomes,
12
12
  listedOutcome
@@ -28,7 +28,7 @@ import {
28
28
  moduleFileForm,
29
29
  repoPathSchema,
30
30
  versionSupport
31
- } from "../../../chunks/chunk-MVK5KFJI.js";
31
+ } from "../../../chunks/chunk-NRXSM7BY.js";
32
32
  import {
33
33
  TOOL_IDENTITY,
34
34
  clauseAddressText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailstails/hone",
3
- "version": "0.1.0-pre.6",
3
+ "version": "0.1.0-pre.8",
4
4
  "description": "Checks a repository against the disciplines it selects, applies its recorded exceptions and prints one verdict.",
5
5
  "keywords": [
6
6
  "disciplines",
@@ -30,11 +30,15 @@
30
30
  "./package.json": "./package.json",
31
31
  "./audit": {
32
32
  "types": "./api/audit.d.ts",
33
- "default": "./api/audit.mjs"
33
+ "default": "./api/audit.js"
34
34
  },
35
35
  "./rule-set": {
36
36
  "types": "./api/rule-set.d.ts",
37
- "default": "./api/rule-set.mjs"
37
+ "default": "./api/rule-set.js"
38
+ },
39
+ "./testing": {
40
+ "types": "./api/testing.d.ts",
41
+ "default": "./api/testing.js"
38
42
  },
39
43
  "./mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js": "./mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js",
40
44
  "./mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js": "./mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js",
@@ -50,6 +54,7 @@
50
54
  },
51
55
  "files": [
52
56
  "ADOPTING.md",
57
+ "CHANGELOG.md",
53
58
  "LICENSE",
54
59
  "MIGRATING.md",
55
60
  "README.md",
@@ -38,7 +38,7 @@ it("loads the account", () => {
38
38
  Assert on the whole result. Branching in tests is also reported by CD-27.
39
39
 
40
40
  ## Exceptions
41
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs a throw, such as a shared test harness. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
41
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs a throw, such as a shared test harness. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
42
42
 
43
43
  ```json
44
44
  { "version": 1, "exceptions": [
@@ -46,4 +46,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
46
46
  ] }
47
47
  ```
48
48
 
49
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
49
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -38,7 +38,7 @@ export const createCounter = () => {
38
38
  Return an object of functions from a factory that closes over its state.
39
39
 
40
40
  ## Exceptions
41
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a class is required, such as an adapter extending a library base class. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
41
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a class is required, such as an adapter extending a library base class. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
42
42
 
43
43
  ```json
44
44
  { "version": 1, "exceptions": [
@@ -46,4 +46,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
46
46
  ] }
47
47
  ```
48
48
 
49
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
49
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -29,7 +29,7 @@ const totals = orders.map((order) => order.total);
29
29
  Replace a counted loop with `Array.from({ length }, (_, position) => ...)`.
30
30
 
31
31
  ## Exceptions
32
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file drains an async stream and cannot use a functional form. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
32
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file drains an async stream and cannot use a functional form. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
33
33
 
34
34
  ```json
35
35
  { "version": 1, "exceptions": [
@@ -37,4 +37,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
37
37
  ] }
38
38
  ```
39
39
 
40
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
40
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -26,7 +26,7 @@ const startedAt = clock.now();
26
26
  Accept a clock as a dependency and read time only through it. The one real implementation lives in an adapter.
27
27
 
28
28
  ## Exceptions
29
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the single real clock implementation. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
29
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the single real clock implementation. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
30
30
 
31
31
  ```json
32
32
  { "version": 1, "exceptions": [
@@ -34,4 +34,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
34
34
  ] }
35
35
  ```
36
36
 
37
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
37
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -38,7 +38,7 @@ import { createIdGenerator } from "./id-generator.ts";
38
38
  Import your own port. Only the wrapping file imports the library.
39
39
 
40
40
  ## Exceptions
41
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the wrapping boundary for that dependency. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
41
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the wrapping boundary for that dependency. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
42
42
 
43
43
  ```json
44
44
  { "version": 1, "exceptions": [
@@ -46,4 +46,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
46
46
  ] }
47
47
  ```
48
48
 
49
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
49
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -43,7 +43,7 @@ Parse or narrow the value so the type follows from a check rather than from an a
43
43
  When handing a value across a boundary truly forces a cast, such as a library that types its schemas loosely or a database driver that returns unparsed rows, put the cast in the one adapter file at that boundary and record that file as an `authorised-location` with a why-chain. With clean boundaries that is one file and one record; casts scattered across many files are the sign the boundary is missing.
44
44
 
45
45
  ## Exceptions
46
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file sits on an external boundary that forces an assertion, such as an adapter. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
46
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file sits on an external boundary that forces an assertion, such as an adapter. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
47
47
 
48
48
  ```json
49
49
  { "version": 1, "exceptions": [
@@ -53,4 +53,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
53
53
 
54
54
  Records on `CD-2#non-null-assertions` take the same kinds. Existing `!` debt is usually a `file-carve-out` per file, or one `clause-wide-carve-out` while an assessment's steps pay it down. An `eslint-disable` naming `hone-cd2/no-restricted-syntax`, or naming no rule, is held only by an `authorised-location` or `file-carve-out` on this clause and its file; a `clause-wide-carve-out` does not hold it. The projection carries every record for it, so run `hone project` after recording one.
55
55
 
56
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
56
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -24,7 +24,7 @@ This is `src/price.ts` with no `src/price.test.ts` beside it.
24
24
  Add `src/price.test.ts` next to the file, with at least one test of its behaviour.
25
25
 
26
26
  ## Exceptions
27
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file only wires exports together and has no behaviour of its own to test. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
27
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file only wires exports together and has no behaviour of its own to test. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
28
28
 
29
29
  ```json
30
30
  { "version": 1, "exceptions": [
@@ -32,4 +32,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
32
32
  ] }
33
33
  ```
34
34
 
35
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
35
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -27,7 +27,7 @@ const clock = { now: vi.fn().mockReturnValue(1) };
27
27
  Return a canned value: that double is a stub. If the double needs logic, the seam is probably too wide, or the double is a fake that belongs in a shared in-memory implementation of the port with its own tests.
28
28
 
29
29
  ## Exceptions
30
- A double that legitimately needs behaviour is a fake: write it once as an in-memory implementation of the port, in its own module with its own tests, and pass it in. That is the home for the behaviour, not an exception for a test file. For debt in one file, add a `file-carve-out` entry to `discipline-exceptions.json` at the repository root: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
30
+ A double that legitimately needs behaviour is a fake: write it once as an in-memory implementation of the port, in its own module with its own tests, and pass it in. That is the home for the behaviour, not an exception for a test file. For debt in one file, add a `file-carve-out` entry to `discipline-exceptions.json` at the repository root: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
31
31
 
32
32
  ```json
33
33
  { "version": 1, "exceptions": [
@@ -35,4 +35,4 @@ A double that legitimately needs behaviour is a fake: write it once as an in-mem
35
35
  ] }
36
36
  ```
37
37
 
38
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
38
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -25,7 +25,7 @@ const subject = createSubject({ store: storeStub });
25
25
  Pass the collaborator in as a dependency and hand the test a stub.
26
26
 
27
27
  ## Exceptions
28
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs to intercept a module. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
28
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs to intercept a module. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
29
29
 
30
30
  ```json
31
31
  { "version": 1, "exceptions": [
@@ -33,4 +33,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
33
33
  ] }
34
34
  ```
35
35
 
36
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
36
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -34,7 +34,7 @@ expect(ids).toEqual(["a1", "b2"]);
34
34
  Write the expected value out. A method call in the act step is flagged too, so move such logic into the unit under test.
35
35
 
36
36
  ## Exceptions
37
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs logic. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
37
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a test file legitimately needs logic. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
38
38
 
39
39
  ```json
40
40
  { "version": 1, "exceptions": [
@@ -42,4 +42,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
42
42
  ] }
43
43
  ```
44
44
 
45
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
45
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -31,7 +31,7 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
31
31
  Put the flags in a shared base file that is not named `tsconfig.json`, and leave them out of every `tsconfig.json`. That the base file turns them on is left to review.
32
32
 
33
33
  ## Exceptions
34
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a package must set the flag itself. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
34
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a package must set the flag itself. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
35
35
 
36
36
  ```json
37
37
  { "version": 1, "exceptions": [
@@ -39,4 +39,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
39
39
  ] }
40
40
  ```
41
41
 
42
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
42
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -28,7 +28,7 @@ const createOrder = ({ customerId, items, currency }: OrderRequest) => ({ custom
28
28
  Take one object with named fields so each call site reads as a labelled contract.
29
29
 
30
30
  ## Exceptions
31
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must implement a callback signature fixed by an external library. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. Judgement clauses cannot be selected and need no exception record. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
31
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must implement a callback signature fixed by an external library. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. Judgement clauses cannot be selected and need no exception record. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
32
32
 
33
33
  ```json
34
34
  { "version": 1, "exceptions": [
@@ -36,4 +36,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
36
36
  ] }
37
37
  ```
38
38
 
39
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
39
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -43,7 +43,7 @@ const settle = (orders: Order[]) => orders.filter(isPaid).forEach(refundEligible
43
43
  Move each branch into a named helper so the orchestrator only composes calls.
44
44
 
45
45
  ## Exceptions
46
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file holds a function whose shape is fixed by an external contract. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. Judgement clauses cannot be selected and need no exception record. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
46
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file holds a function whose shape is fixed by an external contract. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. Judgement clauses cannot be selected and need no exception record. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
47
47
 
48
48
  ```json
49
49
  { "version": 1, "exceptions": [
@@ -51,4 +51,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
51
51
  ] }
52
52
  ```
53
53
 
54
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
54
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -36,7 +36,7 @@ const label = (order: Order) => {
36
36
  Handle the unhappy path first with an early return and leave the happy path as the final return.
37
37
 
38
38
  ## Exceptions
39
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must keep an else for an external reason. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. Judgement clauses cannot be selected and need no exception record. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
39
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must keep an else for an external reason. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. Judgement clauses cannot be selected and need no exception record. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
40
40
 
41
41
  ```json
42
42
  { "version": 1, "exceptions": [
@@ -44,4 +44,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
44
44
  ] }
45
45
  ```
46
46
 
47
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
47
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -26,7 +26,7 @@ const render = (mode: "compact" | "full"): string => "";
26
26
  Name each state in the type.
27
27
 
28
28
  ## Exceptions
29
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must follow an external interface that uses a boolean. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
29
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must follow an external interface that uses a boolean. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
30
30
 
31
31
  ```json
32
32
  { "version": 1, "exceptions": [
@@ -34,4 +34,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
34
34
  ] }
35
35
  ```
36
36
 
37
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
37
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -37,7 +37,7 @@ const withTotal = (order: Order): Order => ({ ...order, total: 10 });
37
37
  Copy before sorting or reversing: `[...items].sort()`.
38
38
 
39
39
  ## Exceptions
40
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must fill an output object supplied by an external API. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
40
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file must fill an output object supplied by an external API. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
41
41
 
42
42
  ```json
43
43
  { "version": 1, "exceptions": [
@@ -45,4 +45,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
45
45
  ] }
46
46
  ```
47
47
 
48
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
48
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -26,7 +26,7 @@ spawnSync("git", ["init"], { cwd: directory, env: hermeticGitEnvironment() });
26
26
  Build the environment without inherited git variables or the user's configuration, and run in a temporary directory.
27
27
 
28
28
  ## Exceptions
29
- Record exemptions only in `discipline-exceptions.json` at the repository root; core reads no other allowance file. Use `authorised-location` when a test file legitimately builds its environment another way. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
29
+ Record exemptions only in `discipline-exceptions.json` at the repository root; core reads no other allowance file. Use `authorised-location` when a test file legitimately builds its environment another way. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
30
30
 
31
31
  ```json
32
32
  { "version": 1, "exceptions": [
@@ -34,4 +34,4 @@ Record exemptions only in `discipline-exceptions.json` at the repository root; c
34
34
  ] }
35
35
  ```
36
36
 
37
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
37
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
@@ -41,7 +41,7 @@ const first = items[0];
41
41
  Remove the need for the directive. If it must stay, add a tracked reference to the work that removes it: `// biome-ignore lint/style/noNonNullAssertion: until items is typed as a non-empty tuple (#42)`. The reference satisfies this clause only. A directive that escapes a selected clause, such as an `eslint-disable` naming a selected rule or a `@ts-expect-error` under `CD-2#cast-expressions`, still needs a file record on that clause, and that record does not satisfy this clause.
42
42
 
43
43
  ## Exceptions
44
- Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file legitimately carries untracked directives, such as generated code. Use `file-carve-out` for debt in one file: it needs a `whyChain` and is forfeited once the file is touched. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
44
+ Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file legitimately carries untracked directives, such as generated code. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
45
45
 
46
46
  ```json
47
47
  { "version": 1, "exceptions": [
@@ -49,4 +49,4 @@ Add an entry to `discipline-exceptions.json` at the repository root. Use `author
49
49
  ] }
50
50
  ```
51
51
 
52
- Every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. The one exception is a record imported from an earlier system, which carries `provenance` instead. [The exceptions format](../../README.md#discipline-exceptionsjson) gives both shapes.
52
+ By default every record, `authorised-location` included, also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` may give only its `reason`; a `clause-wide-carve-out` still needs its `whyChain`. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.