@hailstails/hone 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/ADOPTING.md +4 -4
  2. package/CHANGELOG.md +22 -0
  3. package/MIGRATING.md +5 -5
  4. package/README.md +14 -8
  5. package/api/audit.d.ts +1 -1
  6. package/api/testing.js +4 -4
  7. package/chunks/{chunk-BLGGM7AV.js → chunk-H4V72FCW.js} +1 -1
  8. package/chunks/{chunk-PVCA3ISA.js → chunk-PL2PNPAR.js} +1 -1
  9. package/chunks/{chunk-CBWWAKQY.js → chunk-T32FOWZA.js} +1 -1
  10. package/chunks/{chunk-MZTLH4EU.js → chunk-Y2KPZDDV.js} +21 -1
  11. package/chunks/{chunk-63SJV5ZY.js → chunk-YSN46EB3.js} +41 -22
  12. package/core/check/tool-command.js +47 -30
  13. package/docs/adding-a-discipline-or-mechanism.md +1 -1
  14. package/docs/extending.md +5 -6
  15. package/docs/output-contract.md +8 -4
  16. package/mechanisms/audit/CD-3/compiler-overrides.js +193 -29
  17. package/mechanisms/audit/CD-3/piece.json +35 -7
  18. package/mechanisms/audit/runner/README.md +3 -2
  19. package/mechanisms/audit/runner/runner.js +42 -6
  20. package/mechanisms/audit/runner/walker-piece.d.ts +12 -0
  21. package/mechanisms/eslint/runner/README.md +1 -1
  22. package/mechanisms/eslint/runner/runner.js +60 -23
  23. package/package.json +1 -1
  24. package/rules/CD-10/CHECKS.md +2 -2
  25. package/rules/CD-14/CHECKS.md +2 -2
  26. package/rules/CD-15/CHECKS.md +2 -2
  27. package/rules/CD-17/CHECKS.md +2 -2
  28. package/rules/CD-19/CHECKS.md +2 -2
  29. package/rules/CD-2/CHECKS.md +2 -2
  30. package/rules/CD-23/CHECKS.md +2 -2
  31. package/rules/CD-25/CHECKS.md +2 -2
  32. package/rules/CD-26/CHECKS.md +2 -2
  33. package/rules/CD-27/CHECKS.md +2 -2
  34. package/rules/CD-3/CHECKS.md +35 -11
  35. package/rules/CD-3/discipline.json +278 -0
  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
