lawspec 0.22.0 → 0.24.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 (37) hide show
  1. package/CHANGELOG.md +358 -2
  2. package/README.md +3 -3
  3. package/bin/lawspec.mjs +95 -14
  4. package/build.json +314 -120
  5. package/compatibility.json +29 -0
  6. package/core.wasm +2 -2
  7. package/doctor.mjs +119 -1
  8. package/examples/native-payments/clojure/lawspec.json +51 -0
  9. package/examples/native-payments/clojure/src/domain/payments.clj +11 -0
  10. package/examples/native-payments/clojure/test/domain/payment_generators.clj +9 -0
  11. package/examples/native-payments/csharp/lawspec.json +51 -0
  12. package/examples/native-payments/csharp/src/Domain/Payments.cs +19 -0
  13. package/examples/native-payments/csharp/tests/Native/PaymentGenerators.cs +14 -0
  14. package/examples/native-payments/fsharp/lawspec.json +167 -0
  15. package/examples/native-payments/fsharp/src/Native/Types/PaymentsDomain.fs +23 -0
  16. package/examples/native-payments/fsharp/tests/Native/PaymentGenerators.fs +11 -0
  17. package/examples/native-payments/groovy/lawspec.json +165 -0
  18. package/examples/native-payments/groovy/src/main/groovy/domain/PaymentsDomain.groovy +49 -0
  19. package/examples/native-payments/groovy/src/test/groovy/domain/PaymentGenerators.groovy +15 -0
  20. package/examples/native-payments/scala/lawspec.json +165 -0
  21. package/examples/native-payments/scala/src/main/scala/domain/PaymentsDomain.scala +18 -0
  22. package/examples/native-payments/scala/src/test/scala/domain/PaymentGenerators.scala +8 -0
  23. package/examples/native-payments/swift/lawspec.json +154 -0
  24. package/examples/native-payments/swift/src/Native/PaymentsDomain.swift +35 -0
  25. package/examples/native-payments/swift/tests/Native/PaymentGenerators.swift +12 -0
  26. package/examples/specs/collections.lawspec +44 -0
  27. package/examples/specs/composition.lawspec +110 -0
  28. package/examples/specs/contracts.lawspec +124 -0
  29. package/examples/specs/generation.lawspec +11 -0
  30. package/examples/specs/records.lawspec +191 -0
  31. package/examples/specs/records_inner.lawspec +10 -0
  32. package/examples/specs/sequences.lawspec +86 -0
  33. package/index.d.ts +40 -1
  34. package/package.json +2 -2
  35. package/scala-coverage.mjs +56 -0
  36. package/templates.mjs +107 -3
  37. package/test-command.mjs +105 -4
