@toiroakr/chisel 0.2.0 → 0.3.1

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 (167) hide show
  1. package/README.md +114 -10
  2. package/dist/absence.d.ts +1 -0
  3. package/dist/absence.js +39 -1
  4. package/dist/absence.js.map +1 -1
  5. package/dist/behavior.d.ts +5 -10
  6. package/dist/behavior.js +48 -225
  7. package/dist/behavior.js.map +1 -1
  8. package/dist/beside.d.ts +5 -0
  9. package/dist/beside.js +10 -0
  10. package/dist/beside.js.map +1 -1
  11. package/dist/border.d.ts +3 -1
  12. package/dist/border.js +47 -3
  13. package/dist/border.js.map +1 -1
  14. package/dist/bounds.js +4 -3
  15. package/dist/bounds.js.map +1 -1
  16. package/dist/changes.d.ts +23 -0
  17. package/dist/changes.js +355 -0
  18. package/dist/changes.js.map +1 -0
  19. package/dist/checks.d.ts +1 -0
  20. package/dist/checks.js +295 -0
  21. package/dist/checks.js.map +1 -0
  22. package/dist/cli.d.ts +2 -0
  23. package/dist/cli.js +80 -11
  24. package/dist/cli.js.map +1 -1
  25. package/dist/codec.js +9 -3
  26. package/dist/codec.js.map +1 -1
  27. package/dist/codegen.js +2 -0
  28. package/dist/codegen.js.map +1 -1
  29. package/dist/composition.js +5 -4
  30. package/dist/composition.js.map +1 -1
  31. package/dist/conformance.d.ts +24 -0
  32. package/dist/conformance.js +44 -0
  33. package/dist/conformance.js.map +1 -0
  34. package/dist/data.d.ts +2 -2
  35. package/dist/data.js +5 -3
  36. package/dist/data.js.map +1 -1
  37. package/dist/decimal-js.d.ts +2 -0
  38. package/dist/decimal-js.js +5 -0
  39. package/dist/decimal-js.js.map +1 -0
  40. package/dist/decimal.d.ts +2 -0
  41. package/dist/decimal.js +3 -0
  42. package/dist/decimal.js.map +1 -0
  43. package/dist/domain.d.ts +2 -2
  44. package/dist/domain.js +59 -19
  45. package/dist/domain.js.map +1 -1
  46. package/dist/ensures.js +1 -1
  47. package/dist/ensures.js.map +1 -1
  48. package/dist/errors.d.ts +18 -0
  49. package/dist/errors.js +25 -0
  50. package/dist/errors.js.map +1 -0
  51. package/dist/exact.d.ts +13 -1
  52. package/dist/exact.js +52 -3
  53. package/dist/exact.js.map +1 -1
  54. package/dist/feasibility.js +205 -18
  55. package/dist/feasibility.js.map +1 -1
  56. package/dist/guard-borders.d.ts +2 -0
  57. package/dist/guard-borders.js +112 -24
  58. package/dist/guard-borders.js.map +1 -1
  59. package/dist/guard-scope.d.ts +5 -1
  60. package/dist/guard-scope.js +26 -6
  61. package/dist/guard-scope.js.map +1 -1
  62. package/dist/hooks.d.ts +22 -0
  63. package/dist/hooks.js +2 -0
  64. package/dist/hooks.js.map +1 -0
  65. package/dist/index.d.ts +16 -5
  66. package/dist/index.js +12 -4
  67. package/dist/index.js.map +1 -1
  68. package/dist/interval.d.ts +1 -0
  69. package/dist/interval.js +44 -4
  70. package/dist/interval.js.map +1 -1
  71. package/dist/isolated.d.ts +7 -1
  72. package/dist/isolated.js +53 -5
  73. package/dist/isolated.js.map +1 -1
  74. package/dist/kinds/decimal.d.ts +1 -0
  75. package/dist/kinds/decimal.js +16 -0
  76. package/dist/kinds/decimal.js.map +1 -0
  77. package/dist/kinds/rational.d.ts +1 -0
  78. package/dist/kinds/rational.js +13 -0
  79. package/dist/kinds/rational.js.map +1 -0
  80. package/dist/kinds/temporal.d.ts +1 -0
  81. package/dist/kinds/temporal.js +15 -0
  82. package/dist/kinds/temporal.js.map +1 -0
  83. package/dist/lean/behavior.d.ts +29 -0
  84. package/dist/lean/behavior.js +76 -0
  85. package/dist/lean/behavior.js.map +1 -0
  86. package/dist/lean/given.d.ts +10 -0
  87. package/dist/lean/given.js +15 -0
  88. package/dist/lean/given.js.map +1 -0
  89. package/dist/lean/index.d.ts +11 -0
  90. package/dist/lean/index.js +8 -0
  91. package/dist/lean/index.js.map +1 -0
  92. package/dist/lean/model.d.ts +20 -0
  93. package/dist/lean/model.js +133 -0
  94. package/dist/lean/model.js.map +1 -0
  95. package/dist/lean/protocol.d.ts +14 -0
  96. package/dist/lean/protocol.js +34 -0
  97. package/dist/lean/protocol.js.map +1 -0
  98. package/dist/lean/rule.d.ts +54 -0
  99. package/dist/lean/rule.js +149 -0
  100. package/dist/lean/rule.js.map +1 -0
  101. package/dist/lean/schema.d.ts +46 -0
  102. package/dist/lean/schema.js +155 -0
  103. package/dist/lean/schema.js.map +1 -0
  104. package/dist/machine.d.ts +25 -0
  105. package/dist/machine.js +88 -17
  106. package/dist/machine.js.map +1 -1
  107. package/dist/model.d.ts +39 -5
  108. package/dist/model.js +268 -59
  109. package/dist/model.js.map +1 -1
  110. package/dist/off-grid.d.ts +4 -0
  111. package/dist/off-grid.js +92 -0
  112. package/dist/off-grid.js.map +1 -0
  113. package/dist/outcomes.d.ts +9 -1
  114. package/dist/outcomes.js +92 -10
  115. package/dist/outcomes.js.map +1 -1
  116. package/dist/pairs.js +2 -1
  117. package/dist/pairs.js.map +1 -1
  118. package/dist/partition.js +12 -9
  119. package/dist/partition.js.map +1 -1
  120. package/dist/placeholders.d.ts +3 -0
  121. package/dist/placeholders.js +44 -0
  122. package/dist/placeholders.js.map +1 -0
  123. package/dist/proof.js +189 -37
  124. package/dist/proof.js.map +1 -1
  125. package/dist/protocol.d.ts +22 -0
  126. package/dist/protocol.js +12 -0
  127. package/dist/protocol.js.map +1 -0
  128. package/dist/relations.d.ts +30 -0
  129. package/dist/relations.js +235 -0
  130. package/dist/relations.js.map +1 -0
  131. package/dist/rewrites.d.ts +41 -0
  132. package/dist/rewrites.js +180 -0
  133. package/dist/rewrites.js.map +1 -0
  134. package/dist/rule.d.ts +29 -6
  135. package/dist/rule.js +145 -5
  136. package/dist/rule.js.map +1 -1
  137. package/dist/runtime.d.ts +4 -4
  138. package/dist/runtime.js +3 -3
  139. package/dist/runtime.js.map +1 -1
  140. package/dist/schema.d.ts +44 -28
  141. package/dist/schema.js +42 -109
  142. package/dist/schema.js.map +1 -1
  143. package/dist/specification.d.ts +11 -1
  144. package/dist/specification.js +391 -26
  145. package/dist/specification.js.map +1 -1
  146. package/dist/stops.d.ts +20 -0
  147. package/dist/stops.js +221 -0
  148. package/dist/stops.js.map +1 -0
  149. package/dist/temporal.js +5 -5
  150. package/dist/temporal.js.map +1 -1
  151. package/dist/tla-validate.d.ts +31 -0
  152. package/dist/tla-validate.js +151 -0
  153. package/dist/tla-validate.js.map +1 -0
  154. package/dist/tla.d.ts +46 -6
  155. package/dist/tla.js +250 -49
  156. package/dist/tla.js.map +1 -1
  157. package/dist/verification.d.ts +2 -0
  158. package/dist/verification.js +2 -0
  159. package/dist/verification.js.map +1 -1
  160. package/dist/ways.d.ts +4 -1
  161. package/dist/ways.js +23 -8
  162. package/dist/ways.js.map +1 -1
  163. package/dist/world.d.ts +2 -2
  164. package/dist/world.js +13 -17
  165. package/dist/world.js.map +1 -1
  166. package/package.json +23 -7
  167. package/schema/report.schema.json +169 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Chisel