package/ADOPTING.md CHANGED
@@ -356,7 +356,7 @@ Before recording anything, take the chain in [the spirit of the rules](rules/SPI
356
356
  - `file-carve-out`: known debt in one file. It is forfeited, and fails the run, as soon as that file changes since `--base-revision`. An `eslint-disable` comment or a `@ts-expect-error`, `@ts-ignore` or `@ts-nocheck` directive already in a file is debt of this kind on the clause it escapes; a new one in a file with no record is `unrecorded`.
357
357
  - `clause-wide-carve-out`: debt across the whole clause. The rule binds and its check is sound, and the codebase cannot address the debt right now. Its why-chain records why, and the debt has an owner who will pay it down. The check still runs, and a clause-wide carve-out that exempts no finding is `stale`, so record one only while the clause still has findings. Leaving the clause out of `clauses` is not an alternative: it leaves the clause `uncovered`. If the check is not a true measure of the rule here, or cannot work here, list the clause as `"not-run"` instead; if the rule does not apply, list it as `"not-adopted"` (step 4).
358
358
 
359
- Every entry needs a `reason`. By default every entry also needs a `whyChain` shaped like this, with exactly five steps in `whys`:
359
+ A `file-carve-out` is debt and needs only its `kind`, `clause` and `file`; its `reason` is an optional note to future developers. Every other entry needs a `reason`, and an `authorised-location` or `clause-wide-carve-out` also needs a `whyChain` shaped like this, with exactly five steps in `whys`:
360
360
 
361
361
  ```json
362
362
  "whyChain": {
@@ -380,14 +380,14 @@ Debt or authorisations already recorded by an earlier system, for example the ol
380
380
 
381
381
  The records live in `discipline-exceptions.json` by default. To keep one file for each rule and kind instead, so the name of a changed file says which rule and which kind a change touches, move to the split layout with `hone split-records`, as [MIGRATING.md](MIGRATING.md#16-moving-to-the-split-layout) section 16 shows; [README.md](README.md#the-split-layout) describes the layout. Everything that reads or writes records works the same in either.
382
382
 
383
- To record existing debt without a chain on every entry, set `"fileExceptionWhyChains": "optional"` in `disciplines.json`; step 7a writes those records for you. An `authorised-location` or `file-carve-out` entry may then give only its `reason`, so write the reason as why the exception exists; a blank reason is refused. A run with any file carve-out still needs `--base-revision`, or it reports `forfeiture-unmeasured` and fails. A `clause-wide-carve-out` still needs its `whyChain`, and a `whyChain` or `provenance` you give anyway is still checked. [README.md](README.md#discipline-exceptionsjson) has the details.
383
+ Existing debt needs no chain and no reason: a `file-carve-out` names only its clause and file, and step 7a writes those records for you. Add a `reason` if you want to leave future developers a note on what the debt signals. A run with any file carve-out still needs `--base-revision`, or it reports `forfeiture-unmeasured` and fails. `"fileExceptionWhyChains": "optional"` in `disciplines.json` lets an `authorised-location` give only its `reason` too, but a reason-only `authorised-location` will be refused in the next major release. A `clause-wide-carve-out` still needs its `whyChain`, and a `whyChain` or `provenance` you give anyway is still checked. [README.md](README.md#discipline-exceptionsjson) has the details.
384
384
 
385
385
  ### 7a. Record the debt you inherit
386
386
 
387
387
  A repository with existing code usually has more findings than the change that adopts Hone can fix. `hone record-debt` writes a `file-carve-out` for each clause and file the check finds broken, so the first passing run does not wait on hundreds of records written by hand. Do this after the assessment (step 5a), and after fixing what you are going to fix in this change.
388
388
 
389
389
  1. **Decide the permanent exceptions first.** List each file or folder that breaks a clause on purpose and always will, such as the one adapter that reads the real clock. Those are not debt. They get an `authorised-location` with their own reason, written by a person, so keep them out of the generated records with `--leave`.
390
- 2. **Accept reason-only records.** Set `"fileExceptionWhyChains": "optional"` in `disciplines.json`. Without it the command writes nothing and stops with `load failure: why-chains-required`.
390
+ 2. **Leave `disciplines.json` as it is, and put every check on this release.** The records the command writes are file carve-outs, which are debt and need no `whyChain` and no `reason`, so it needs no setting. The same command records debt a later change uncovers, such as a newly selected clause or a newer edition: run it again against the branch's base. A Hone from before file carve-outs could leave out `reason` refuses such a record: the whole check stops with `load failure: file-malformed <records file> … at exceptions[<index>].reason` and exits `2`. So before the command writes any record, update the Hone that every pre-push hook, CI job and other machine runs to this release or later, as [ADOPTING.md](#10-update-and-remove) step 10 says, or that check stops.
391
391
  3. **Finish every source file this change edits.** Decay is assessed against the branch's base, the revision your pre-push hook and CI pass to the check (step 5), such as `origin/main`, not against the commit you run from. A file the adopting change edits has changed since that base, so a record for it is forfeited there, even after you commit the edit. In each file this change edits, fix every finding of each clause, or take the edit out of this change and make it later in a change that fixes the file. A file this change adds has no record to lose: point 4 reports it `new-file`.
392
392
  4. **Run it once, with the branch's base as `--base-revision`**, one `--leave` for each path from point 1. Fetch the base first, so the revision is current:
393
393
 
@@ -396,7 +396,7 @@ A repository with existing code usually has more findings than the change that a
396
396
  node_modules/.bin/hone record-debt --repo . --base-revision origin/main --leave src/clock.ts --leave src/adapters
397
397
  ```
398
398
 
399
- It prints one line per clause and file. `recorded` lines are records it added to the exception records. `left` lines are files under a `--leave` path: write their `authorised-location` records now, each with its own reason. `new-file` lines are files the base revision does not hold, so nothing in them was inherited: fix them, or record them yourself with a reason of your own. `already-recorded` and `refused` lines say why nothing was written; [README.md](README.md#recording-inherited-debt) has the details.
399
+ It prints one line per clause and file. `recorded` lines are records it added to the exception records. `left` lines are files under a `--leave` path: write their `authorised-location` records now, each with its own reason. `new-file` lines are files the base revision does not hold, so nothing in them was inherited: fix them, or record them yourself with a reason of your own. `already-recorded`, `refused` and `nested-configuration` lines say why nothing was written; [README.md](README.md#recording-inherited-debt) has the details.
400
400
  5. **Re-project and check against the same base.** With any `eslint` clause, run `npm run --silent hone:project`. Then run `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main` (with pnpm, `pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main`). `--forfeiture this-run` makes this run assess decay whatever `assessment.forfeiture` says, as the run that assesses it for your repository does: the pre-push hook with `"forfeiture": "elsewhere"` (step 5), or CI without it. A `forfeited` line names a file this change edits: go back to point 3 for it. A check against `HEAD` hides those lines, because nothing has changed since `HEAD`, and the hook or CI then fails where this run passed. The generated records leave only what point 4 did not record, such as `config-override` or lint-script options under `unrecorded`, which step 6 says how to clear.
401
401
  6. **Review the diff.** Nothing takes effect until you commit it. Each generated record says it is inherited debt that nobody has reviewed, and the reviewer of the adopting change reads them as that. Note them in each clause's Debt line in `disciplines.assessment.md`.
402
402
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  Every release of Hone, newest first. `pnpm run release-pull-request` writes each new section from the commits merged to `main` since the previous release tag, whose subjects are the squash-merged pull request titles; README.md's Compatibility section says what each kind of release may change. The sections below were written by hand from the merged pull requests when the changelog started.
4
4
 
5
+ ## 1.3.0
6
+
7
+ ### Features
8
+
9
+ - debt records need no reason or why-chain (#147)
10
+ - record-debt skips files the ESLint projection cannot reach (#153)
11
+
12
+ ### Fixes
13
+
14
+ - pass over a package.json script whose quotes do not pair, and list one naming eslint as an unreadable command-line-option (#139)
15
+
16
+ ### Other changes
17
+
18
+ - keep Hone's own exception records in the split layout (#140)
19
+ - run CD-27 test-body-logic and the CD-3 clauses at edition 2, and record Hone's backlog as debt (#157)
20
+
21
+ ## 1.2.0
22
+
23
+ ### Features
24
+
25
+ - add CD-3 edition 2, judging the options a tsconfig.json resolves to through extends, and a required disk on the experimental audit WalkerRepository (#136)
26
+
5
27
  ## 1.1.0
6
28
 
7
29
  ### Features
package/MIGRATING.md CHANGED
@@ -103,17 +103,17 @@ Each converted record is imported: give it `provenance` naming the old record in
103
103
  }
104
104
  ```
105
105
 
106
- `source` is the old file and the entry's position in its array, counting from `0`, so both files in the example above use `.constitution-carve-outs/cd-15.json#0`. An authorised location uses `{ "kind": "existing-authorisation", "source": ".constitution-authorised-locations/cd-<id>.json#<index>" }`. Hone accepts an imported record only while the `--base-revision` holds it unchanged or its `source` entry lists the record's file at that revision, so keep the old record files committed until step 6, and run every check in this migration with `--base-revision HEAD`. A record you write for new debt, or an imported record you later change, needs a full `whyChain` that follows the [why-chain contract](docs/why-chain-contract.md): Hone refuses it as `import-unverified` otherwise. A repository whose `disciplines.json` sets `"fileExceptionWhyChains": "optional"` may instead give such an `authorised-location` or `file-carve-out` only its `reason`, with no `whyChain` and no `provenance`.
106
+ `source` is the old file and the entry's position in its array, counting from `0`, so both files in the example above use `.constitution-carve-outs/cd-15.json#0`. An authorised location uses `{ "kind": "existing-authorisation", "source": ".constitution-authorised-locations/cd-<id>.json#<index>" }`. Hone accepts an imported record only while the `--base-revision` holds it unchanged or its `source` entry lists the record's file at that revision, so keep the old record files committed until step 6, and run every check in this migration with `--base-revision HEAD`. An imported record you later change needs a full `whyChain` that follows the [why-chain contract](docs/why-chain-contract.md), or, for a `file-carve-out`, no `provenance` at all: Hone refuses it as `import-unverified` otherwise. A `file-carve-out` is debt, so a record you write for new debt needs only its clause and file, with no `whyChain` and no `provenance`; a `reason` is an optional note. An `authorised-location` you write needs a `whyChain`; a repository whose `disciplines.json` sets `"fileExceptionWhyChains": "optional"` may give one only its `reason`, which will be refused in the next major release.
107
107
 
108
108
  An imported `file-carve-out` needs a `decision`: copy the old entry's. If the old entry has none, stop and ask the human who accepted the debt. An imported `authorised-location` needs no `decision`: copy the old entry's if it has one, otherwise give `kind` and `source` only. Never write a placeholder or a root cause that only says the check was failing: Hone refuses those as `invalidRecords`.
109
109
 
110
- Once the old records are converted, what is left is debt no old record covers: findings in a folder whose relaxed rule set was not carried over (step 2a), clauses the old route never checked, and inline disables or `@ts-expect-error` directives the old tool accepted ([section 14](#14-moving-to-recorded-inline-exceptions)). When the human approves recording it, set `"fileExceptionWhyChains": "optional"` in `disciplines.json` and run, with one `--leave` for each file the human decided is a permanent exception:
110
+ Once the old records are converted, what is left is debt no old record covers: findings in a folder whose relaxed rule set was not carried over (step 2a), clauses the old route never checked, and inline disables or `@ts-expect-error` directives the old tool accepted ([section 14](#14-moving-to-recorded-inline-exceptions)). When the human approves recording it, run, with one `--leave` for each file the human decided is a permanent exception:
111
111
 
112
112
  ```bash
113
113
  node_modules/.bin/hone record-debt --repo . --base-revision origin/main --leave <path>
114
114
  ```
115
115
 
116
- Give it the branch's base, `origin/main`, not `HEAD` as this migration's other checks do: after step 6 the pre-push hook and CI assess decay against that base, so a record for a file this branch edits passes a check against `HEAD` and is forfeited there. Finish each file the migration edits, as [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a point 3 says, and confirm with `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main`, which assesses decay in that run whatever `assessment.forfeiture` says. It adds a reason-only `file-carve-out` for each clause and file that no converted record holds, and leaves the converted records as they are. A converted record still holds its pair, so the command reports it `already-recorded` only if the check does not accept it; fix that record rather than adding another. [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a says how to read its output and review the result.
116
+ Give it the branch's base, `origin/main`, not `HEAD` as this migration's other checks do: after step 6 the pre-push hook and CI assess decay against that base, so a record for a file this branch edits passes a check against `HEAD` and is forfeited there. Finish each file the migration edits, as [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a point 3 says, and confirm with `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main`, which assesses decay in that run whatever `assessment.forfeiture` says. Before you run it, put every pre-push hook, CI job and other machine that runs the check on this release or later: the records it writes give no `reason`, and a Hone from before file carve-outs could leave out `reason` stops with `load failure: file-malformed` on them. It adds a `file-carve-out` naming only its clause and file for each clause and file that no converted record holds, and leaves the converted records as they are. A converted record still holds its pair, so the command reports it `already-recorded` only if the check does not accept it; fix that record rather than adding another. [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a says how to read its output and review the result.
117
117
 
118
118
  ## 4. Replace the hand-written linter rules
119
119
 
@@ -192,7 +192,7 @@ Stop and ask the human if anything outside the old trial uses the copied tools o
192
192
  | --- | --- | --- |
193
193
  | What is installed | rule text only; checks were the repository's own linters, plus an optional copied tools tree | one package that runs every selected check |
194
194
  | Selection | whole CD files, read by an agent; a check ran only if wired by hand | clauses in `disciplines.json`; every mechanical clause of an adopted discipline must be selected |
195
- | First-adoption debt | inherited debt could be recorded without a why-chain | imported with `provenance` and no `whyChain`, accepted only while unchanged since `--base-revision`; new or edited exceptions need a causal five-step `whyChain` ([contract](docs/why-chain-contract.md)), unless `disciplines.json` sets `"fileExceptionWhyChains": "optional"`, which lets file-level exceptions give only a `reason` |
195
+ | First-adoption debt | inherited debt could be recorded without a why-chain | imported with `provenance` and no `whyChain`, accepted only while unchanged since `--base-revision`; a `file-carve-out` is debt and needs only its clause and file; a new or edited `authorised-location` or `clause-wide-carve-out` needs a causal five-step `whyChain` ([contract](docs/why-chain-contract.md)) |
196
196
  | CD-1 | no exemptions | exempted like every other discipline, so existing `any` debt can be recorded |
197
197
  | CD-3 flags | merged into the shared `compilerOptions`, wherever they were | set only in a base file not named `tsconfig.json`; any of the seven in a `tsconfig.json` is a finding |
198
198
  | Running with debt | the decay check needed a base ref | every run with a file carve-out needs `--base-revision`, unless it sets forfeiture `elsewhere`; every run with imported or legacy-chain records needs it either way |
@@ -313,7 +313,7 @@ Earlier releases reported an `eslint-disable` comment naming a selected rule as
313
313
 
314
314
  1. **Refresh Hone** as [ADOPTING.md](ADOPTING.md#10-update-and-remove) step 10 says, and run the check. Each `@ts-expect-error`, `@ts-ignore` and `@ts-nocheck` in a `.ts` or `.tsx` file is listed under `unrecorded` as `CD-2#cast-expressions audit inline-disable <file>:<line> <comment>`, test files included, and each `eslint-disable` as before.
315
315
  2. **Remove what you can.** A directive or disable that hides nothing is cheaper to delete than to record.
316
- 3. **Record the rest per clause and file.** Add a `file-carve-out` for debt, or an `authorised-location` where the clause truly does not apply to that file, on the clause the line names and that file. For a repository that accepts reason-only records, `hone record-debt` writes the debt records ([ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a). One record holds every inline exception of that clause in the file. A `clause-wide-carve-out` does not hold them, and a tracked reference on the comment (CD-5) does not stand in for the record. Editing a carved file forfeits the carve-out, and each inline exception it held is listed again.
316
+ 3. **Record the rest per clause and file.** Add a `file-carve-out` for debt, or an `authorised-location` where the clause truly does not apply to that file, on the clause the line names and that file. `hone record-debt` writes the debt records ([ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a). One record holds every inline exception of that clause in the file. A `clause-wide-carve-out` does not hold them, and a tracked reference on the comment (CD-5) does not stand in for the record. Editing a carved file forfeits the carve-out, and each inline exception it held is listed again.
317
317
  4. **Name the rule in a bare disable.** An `eslint-disable` naming no rule escapes every selected ESLint clause and needs a record for each. Its lines end `names no rule and escapes every selected clause: naming the rule is the cheap fix`.
318
318
  5. **Fix lint-script options.** A `command-line-option` line that ends `weakens the script's whole run, so no record can cover it: remove it from the script` names an option to remove. One that ends `is not the first command of its script, so Hone cannot tell what the option does to the files under check; give <command> a script of its own, such as "<invocation>"` names a script such as `tsc && eslint -c eslint.config.mjs .`: move the quoted command to a script of its own, then run the check again. One that ends `comes before <command> and is neither a package runner nor a NAME=value setting, so Hone cannot tell what the option does to the files under check; put only package runners and NAME=value settings before <command>` quotes the first token Hone does not read, such as `env` or a runner flag like `-y`: rewrite the command so only package runners and `NAME=value` settings, including `cross-env NAME=value`, come before `eslint`. `-c` naming the config ESLint already finds, and `--ignore-pattern` that ignores no checked file, are not reported once `eslint` runs plainly.
319
319
  6. **Stale records may clear.** A record that holds a native exception it can cover now counts as used. An `authorised-location` or `file-carve-out` that held only a `config-override`, and was listed `stale` while dropping it left the override unrecorded, is no longer stale.
package/README.md CHANGED
@@ -52,6 +52,7 @@ An `unrecorded` line is `<clause> <mechanism> <kind> <detail>`. Two kinds end wi
52
52
  | `command-line-option` that weakens the run | `<clause> eslint command-line-option <package.json> <script> <option> weakens the script's whole run, so no record can cover it: remove it from the script` |
53
53
  | `command-line-option` Hone cannot judge, because another command comes before `eslint` in its script | `<clause> eslint command-line-option <package.json> <script> <option>: <command> is not the first command of its script, so Hone cannot tell what the option does to the files under check; give <command> a script of its own, such as "<invocation>"` |
54
54
  | `command-line-option` Hone cannot judge, because something before `eslint` in its own command is not a package runner or a `NAME=value` setting | `<clause> eslint command-line-option <package.json> <script> <option>: "<wrapper>" comes before <command> and is neither a package runner nor a NAME=value setting, so Hone cannot tell what the option does to the files under check; put only package runners and NAME=value settings before <command>` |
55
+ | `command-line-option` Hone cannot judge, because a quote in a script naming `eslint` has no partner; the whole script stands in for the option | `<clause> eslint command-line-option <package.json> <script> <script text>: a quote in the script has no partner, so Hone cannot read what the script passes to <command> or tell what that does to the files under check; pair every quote in the script` |
55
56
 
56
57
  `<command>` is the `eslint` call as the script writes it, `<invocation>` is its whole command with its settings and options, from the same script, and `<wrapper>` is the first token before it that Hone does not read, such as `env` or a runner flag like `-y` or `-C`. `cross-env` followed only by `NAME=value` settings counts as a setting. Once only package runners and settings come first, Hone judges the option: `-c` naming the config ESLint already finds, and `--ignore-pattern` that ignores no checked file, are then not reported.
57
58
 
@@ -99,16 +100,19 @@ The `assessment` section is informational and the marker does not change the exi
99
100
 
100
101
  ### Recording inherited debt
101
102
 
102
- `hone record-debt` gives a repository that adopts Hone with existing code a file record for each debt it cannot fix on day one. [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a is the procedure. The command runs the check with the `--base-revision` it is given, then adds one `file-carve-out` to the exception records, `discipline-exceptions.json` or the discipline's file in [the split layout](#the-split-layout), for each clause and file that has a finding, or an inline disable or TypeScript directive under `unrecorded`. Each is the record a person would write, so nothing downstream treats it differently. It gives only a `reason`, which says the debt was inherited and that nobody has reviewed it, so `disciplines.json` must set `"fileExceptionWhyChains": "optional"`. Without that setting the command writes nothing and stops with the load failure `why-chains-required`. It never sets the key itself.
103
+ `hone record-debt` gives a repository that adopts Hone with existing code a file record for each debt it cannot fix on day one. [ADOPTING.md](ADOPTING.md#7a-record-the-debt-you-inherit) step 7a is the procedure. The command runs the check with the `--base-revision` it is given, then adds one `file-carve-out` to the exception records, `discipline-exceptions.json` or the discipline's file in [the split layout](#the-split-layout), for each clause and file that has a finding, or an inline disable or TypeScript directive under `unrecorded`. Each is the record a person would write, so nothing downstream treats it differently: it names only its `kind`, `clause` and `file`. A file carve-out is debt and needs no `reason` and no `whyChain`, so the command needs no setting in `disciplines.json` and never sets one. Add a `reason` by hand afterwards if you want to leave a note for future developers on what the debt signals.
103
104
 
104
105
  Give it the base that the run assessing decay is given, such as `origin/main` for a branch: a record for a file changed since that base is forfeited by that run, and a check against a later revision, such as `HEAD`, does not show it.
105
106
 
107
+ The records it writes give no `reason`. A Hone from before file carve-outs could leave out `reason` refuses such a record: the whole check stops with `load failure: file-malformed <records file> … at exceptions[<index>].reason` and exits `2`. So before the command writes any record, update the Hone that every pre-push hook, CI job and other machine runs to this release or later, as [ADOPTING.md](ADOPTING.md#10-update-and-remove) step 10 says, or that check stops.
108
+
106
109
  It never writes anything wider than one clause in one file: no `authorised-location`, no `clause-wide-carve-out`, no `exclude` entry and no setting. It prints one line per clause and file, `recorded` for each record it added, and writes nothing for:
107
110
 
108
111
  - a pair that already has an `authorised-location` or `file-carve-out`, such as one the check forfeits (`already-recorded`);
109
112
  - a file under a `--leave` path (`left`). `--leave` takes an exact file or folder, as `exclude` does, and may be given once for each path. It names the deliberate, permanent exceptions, which a person records as an `authorised-location` with its own reason;
110
113
  - a file the base revision does not hold, since nothing in it was inherited (`new-file`);
111
- - a clause whose discipline refuses exceptions (`refused`).
114
+ - a clause whose discipline refuses exceptions (`refused`);
115
+ - a file that loads its own ESLint config inside a folder holding its own `disciplines.json` (`nested-configuration`). The projection never reaches that config, so the record could not take effect and the next check would fail on it. Nested Hone configurations are not supported yet ([#72](https://github.com/HailsTails/hone/issues/72)).
112
116
 
113
117
  Other native exceptions under `unrecorded`, such as a `config-override` or a lint-script option, are not recorded: [ADOPTING.md](ADOPTING.md#6-read-the-report) step 6 says what to do with each.
114
118
 
@@ -197,7 +201,7 @@ At the repository root. It selects clauses and the mechanism that checks each on
197
201
  - A judgement clause cannot be selected; it is enforced by review.
198
202
  - `eslintConfigLookup`, optional, is `"nearest-to-file"` or `"repository-root"` and says which `eslint.config.*` the team's own ESLint run applies to a file; see [Runtime](#runtime). Leave it out to let Hone detect it.
199
203
  - `eslintConfigRoots`, optional, lists repository folders that get their own projection slice under either lookup although they track no `eslint.config.*`, such as a package whose config a tool generates and ignores; see [Package slices](#package-slices). Globs are refused. Each entry must be a folder git tracks files under outside every `exclude` path, spelled exactly as git spells it; any other entry stops the run before anything is checked or written, as `load failure: config-root-untracked <folder>:` with what to fix.
200
- - `fileExceptionWhyChains`, optional, is `"required"` (the default) or `"optional"`. `"optional"` lets an `authorised-location` or `file-carve-out` entry give only its `reason`; see [discipline-exceptions.json](#discipline-exceptionsjson). `hone record-debt` writes such entries, so it needs `"optional"`.
204
+ - `fileExceptionWhyChains`, optional, is `"required"` (the default) or `"optional"`. It governs authorised locations only: `"optional"` lets an `authorised-location` entry give only its `reason`, which will be refused in the next major release; see [discipline-exceptions.json](#discipline-exceptionsjson). A `file-carve-out` needs no `whyChain` under either value.
201
205
  - `reportOutput`, optional, is `"full"` (the default), `"failures-only"`, `"counts"` or `"verdict-only"`: the repository's default for how much of the report the check prints. `--report-output` overrides it for one run; see [Commands](#commands).
202
206
  - `checkEditions`, optional, is `"pinned"` (the default) or `"latest"`. A clause whose check has been tightened has more than one edition, listed on its CHECKS.md. `"pinned"` runs each clause's default edition, which changes only in a major release; `"latest"` runs the newest edition the installed Hone has for every selected clause, so a minor release can add findings. `"edition"` in a clause's `clauseSettings` holds that one clause to the edition it names over either. The report lists the edition each such clause ran under `editions`.
203
207
  - `clauseSettings`, optional, maps a selected clause address to an object of that clause's settings, for a clause whose CHECKS.md lists settings. Each key must be one the clause's piece declares, and its value must be the same JSON kind as the declared default and, where the piece lists choices, one of them; the value replaces the default. Anything else makes `disciplines.json` malformed, naming the clause, the key and what is accepted: settings for a clause the file does not select or names twice, for a clause that takes none, under an undeclared key, or of the wrong kind or choice.
@@ -213,7 +217,7 @@ At the repository root, or split by rule into the `discipline-exceptions` folder
213
217
  "version": 1,
214
218
  "exceptions": [
215
219
  { "kind": "authorised-location", "clause": "CD-14#class-syntax", "file": "src/adapter.ts", "reason": "..." },
216
- { "kind": "file-carve-out", "clause": "CD-14#class-syntax", "file": "src/legacy.ts", "reason": "...", "whyChain": { } },
220
+ { "kind": "file-carve-out", "clause": "CD-14#class-syntax", "file": "src/legacy.ts", "reason": "..." },
217
221
  { "kind": "clause-wide-carve-out", "clause": "CD-14#class-syntax", "reason": "...", "whyChain": { } }
218
222
  ]
219
223
  }
@@ -223,7 +227,7 @@ At the repository root, or split by rule into the `discipline-exceptions` folder
223
227
  - A `file-carve-out` is debt in one file. It is forfeited once the file is touched.
224
228
  - A `clause-wide-carve-out` exempts the clause's findings everywhere. It does not hold an inline exception.
225
229
  - An inline exception, an `eslint-disable` comment naming a selected rule or no rule, or a `@ts-expect-error`, `@ts-ignore` or `@ts-nocheck` directive under `CD-2#cast-expressions`, is held only by an `authorised-location` or `file-carve-out` on its clause and file. A comment naming no rule escapes every selected ESLint clause and needs one per clause. Without a record it is listed under `unrecorded` and fails the run. A lint-script option that weakens the whole run, such as `--rule`, `--suppress-all` or `-c` naming another config, cannot be recorded.
226
- - Every entry needs a `whyChain` (an `authorised-location` or `file-carve-out` may leave it out when `fileExceptionWhyChains` is `"optional"`; see below) that follows the [why-chain contract](docs/why-chain-contract.md): exactly five `{ "why", "because", "evidence" }` steps chained cause to cause, then `rootCause`, `rootCheck`, `readback` and `owner`. The contract lists what Hone refuses and what review still judges:
230
+ - A `file-carve-out` is debt: it needs only its `kind`, `clause` and `file`, never a `whyChain`, under either `fileExceptionWhyChains` value. Its `reason` is optional, a note to future developers on what the debt signals, and nothing reads it. Forfeiture is what holds it: it is forfeited once its file is touched. Every other entry needs a `whyChain` (an `authorised-location` may leave it out while `fileExceptionWhyChains` is `"optional"`; see below) that follows the [why-chain contract](docs/why-chain-contract.md): exactly five `{ "why", "because", "evidence" }` steps chained cause to cause, then `rootCause`, `rootCheck`, `readback` and `owner`. The contract lists what Hone refuses and what review still judges:
227
231
 
228
232
  ```json
229
233
  "whyChain": {
@@ -242,7 +246,8 @@ At the repository root, or split by rule into the `discipline-exceptions` folder
242
246
  ```
243
247
  - A chain with neither `rootCheck` nor `readback` was written to the earlier contract. It is accepted only while the `--base-revision` holds its entry unchanged; a new or edited one is refused as `why-chain-refused`, and a run with such a chain and no `--base-revision` is `legacy-chain-unmeasured`.
244
248
  - An entry carried over from an earlier system may give `provenance` instead of a `whyChain`: `{ "kind": "inherited-debt", "source", "decision" }` on a file carve-out, `{ "kind": "existing-authorisation", "source" }` on an authorised location, where `decision` is optional. `source` names the old record entry as `<directory>/cd-<id>.json#<index>`: `.constitution-carve-outs` for inherited debt, `.constitution-authorised-locations` for an existing authorisation, the old file for the record's discipline, and the entry's position in its array. Such an entry is imported, and is accepted only while the `--base-revision` already holds it unchanged, or, when the base holds no record for that kind, clause and file, while the `source` entry at that revision lists the file in its `files`. A new or edited entry without a `whyChain` is refused as `import-unverified`, and a run with imported entries and no `--base-revision` is `import-unmeasured`. The report names each imported entry it exempts by.
245
- - With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` or `file-carve-out` entry may give only its `reason`, which then carries why the exception exists and must not be blank. The entry itself is not checked against `--base-revision`, but a run with any file carve-out still needs `--base-revision`: without it the report lists `forfeiture-unmeasured` and the run fails, and with it a file carve-out is forfeited once its file is touched. A `whyChain` or `provenance` the entry gives anyway is still judged as above. A `clause-wide-carve-out` still needs its `whyChain`.
249
+ - A `file-carve-out` without a `whyChain` or `provenance` is not checked against `--base-revision`, but a run with any file carve-out still needs `--base-revision`: without it the report lists `forfeiture-unmeasured` and the run fails, and with it a file carve-out is forfeited once its file is touched. A `whyChain` or `provenance` a file carve-out gives anyway is still judged as above.
250
+ - With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` entry may give only its `reason`, which then carries why the exception exists and must not be blank. This is deprecated: a reason-only `authorised-location` will be refused in the next major release, so give it a `whyChain`. A `whyChain` or `provenance` the entry gives anyway is still judged as above. A `clause-wide-carve-out` still needs its `whyChain`.
246
251
  - A clause whose `discipline.json` declares `"exceptions": "refused"` cannot be exempted. No shipped discipline declares it, so every shipped clause can be.
247
252
  - Files are exact repository paths, never globs.
248
253
  - An entry that exempts nothing is stale, a file both authorised and carved for one clause is doubly held, and an entry that cannot be parsed is invalid. Each fails the run.
@@ -338,6 +343,7 @@ This is the first release. Its tests cover each supported platform's ordinary pa
338
343
  - `.d.mts` and `.d.cts` declaration files are not handled separately from other sources.
339
344
  - Columns reported on lines holding non-ASCII text.
340
345
  - Lint scripts are read with a simple shell tokenizer, so unusual quoting or a `cd` before `eslint` is not interpreted.
346
+ - A script whose quotes do not pair as `sh` reads them, such as `echo don't stop`, is passed over when nothing in it names `eslint`. One that names `eslint` is listed as an unreadable `command-line-option` on every selected ESLint clause, since Hone cannot tell what it passes to ESLint.
341
347
  - Detection reads an ESLint 9 run started from inside a package, or given the lookup flag through the environment or a task runner, as a root-only run; set `eslintConfigLookup` in `disciplines.json` for those repositories.
342
348
  - Team ESLint configs that imitate projection block names, register a second copy of the plugin, or use processors are not exercised.
343
349
  - A byte-order mark at the start of `disciplines.json`, `discipline-exceptions.json` or a file of the split layout; save them without one.
@@ -355,14 +361,14 @@ This repository is self-contained: it holds its own configuration and its own lo
355
361
  | `build-package` | `node scripts/build-package.ts`: compiles Hone's own code with esbuild into `dist/`, leaving each declared peer and dependency to be imported by name, and adds the published `package.json`, which declares the dependencies at the ranges `package.json` declares, and the shipped documents and data. It fails if a dependency is not declared as a caret range of one release, if that range's floor is not the version the lock's root importer holds, or if the lock does not hold it, if an output imports anything but a `node:` builtin, a declared peer or a declared dependency, if an output carries an installed package's code, if a command or runner is not emitted at its own path with its own code, or if a shipped page links to a file the package does not ship. The tool's name, package name, command name, shipped rule-set name, reserved ESLint namespace, description, GitHub repository and the unrelated npm name to warn against live in `core/values/tool-identity.ts`, which the build, the install proof, the release text, the command's usage line and the ESLint runner all read. The reserved namespace is its own field, independent of the package name |
356
362
  | `pack-package` | `node scripts/pack-package.ts`: builds `dist/` and packs it with `npm pack` into `artefacts/hailstails-hone-<version>.tgz`, named by the `version` in `package.json` |
357
363
  | `package-determinism` | `node scripts/check-package-determinism.ts`: builds and packs twice into separate temporary roots and fails naming any file that differs, or when the two packed tarballs differ |
358
- | `self-check` | `node scripts/self-check.ts check --repo .`: runs Hone's own check on this repository with `disciplines.json` and `discipline-exceptions.json`; pass `--base-revision <rev>` after the script name. See [Core's check on itself](#hones-check-on-itself) |
364
+ | `self-check` | `node scripts/self-check.ts check --repo .`: runs Hone's own check on this repository with `disciplines.json` and the exception records in its `discipline-exceptions` folder; pass `--base-revision <rev>` after the script name. See [Core's check on itself](#hones-check-on-itself) |
359
365
  | `install-proof` | `node scripts/install-proof.ts`: packs the package once into a temporary tarball, or, given `--tarball <path>` after the script name, copies that already packed tarball there instead, and installs it with pnpm into six CommonJS consumers in an OS temporary directory outside the working tree, each copied from its folder under `tests/test-fixtures/consumer-proof/`, which holds only what that consumer's action needs. Each consumer exists for one thing only an installed package shows. The audit consumer, on TypeScript 4.8.4, runs `check` through the installed bin and expects its finding. The ESLint 9.28.0 and 10.0.0 consumers run `project`, expect a projection importing the piece by package name, and expect its finding from `check`. The consumer without `eslint` expects `toolchain-unavailable`. These four run with type stripping off. The team consumer is the example [docs/extending.md](docs/extending.md) follows. On TypeScript 4.8.4 it type-checks a wrong team piece, rule set and ESLint piece settings with its own `tsc`, as described under Public type entries, and expects the three errors. On the development versions, TypeScript 6.0.3, ESLint 10.11.0 and typescript-eslint 8.71.2, it also type-checks its rule set under `nodenext` and `bundler` and a CommonJS file, then runs both commands with type stripping on: its `.ts` pieces load through the installed package and give one finding from each mechanism under the team's `acme/` prefix. Its root says `"type": "commonjs"`, the hard case, so its rule set carries its own `"type": "module"` `package.json`. Each consumer declares its toolchain at exact pins in its own `devDependencies`, as an adopter does: TypeScript 4.8.4 alone for the audit consumer, the consumer without `eslint` and the team consumer on 4.8.4; ESLint 9.28.0 or 10.0.0 with typescript-eslint 8.56.0 and TypeScript 4.8.4 for the two ESLint consumers; and the development versions for the team consumer. It declares the tarball beside them, pins the pnpm version this repository's `package.json` pins, and waits this repository's `minimumReleaseAge`. pnpm's store shares each toolchain package between consumers. The proof prints where pnpm put the installed package, checks that each of Hone's dependencies is installed beside it at a release inside its published range, and expects the report to name its pages through the consumer's `node_modules/@hailstails/hone` instead, and it runs `check` through the package script with its options after `--`, as an adopter's pre-push hook does. A pass once a violation is removed, rule-set naming, plugin namespaces, settings overrides and per-package ESLint configs are proven by unit and in-process tests instead. The temporary directory is removed afterwards |
360
366
  | `pull-request-title` | `node scripts/pull-request-title-command.ts <title>`: passes a title shaped as a Conventional Commits subject, `type(scope)!: description`, and fails any other with the expected form. See [Versions and releases](#versions-and-releases) |
361
367
  | `release-pull-request` | `node scripts/release-pull-request-command.ts [pre-release\|stable]`: writes the next release's section into `CHANGELOG.md` and its version into `package.json`, in the working tree only. See [Versions and releases](#versions-and-releases) |
362
368
 
363
369
  ### Hone's check on itself
364
370
 
365
- `disciplines.json` selects every mechanical clause Hone ships, through the mechanism it names, confines the `eslint` package under CD-19's `confinedPackages`, and excludes `tests/test-fixtures/consumer-proof`: those folders are package-test content, the files of other repositories that `install-proof` copies out and checks with their own Hone run. `eslint.config.mjs` spreads the committed `disciplines.eslint.mjs` projection, which `node scripts/self-check.ts project --repo .` regenerates. `discipline-exceptions.json` holds eight `authorised-location` records for `CD-19#import-boundaries`, each the single file that binds a runtime or third-party surface; seven are imported, with `existing-authorisation` provenance, from the earlier records kept in `.constitution-authorised-locations/cd-19.json`, and the eighth, for `mechanisms/eslint/runner/native-rules.ts`, carries its own why-chain. Strictness lives in `tsconfig.base.json`, which `tsconfig.json` extends; `tsconfig.json` leaves the same consumer folders out, since their files compile against the installed package.
371
+ `disciplines.json` selects every mechanical clause Hone ships, through the mechanism it names, confines the `eslint` package under CD-19's `confinedPackages`, and excludes `tests/test-fixtures/consumer-proof`: those folders are package-test content, the files of other repositories that `install-proof` copies out and checks with their own Hone run. `eslint.config.mjs` spreads the committed `disciplines.eslint.mjs` projection, which `node scripts/self-check.ts project --repo .` regenerates. Hone keeps its exception records in [the split layout](#the-split-layout): `discipline-exceptions/authorised-locations/cd-19.json` holds eight `authorised-location` records for `CD-19#import-boundaries`, each the single file that binds a runtime or third-party surface; seven are imported, with `existing-authorisation` provenance, from the earlier records kept in `.constitution-authorised-locations/cd-19.json`, and the eighth, for `mechanisms/eslint/runner/native-rules.ts`, carries its own why-chain. Strictness lives in `tsconfig.base.json`, which `tsconfig.json` extends; `tsconfig.json` leaves the same consumer folders out, since their files compile against the installed package.
366
372
 
367
373
  `self-check` prints Hone's full report on itself, then one `self-check:` line. It fails when the run cannot load, or when any of `uncovered`, `stale`, `forfeited`, `doublyHeld`, `invalidRecords`, `unmeasured` or `projectionProblems` holds an entry: that is, when the selection, the exception records or the projection are not sound. It does not fail on `findings` or `unrecorded`. Those are printed in full and counted in the `self-check:` line, but they do not gate a change yet: the test fixtures hold deliberate violations, and some of Hone's own code does not meet every selected clause. CI runs `self-check` on every change with the pull request's base, or the previous `main`, as the base revision.
368
374
 
package/api/audit.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { ClauseId, DisciplineId, RuleSetName } from "../core/values/identif
9
9
  export type { RepoPath } from "../core/values/repo-path-types.js";
10
10
  export type { Result } from "../core/values/result.js";
11
11
  export type { CommentRange, SyntaxApi, SyntaxNode, SyntaxTree } from "../mechanisms/audit/runner/typescript-parse.js";
12
- export type { PieceHit, PreparedFileCheck, PreparedWalkerCheck, SourceObservers, WalkerFile, WalkerPiece, WalkerRepository } from "../mechanisms/audit/runner/walker-piece.js";
12
+ export type { PieceHit, PreparedFileCheck, PreparedWalkerCheck, SourceObservers, WalkerDisk, WalkerFile, WalkerPiece, WalkerRepository } from "../mechanisms/audit/runner/walker-piece.js";
13
13
  export declare const folderScope: (request: {
14
14
  readonly file: string;
15
15
  }) => "generated" | "authored";
package/api/testing.js CHANGED
@@ -5,15 +5,15 @@ import {
5
5
  loadRunner,
6
6
  rejectedCall,
7
7
  runnerInvalidOutput
8
- } from "../chunks/chunk-63SJV5ZY.js";
8
+ } from "../chunks/chunk-YSN46EB3.js";
9
9
  import {
10
10
  caseVerdictSchema,
11
11
  runnerResultSchema
12
- } from "../chunks/chunk-BLGGM7AV.js";
12
+ } from "../chunks/chunk-H4V72FCW.js";
13
13
  import {
14
14
  readDisciplineFile,
15
15
  readPieceFile
16
- } from "../chunks/chunk-PVCA3ISA.js";
16
+ } from "../chunks/chunk-PL2PNPAR.js";
17
17
  import "../chunks/chunk-RWQ4UNKY.js";
18
18
  import "../chunks/chunk-NA5L6PUE.js";
19
19
  import {
@@ -25,7 +25,7 @@ import {
25
25
  createDefaultPathPort,
26
26
  moduleExtensionOf,
27
27
  repoPathSchema
28
- } from "../chunks/chunk-MZTLH4EU.js";
28
+ } from "../chunks/chunk-Y2KPZDDV.js";
29
29
  import {
30
30
  clauseAddressSchema,
31
31
  mechanismIdSchema
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  repoPathSchema,
3
3
  snippetSchema
4
- } from "./chunk-MZTLH4EU.js";
4
+ } from "./chunk-Y2KPZDDV.js";
5
5
  import {
6
6
  clauseAddressObjectSchema
7
7
  } from "./chunk-FR4FASVM.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-RWQ4UNKY.js";
5
5
  import {
6
6
  repoPathSchema
7
- } from "./chunk-MZTLH4EU.js";
7
+ } from "./chunk-Y2KPZDDV.js";
8
8
  import {
9
9
  clauseIdSchema,
10
10
  disciplineIdSchema,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createDefaultPathPort,
3
3
  installRootAboveEntry
4
- } from "./chunk-MZTLH4EU.js";
4
+ } from "./chunk-Y2KPZDDV.js";
5
5
 
6
6
  // core/mechanism-port/toolchain-bound-runner.ts
7
7
  var builtOnce = (request) => request.toolchain.then((loaded) => loaded.outcome === "failed" ? loaded : { outcome: "ok", value: request.runnerOf(loaded.value) });
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MXSIQPCV.js";
4
4
 
5
5
  // core/platform-ports/file-system-port.ts
6
- import { accessSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
6
+ import { accessSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
7
7
  var NO_SUCH_FILE_CODE = "ENOENT";
8
8
  var presenceAfterAccessFailure = (request) => request.thrown instanceof Error && "code" in request.thrown && request.thrown.code === NO_SUCH_FILE_CODE ? "absent" : "present";
9
9
  var failureDetail = (request) => request.thrown instanceof Error ? request.thrown.message : String(request.thrown);
@@ -114,6 +114,25 @@ var defaultDirectorySurface = {
114
114
  var createDefaultDirectoryPort = (_options) => createDirectoryPort({
115
115
  directory: defaultDirectorySurface
116
116
  });
117
+ var createEntryKindPort = (options) => ({
118
+ kindOf: (request) => {
119
+ try {
120
+ return options.surface.stat({ path: request.path }) ?? "absent";
121
+ } catch {
122
+ return "absent";
123
+ }
124
+ }
125
+ });
126
+ var defaultEntryKindSurface = {
127
+ stat: (request) => {
128
+ const found = statSync(request.path, { throwIfNoEntry: false });
129
+ if (found === void 0) {
130
+ return void 0;
131
+ }
132
+ return found.isDirectory() ? "directory" : "file";
133
+ }
134
+ };
135
+ var createDefaultEntryKindPort = (_options) => createEntryKindPort({ surface: defaultEntryKindSurface });
117
136
 
118
137
  // core/platform-ports/path-port.ts
119
138
  import platformPath, { posix, win32 } from "node:path";
@@ -442,6 +461,7 @@ export {
442
461
  createDefaultFileTextPort,
443
462
  createDefaultFileRemovalPort,
444
463
  createDefaultDirectoryPort,
464
+ createDefaultEntryKindPort,
445
465
  isRepoPathText,
446
466
  repoPathTextSchema,
447
467
  brandedRepoPathSchema,
@@ -3,7 +3,7 @@ import {
3
3
  nativeExceptionKindSchema,
4
4
  projectionWriteSchema,
5
5
  runnerResultSchema
6
- } from "./chunk-BLGGM7AV.js";
6
+ } from "./chunk-H4V72FCW.js";
7
7
  import {
8
8
  JSON_KIND_NAMES,
9
9
  RESERVED_EDITION_SETTING,
@@ -16,7 +16,7 @@ import {
16
16
  readPieceFile,
17
17
  readVersionOneJson,
18
18
  sameJsonValue
19
- } from "./chunk-PVCA3ISA.js";
19
+ } from "./chunk-PL2PNPAR.js";
20
20
  import {
21
21
  NOT_INSTALLED,
22
22
  brandedRepoPathSchema,
@@ -24,7 +24,7 @@ import {
24
24
  repoPathSchema,
25
25
  repoPathTextSchema,
26
26
  runnerModuleSegmentsOf
27
- } from "./chunk-MZTLH4EU.js";
27
+ } from "./chunk-Y2KPZDDV.js";
28
28
  import {
29
29
  NOT_ADOPTED,
30
30
  NOT_RUN,
@@ -450,7 +450,7 @@ var exceptionsFileSchema = z2.object({
450
450
  kind: z2.literal("file-carve-out"),
451
451
  clause: z2.string(),
452
452
  file: z2.string(),
453
- reason: z2.string(),
453
+ reason: z2.string().optional(),
454
454
  whyChain: z2.unknown().optional(),
455
455
  provenance: z2.unknown().optional()
456
456
  }),
@@ -511,19 +511,19 @@ var fileCarveOutFields = {
511
511
  kind: z2.literal("file-carve-out"),
512
512
  clause: z2.string(),
513
513
  file: z2.string(),
514
- reason: z2.string()
514
+ reason: z2.string().optional()
515
515
  };
516
516
  var chainedFileCarveOutSchema = z2.strictObject({ ...fileCarveOutFields, whyChain: unjudgedWhyChainSchema, provenance: inheritedDebtProvenanceSchema.optional() });
517
517
  var importedFileCarveOutSchema = z2.strictObject({ ...fileCarveOutFields, whyChain: z2.never().optional(), provenance: inheritedDebtProvenanceSchema });
518
- var reasonedFileCarveOutSchema = z2.strictObject({ ...fileCarveOutFields, ...reasonOnlyFields });
518
+ var plainFileCarveOutSchema = z2.strictObject({ ...fileCarveOutFields, whyChain: z2.never().optional(), provenance: z2.never().optional() });
519
519
  var FILE_EVIDENCE_SCHEMAS_OF = {
520
520
  required: {
521
521
  "authorised-location": z2.union([chainedAuthorisedLocationSchema, importedAuthorisedLocationSchema]),
522
- "file-carve-out": z2.union([chainedFileCarveOutSchema, importedFileCarveOutSchema])
522
+ "file-carve-out": z2.union([chainedFileCarveOutSchema, importedFileCarveOutSchema, plainFileCarveOutSchema])
523
523
  },
524
524
  optional: {
525
525
  "authorised-location": z2.union([chainedAuthorisedLocationSchema, importedAuthorisedLocationSchema, reasonedAuthorisedLocationSchema]),
526
- "file-carve-out": z2.union([chainedFileCarveOutSchema, importedFileCarveOutSchema, reasonedFileCarveOutSchema])
526
+ "file-carve-out": z2.union([chainedFileCarveOutSchema, importedFileCarveOutSchema, plainFileCarveOutSchema])
527
527
  }
528
528
  };
529
529
  var legacySourceOf = (request) => {
@@ -545,9 +545,13 @@ var legacyListing = (request) => {
545
545
  const records = legacyRecordsSchema.safeParse(document.value);
546
546
  return records.success && records.data[request.source.index]?.files.includes(request.file) === true ? "listed" : "not-listed";
547
547
  };
548
+ var IMPORT_WAY_OUT = {
549
+ "authorised-location": "give it a whyChain",
550
+ "file-carve-out": "give it a whyChain, or remove its provenance to keep it as debt"
551
+ };
548
552
  var importRefused = (request) => ({
549
553
  outcome: "failed",
550
- error: { kind: "import-unverified", detail: `${request.detail}: give it a whyChain` }
554
+ error: { kind: "import-unverified", detail: `${request.detail}: ${IMPORT_WAY_OUT[request.kind]}` }
551
555
  });
552
556
  var verifiedImport = (request) => {
553
557
  const { baseline } = request;
@@ -558,11 +562,12 @@ var verifiedImport = (request) => {
558
562
  return { outcome: "ok", value: request.record };
559
563
  }
560
564
  if (baseline.entriesAtBase.some((baseEntry) => sameIdentity({ entry: baseEntry, identity: request.identity }) === "same")) {
561
- return importRefused({ detail: "the imported record was edited since the base revision" });
565
+ return importRefused({ detail: "the imported record was edited since the base revision", kind: request.identity.kind });
562
566
  }
563
567
  const source = legacySourceOf({ source: request.provenance.source });
564
568
  const listed2 = source !== "not-legacy-source" && source.directory === LEGACY_DIRECTORY_OF[request.provenance.kind] && source.discipline === request.discipline.toUpperCase() && legacyListing({ sourceTextsAtBase: baseline.sourceTextsAtBase, source, file: request.identity.file }) === "listed";
565
569
  return listed2 ? { outcome: "ok", value: request.record } : importRefused({
570
+ kind: request.identity.kind,
566
571
  detail: `the record is new since the base revision, and its provenance source ${request.provenance.source} is not an entry at the base revision listing ${request.identity.file} under ${LEGACY_DIRECTORY_OF[request.provenance.kind]}/${request.discipline.toLowerCase()}.json`
567
572
  });
568
573
  };
@@ -1724,7 +1729,8 @@ var inlineDisableSchema = z10.object({
1724
1729
  var scriptOptionCauseSchema = z10.discriminatedUnion("kind", [
1725
1730
  z10.object({ kind: z10.literal("weakens-run") }).readonly(),
1726
1731
  z10.object({ kind: z10.literal("after-another-command"), command: z10.string(), invocation: z10.string() }).readonly(),
1727
- z10.object({ kind: z10.literal("wrapped"), command: z10.string(), wrapper: z10.string() }).readonly()
1732
+ z10.object({ kind: z10.literal("wrapped"), command: z10.string(), wrapper: z10.string() }).readonly(),
1733
+ z10.object({ kind: z10.literal("unreadable"), command: z10.string() }).readonly()
1728
1734
  ]);
1729
1735
  var nativeExceptionSchema = z10.discriminatedUnion("kind", [
1730
1736
  z10.object({ kind: z10.literal("ignore"), clause: clauseAddressObjectSchema, file: repoPathSchema }).readonly(),
@@ -1760,11 +1766,16 @@ var sliceProblemSchema = z10.object({
1760
1766
  slice: repoPathSchema,
1761
1767
  state: z10.enum(["out-of-date", "missing", "not-applied", "unconfigured", "nested-configuration"])
1762
1768
  }).readonly();
1769
+ var unprojectedFolderSchema = z10.object({
1770
+ folder: repoPathSchema,
1771
+ selectionFolder: repoPathSchema
1772
+ }).readonly();
1763
1773
  var embeddedRunReportSchema = z10.object({
1764
1774
  hits: z10.array(hitSchema).readonly(),
1765
1775
  nativeExceptions: z10.array(nativeExceptionSchema).readonly(),
1766
1776
  projection: z10.enum(["current", "out-of-date", "missing", "not-included"]),
1767
- slices: z10.array(sliceProblemSchema).readonly().default([])
1777
+ slices: z10.array(sliceProblemSchema).readonly().default([]),
1778
+ unprojectedFolders: z10.array(unprojectedFolderSchema).readonly().default([])
1768
1779
  }).readonly();
1769
1780
 
1770
1781
  // core/mechanism-port/runner-failure.ts
@@ -1832,7 +1843,8 @@ var standaloneRun = (request) => {
1832
1843
  nativeExceptions: report.nativeExceptions,
1833
1844
  coverableKinds: STANDALONE_COVERABLE_KINDS,
1834
1845
  projection: "none",
1835
- slices: []
1846
+ slices: [],
1847
+ unprojectedFolders: []
1836
1848
  }
1837
1849
  };
1838
1850
  };
@@ -1875,7 +1887,8 @@ var embeddedRun = (request) => {
1875
1887
  nativeExceptions: report.nativeExceptions,
1876
1888
  coverableKinds: request.projectedKinds,
1877
1889
  projection: report.projection,
1878
- slices: report.slices
1890
+ slices: report.slices,
1891
+ unprojectedFolders: report.unprojectedFolders
1879
1892
  }
1880
1893
  };
1881
1894
  };
@@ -2182,7 +2195,8 @@ var checkReportOf = (request) => {
2182
2195
  readFirst: clauseReadingsOf({ ...request.check, findings: governed.findings, clauseRoots: request.inputs.clauseRoots })
2183
2196
  };
2184
2197
  };
2185
- var runCheck = async (request) => {
2198
+ var unprojectedOf = (request) => request.runs.flatMap((run) => run.unprojectedFolders.map((unprojected) => ({ mechanism: run.mechanism, ...unprojected })));
2199
+ var runReachedCheck = async (request) => {
2186
2200
  const inputs = await loadInputs({
2187
2201
  ...request,
2188
2202
  exceptionBaselineOf: ({ entries }) => exceptionBaselineOf({ check: request, entries })
@@ -2200,15 +2214,19 @@ var runCheck = async (request) => {
2200
2214
  }
2201
2215
  return {
2202
2216
  outcome: "ok",
2203
- value: checkReportOf({
2204
- check: request,
2205
- assessment: request.assessment,
2206
- inputs: inputs.value,
2207
- runs: runs.value,
2208
- touched: touchedSetFor({ check: request, records: inputs.value.records })
2209
- })
2217
+ value: {
2218
+ report: checkReportOf({
2219
+ check: request,
2220
+ assessment: request.assessment,
2221
+ inputs: inputs.value,
2222
+ runs: runs.value,
2223
+ touched: touchedSetFor({ check: request, records: inputs.value.records })
2224
+ }),
2225
+ unprojected: unprojectedOf({ runs: runs.value })
2226
+ }
2210
2227
  };
2211
2228
  };
2229
+ var runCheck = (request) => runReachedCheck(request).then((reached) => reached.outcome === "failed" ? reached : { outcome: "ok", value: reached.value.report });
2212
2230
 
2213
2231
  export {
2214
2232
  exceptionEntriesOfDocument,
@@ -2243,5 +2261,6 @@ export {
2243
2261
  loadInputs,
2244
2262
  recordsOf,
2245
2263
  checkedTreeOf,
2264
+ runReachedCheck,
2246
2265
  runCheck
2247
2266
  };