package/CHANGELOG.md CHANGED
@@ -6,6 +6,360 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.24.0] - 2026-10-13
10
+
11
+ ### Added
12
+
13
+ - A Scala target (`--target scala`): Scala 3.9 over the shared JVM runtime,
14
+ built and tested with Scala CLI (`scala test .`) in sbt's source layout.
15
+ Data types are case classes and enums, and the built-in types are Scala's
16
+ own: `List`, `Option`, `Either`, `Set`, `Map`, `Queue`, `Vector`, `BigInt`,
17
+ exact `BigDecimal`, `FiniteDuration` and `IArray`. Abilities are traits,
18
+ and an adapter or operation that fails with `E` returns `Either[E, R]`;
19
+ async adapters return `Future`. Laws are ScalaTest suites whose properties
20
+ run on ScalaCheck 1.20.0 with LawSpec's shrink-tree generators, so shrinks
21
+ stay inside refinements and `LAWSPEC_SEED` replays a run
22
+ (DEC-scala-property-library). Checked definitions run on the shared JVM
23
+ bodies, typed where the plan allows; actors, supervisors, sessions,
24
+ mailboxes, remote evaluation, the secure network, post-quantum crypto, the
25
+ built-in abilities' default handlers, native bindings and every harness
26
+ feature (strategies, cover, targeted search, the failure database, retries,
27
+ timeouts, order random, parallel units, benchmarks and JUnit reports) are
28
+ supported. `lawspec test --coverage` measures Scala with Scala 3's own
29
+ instrumentation and the scoverage reporter, with nothing to install.
30
+ - Typed BEAM code: on Erlang, Elixir and Gleam, a checked definition whose
31
+ values all have native forms, and a spec handler whose clauses are all
32
+ typed, run as native Erlang in `lawspec_typed`, over each language's own
33
+ tuples, structs or custom types, with `KeyVal` as maps and `Set` as
34
+ version 2 `sets` whose entries and items come out in the portable order.
35
+ Integers are checked where their type bounds them, raise and attempt fail
36
+ as the dynamic code does, and definitions that perform other abilities'
37
+ operations take the handler context. A typed handler keeps its state in
38
+ its cell's process and runs each operation there, so an operation copies
39
+ only its arguments and result; `cluster_typed_state` and
40
+ `cluster_set_typed_state` read and replace that state without
41
+ conversion. `lawspec-dev bench kafka` has Erlang, Elixir and Gleam
42
+ drivers: at 10,000 produces the workload took 34 to 36 seconds on the
43
+ dynamic path and 0.02 to 0.03 seconds typed, and a million produces now
44
+ run at 400,000 to 770,000 operations a second. `--typed` reports the BEAM
45
+ plan too.
46
+ - Groovy target (`--target groovy`) on Groovy 5.0, Gradle and Spock 2.5. Groovy
47
+ runs over the Java model: the data types (records and sealed interfaces),
48
+ codecs, ability interfaces, checked definitions, actors, sessions, mailboxes,
49
+ the network and the secure handler are the Java target's, compiled jointly
50
+ with the Groovy sources. Adapters and bound application code are Groovy
51
+ classes checked with `@CompileStatic`, and each unit's laws are a Spock
52
+ specification with a feature per test, named in words. Properties run on
53
+ JetCheck with LawSpec's generators, so shrinks stay inside refinements, and
54
+ `LAWSPEC_SEED` replays a run; `order random` and `parallel` become a seeded
55
+ feature order and Spock's concurrent execution. The surveys behind the
56
+ property libraries are DEC-groovy-property-library and
57
+ DEC-clojure-property-library.
58
+ - Clojure target (`--target clojure`) on Clojure 1.12 with deps.edn,
59
+ `clojure.test` and test.check. Clojure runs over the Java model too, which
60
+ `lawspec.build` compiles with the JDK's compiler. Each unit's adapters are
61
+ functions of a namespace, called through a generated Java bridge, and
62
+ values cross as Clojure data: tagged maps (`{:lawspec/tag
63
+ :payment/approved, :cents 500}`) or a tag alone for a constructor without
64
+ fields, vectors, sets, maps, nil for Maybe's nothing, `[:left e]` and
65
+ `[:right a]`, and failures as ex-info. Native handlers are maps of
66
+ operations. `lawspec.json` binds functions, handle constructors and
67
+ methods, handlers and failures (an ex-info's `:type`) to Clojure.
68
+ Properties run on test.check: LawSpec's generators make rose trees whose
69
+ shrinks stay inside refinements, and `LAWSPEC_SEED` replays a run; a
70
+ namespace's `test-ns-hook` gives `order random` and `parallel`.
71
+ - A Swift target (`--target swift`) on Swift 6.2 and later, with SwiftPM and
72
+ `swift test`. Its runtime is written for Swift 6 with strict concurrency:
73
+ structs and enums with associated values (`indirect` where recursive) in
74
+ LawSpec's order, exact integers, persistent lists (`PersistentList`) and
75
+ sorted collections, typed throws for failures, abilities as protocols,
76
+ `async` adapters, supervised actors whose messages also have `async`
77
+ overloads, single-use session ends, mailboxes, a virtual clock, workflow
78
+ policies, remote evaluation and the secure network on the shared wire
79
+ format, and post-quantum crypto from CryptoKit (macOS 26), with the
80
+ runtime's own SHAKE256 and SLH-DSA where CryptoKit has none. Tests are Swift
81
+ Testing functions; no maintained Swift property library shrinks inside
82
+ refinements and replays from a seed, so properties run on a small
83
+ shrink-tree engine in `LawSpecTesting`, with `LAWSPEC_SEED` replay. Models,
84
+ linearizability, scenarios and the whole harness run around it.
85
+ Definitions whose values all have native types run typed, with self tail
86
+ calls as loops, and each spec handler is a native class with its state to
87
+ read or restore. `lawspec test`, `lawspec doctor` and `lawspec examples`
88
+ support it. See [Set up Swift](docs/how-to/targets/swift.md).
89
+
90
+ ### Fixed
91
+
92
+ - Erlang and Elixir: a data type named after a built-in type that a module
93
+ may redefine, such as `Record`, no longer makes `lawspec_data` warn. The
94
+ type takes its qualified name, and its constructors keep their tags.
95
+ - Erlang and Elixir: EUnit and ExUnit now allow a law, model check or
96
+ benchmark ten minutes on top of its own timeouts. This is a guard against
97
+ hangs, not a budget. Before, the limit was 60 s, and a law that retries
98
+ over a lossy network on the real clock could run past it on a loaded
99
+ machine.
100
+ - BEAM parallel model checks pause with a run of yields instead of a 1 ms
101
+ timer, which a loaded machine stretches across hundreds of runs.
102
+ - Refined record fields are now generated instead of filtered. On Python, a
103
+ constructor field refined by a regex also draws samples of that regex. On
104
+ every target, a data input whose refinement matches one of its fields
105
+ against a regex (`validPet p`) now starts from values whose field matches.
106
+ This stops Hypothesis's `filter_too_much` health check from failing.
107
+
108
+ ## [0.23.0] - 2026-10-12
109
+
110
+ ### Added
111
+
112
+ - F# and C# targets (`--target fsharp`, `--target csharp`) on .NET 10, with
113
+ xunit.v3 on Microsoft.Testing.Platform and `dotnet test`. F# gets a runtime
114
+ written for it: records and unions in LawSpec's order, exact integers,
115
+ persistent collections, `Result` for typed failures, abilities as
116
+ interfaces, `Task` for async, typed actors and supervisors, single-use
117
+ session ends, mailboxes, a virtual clock, remote evaluation and the secure
118
+ network on the shared wire format, and post-quantum crypto from .NET with
119
+ BouncyCastle where .NET lacks it. Properties run on FsCheck 3.4.0, driven
120
+ from the xUnit facts: LawSpec's refinement-directed generators are FsCheck
121
+ generators of shrink trees, so shrinks stay inside refinements, and FsCheck
122
+ runs, sizes, shrinks and replays (`LAWSPEC_SEED`) the cases; generator
123
+ bindings return FsCheck Arbitraries. Models, linearizability, scenarios and
124
+ the whole harness run around it. C# runs over it: the program's model is a generated F#
125
+ project, and adapters, entries, the embedding API and tests are C#, with
126
+ `LawSpec.CSharp` as the compatibility layer. Definitions whose values all
127
+ have native types run typed, over the program's own F# types with checked
128
+ .NET integers, and each spec handler is a native class with `Result`
129
+ try-forms and its state to read or restore (typed handlers keep it native).
130
+ Native bindings, `lawspec test`, `lawspec doctor`, the native payments
131
+ example and `lawspec-dev bench kafka` cover both targets. Every acceptance
132
+ suite passes on both, with its mutants rejected, and the tutorial lessons
133
+ have F# and C# implementations. Text in a Set or a KeyVal orders by code
134
+ point on .NET as everywhere: F#'s own string order (by UTF-16 unit) is
135
+ never observed, as items, keys, entries or a comparison. See the F# and C#
136
+ setup guides.
137
+ - The collections suite checks that text keys and items order by code point,
138
+ with a character outside the Basic Multilingual Plane beside a fullwidth
139
+ letter, on every target.
140
+ - `lawspec evidence` says which tested laws ran against stand-ins. It reads
141
+ an environment attestation, a versioned JSON document any tool may write
142
+ for one run: the environment, the run's id and times, and for each
143
+ dependency its endpoint, whether it was reached, and whether it was the
144
+ real dependency or a stand-in (with the stand-in's identity, version,
145
+ declared conformance level and optional history digest). A dependency is
146
+ matched by name to an ability whose production handler a law runs under
147
+ (`unit::Name` or `unit::ability::Name`) or to an adapter or bound native
148
+ function the law calls. Each such law whose tests ran gets a line, and
149
+ `--json` the fields `environment`, `environmentRun` and `against`; an
150
+ `ENVIRONMENT` section lists the dependencies. It is reporting only: no
151
+ status changes and no law means anything different.
152
+ - `lawspec evidence --attestation <file>` and `lawspec test --attestation
153
+ <file>`, or `attestation` in `lawspec.json`, name the attestation. `lawspec
154
+ test` keeps it with the run's results in `.lawspec/results`, so a later
155
+ `lawspec evidence` shows the attested run each law last passed in; a law it
156
+ touches runs again when its dependencies are wired differently.
157
+ - The compiler API takes an `attestation` in any request: the result's
158
+ `evidence` carries the fields above and `attestation` lists each dependency
159
+ with the obligations it touched. A malformed attestation, or an unknown
160
+ format or version, is a diagnostic with code `attestation`.
161
+ - Checked definitions and stateful spec handlers run as typed native code on
162
+ all eight targets wherever every value they touch has a typed form
163
+ (Bool, Unit, the bounded integers, Integer, Text, Bytes, List, Maybe,
164
+ Either, KeyVal, Set and data built from them); anything else runs on the
165
+ dynamic values, as before. A definition that performs an operation of
166
+ another ability, or calls one that does, runs typed too: it takes the
167
+ handler context first and performs through the handler in scope, so
168
+ LawTwin's Kafka client handlers (`kafkaProducer`, `kafkaConsumer`,
169
+ `kafkaTransactions`) run typed, and 829 of the contract's 865 definitions
170
+ do (only the IntSize and UIntPtr helpers stay dynamic). Python represents
171
+ data as tuples, lists as shared cons cells that know their length and
172
+ KeyVal and Set as persistent AVL trees, and turns self tail calls into
173
+ loops; JavaScript and TypeScript use classes with generated TypeScript
174
+ types, and a number for every integer that fits a safe integer, a BigInt
175
+ only beyond; Haskell uses strict data types, `Data.Map.Strict` and
176
+ `Data.Set`, and threads a handler's state through an `MVar`. Definitions that `fail with E`, `raise` and `prelude.attempt`, field
177
+ access and record update, bounded arithmetic, recursion on integers and
178
+ the sequence helpers run typed, and so does a spec handler of several
179
+ abilities with a computed start; a typed failure is the same panic or
180
+ exception the dynamic code raises, so each catches the other's.
181
+ `lawspec-dev bench <name> --typed` lists what stays dynamic, and why. Lists are
182
+ persistent cons lists that share their tails, KeyVal and Set persistent AVL
183
+ trees in the portable order, Integer stays in a machine word until it
184
+ outgrows it, data with fields is shared by reference, and a definition's
185
+ self tail calls become a loop. A handler's state is never copied: an
186
+ operation costs what it changes. Values convert directly between the typed
187
+ forms and each target's native types at a handler's interface, and through
188
+ the dynamic value where typed and dynamic code meet.
189
+ - Embedding entry points: a stateful spec handler can be made outside any law
190
+ and called from native code, `Handler::start()` in Rust,
191
+ `Start<Handler>()` in Go, the no-argument constructor in Java and Kotlin,
192
+ `Handler()` in Python, `new Handler()` in JavaScript and TypeScript and
193
+ the handler's function over a symbol context in Haskell. Its operations apply one at a time, so it can
194
+ be shared between threads. Each operation that fails with `E` also has a
195
+ form that returns the failure as a value: `try_op` gives `Result<T, E>` in
196
+ Rust, `TryOp` gives `(T, error)` with a `*LawSpecRaised[E]` in Go, `tryOp`
197
+ an `Outcome<T, E>` in Java and Kotlin, `Right` or `Left` in Python,
198
+ JavaScript and TypeScript, and `Either E T` in Haskell. A handler's state
199
+ can be read and replaced (`state`, `set_state` and their typed forms;
200
+ `<h>Snapshot` and `<h>Restore` in Haskell), and the state's type is
201
+ public. The new guide "Embed a generated model" shows how.
202
+ - `lawspec-dev bench <name>` runs a benchmark of generated code on all eight
203
+ targets. `bench/kafka` drives LawTwin's Kafka reference model (a
204
+ copy under its MIT licence, re-expressed with failing operations, one
205
+ handler for three abilities, fields and bounded arithmetic) through its
206
+ `cluster` handler: a million produces over 100 partitions, a consumer
207
+ group of ten fetching and committing with a rebalance, and ten thousand
208
+ transactions. Every definition of the model and the handler run typed.
209
+ It runs the whole workload at 0.53 (Rust), 1.03 (Go), 0.78 (Java) and 0.93
210
+ (Kotlin) million operations a second, holding about 190 to 270 MiB for the
211
+ million records, where 0.21.0's generated Rust managed 9 operations a
212
+ second, and 1.5 GiB, at two thousand. Python runs it at 118 thousand
213
+ operations a second (it ran 1,100 on the dynamic values, at twenty
214
+ thousand), JavaScript at 942 thousand and TypeScript at 964 thousand
215
+ (7,300 before) and Haskell at 1.83 million (57 before, at two thousand).
216
+ `lawspec-dev bench kafka --deterministic` generates the contract on each
217
+ target with and without a cache, cold and warm, and by `lawspec-core`, and
218
+ fails unless every run gives the same bytes.
219
+ - Fields: `b.balance` reads a field of a single-constructor value, and
220
+ `b with balance = v, owner = o` copies it with fields replaced.
221
+ - Handlers of several abilities: `handler reference for Broker, Admin with
222
+ state s :: S start e is ... end` answers every operation of each from one
223
+ state. A law that runs it for one of its abilities runs it for the others
224
+ it uses, made once per case.
225
+ - Sets of handlers: `handlers reference is cluster, client end`. Every law of
226
+ an ability a set covers runs under all of its handlers at once,
227
+ `` Broker: law [reference] ``, and so does every law that uses one of its
228
+ abilities.
229
+ - `ability Broker with Cluster is ... end`: native handlers made with a
230
+ resource. Each case acquires one `Cluster` and makes every such native
231
+ handler with it, so native handlers of one case share it.
232
+ - Ability operations may fail: `produce :: Batch -> Int64 fails with
233
+ KafkaError`. Spec handler clauses `raise`; native handlers raise the
234
+ runtime's `Fail`. `prelude.attempt` works in definitions.
235
+ - Handler clauses: a start value may call definitions and the prelude
236
+ (`start prelude.keyValOf []`); a tail `match` or `if` may update the state
237
+ in its branches; `op by f` makes a clause of a definition that gives
238
+ `Pair result next`.
239
+ - Sequences: `++`, `prelude.slice`, `take`, `drop`, `at`, `range`, `octets`,
240
+ `bytesOf`, `utf8`, `textOf` and `join` over `Text`, `Bytes` and `List`.
241
+ - Bounded arithmetic: `prelude.wrapping`, `prelude.saturating` and
242
+ `prelude.bounded` put an integer result into the bounded type the context
243
+ wants.
244
+ - Recursion on integers: a recursive call may move an integer argument
245
+ strictly toward a bound.
246
+ - The totality checker knows what guards say about calls, fields and lengths,
247
+ that a call lies in its result type's range, that lengths are not negative,
248
+ and the bounds of `prelude.rem` and `prelude.quot`.
249
+ - A text refined by a regex, directly or through a checked definition, is
250
+ generated from texts the regex matches instead of filtered from any text,
251
+ also in laws that mix it with record or list inputs.
252
+ - On Python, a unit named like another unit's package (`shop.tax` beside
253
+ `shop.tax.rates`) is the package's `__init__.py`.
254
+ - New acceptance suites `records`, `sequences` and `composition`.
255
+ - Erlang, Elixir and Gleam run the language gaps on their dynamic path:
256
+ handlers of several abilities and sets of handlers, operations that `fail
257
+ with`, natives made with a resource, computed starts and state updated in
258
+ branches, field access and record update, the sequence, `Bytes` and `Text`
259
+ operations, bounded arithmetic, and regex-shaped generation of refined text
260
+ fields. A handler of several abilities gives one native interface per
261
+ ability over its one state; each operation that fails has a try form
262
+ (`{ok, V}` or `{error, E}`, a `Result` in Gleam), and a spec handler with
263
+ state has `<handler>_state` and `<handler>_set_state`. The `records`,
264
+ `sequences`, `composition` and `contracts` suites run on all eleven
265
+ targets, and a `beam-embedding` suite checks the embedding forms.
266
+ - Vetting on Rice's Tax's review page: `make assess` records every pending
267
+ row, `make tax` serves the page on which each comment, page, decision and
268
+ reference is judged beside the code or page it explains, and `make audit`
269
+ says what is left. `lawspec-dev tax` runs the Rice's Tax checkout named by
270
+ `RICESTAX_HOME`; see the new how-to guide, Vet the canonical material.
271
+
272
+ ### Changed
273
+
274
+ - `canon.yaml` names the canon version its vetting files were written with,
275
+ 0.2.1, which both `make canon` and Rice's Tax require. Code reshaped in
276
+ 0.20.1 for canon's Haskell grammar has its original forms back, since canon
277
+ 0.2.1 reads them.
278
+ - Definitions that are the same up to their names, such as an import's
279
+ copies, share one generated body: Rust aliases the copies' functions, and
280
+ Java and Go delegate to it. Go packages hold only the bodies they reach,
281
+ and the native entry points of typed definitions convert their values
282
+ directly. LawTwin's Kafka contract generates 23,606 lines of
283
+ `lawspec_definitions.rs` instead of 83,157, 27,439 lines of Java
284
+ definitions instead of 80,444, 27,309 of Kotlin and Java instead of 87,537,
285
+ and 37,900 lines of Go definitions over its four packages instead of
286
+ 113,462.
287
+ - Generated Rust builds its data schema once: `lawspec_schema::schema()`
288
+ returns `&'static ls::Schema`.
289
+ - `lawspec-dev ci` runs its steps in parallel: `--jobs N` at a time
290
+ (`LAWSPEC_CI_JOBS`, half the processors by default), and `--jobs 1` runs
291
+ them one at a time as before. Each step declares the steps it follows and
292
+ what it holds (its target's `.integration` environment, its acceptance
293
+ project, the repository's `.stack-work`, Stack's snapshot database, the
294
+ runtime crate's Cargo target, a timing class for real-time suites), so
295
+ parallel steps never share what one of them changes, and every step still
296
+ runs after a failure. A line is printed as each step finishes, a terminal
297
+ shows the running steps, the summary names failures in step order, and
298
+ Ctrl-C stops every running step's process group. Cached steps are skipped
299
+ exactly as before. See Contribute to LawSpec.
300
+ - The npm package's `prepack` replaces `README.md` and `CHANGELOG.md` in
301
+ `npm/` by rename, and leaves identical copies alone, so concurrent packs
302
+ never read a half-written copy.
303
+ - `package-smoke` allows half an hour for exporting the examples, and
304
+ `lawspec-dev ci` runs it alone.
305
+
306
+ ### Fixed
307
+
308
+ - The predicates npm test makes its scratch project under `.artifacts`, so a
309
+ `generate --check` running beside it in parallel CI no longer sees it.
310
+ - `tools/bootstrap-integration.mjs` installs the crypto packages the crypto
311
+ and distribution suites need (`@noble/post-quantum` from the JavaScript and
312
+ TypeScript locks, `cryptography` for Python), so a new `.integration`
313
+ passes them.
314
+
315
+ - The acceptance harness strips ANSI escape sequences before it decides
316
+ whether a mutant failed to compile, so a coloured toolchain (Gleam under
317
+ `FORCE_COLOR`) no longer hides a compile failure behind its colour codes.
318
+ - Generation is deterministic: the on-disk cache is keyed by the build of
319
+ the compiler that wrote it (its executable's path, size and time) as well
320
+ as its version, so a rebuilt compiler no longer reads another build's
321
+ entries.
322
+ - Generated names are stable under unrelated edits: the typed functions a
323
+ handler's clauses call, and its start, are named from the definitions and
324
+ the handler (with a suffix from the digest of what they name where one is
325
+ needed), not from their position among the others.
326
+ - Generated code builds without warnings, or with targeted allow attributes,
327
+ on every target, also as a dependency of another project.
328
+ - A TypeScript type with several type arguments no longer has a trailing
329
+ comma.
330
+ - A spec handler clause that fails no longer poisons the handler on Rust:
331
+ later operations see the state as the failure left it.
332
+ - A field's refinement may call a checked definition of its unit
333
+ (`label :: (v :: Text where validName v)`).
334
+ - A record update or a rebuild proves a field's regex refinement, which the
335
+ copied field already met; text tests and the sequence helpers are facts
336
+ the checker knows.
337
+ - A definition that says it `fails with E` but never raises may be a
338
+ handler clause (`op by f`).
339
+ - A spec handler named like its ability (`counter` for `Counter`) is
340
+ `CounterSpec` where the two would share a name.
341
+ - A record whose field a regex constrains has boundary witnesses that match
342
+ the regex.
343
+ - Bounded arithmetic used by an import's definitions resolves in the
344
+ importing unit, packages included.
345
+ - Checking scales with a program's size: LawTwin's import of GitHub's whole
346
+ REST description (2,108 types, 1,232 operations, 87 laws) checks in
347
+ minutes, where it did not finish in 30. Field access is typed without
348
+ building its match, registries, indexes, audits and unit elaboration are
349
+ made once per program, and sets and maps replace quadratic list scans.
350
+ `lawspec-dev bench compile` times a scaled model. Field access and record
351
+ update are Core's own projection and update, read directly by validation,
352
+ evaluation and the totality audits, instead of a match binding every field
353
+ of the record: the scaled model of 100, 200 and 400 types checks in 22.5,
354
+ 46.9 and 129.9 seconds instead of 33.8, 95.5 and 340.2 (unoptimized
355
+ builds).
356
+ - Java and Kotlin generation accepts a field named `record`, `sealed`,
357
+ `permits` or `var`, which Java restricts only as type names.
358
+ - Prelude helpers such as `prelude.isRight` work in an ability's laws and in
359
+ handler clauses.
360
+ - A numeric literal in a `match` or `if` branch, or a list, takes its type
361
+ from the other branches or items.
362
+
9
363
  ## [0.22.0] - 2026-10-10
10
364
 
11
365
  ### Added
@@ -372,7 +726,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
372
726
  requirements the tests verify), `canonical_decisions.yaml` (the design
373
727
  decisions, each cited as `ref:KEY`) and `canonical_exemptions.yaml` sit at
374
728
  the root, and `canonical_vetting/` holds every comment, page, decision and
375
- reference as pending with owner review deferred until after the 0.21 refactor.
729
+ reference as pending with owner review deferred until 1.0.
376
730
  - `make canon` and `lawspec-dev canon` run canon over the repository, and the
377
731
  complete check runs it as its `canon` step. Set `CANON_HOME` to a canon
378
732
  checkout built with `stack build`; without one the step is skipped with a
@@ -1280,7 +1634,9 @@ A maintenance release. The language, generated code and API are unchanged from
1280
1634
  machine-sized bindings reject an architecture mismatch. Rust adapters take
1281
1635
  owned values.
1282
1636
 
1283
- [Unreleased]: https://github.com/brain-fuel/lawspec/compare/v0.22.0...HEAD
1637
+ [Unreleased]: https://github.com/brain-fuel/lawspec/compare/v0.24.0...HEAD
1638
+ [0.24.0]: https://github.com/brain-fuel/lawspec/compare/v0.23.0...v0.24.0
1639
+ [0.23.0]: https://github.com/brain-fuel/lawspec/compare/v0.22.0...v0.23.0
1284
1640
  [0.22.0]: https://github.com/brain-fuel/lawspec/compare/v0.21.0...v0.22.0
1285
1641
  [0.21.0]: https://github.com/brain-fuel/lawspec/compare/v0.20.1...v0.21.0
1286
1642
  [0.20.1]: https://github.com/brain-fuel/lawspec/compare/v0.20.0...v0.20.1
package/README.md CHANGED
@@ -30,7 +30,7 @@ Node 22+ and the selected target's build tools are required. No Haskell
30
30
  toolchain is needed. The reference platforms are macOS and Linux.
31
31
 
32
32
  ```sh
33
- npm install --save-dev lawspec@0.22.0
33
+ npm install --save-dev lawspec@0.24.0
34
34
  npx lawspec --version
35
35
  ```
36
36
 
@@ -40,8 +40,8 @@ LawSpec can create `package.json` and its test script:
40
40
  ```sh
41
41
  mkdir lawspec-example
42
42
  cd lawspec-example
43
- npm exec --package=lawspec@0.22.0 -- lawspec init --target javascript
44
- npm install --save-dev lawspec@0.22.0
43
+ npm exec --package=lawspec@0.24.0 -- lawspec init --target javascript
44
+ npm install --save-dev lawspec@0.24.0
45
45
  npx lawspec check
46
46
  npx lawspec explain 'example.atoi_codec::itoa and then atoi yields a'
47
47
  npx lawspec doctor