2
2
 
3
- Chisel is an experimental TypeScript toolkit for defining executable state transitions and checking the same definitions against invariants. A machine runs in production through `@toiroakr/chisel`; its verification properties live separately in `@toiroakr/chisel/verification`, so they are not part of the runtime import graph. See [one reducer for runtime and exhaustive checking](#one-reducer-for-runtime-and-exhaustive-checking) for a complete example.
3
+ Chisel is an experimental TypeScript toolkit for defining executable state transitions and checking the same definitions against invariants. A machine runs in production through `@toiroakr/chisel/runtime`; its verification properties live separately in `@toiroakr/chisel/verification`, so they are not part of the runtime import graph. See [one reducer for runtime and exhaustive checking](#one-reducer-for-runtime-and-exhaustive-checking) for a complete example.
4
4
 
5
5
  The machine workflow is:
6
6
 
@@ -14,13 +14,48 @@ define state and commands
14
14
 
15
15
  Install with `npm install @toiroakr/chisel` (Node.js 22.22, 24.15, 26 or newer, or Bun).
16
16
 
17
- **0.2.0 migration:** The package root now exports the state-machine runtime. Existing 0.1.x imports of `behavior`, `spec`, `check`, and related APIs must change from `@toiroakr/chisel` to `@toiroakr/chisel/full`. Verification of machines uses `@toiroakr/chisel/verification`. This breaking export change is outside the `^0.1.0` version range.
17
+ **Entry points.** The package root `@toiroakr/chisel` is a small runtime written with functions (`c.string()`, `c.lte(a, b)`, `c.model(...)`), kept small so a bundle holds only the functions it calls. Everything else is a sub-path:
18
+
19
+ | Import | What it is | When to use it |
20
+ | --- | --- | --- |
21
+ | `@toiroakr/chisel` | the function-based runtime: schemas, rules, `model`, `behavior`, `implement`, `perform`, `performSync` | production code that decides and validates |
22
+ | `@toiroakr/chisel/full` | the method-based library with `check`, `generate`, `verify`, `test`, decimals, Temporal, dependencies and codecs | specifications and tests; it also takes declarations made with the root |
23
+ | `@toiroakr/chisel/runtime` | the method-based runtime of 0.2.x: machines, decimals, Temporal, dependencies, `decode`/`encode` | production code that needs what the root lacks |
24
+ | `@toiroakr/chisel/verification` | machine invariants, `checkMachine`, TLA+ translation | verification modules, outside the production graph |
25
+ | `@toiroakr/chisel/decimal` | side-effect import that loads decimal.js and lets the root compare `Decimal` values | production code holding decimals |
26
+ | `@toiroakr/chisel/temporal` | side-effect import that lets the root compare Temporal values (`Instant`, `PlainDate`, `PlainTime`, `PlainDateTime`, `PlainYearMonth`, `ZonedDateTime`, `Duration`); it needs no `Temporal` global until a value exists | production code holding Temporal values |
27
+ | `@toiroakr/chisel/checks` | side-effect import that runs the declaration checks | a test setup file, so a bad declaration still throws where it is written |
28
+ | `@toiroakr/chisel/isolated` | `runIsolated`, which needs Node | hosts running the CLI's worker boundary |
29
+
30
+ **Migration to this version (breaking):** the root used to be the method-based runtime. Move code that used it to `@toiroakr/chisel/runtime` unchanged, or rewrite it with functions: `v.$gt(x)` becomes `c.gt(v, x)`, `c.string().min(1)` becomes `c.pipe(c.string(), c.minLength(1))`, `x.optional()` becomes `c.optional(x)` and `list.$all(f)` becomes `c.all(list, f)`. Imports of `check`, `generate`, `spec` and the other analyses stay at `@toiroakr/chisel/full`; machine verification stays at `@toiroakr/chisel/verification`. decimal.js and the declaration checks are no longer loaded by the root or `/runtime` until `/decimal`, `/checks`, `/full`, `/verification` or the CLI is loaded.
31
+
32
+ **What the root compares.** Numbers, bigints, strings (as NFC, in code point order), `Date`s, and plain objects and arrays (by structure for `eq`/`ne`). It does not guess about any other class instance: `c.lt(decimal, other)` on a `Decimal` or a Temporal value throws `Cannot order Decimal against Decimal: register their type with registerKind, or import @toiroakr/chisel/decimal or @toiroakr/chisel/temporal` until the type is registered. `import "@toiroakr/chisel/decimal"` registers `Decimal`, `import "@toiroakr/chisel/temporal"` registers the Temporal types, and `/full` registers both and `Rational`. Another type is registered with `c.registerKind({ name, is, order, same })`: `is(value)` says whether a value is of the type (a precise test, not "has a `comparedTo` method"), `order(a, b)` answers a negative number, zero or a positive number, and `same(a, b)` answers whether they are equal. The first registration whose `is` accepts either side is used, and a second registration under one `name` replaces the first, so loading a module twice is harmless.
18
33
 
19
34
  The earlier behavior-and-example workflow remains available from `/full` and is documented below.
20
35
 
21
36
  ## 1. Declare data and behavior
22
37
 
23
- The behavior and specification examples below use `import * as c from "@toiroakr/chisel/full"`. The package root `@toiroakr/chisel` provides the executable state-machine API described in [one reducer for runtime and exhaustive checking](#one-reducer-for-runtime-and-exhaustive-checking), together with what production code needs to run a behavior: the schemas, `behavior`, `implement`, `model` and its expressions, `dependency`, `perform`, `performSync`, `decode` and `encode`. It reaches neither the analysis (`check`, `generate`, `verify`) nor zod, tsx or `tla-ts`, so code that runs a verified model in place of its own imports only the root, and its specification imports `/full` alongside.
38
+ The behavior and specification examples below use `import * as c from "@toiroakr/chisel/full"`, the method-based library (`c.string().min(1)`, `input.next.$gt(input.current)`). The package root `@toiroakr/chisel` is a small runtime written with functions, so a bundle holds only the functions it calls:
39
+
40
+ ```ts
41
+ import * as c from "@toiroakr/chisel";
42
+
43
+ const expiry = c.behavior("expiry", {
44
+ input: c.variants("state", { recorded: c.object({ expiresAt: c.jsDate(), now: c.jsDate(), name: c.pipe(c.string(), c.minLength(1)) }) }),
45
+ result: c.variants("verdict", { candidate: c.object({ name: c.string() }), keep: c.object({}) }),
46
+ effects: c.variants("kind", {}),
47
+ ensures: clause => [clause.when("candidate only when expired", ["candidate"], input => c.lte(input.expiresAt, input.now))],
48
+ });
49
+
50
+ const decide = c.implement(expiry, { cases: { recorded: c.model("decide", input => ({
51
+ result: c.choose(c.lte(input.expiresAt, input.now), { verdict: "candidate" as const, name: input.name }, { verdict: "keep" as const }),
52
+ effects: [],
53
+ })) } });
54
+
55
+ c.performSync(decide, { state: "recorded", expiresAt: new Date(1), now: new Date(2), name: "a" });
56
+ ```
57
+
58
+ The root has the schemas `string`, `rawString`, `jsDate`, `boolean`, `number`, `int`, `literal`, `enum`, `optional`, `object`, `variants`, `array`, `record` and `pipe` (with `check`, `min`, `max`, `minLength`, `maxLength`), the rules `lt`, `lte`, `gt`, `gte`, `eq`, `ne`, `and`, `or`, `not`, `all`, `any` and `length`, the model nodes `model`, `choose`, `bind`, `map`, `fold`, `arithmetic` (numbers and bigints) and `concat`, `behavior`, `protocol`, `given`, `implement`, `performSync`, `perform` and `todo`. A declaration made with it carries what `check`, `verify` and `generate` read, so `@toiroakr/chisel/full` takes it as it takes one written with the methods; the same declaration is run in production and proved in a test. A bundle that runs one decision, with the validation of its input and answer and an `ensures` clause, is about 12.7 KB unminified, 7.0 KB minified and 3.0 KB gzipped, and one that also writes a `protocol` and a `c.given` clause about 16.3 KB, 9.2 KB and 3.8 KB, since a bundle holds only what a declaration calls (`test/lean-size.test.ts` holds both). Decimals, rationals, Temporal values, dependencies and `call`, arithmetic on them, `decode`/`encode` and the state-machine runtime are not in it yet: they stay in the method-based runtime of earlier versions, `@toiroakr/chisel/runtime` (see [one reducer for runtime and exhaustive checking](#one-reducer-for-runtime-and-exhaustive-checking)), which does not load decimal.js (`import "@toiroakr/chisel/decimal"` loads it) or run the declaration checks (`import "@toiroakr/chisel/checks"` runs them, and a test suite imports it once so a bad declaration still throws where it is written: a guard comparing a decimal with a value off its grid, a read of a field that may be left out, a `match` that misses a case, an `ensures` clause or a `refine` rule breaking the same laws, a callback in a model, an `ensures` clause named twice). `placeholder()` of a schema with invariants stays at the value of its kind until `/checks` is imported.
24
59
 
25
60
  `c.performSync(implementation, input, deps)` answers what `perform` answers, for a caller that cannot await: it parses and validates the same way and throws `SpecificationError` where a dependency or a decision answers a promise.
26
61
 
@@ -178,6 +213,8 @@ export const cancellation = c.spec("order cancellation", {
178
213
  - `data("Price", object(...))` creates a nominal object type. `Price.create(...)` validates and freezes a value. In a model, use `construct(Price, {...})` and list `constructs: [Price]` in `implement`. The ordinary schema parser remains an explicit validation boundary. This is a TypeScript type guarantee, not protection from `any` or malicious host modules.
179
214
  - `int64()` stores signed 64-bit `bigint` values; `rational()` stores reduced `Rational` values. `arithmetic` supports exact bigint, Rational, and Decimal operations; `quotient` returns an exact Rational, including for integer division. `int()` retains safe JavaScript integers and `number()` retains finite JavaScript numbers. Decimal arithmetic in the model and linear rules does not inherit decimal.js's process precision setting. JSON uses strings for int64, Rational, Decimal, and Temporal values.
180
215
  - `string()` now normalizes to NFC, rejects unpaired surrogates, and measures and orders Unicode scalar values. Enum and literal declarations must already be NFC; parsed text is normalized. This changes results for supplementary characters and decomposed text.
216
+ - `jsDate()` carries a JavaScript `Date` and needs no `Temporal`, so it runs on every supported Node.js. `parse` refuses an invalid Date and keeps its own copy, and a Date written in a rule (`v.$gte(new Date(...))`) or a model is copied too, so changing yours later leaves the schema alone. It is ordered by the time it holds with `min`/`max`/`gt`/`lt`, a rule or a guard; borders step by a millisecond; a guard comparing two of them is read on their difference in milliseconds. JSON carries exactly the string `toISOString()` writes (`2026-09-07T12:00:00.000Z`), and `decode` refuses any other, since `new Date("2026-09-07")` and `new Date("2026-09-07T12:00:00")` read in the time zone of the machine. `generate` writes `new Date("…")`, and a rule describes a Date the same way, whatever the time zone.
217
+ - `rawString()` carries a string exactly as written: it neither normalizes to NFC nor refuses an unpaired surrogate, and a recorded answer is compared as written. Rules and models compare text as NFC, so reading one would answer as if it were normalized (`label != "é"` answers false for the decomposed `"e\u0301"`, which is two code points long); a rule, guard, ensures clause or model condition that reads a `rawString`, and `concat` of one, is therefore refused where it is written. Pass it through (`{ label: input.label }`), or compare a `string()` instead. A text constant of a model is kept as written, so a model may answer `"e\u0301"` as a `rawString`. A `string()` answer may be composed into a `rawString` input; the other way is refused, since `string()` would change it.
181
218
 
182
219
  `check` reports `measures.constructions` and `measures.pairs` in schema version 2. Configure pair budgets with `pairs: { obligations, candidates }` or CLI `--pair-obligations` / `--pair-candidates`. Bounds apply to proofs and generation; an unresolved obligation fails strict checking.
183
220
 
@@ -377,7 +414,9 @@ const implementation = c.implement(checkout, {
377
414
  });
378
415
  ```
379
416
 
380
- Every guard has a `holds` and an `else` arm, and every case of a `match` is an arm (a `match` that leaves out a case of the `variants` or value of the `enum` it matches on, or names one it does not have, fails to compile, and one on a sum that may be left out, or is held by something that may be, is refused by `implement`, since no case would take its absence: write the absence as a case of the sum); each way through the guards is a rule. Where every value the guards and the `match` read is a boolean, an `enum` or a `variants` case and their combinations are few enough (`feasibility.combinations`), Chisel tries each combination the invariants on those values keep and lists only the ways some combination takes, since the ways `$and`/`$or` spell grow exponentially with the conditions while the combinations stay few; otherwise it lists at most `feasibility.ways` ways (10000 by default, `chisel check --feasibility-ways <n>`) and leaves a decision with more unmeasured instead. A way or an arm no row took is a gap only when some row could take it: where the conditions it passes contradict each other or the invariants of the values they read (`$.x >= 10` holds and `$.x >= 5` fails), no row is owed, and that includes an invariant relating several booleans, enums or `variants` cases by `==`/`!=` (with each other or with a value) and `$and`/`$or`/`$not`, whose combinations Chisel tries up to a limit (`c.check(specification, { feasibility: { combinations } })`, `chisel check --feasibility-combinations <n>`, 4096 by default; past it the way is undecided); where a condition Chisel cannot read (`all`/`any`) shares a value with another, it is undecided, which leaves the verdict `undetermined` rather than `not_satisfied`. Both are counted under their reason instead of listed. A guard border point is settled the same way, from the conditions a row has passed before it reaches the comparison. That holds for a comparison of two positions too, read on their difference: behind a guard `x <= y`, the `IN (> 0)` point of a later `x >= y` is one no row can reach, so no row is owed there, as Souther refutes a point the rules leave no value at. `generate` offers a row for each way no row takes but some row could: where the way ends in a `match`, it moves the matched field of a row that reaches it, and, with `chisel generate --ways` (`c.generate(examples, implementation, { ways: true })`), where every condition on the way compares a boolean, an `enum` or a `variants` case with a value (`==`/`!=`), it writes all of them at once, so a way that needs several values chosen together (`$.甲 == "x"` and `$.乙 == "y"`) gets a row too. Without it such a way is only named, since every way through `$and`/`$or` is its own row and their number grows quickly with the conditions. Wherever a row `generate` writes would break an invariant relating several booleans, enums or `variants` cases, the other values those invariants reach are chosen again so the row keeps them, and a way row is tried from every answered row of the case before its placeholder. A way with an ordering, a length, `all`/`any` or a field inside a `variants` field it cannot compose is named in its output instead. A guard comparing a position with a constant divides it into classes and owes all four border points; one comparing two positions with an order draws its border on their difference, while an equality between two positions draws none, since its `holds` and `else` arms already ask for a row on each side of the line. A guard point is met only by a row that reached the comparison.
417
+ Every guard has a `holds` and an `else` arm, and every case of a `match` is an arm (a `match` that leaves out a case of the `variants` or value of the `enum` it matches on, or names one it does not have, fails to compile, and one on a sum that may be left out, or is held by something that may be, is refused by `implement`, since no case would take its absence: write the absence as a case of the sum); each way through the guards is a rule. Where every value the guards and the `match` read is a boolean, an `enum` or a `variants` case and their combinations are few enough (`feasibility.combinations`), Chisel tries each combination the invariants on those values keep and lists only the ways some combination takes, since the ways `$and`/`$or` spell grow exponentially with the conditions while the combinations stay few; otherwise it lists at most `feasibility.ways` ways (10000 by default, `chisel check --feasibility-ways <n>`) and leaves a decision with more unmeasured instead. Before it counts, it prunes and splits: a way whose steps hold one value equal to two constants (`$.type == "a"` then `$.type == "b"`), or a `match` against a comparison it contradicts, is never listed; and the fields of a model's answer that read nothing another field computes (each reached through plain objects and lists, and the bodies of binds of a value that chooses nothing) are independent parts, whose ways are listed and counted apart (`result.sets.tierChanged: …`) and add up rather than multiply, a run handing each part's steps apart as it does an iteration's. A model answering nine independent verdicts of a dozen choices each has a few hundred ways, not millions. `verify` proves such a model part by part: the answer's frame with each part standing as any value of the schema at its place, each part against that schema, and each `ensures` clause over the ways of the parts it reads only (where the frame is not proved so, as when an invariant relates two parts, it proves every way together as before). A way's `==`/`!=` between two booleans, enums or sum tags is settled with them by trying their values, and between two strings no invariant narrows by which of them the way makes equal; a field of a sum's case is read with the schema the case gives it, since a way reads one only where it settled the case. A quantified condition and the same condition written negated (`any(xs, x => all(ys, y => y != x))` and `all(xs, x => any(ys, y => y == x))`) are known to be each other's negation. Such a decision is reported in `toBeChangedFirst` with what to change, read off the model's shape without listing its ways (`c.modelChanges(specification, options)`, which `chisel check` prints under `計測の前に:` before it measures in text mode; with `--json` the guidance is in the report's `toBeChangedFirst`): the ways of a model multiply across the parts a way goes through all of, so the report names parts, chosen greedily and each itself within the limit, that, declared as behaviors of their own and called as dependencies (whose answer is read as a value, their choices measured once in their own reports), leave the rest within the limit (a guide, not the smallest split there is); for guards, it names the stages that, joined with `compose`, are each within it (or says no such split exists). Nothing it says depends on the measurement, so the model can be changed as soon as it is printed. A check that runs long says on stderr which behavior and phase it is on, after three seconds and then once a minute (`progress` in `CheckOptions` and `GenerationOptions`).
418
+
419
+ Following Souther 0.5.0, a check also reports `walks`: every `fold` a model writes is run, for each answered row that took a second element, with the walk stopping after its first step and with every step handed the seed; a rewrite no row tells apart is `not told`, which makes the specification inadequate, and `generate` offers a row with the walked list grown to two elements. It reports `stops`: every operation, temporal move and construction a model writes is judged once as `may stop` (with an input that stops there, and for a division by an input field the invariant that keeps it from stopping), `never stops` (shown by an exhaustive run, a proved construction or the exact range of the operation) or `not resolved`, which leaves the verdict `undetermined`. Guard borders over one computation owe their weights from the lines beside them once, however many thresholds it is compared with. `generate` also offers suggested rows that owe nothing: the inputs a called behavior's recorded rows were written with, asked in its caller. A condition may also relate a place to a value: `v.email.$endsWith("@example.com")`, `$startsWith`, `$contains`, `v.rates.$hasKey("USD")` on a record and `v.tags.$includes("vip")` on an array; against a written value it divides the place into the classes the relations come out in, each owed a row, and a way whose relations contradict each other by their laws owes none. `c.decimal()` without a scale takes any finite decimal, `c.round(value, scale, mode)` and `c.divide(a, b, scale, mode)` round exactly at any scale, and a run with no room to write an answer fails as `OutOfRoom`, which `check` reports apart from the model's failures. A fold or map takes its step as a value too: `c.fold(element, output, xs, seed, c.choose(cond, c.step<[number, number], number>((total, x) => …), c.step<[number, number], number>(…)))` chooses the step once, before the walk. A way or an arm no row took is a gap only when some row could take it: where the conditions it passes contradict each other or the invariants of the values they read (`$.x >= 10` holds and `$.x >= 5` fails), no row is owed, and that includes an invariant relating several booleans, enums or `variants` cases by `==`/`!=` (with each other or with a value) and `$and`/`$or`/`$not`, whose combinations Chisel tries up to a limit (`c.check(specification, { feasibility: { combinations } })`, `chisel check --feasibility-combinations <n>`, 4096 by default; past it the way is undecided); where a condition Chisel cannot read (`all`/`any`) shares a value with another, it is undecided, which leaves the verdict `undetermined` rather than `not_satisfied`. Both are counted under their reason instead of listed. A guard border point is settled the same way, from the conditions a row has passed before it reaches the comparison. That holds for a comparison of two positions too, read on their difference: behind a guard `x <= y`, the `IN (> 0)` point of a later `x >= y` is one no row can reach, so no row is owed there, as Souther refutes a point the rules leave no value at. `generate` offers a row for each way no row takes but some row could: where the way ends in a `match`, it moves the matched field of a row that reaches it, and, with `chisel generate --ways` (`c.generate(examples, implementation, { ways: true })`), where every condition on the way compares a boolean, an `enum` or a `variants` case with a value (`==`/`!=`), it writes all of them at once, so a way that needs several values chosen together (`$.甲 == "x"` and `$.乙 == "y"`) gets a row too. Without it such a way is only named, since every way through `$and`/`$or` is its own row and their number grows quickly with the conditions. Wherever a row `generate` writes would break an invariant relating several booleans, enums or `variants` cases, the other values those invariants reach are chosen again so the row keeps them, and a way row is tried from every answered row of the case before its placeholder. A way with an ordering, a length, `all`/`any` or a field inside a `variants` field it cannot compose is named in its output instead. A guard comparing a position with a constant divides it into classes and owes all four border points; one comparing two positions with an order draws its border on their difference, while an equality between two positions draws none, since its `holds` and `else` arms already ask for a row on each side of the line. A guard point is met only by a row that reached the comparison.
381
420
 
382
421
  Any free-form `run` closure, including `action({ run })` and match handlers, may contain hidden branches and constructions. Declared guards still have coverage measurements, but `measures.constructions` is `undetermined`, so the specification cannot be certified. The same holds for a comparison inside `rules` that Chisel cannot draw a line from.
383
422
 
@@ -401,6 +440,55 @@ Every answer an example writes, the model produces or a conformance subject retu
401
440
 
402
441
  `check` now enforces feasible pairs of classes as obligations (`measures.pairs`), and retains the older reached counts in `pairs` for display, over the same classes the report lists (including those guard thresholds draw, and leaving excluded classes out), and `check --json` writes the whole report as one document, described by the closed JSON Schema in [`schema/report.schema.json`](schema/report.schema.json) (published as `@toiroakr/chisel/report.schema.json`). The arms, rules, and comparisons measures retain their availability and weakening metadata; pairs record each obligation and constructions record each proof; every border point, arm, way, and pair carries a stable `obligationId`; `incompleteness` lists the rows that were not observed (not run for want of a stand-in, or not come back); and `sources` names the spec file each report's `source` refers to. `schemaVersion` is raised only when a field is removed or renamed.
403
442
 
443
+ ### Reading a union, and clauses about some of its cases
444
+
445
+ The terms an `ensures` clause is handed expose the fields of every case of a sum, typed by the cases that declare them, so `read.expiresAt` needs no cast where only the `recorded` case has it. A term of a sum is a path, and a path no case of the input holds reads as absent, which makes a comparison hold: `c.lte(read.expiresAt, read.now)` is true for an input of another case. Name the case first, as the absence check expects: `c.and(c.eq(read.state, "recorded"), c.lte(read.expiresAt, read.now))`. To say a clause of some input cases and no others, write it with `c.given(name, cases, rule)`, which `ensures` takes beside the clauses it builds; its `read` is then typed as those cases, and the rule is held of inputs in them only:
446
+
447
+ ```ts
448
+ ensures: () => [
449
+ c.given("a passed expiry is a candidate", ["recorded"], (read, answer) =>
450
+ c.or(c.eq(answer.verdict, "candidate"), c.not(c.lte(read.expiresAt, read.now)))),
451
+ ],
452
+ ```
453
+
454
+ `clause.when(name, resultCases, rule)` narrows by the answer's case. `c.protocol` and `c.given` are functions of their own rather than methods of the builders, so a bundle holds their checks only where a behavior writes one.
455
+
456
+ ## The calls a behavior makes
457
+
458
+ `effects` declares which calls a behavior makes; `ensures` says nothing of them. `protocol` says what order they come in and when they may be made, and `verify` and `checkProtocol` hold code to it. A workspace is deleted only after its expiry is read again, and only if that second read still says it has passed: someone may have renewed it in between. The input carries both reads, so the interruption is a pair of values the checks try:
459
+
460
+ ```ts
461
+ const prune = c.behavior("prune one workspace", {
462
+ input: c.variants("state", {
463
+ listed: c.object({ expiresAt: c.jsDate(), recheckedExpiry: c.jsDate(), now: c.jsDate() }),
464
+ unlisted: c.object({}),
465
+ }),
466
+ result: c.variants("verdict", { deleted: c.object({}), kept: c.object({}) }),
467
+ effects: c.variants("type", { recheckExpiry: c.object({}), deleteWorkspace: c.object({}) }),
468
+ protocol: c.protocol(rule => [
469
+ rule.before("recheckExpiry", "deleteWorkspace"), // every deleteWorkspace comes after a recheckExpiry
470
+ rule.only("deleteWorkspace", read => c.and(c.eq(read.state, "listed"), c.lte(read.recheckedExpiry, read.now))),
471
+ rule.atMostOnce("deleteWorkspace"),
472
+ ]),
473
+ });
474
+ ```
475
+
476
+ Names in the rules are the declared effects (a name that is not one is refused where it is written), and an `only` rule reads the input.
477
+
478
+ - **A model** (`c.implement` with `c.model`): `performSync` and `perform` refuse effects that break a rule (`Protocol recheckExpiry before every deleteWorkspace does not hold of the effects deleteWorkspace`), an example row whose expected effects break one fails in `check`, and `verify` proves each way through the model, reading the list of effects the way answers: `before` and `atMostOnce` by the list, `only` from the way's conditions. A way where the proof fails is `refuted` with an input when a run on the domain it samples breaks the rule (a model that decides on the first read, `expiresAt <= now`, is refuted by an input where `recheckedExpiry` is after `now`), and `undetermined` otherwise. A behavior with a protocol is `verified` only when every way is proved, so an effects list the proof cannot read as a list of declared calls leaves it undetermined.
479
+ - **Code that makes its own calls** (a function that lists, asks, then deletes) is run by `checkProtocol` from `@toiroakr/chisel/full`. It hands the code an `api` with one function per declared effect, records each call, and answers the calls from the input:
480
+
481
+ ```ts
482
+ const report = await checkProtocol(prune, async (api, input) => {
483
+ if (input.state !== "listed") return;
484
+ const again = await api.recheckExpiry();
485
+ if (again <= input.now) await api.deleteWorkspace();
486
+ }, { answers: { recheckExpiry: input => input.recheckedExpiry } });
487
+ // { status: "passed", checked: 126, exhaustive: false, failures: [] }
488
+ ```
489
+
490
+ A call the behavior does not declare (`api.dropDatabase()`) fails the input even where the code catches what it throws. A failure names the input, the calls made and the rule: `{ input: { state: "listed", expiresAt: …, recheckedExpiry: <after now>, now: … }, calls: ["recheckExpiry", "deleteWorkspace"], reason: "Protocol deleteWorkspace only when … does not hold" }`. `inputs` runs the inputs you write instead of the ones the schema gives (a date comes with the points a millisecond and a day either side, so before, equal and after are all tried), and `exhaustive` says whether the inputs run were every input the schema allows: a pass over a sample says nothing of the rest.
491
+
404
492
  ## One model, several behaviors
405
493
 
406
494
  Behaviors that work on one record can share its model as their input: `input: Report` in each of them, so a state added to `Report` reaches every behavior at once. Each of them is then asked about every field of every state, including fields its answer never turns on. `disregards` says which, per input case like `cases`, with `$default` for every case not written; `r => [r]` disregards a whole case:
@@ -427,10 +515,10 @@ A disregarded field draws no classes of its type, no invariant borders and no bo
427
515
 
428
516
  ## One reducer for runtime and exhaustive checking
429
517
 
430
- For a finite command domain, `machine` uses one expression for both runtime state updates and exhaustive reachability checking. Commands emitted by a transition run through that same reducer in order. The returned state is yours to persist wherever you choose. Import the execution API from `@toiroakr/chisel`; put verification properties in a separate module importing `@toiroakr/chisel/verification`. This keeps invariant definitions, model checking, TLA+ translation, and `tla-ts` out of the production import graph. The optional `/runtime` subpath is an alias of the root, which also exports the behavior runtime described above; the previous combined API is available from `/full`.
518
+ For a finite command domain, `machine` uses one expression for both runtime state updates and exhaustive reachability checking. Commands emitted by a transition run through that same reducer in order. The returned state is yours to persist wherever you choose. Import the execution API from `@toiroakr/chisel/runtime`; put verification properties in a separate module importing `@toiroakr/chisel/verification`. This keeps invariant definitions, model checking, TLA+ translation, and `tla-ts` out of the production import graph. `/runtime` is the method-based runtime (it also exports the behavior runtime described above, with the methods); the previous combined API is available from `/full`.
431
519
 
432
520
  ```ts
433
- import * as c from "@toiroakr/chisel";
521
+ import * as c from "@toiroakr/chisel/runtime";
434
522
 
435
523
  const State = c.int().min(0).max(2);
436
524
  const Command = c.enum(["go", "finish"] as const);
@@ -482,7 +570,7 @@ update: (state, command) => ({
482
570
  A process can also die between two effects, and then no failure handling runs. `specifyMachine(machine, { crashes: true })` makes `checkMachine` explore a death before the first effect of each command and after each effect. The state the death leaves is a reachable state from which every command is explored, a death skips the failure handling (a `failure` state names what a failed effect leaves, not what a death leaves, so the writes of the effects already done stay), a death after the last effect loses the commands the command would have emitted, and the commands still queued behind it die with the process, so the state a death leaves is where the next command starts. Take a checkout that reserves stock and then charges the customer, each effect rolling the whole command back when it fails:
483
571
 
484
572
  ```ts
485
- import * as c from "@toiroakr/chisel";
573
+ import * as c from "@toiroakr/chisel/runtime";
486
574
  import { invariant, specifyMachine, checkMachine } from "@toiroakr/chisel/verification";
487
575
 
488
576
  const checkout = c.machine("checkout", {
@@ -502,6 +590,18 @@ checkMachine(specifyMachine(checkout, { invariants: [leak], crashes: true }));
502
590
 
503
591
  A command without effects has no point to die at, and a command that stopped by dying is held to its precondition as a command that stopped at a failed effect is. `runMachine` takes `dies: point => point.completed === 1` to follow such a run, and `chisel run-machine ... --die-after 1` does the same. In TLA+ a death is one more outcome of the command, so `--engine tla` and `prove-machine` read it too.
504
592
 
593
+ ### Running a machine in production
594
+
595
+ `runMachine` only follows the machine; `driveMachine` runs it. The transition that `checkMachine`, `model-check` and `prove-machine` read decides each next effect, and the `perform` you pass makes the outside world reach the state the effect names, so production code holds no second copy of the order of the steps or of what a failure leaves:
596
+
597
+ ```ts
598
+ const { state, failures } = await c.driveMachine(order, current, { type: "submit" }, {
599
+ perform: async effect => { await reconcile(effect.before, effect.after); },
600
+ });
601
+ ```
602
+
603
+ `perform` gets the effect's name, its index and command, the state before it and the state it is to leave. When it returns, the effect succeeded; when it throws or rejects, the effect failed, and the command ends in the effect's failure state and drops the commands it would have emitted, exactly the outcome `checkMachine` explored. The error is listed in `failures` instead of thrown. `perform` may return `{ commands }`: what it observed, run as commands after those the transition emitted. Every command of the domain is explored in every reachable state, so these are checked like any other. A transition still cannot call a dependency; what reaches outside the machine is an effect.
604
+
505
605
  Two runs of one flow can also work on the same state at once. `checkInterleavings(specification, { copies: [commandA, commandB] })` runs one copy per command against a single shared state. A copy reads the state when it starts a command, then performs that command's effects one step at a time, and every order in which the steps of the copies interleave is explored. An effect writes only the fields it changes from what its copy last saw (or the fields `writes: ["stock", "a"]` names, which must be fields of the state) onto the state as it is by then, so a write computed from a stale read overwrites what another copy wrote since, and `c.effect(name, after, { ifUnchanged: true })` applies only if nothing was written since the copy read the state, otherwise the copy ends `refused` with the shared state unchanged. Take two customers buying the last unit of a stock, each copy reading the stock and then writing it with its own flag:
506
606
 
507
607
  ```ts
@@ -560,7 +660,11 @@ chisel run-machine examples/order-machine.ts --state '{"phase":"draft","ordered"
560
660
 
561
661
  `--engine tla` also checks `requires` (a step whose precondition disagrees with whether it changes the state is a violation), and `prove-machine` proves each precondition as two obligations, one for "changes only if it holds" and one for "holds only if it changes". The matrix is produced by the native checker only. The proof compares object states field by field; any other value, such as a state that is a sum, an array field or a sum held in a field, is compared as a whole, which the prover may not discharge, so those obligations can stay `undetermined`.
562
662
 
563
- `--engine tla` compiles the same expression-based update and invariant into a TLA+ `Step`, `Init`, and `Next` and checks them with `tla-ts`. It models emitted commands as a pending queue, so intermediate states are checked. `chisel tla` returns the module and config as JSON, or writes both `.tla` and `.cfg` files with `--output-dir`. TLA+ translation requires exhaustively enumerable state and command schemas and refuses unsupported operators instead of claiming a result. For open state spaces the native `model-check` remains the available finite reachability check when commands can be enumerated; its result is `undetermined` if exploration does not complete. Existing output files are preserved; pass `--force` to replace both files. Use `--max-commands` to choose the generated command budget.
663
+ `--engine tla` compiles the same expression-based update and invariant into a TLA+ `Step`, `Init`, and `Next` and checks them with `tla-ts`. It models emitted commands as a pending queue, so intermediate states are checked. `chisel tla` returns the module and config as JSON, or writes both `.tla` and `.cfg` files with `--output-dir`. TLA+ translation requires exhaustively enumerable state and command schemas and refuses unsupported operators instead of claiming a result. It reads `null` (as the empty set, which no other value a machine holds is), empty objects, field names TLA+ cannot spell (read by name, `s["foo-bar"]`), an array's `$length()`, and a supported `matchValue` or schema-preserving `map` (a direct array field of the state or command whose element and output are one schema, with a body that keeps to it) over a field held under its own schema; a `bind` or `map` of a field that may be left out is refused. For open state spaces the native `model-check` remains the available finite reachability check when commands can be enumerated; its result is `undetermined` if exploration does not complete. Existing output files are preserved; pass `--force` to replace both files. Use `--max-commands` to choose the generated command budget.
664
+
665
+ Before it checks anything, `--engine tla` (`checkMachineTla`) compares the translation with the TypeScript it came from. The states and the commands are finite and listed, so for every reachable state and every command the translated `Step` is evaluated by TLC and compared with what `evaluateCommand` reads off the machine (the state or the effects with their failure states, and the emitted commands), and the `StateDomain` and `CommandDomain` it lists with the ones TypeScript enumerates. The expected value is written by a renderer of its own, not the translator's, so a fault in how the translator writes a rule or a value shows as a pair that disagrees. A pair TypeScript refuses (an answer outside the schema) must not be accepted by the translation either. A translation that disagrees is `mismatch`, not `undetermined`, and nothing it says of the machine is relied on: the reason names the state and the command, what TypeScript gives and what the translation gives (`at state 1 and command true TypeScript gives [state |-> 2, commands |-> <<>>] and the translation [state |-> 1, commands |-> <<>>]`). The report's `validation` says how many pairs were compared (`{ status: "validated", pairs: 6, of: 6 }`); past `validationLimit` (`chisel model-check --validation-limit`, 20000 pairs by default, the largest machine tried compares 9,600 in under a second) a spread over all the pairs is compared and the status is `sampled`. `==` and `!=` on objects, arrays and null compare what they hold, as `deepEqual` does, in TypeScript and in TLA+ alike, and a state or command that holds a field `kind: "effect"` is no effect.
666
+
667
+ What TLA+ cannot take is refused before the check with what to change, and the result stays `undetermined`: an integer of 2^31 or more (TLC reads 32 bits), a string with a control character TLA+ has no escape for (anything below U+0020 except tab, newline, form feed and carriage return) or an unpaired surrogate, a sequence or a record with fields compared with null (null is the empty set there), `<`, `<=`, `>` or `>=` on an enum, a boolean or a string (TLA+ orders integers only), `add`, `subtract` and `multiply` of anything but whole numbers of one kind (an integer field or constant, the length of an array, a linear term of integer fields, or such arithmetic: a bigint, a decimal and a rational are refused, as is any other operator), and an object whose fields may all be left out, or a read of a field that may be left out where it is absent (TLA+ has no absent field and no empty record: give the object a field that is always there, or write the absence as a case of a sum). With `--engine tla` (`checkMachineTla`), a field that may be left out in an object with a field that is always there is taken: each state or command with the field and without it is a record of its own. `model-check --engine tla` for interleavings (`checkInterleavingsTla`) and `prove-machine` still refuse an optional state or command field.
564
668
 
565
669
  `prove-machine` emits universal inductive obligations for the initial states, the state contract, emitted commands, invariants, and transition properties, then calls tla-ts's proof engine. It reports `proved` only if every obligation is discharged. This can prove some machines with open state and command domains (see [`examples/open-machine.spec.ts`](examples/open-machine.spec.ts)); unsupported schema and expression constructs, or obligations the prover cannot discharge, remain `undetermined`. A proof is over the TLA+ interpretation of the supported expression subset; `runMachine` is still the executable implementation. Use `model-check` for counterexample traces and `prove-machine` for inductive claims.
566
670
 
@@ -680,7 +784,7 @@ The [Souther comparison and design decisions](docs/souther-comparison.html) reco
680
784
 
681
785
  ## Publishing
682
786
 
683
- The `release.yml` workflow publishes `@toiroakr/chisel` when a `v*` tag is pushed. The tag must match the version in `package.json` (for example, `v0.2.0` for version `0.2.0`). Publishing runs the type check, tests, and build through `prepublishOnly`. The workflow can also be rerun manually by selecting the release tag.
787
+ Versions are managed with [Changesets](https://github.com/changesets/changesets): a change that reaches the published package adds a changeset (`npm run changeset`). Before 1.0, a patch is any change that breaks nothing and a minor is a breaking change. On every push to `main`, the `release.yml` workflow opens or updates the `chore: release` pull request while changesets are pending; merging it publishes `@toiroakr/chisel` to npm, running the type check, tests and build through `prepublishOnly`, and creates the GitHub release.
684
788
 
685
789
  Configure an npm Trusted Publisher for `@toiroakr/chisel` with:
686
790
 
@@ -688,7 +792,7 @@ Configure an npm Trusted Publisher for `@toiroakr/chisel` with:
688
792
  - Organization or user: `toiroakr`
689
793
  - Repository: `chisel`
690
794
  - Workflow filename: `release.yml`
691
- - Environment name: leave empty
795
+ - Environment name: `release`
692
796
  - Permission: allow publishing
693
797
 
694
798
  The workflow authenticates with OIDC and publishes provenance; no npm token secret is required.
package/dist/absence.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface Fact {
6
6
  }
7
7
  export interface Roots {
8
8
  readonly scope: AnySchema;
9
+ readonly outputs?: Readonly<Record<string, AnySchema>>;
9
10
  readonly locals?: ReadonlyMap<string, AnySchema>;
10
11
  readonly labels?: ElementLabels;
11
12
  readonly declared?: ReadonlySet<string>;
package/dist/absence.js CHANGED
@@ -1,4 +1,4 @@
1
- import { childrenOf, nodeOf } from "./model.js";
1
+ import { childrenOf, dependencyName, nodeOf } from "./model.js";
2
2
  import { describeTerm, isTerm, localLabel, termData } from "./rule.js";
3
3
  // What a rule settled with the outcome tells of the comparisons in it.
4
4
  export function factsOf(rule, outcome) {
@@ -61,11 +61,37 @@ export function leftOutReadIn(rule, roots, facts = [], label = "$") {
61
61
  return found;
62
62
  }
63
63
  return undefined;
64
+ case "relation":
65
+ // The subject is read first, as the comparison above reads its left side, so a missing read on it is not masked by an undefined other.
66
+ return leftOutOperand(rule.subject, roots, facts, label)
67
+ ?? (rule.other === undefined
68
+ ? `$${rule.relation} with undefined, which no value is: write the absence as a case of a sum`
69
+ : leftOutOperand(rule.other, roots, facts, label));
64
70
  }
65
71
  }
72
+ // Rules and models compare text as NFC, so a value that is only carried as
73
+ // written must not be read by one: it would answer as if it were normalized.
74
+ function carriedOnly(operand, roots, facts, label) {
75
+ if (!isTerm(operand)) {
76
+ // What a choice hands on is read as what it chooses between.
77
+ const node = nodeOf(operand);
78
+ if (node?.kind === "call") {
79
+ const name = dependencyName(node.dependency);
80
+ return roots.outputs?.[name]?.kind === "rawString" ? `calls ${name}, which answers a rawString, which is only carried: have it answer a string() instead` : undefined;
81
+ }
82
+ return node?.kind === "choose" ? carriedOnly(node.yes, roots, facts, label) ?? carriedOnly(node.no, roots, facts, label) : undefined;
83
+ }
84
+ const data = termData(operand);
85
+ const paths = data.kind === "position" ? [data.path] : data.parts.map(part => part.path);
86
+ const path = paths.find(found => resolve(found, roots, facts).some(schema => schema.kind === "rawString"));
87
+ return path === undefined ? undefined : `reads ${render(path, label, roots)}, a rawString, which is only carried: compare a string() instead`;
88
+ }
66
89
  function leftOutOperand(operand, roots, facts, label) {
67
90
  if (!isTerm(operand))
68
91
  return undefined;
92
+ const carried = carriedOnly(operand, roots, facts, label);
93
+ if (carried !== undefined)
94
+ return carried;
69
95
  const data = termData(operand);
70
96
  const paths = data.kind === "position" ? [data.path] : data.parts.map(part => part.path);
71
97
  for (const path of paths) {
@@ -216,6 +242,18 @@ export function leftOutReadInModel(template, roots, facts = []) {
216
242
  return leftOutReadInModel(node.values, roots, facts) ?? leftOutReadInModel(node.initial, roots, facts)
217
243
  ?? leftOutReadInModel(node.body, { ...body, locals: new Map([...(body.locals ?? []), [node.accumulator, node.output]]) }, facts);
218
244
  }
245
+ case "operation":
246
+ if (node.operator === "concat") {
247
+ const carried = carriedOnly(node.left, roots, facts, "$") ?? carriedOnly(node.right, roots, facts, "$");
248
+ if (carried !== undefined)
249
+ return carried;
250
+ }
251
+ for (const child of childrenOf(template)) {
252
+ const found = leftOutReadInModel(child, roots, facts);
253
+ if (found !== undefined)
254
+ return found;
255
+ }
256
+ return undefined;
219
257
  default:
220
258
  for (const child of childrenOf(template)) {
221
259
  const found = leftOutReadInModel(child, roots, facts);
@@ -1 +1 @@
1
- {"version":3,"file":"absence.js","sourceRoot":"","sources":["../src/absence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAwBvE,uEAAuE;AACvE,MAAM,UAAU,OAAO,CAAC,IAAU,EAAE,OAAgB;IAClD,QAAQ,IAAI,CAAC,IAA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,CAAC,CAAC;gBACtD,IAAI,KAAK,KAAK,SAAS;oBAAE,OAAO,KAAK,CAAC;YACxC,CAAC;YACD,OAAO,SAAS,CAAC;QACnB;YACE,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzC,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBACtD,IAAI,KAAK,KAAK,SAAS;oBAAE,OAAO,KAAK,CAAC;YACxC,CAAC;YACD,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -2,6 +2,8 @@ import type { Translation } from "./model.js";
2
2
  import type { DeclaredDependencies, Resolved, Supplied } from "./dependency.js";
3
3
  import type { AnyVariantsSchema, Infer, Schema, Tags, VariantOf } from "./schema.js";
4
4
  import type { CompareRule, Distinction, Rule, Term, TermOf } from "./rule.js";
5
+ import type { ProtocolRule } from "./protocol.js";
6
+ import { SpecificationError, TodoDecision } from "./errors.js";
5
7
  export interface Execution<Result, Effect> {
6
8
  readonly result: Result;
7
9
  readonly effects: readonly Effect[];
@@ -64,6 +66,7 @@ export interface Behavior<InputSchema extends AnyVariantsSchema, ResultSchema ex
64
66
  readonly effects: EffectSchema;
65
67
  readonly dependencies: Requires;
66
68
  readonly ensures: readonly EnsuresClause[];
69
+ readonly protocol?: readonly ProtocolRule[];
67
70
  readonly disregards: Readonly<Record<string, readonly (readonly string[])[]>>;
68
71
  }
69
72
  type KeysOfEvery<T> = T extends unknown ? keyof T : never;
@@ -106,15 +109,8 @@ export interface Implementation<B extends AnyBehavior> {
106
109
  };
107
110
  }
108
111
  export type AnyImplementation = Implementation<AnyBehavior>;
109
- export declare class SpecificationError extends Error {
110
- constructor(message: string);
111
- }
112
- export declare class TodoDecision extends SpecificationError {
113
- readonly behavior: string;
114
- readonly variant: string;
115
- readonly reason: string;
116
- constructor(behavior: string, variant: string, reason: string);
117
- }
112
+ export { SpecificationError };
113
+ export { TodoDecision };
118
114
  export declare function match<Input, Result, Effect, Deps = unknown, Tag extends string = string>(select: (input: TermOf<Input>) => Term<Tag>, cases: {
119
115
  readonly [Case in Tag]: (input: Input, deps: Deps) => Execution<Result, Effect>;
120
116
  }): Match<Input, Result, Effect, Deps>;
@@ -190,4 +186,3 @@ export declare function traceSync(implementation: AnyImplementation, input: unkn
190
186
  readonly error?: unknown;
191
187
  };
192
188
  export declare function comparisonsReached(implementation: AnyImplementation, input: unknown, deps?: unknown): readonly ComparisonReached[];
193
- export {};