lawspec 0.19.1 → 0.20.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.
- package/CHANGELOG.md +712 -698
- package/README.md +4 -4
- package/bin/lawspec.mjs +5 -2
- package/build.json +168 -168
- package/core.wasm +0 -0
- package/examples/packages/orders/lawspec.json +2 -2
- package/examples/packages/orders/orders.lawspec +25 -0
- package/examples/packages/shop-domain/lawspec-package.json +3 -1
- package/examples/packages/shop-domain/src/domain.lawspec +8 -0
- package/examples/packages/shop-tax-1/lawspec-package.json +5 -0
- package/examples/packages/shop-tax-1/src/api.lawspec +6 -0
- package/examples/packages/shop-tax-1/src/rates.lawspec +8 -0
- package/examples/packages/shop-tax-2/lawspec-package.json +5 -0
- package/examples/packages/shop-tax-2/src/api.lawspec +6 -0
- package/examples/packages/shop-tax-2/src/rates.lawspec +9 -0
- package/examples/specs/approvals.lawspec +35 -0
- package/examples/specs/async_bindings.lawspec +39 -0
- package/examples/specs/collections.lawspec +20 -0
- package/examples/specs/distribution.lawspec +24 -2
- package/examples/specs/flow_stack.lawspec +34 -0
- package/examples/specs/generation.lawspec +22 -0
- package/examples/specs/models.lawspec +21 -0
- package/examples/specs/workflows.lawspec +30 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,33 +1,143 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
All notable changes to LawSpec are documented in this file. The format is based
|
|
4
|
+
on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and LawSpec adheres
|
|
5
|
+
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.20.1] - 2026-10-06
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- The repository follows canon's canonical format. `canon.yaml`,
|
|
14
|
+
`canonical_refs.yaml` (every work the docs and code cite, and the
|
|
15
|
+
requirements the tests verify), `canonical_decisions.yaml` (the design
|
|
16
|
+
decisions, each cited as `ref:KEY`) and `canonical_exemptions.yaml` sit at
|
|
17
|
+
the root, and `canonical_vetting/` holds every comment, page, decision and
|
|
18
|
+
reference as pending until the owner vets it in 0.20.2.
|
|
19
|
+
- `make canon` and `lawspec-dev canon` run canon over the repository, and the
|
|
20
|
+
complete check runs it as its `canon` step. Set `CANON_HOME` to a canon
|
|
21
|
+
checkout built with `stack build`; without one the step is skipped with a
|
|
22
|
+
message.
|
|
23
|
+
- Documentation pages cite sources and decisions as `ref:KEY`, rendered as
|
|
24
|
+
links on the site.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- `CHANGELOG.md` follows Keep a Changelog 1.0.0: dated releases, changes
|
|
29
|
+
grouped as Added, Changed, Removed and Fixed, and comparison links.
|
|
30
|
+
- Every documentation page begins with front matter naming its id, kind and
|
|
31
|
+
title; `docs/nav.json` no longer repeats page titles.
|
|
32
|
+
- Documentation fences include files with `include=` instead of `file=`,
|
|
33
|
+
which is left to canon's tangled blocks.
|
|
34
|
+
- The contributing and release guides move to `docs/how-to/contribute.md` and
|
|
35
|
+
`docs/how-to/release.md`, and appear on the site.
|
|
36
|
+
- `lawspec-dev bump` and `version --check` cover `canon.yaml`.
|
|
37
|
+
- The npm package's `README.md` and `CHANGELOG.md` are copied from the
|
|
38
|
+
repository root when the package is packed, instead of being kept twice in
|
|
39
|
+
git. The package's contents are unchanged.
|
|
40
|
+
|
|
41
|
+
## [0.20.0] - 2026-10-05
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- `lawspec.json` can bind an `async` adapter to native code returning the
|
|
46
|
+
target's task: a coroutine, `Promise`, `CompletableFuture`, `suspend fun`,
|
|
47
|
+
`LawSpecTask`, Rust future or `IO` action. The bridge stays asynchronous
|
|
48
|
+
and converts the result once the task completes.
|
|
49
|
+
- `SizedStack n a` and `SizedQueue n a` are stacks and queues indexed by their
|
|
50
|
+
size: `prelude.sizedPop`, `sizedTop`, `sizedDequeue` and `sizedFront` take a
|
|
51
|
+
non-empty one by type.
|
|
52
|
+
- A function may take several flow parameters (`A / A'`); a call passes a
|
|
53
|
+
state to each (`pushBoth x ~a ~b`), and a definition may update each.
|
|
54
|
+
- Flow calls may sit in the branches of an `if` or a `match`. A state the
|
|
55
|
+
branches leave at different types cannot be used afterwards, and the error
|
|
56
|
+
names each branch's type.
|
|
57
|
+
- `if c then a else b` in laws and checked definitions. Only the selected
|
|
58
|
+
branch is evaluated, and the totality audit checks each branch knowing which
|
|
59
|
+
way the condition went.
|
|
60
|
+
- A unit can re-export names it imports with an `export` line after its
|
|
61
|
+
imports (`export Band, rates.rateOf`), so a package can offer one facade
|
|
62
|
+
unit. Re-exported names are the original declarations, not copies.
|
|
63
|
+
- A build can hold several versions of one package. Each unit sees the version
|
|
64
|
+
its own package's range selects (the highest supplied version the range
|
|
65
|
+
accepts), and each version's units are compiled under names with the
|
|
66
|
+
version after the package name (`shop.tax.v2x0x0.api`), so their types and
|
|
67
|
+
native names stay apart. A mismatch between two versions' types names both
|
|
68
|
+
versions. A package supplied in one version is unchanged.
|
|
69
|
+
- New channel frames `take`, `state`, `moved` and `moved-ack`, for moving a
|
|
70
|
+
channel end between nodes.
|
|
71
|
+
|
|
72
|
+
### Changed
|
|
73
|
+
|
|
74
|
+
- `lawspec package` lists only the package's own units, not those of the
|
|
75
|
+
packages it depends on.
|
|
76
|
+
- An `all` group with an asynchronous step runs its steps at the same time,
|
|
77
|
+
on each target's own concurrency, so it takes as long as its slowest step.
|
|
78
|
+
Results and accumulated errors keep the order of declaration, and every
|
|
79
|
+
step finishes before the group fails. Groups of synchronous steps still run
|
|
80
|
+
in turn.
|
|
81
|
+
- A channel end that already talks across the network now moves when it is
|
|
82
|
+
sent to another node, instead of being relayed. The old node hands the
|
|
83
|
+
end's state over (sequence numbers, unacknowledged values, values received
|
|
84
|
+
but not yet used), forwards anything still in flight, and the peer is told
|
|
85
|
+
the new address, so the old node can stop once the receive returns. Ends
|
|
86
|
+
can move on again, and a peer that does not answer the move is still
|
|
87
|
+
reached through the old node. Local ends are relayed as before.
|
|
88
|
+
- A match may leave out constructors that the value's index rules out: taking
|
|
89
|
+
the head of a `Vec (n + 1) a` needs no `VNil` branch. The compiler proves
|
|
90
|
+
each one impossible, and names a constructor the index allows.
|
|
91
|
+
- `prelude.select` now means the same as `if c then a else b`.
|
|
92
|
+
- The totality audit bounds products: `x * x` for an `Int16` `x` fits `Int64`,
|
|
93
|
+
and factors with known bounds give their product's bounds.
|
|
94
|
+
- Scenarios may close cycles between processes: LawSpec accepts channels that
|
|
95
|
+
form a cycle when no process can wait for another in a cycle, and names the
|
|
96
|
+
waits when one could. Scenarios with mailboxes or `or else` keep the tree
|
|
97
|
+
rule.
|
|
98
|
+
|
|
99
|
+
### Fixed
|
|
100
|
+
|
|
101
|
+
- A node's channel ends stop resending once the node closes (Python, Go,
|
|
102
|
+
Haskell).
|
|
103
|
+
- A Rust unit with native bindings keeps its generated remote, session, actor
|
|
104
|
+
and mailbox code.
|
|
105
|
+
|
|
106
|
+
## [0.19.1] - 2026-10-05
|
|
107
|
+
|
|
108
|
+
### Added
|
|
6
109
|
|
|
7
110
|
- A handle's Kotlin type binding can give the native class's type
|
|
8
111
|
`arguments` (`["kotlin.Int"]`), so generated Kotlin names the handle's type
|
|
9
112
|
in full instead of `kotlin.Any`.
|
|
113
|
+
|
|
114
|
+
### Changed
|
|
115
|
+
|
|
10
116
|
- A Haskell method binding on a handle with no type binding names the handle
|
|
11
117
|
and the `lawspec.json` entry to add.
|
|
118
|
+
|
|
119
|
+
### Fixed
|
|
120
|
+
|
|
12
121
|
- The sessions example's adapters are asynchronous, so the JavaScript and
|
|
13
122
|
TypeScript ones await each receive instead of using `receiveNow`.
|
|
14
123
|
|
|
15
|
-
## 0.19.0
|
|
124
|
+
## [0.19.0] - 2026-10-04
|
|
16
125
|
|
|
17
|
-
###
|
|
126
|
+
### Added
|
|
18
127
|
|
|
19
|
-
-
|
|
20
|
-
checked definition per command. LawSpec generates runs of
|
|
21
|
-
model, runs them against the adapters, and checks every
|
|
22
|
-
state and invariant. See
|
|
128
|
+
- Stateful models: a `model` pairs a system's commands with a reference, a
|
|
129
|
+
model state and a checked definition per command. LawSpec generates runs of
|
|
130
|
+
commands from the model, runs them against the adapters, and checks every
|
|
131
|
+
result, abstracted state and invariant. See
|
|
132
|
+
[models](docs/reference/language/models.md).
|
|
23
133
|
- **Linear** models thread a flow-typed state, and each command's typestate
|
|
24
134
|
comes from its flow signature, so runs never take a step the types forbid.
|
|
25
135
|
**Shared** models share one handle; `when` preconditions come from the
|
|
26
136
|
model state.
|
|
27
|
-
-
|
|
28
|
-
descriptors gives the same runs and the same shrinks on every target
|
|
29
|
-
the same seed. A failing run is shrunk by dropping commands and
|
|
30
|
-
arguments.
|
|
137
|
+
- Portable generation and shrinking for models: a SplitMix64 generator over
|
|
138
|
+
type descriptors gives the same runs and the same shrinks on every target
|
|
139
|
+
for the same seed. A failing run is shrunk by dropping commands and
|
|
140
|
+
shrinking arguments.
|
|
31
141
|
- Shared models also run in parallel: a short prefix, then a branch per
|
|
32
142
|
thread, run at the same time with random yields, repeated, and each history
|
|
33
143
|
must be linearizable. Sets and maps are checked key by key.
|
|
@@ -38,9 +148,6 @@
|
|
|
38
148
|
- `handle Name` declares a type only adapters create. With native bindings,
|
|
39
149
|
a handle can be a target's own class, such as a concurrent queue, and
|
|
40
150
|
commands can call its methods and constructors directly.
|
|
41
|
-
|
|
42
|
-
### Protocols, scenarios and typed channels
|
|
43
|
-
|
|
44
151
|
- A `protocol` lists what one end of a channel sends and receives. A
|
|
45
152
|
`scenario` runs a shared model's commands from processes (`par ... with ...
|
|
46
153
|
end`) that talk over channels (`send`, `receive`, `expect`). LawSpec proves
|
|
@@ -51,9 +158,6 @@
|
|
|
51
158
|
implementation code: a type per step, so an out-of-order send does not
|
|
52
159
|
compile. A used end fails if used again (in Rust, it does not compile).
|
|
53
160
|
`spawn` and `par` run processes on the target's own concurrency.
|
|
54
|
-
|
|
55
|
-
### Actors and supervision
|
|
56
|
-
|
|
57
161
|
- An `actor` owns a state and handles one message at a time. Handlers are
|
|
58
162
|
plain functions from the state to a reply and the next state. Actors are
|
|
59
163
|
checked like shared models, with injected crashes, and generated as typed
|
|
@@ -67,9 +171,6 @@
|
|
|
67
171
|
- Failures are affine in scenarios: a receive from a failed process fails,
|
|
68
172
|
or runs its `or else`, instead of blocking. One run in three crashes a
|
|
69
173
|
process. Typed channel ends raise `PeerFailed` when the other end gives up.
|
|
70
|
-
|
|
71
|
-
### Mailboxes
|
|
72
|
-
|
|
73
174
|
- `mailbox jobs of Job` declares a typed queue with many senders and one
|
|
74
175
|
receiver. Every target generates `JobsMailbox`, which can also be served on
|
|
75
176
|
a node and sent to from others.
|
|
@@ -77,9 +178,6 @@
|
|
|
77
178
|
every message sent must be received, and senders join the receiver in the
|
|
78
179
|
deadlock-freedom tree. A receive whose senders have all failed fails, or
|
|
79
180
|
runs its `or else`.
|
|
80
|
-
|
|
81
|
-
### Distribution
|
|
82
|
-
|
|
83
181
|
- Nodes talk over a transport: in memory (with loss, duplication, delay and
|
|
84
182
|
partitions, for testing), TCP or HTTP. Actors can be served and called
|
|
85
183
|
across nodes, protocols can listen and dial, and checked definitions can be
|
|
@@ -93,125 +191,126 @@
|
|
|
93
191
|
- A channel end sent to another node keeps working there: the sending node
|
|
94
192
|
relays the conversation. Every protocol can `listen` and `dial`.
|
|
95
193
|
- One scenario run in three sends every channel over a faulty network.
|
|
194
|
+
- `lawspec evidence` lists models, consistency, restarts and supervision as
|
|
195
|
+
property-tested, and each scenario as proved deadlock-free and race-free.
|
|
96
196
|
|
|
97
|
-
###
|
|
197
|
+
### Changed
|
|
98
198
|
|
|
99
199
|
- A refinement's constant integer bounds narrow generation on every target,
|
|
100
200
|
so `(amount :: Int32 where amount >= 1 && amount <= 1000)` is drawn from
|
|
101
201
|
`1..1000` instead of being filtered out of every `Int32`.
|
|
102
|
-
- Generated Python property tests no longer have a per-example deadline, since
|
|
103
|
-
adapters may wait on networks or timers.
|
|
104
202
|
|
|
105
|
-
###
|
|
203
|
+
### Removed
|
|
106
204
|
|
|
107
|
-
-
|
|
108
|
-
|
|
205
|
+
- Generated Python property tests no longer have a per-example deadline, since
|
|
206
|
+
adapters may wait on networks or timers.
|
|
109
207
|
|
|
110
|
-
## 0.18.0
|
|
208
|
+
## [0.18.0] - 2026-10-03
|
|
111
209
|
|
|
112
|
-
###
|
|
210
|
+
### Added
|
|
113
211
|
|
|
114
|
-
- `>>=`, `<$>`, `<!>`, `<|>`, `??`, `>=>`, `|>` and
|
|
115
|
-
names `bind`, `then`, `map`, `mapError`, `orElse`,
|
|
116
|
-
`andThen`, `pipe`, `both`, `ensure`, `isLeft` and
|
|
117
|
-
and recover `Either` values in laws and checked
|
|
118
|
-
|
|
212
|
+
- Railway combinators: `>>=`, `<$>`, `<!>`, `<|>`, `??`, `>=>`, `|>` and
|
|
213
|
+
`<*>`, and the prelude names `bind`, `then`, `map`, `mapError`, `orElse`,
|
|
214
|
+
`fallback`, `fromEither`, `andThen`, `pipe`, `both`, `ensure`, `isLeft` and
|
|
215
|
+
`isRight`, sequence, map and recover `Either` values in laws and checked
|
|
216
|
+
definitions on every target. See
|
|
217
|
+
[expressions](docs/reference/language/expressions-and-arithmetic.md).
|
|
119
218
|
- `Pair` joins the built-in collections unit, and `prelude.select` chooses
|
|
120
219
|
between two values.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
steps, `then`, `map`, `mapError`, `tap`, `ensure`, `orElse`, `fallback`, and
|
|
126
|
-
`all` groups whose results `combine` joins. With `accumulate`, an `all`
|
|
127
|
-
group reports every failing step's error. See
|
|
220
|
+
- LawSpec generates each `workflow` on every target from its stages: steps,
|
|
221
|
+
`then`, `map`, `mapError`, `tap`, `ensure`, `orElse`, `fallback`, and `all`
|
|
222
|
+
groups whose results `combine` joins. With `accumulate`, an `all` group
|
|
223
|
+
reports every failing step's error. See
|
|
128
224
|
[workflows](docs/reference/language/workflows.md).
|
|
129
|
-
-
|
|
130
|
-
through `mapError`; with `Either _ T`, LawSpec generates an error
|
|
131
|
-
after the workflow, with a constructor per failing step
|
|
225
|
+
- Workflow steps may fail with different error types. A declared error type
|
|
226
|
+
takes them through `mapError`; with `Either _ T`, LawSpec generates an error
|
|
227
|
+
type named after the workflow, with a constructor per failing step
|
|
132
228
|
(`PlaceOrderValidateOrderFailed`).
|
|
133
229
|
- Generated laws check that each workflow composes its stages, succeeds when
|
|
134
230
|
every stage does, stops when a step fails, and recovers with each handler.
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- The rate limits, breaker and bulkhead are written once, as checked
|
|
151
|
-
definitions of a built-in unit, `lawspec.resilience`, so they behave the same
|
|
152
|
-
on every target. A new resilience acceptance suite checks each target's
|
|
153
|
-
runtime against them.
|
|
154
|
-
- Generated tests run workflows on a virtual clock with stateful policies,
|
|
155
|
-
timeouts and hedges off; retries still apply.
|
|
156
|
-
|
|
157
|
-
### Durations
|
|
158
|
-
|
|
159
|
-
- `Duration` is a whole number of microseconds, exact on every target, with
|
|
231
|
+
- Step policies: `retry` (immediate, fixed, linear, exponential, fibonacci or
|
|
232
|
+
custom, with optional jitter and a `when` predicate), `timeout`,
|
|
233
|
+
`rateLimit` (token bucket, leaky bucket, fixed or sliding window; wait or
|
|
234
|
+
reject), `circuitBreaker`, `bulkhead`, `cache`, `compensate` and `hedge`. A
|
|
235
|
+
policy failure becomes a constructor of a generated error type, or the value
|
|
236
|
+
a declared error type names with `else`.
|
|
237
|
+
- A workflow runtime: a real or virtual clock, a SplitMix64 random source
|
|
238
|
+
identical on every target, a trace, and the state of limiters, breakers,
|
|
239
|
+
bulkheads and caches. Callers create one to give a workflow its own state or
|
|
240
|
+
a virtual clock; otherwise a shared runtime is used.
|
|
241
|
+
- The built-in unit `lawspec.resilience` defines the rate limits, breaker and
|
|
242
|
+
bulkhead once, as checked definitions, so they behave the same on every
|
|
243
|
+
target. A new `resilience` acceptance suite checks each target's runtime
|
|
244
|
+
against them.
|
|
245
|
+
- `Duration`, a whole number of microseconds, exact on every target, with
|
|
160
246
|
literals (`250ms`, `2s`, `5min`), arithmetic, comparisons and native types
|
|
161
247
|
(`timedelta`, `time.Duration`, `java.time.Duration`,
|
|
162
248
|
`kotlin.time.Duration`, `std::time::Duration`). See
|
|
163
249
|
[durations](docs/reference/language/durations.md).
|
|
250
|
+
- Kotlin workflows can call `suspend` adapters. The Kotlin scaffold depends on
|
|
251
|
+
`kotlinx-coroutines-core`, and `lawspec doctor` reports it missing.
|
|
252
|
+
|
|
253
|
+
### Changed
|
|
254
|
+
|
|
255
|
+
- **Migration:** hand-written workflow adapters are no longer called. Remove
|
|
256
|
+
them, and move any behaviour they had into the steps.
|
|
257
|
+
- Generated tests run workflows on a virtual clock with stateful policies,
|
|
258
|
+
timeouts and hedges off; retries still apply.
|
|
164
259
|
- The totality audit proves more: products and quotients are atoms, quotients
|
|
165
260
|
are bounded, calls satisfy their definitions' postconditions, and unwrapped
|
|
166
261
|
wrapper values satisfy their constraints.
|
|
262
|
+
- On JavaScript and TypeScript, a checked definition that calls an `async`
|
|
263
|
+
adapter, directly or through another definition, is itself `async`.
|
|
264
|
+
|
|
265
|
+
### Removed
|
|
167
266
|
|
|
168
|
-
|
|
267
|
+
- Python property tests have no per-example deadline, since adapters may do
|
|
268
|
+
real work.
|
|
269
|
+
|
|
270
|
+
### Fixed
|
|
169
271
|
|
|
170
272
|
- A definition or adapter named with a target keyword is emitted with a
|
|
171
273
|
leading underscore on that target (`class` is `_class` in Python); such names
|
|
172
274
|
were rejected or broke the build before.
|
|
173
|
-
- On JavaScript and TypeScript, a checked definition that calls an `async`
|
|
174
|
-
adapter, directly or through another definition, is itself `async`.
|
|
175
|
-
- Kotlin workflows can call `suspend` adapters. The Kotlin scaffold depends on
|
|
176
|
-
`kotlinx-coroutines-core`, and `lawspec doctor` reports it missing.
|
|
177
275
|
- Python: a synchronous definition called from inside a running event loop
|
|
178
276
|
(from an `async` adapter) awaits its asynchronous steps on a thread of its
|
|
179
277
|
own instead of failing.
|
|
180
|
-
- Python property tests have no per-example deadline, since adapters may do
|
|
181
|
-
real work.
|
|
182
278
|
|
|
183
|
-
## 0.17.5
|
|
279
|
+
## [0.17.5] - 2026-10-02
|
|
280
|
+
|
|
281
|
+
### Changed
|
|
184
282
|
|
|
185
|
-
|
|
283
|
+
- Results and runner reports of `lawspec test` live in `.lawspec/results` and
|
|
284
|
+
`.lawspec/reports`, each with its own `.gitignore`.
|
|
186
285
|
|
|
187
|
-
|
|
286
|
+
### Fixed
|
|
287
|
+
|
|
288
|
+
- A test filter that matches nothing made Go, Rust, Node, Kotest and hspec
|
|
188
289
|
report success without running anything. `lawspec test` now reads each
|
|
189
290
|
runner's own report (pytest and Node JUnit XML, `go test -json`, the
|
|
190
291
|
Surefire and Gradle reports, and Rust's and hspec's per-test output) and
|
|
191
292
|
records a law as passing only if at least one of its tests ran and was not
|
|
192
293
|
skipped. A selected law with no executed test fails the run, naming the law.
|
|
193
|
-
- Results and runner reports live in `.lawspec/results` and `.lawspec/reports`,
|
|
194
|
-
each with its own `.gitignore`.
|
|
195
294
|
|
|
196
|
-
## 0.17.4
|
|
295
|
+
## [0.17.4] - 2026-10-02
|
|
197
296
|
|
|
198
|
-
###
|
|
297
|
+
### Added
|
|
199
298
|
|
|
200
|
-
-
|
|
201
|
-
since their last passing run, through each target's own runner,
|
|
202
|
-
the laws that pass. A law runs again when the law changes, or
|
|
203
|
-
depends on: the types and definitions it reaches, its unit's
|
|
204
|
-
tests, the LawSpec version, the target's settings, the project's
|
|
205
|
-
lock files, the toolchain, and, for a law that calls adapters, any
|
|
206
|
-
the project LawSpec did not generate. `--fresh` runs every law. See
|
|
299
|
+
- `lawspec test` runs the generated tests of only the laws whose results may
|
|
300
|
+
have changed since their last passing run, through each target's own runner,
|
|
301
|
+
and records the laws that pass. A law runs again when the law changes, or
|
|
302
|
+
anything it depends on: the types and definitions it reaches, its unit's
|
|
303
|
+
generated tests, the LawSpec version, the target's settings, the project's
|
|
304
|
+
build and lock files, the toolchain, and, for a law that calls adapters, any
|
|
305
|
+
file in the project LawSpec did not generate. `--fresh` runs every law. See
|
|
207
306
|
[`lawspec test`](docs/reference/cli.md#test).
|
|
208
|
-
- Every run uses one random seed for all property tests,
|
|
209
|
-
summary and recorded with each pass; `--seed` fixes it.
|
|
307
|
+
- Every `lawspec test` run uses one random seed for all property tests,
|
|
308
|
+
printed in the summary and recorded with each pass; `--seed` fixes it.
|
|
210
309
|
- `planGeneration` responses list each law's generated test file, its
|
|
211
310
|
position in the unit, its dependency key and whether it calls adapters
|
|
212
311
|
(`tests`).
|
|
213
312
|
|
|
214
|
-
###
|
|
313
|
+
### Changed
|
|
215
314
|
|
|
216
315
|
- Property tests read their seed from `LAWSPEC_SEED` on every target, so a
|
|
217
316
|
failing run can be repeated exactly.
|
|
@@ -219,63 +318,70 @@
|
|
|
219
318
|
their example and boundary tests, so each law's tests can be selected by
|
|
220
319
|
name.
|
|
221
320
|
|
|
222
|
-
## 0.17.3
|
|
223
|
-
|
|
224
|
-
### Incremental front end
|
|
225
|
-
|
|
226
|
-
- Each law's expansion and type checking, and its elaboration to Core, are
|
|
227
|
-
keyed by exactly their inputs: the law, the laws it invokes, its unit's
|
|
228
|
-
signatures and the program's data types. Editing a definition's body, or
|
|
229
|
-
another unit's laws, no longer re-checks a law; the dependency keys of
|
|
230
|
-
0.17.2 still replan the laws that reach the edit.
|
|
231
|
-
- Unit validation and totality checks are keyed by the unit.
|
|
232
|
-
- Evidence discharge shares the test planner's work, and builds the type
|
|
233
|
-
registry once per program rather than once per law.
|
|
321
|
+
## [0.17.3] - 2026-10-02
|
|
234
322
|
|
|
235
|
-
###
|
|
323
|
+
### Added
|
|
236
324
|
|
|
237
325
|
- `lawspec check`, `evidence`, `explain` and `generate` keep the compiler's
|
|
238
326
|
work in `.lawspec/cache` and reuse it across runs. Results are identical to
|
|
239
327
|
an uncached run. With every bundled example in one project, a repeated
|
|
240
328
|
`lawspec check` takes 4.7 seconds instead of 8.4, and generating Python
|
|
241
329
|
tests through the API 9.2 instead of 18.2 (natively, a third of the time).
|
|
242
|
-
-
|
|
243
|
-
are recomputed. `--no-cache` or `"cache": false` turns it
|
|
244
|
-
[the compiler cache](docs/reference/cli.md#the-compiler-cache).
|
|
330
|
+
- The cache keeps one folder per compiler build, with its own `.gitignore`;
|
|
331
|
+
damaged entries are recomputed. `--no-cache` or `"cache": false` turns it
|
|
332
|
+
off. See [the compiler cache](docs/reference/cli.md#the-compiler-cache).
|
|
245
333
|
- API requests may name a `cacheDirectory` to share work the same way.
|
|
246
334
|
|
|
247
|
-
|
|
335
|
+
### Changed
|
|
336
|
+
|
|
337
|
+
- Each law's expansion and type checking, and its elaboration to Core, are
|
|
338
|
+
keyed by exactly their inputs: the law, the laws it invokes, its unit's
|
|
339
|
+
signatures and the program's data types. Editing a definition's body, or
|
|
340
|
+
another unit's laws, no longer re-checks a law.
|
|
341
|
+
- Unit validation and totality checks are keyed by the unit.
|
|
342
|
+
- Evidence discharge shares the test planner's work, and builds the type
|
|
343
|
+
registry once per program rather than once per law.
|
|
344
|
+
|
|
345
|
+
## [0.17.2] - 2026-10-02
|
|
248
346
|
|
|
249
|
-
###
|
|
347
|
+
### Added
|
|
250
348
|
|
|
251
349
|
- The compiler builds a dependency graph of each program. Its nodes are data
|
|
252
350
|
types and declarations (with their contracts and checked definitions), and
|
|
253
351
|
each node has a Merkle digest (SHA-256) of its content and of everything it
|
|
254
352
|
references, with recursive groups digested together.
|
|
353
|
+
|
|
354
|
+
### Changed
|
|
355
|
+
|
|
255
356
|
- A law is planned again only when it, or a type or definition it can reach,
|
|
256
357
|
changes. A unit's files are emitted again only when the unit or one of its
|
|
257
|
-
laws' plans changes, when a data type changes
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
358
|
+
laws' plans changes, when a data type changes, or when a checked definition
|
|
359
|
+
is added, removed or renamed. Editing one definition's body no longer
|
|
360
|
+
replans and re-emits the whole program, and reverting an edit reuses the
|
|
361
|
+
earlier results.
|
|
261
362
|
- Each law is planned from only the types and definitions it reaches, which
|
|
262
363
|
cuts planning time for the bundled examples by two thirds. Evidence
|
|
263
364
|
discharge plans laws the same way, so `lawspec evidence` reports the boundary
|
|
264
365
|
cases the generated tests use.
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
- Boundary search for constrained data took its depth from the number of data
|
|
269
|
-
types in the whole program, and seeded scalar boundaries with literals from
|
|
270
|
-
every type's constructor predicates. Both now come from the types the law
|
|
271
|
-
reaches, so adding an unrelated type no longer changes a law's tests.
|
|
366
|
+
- Boundary search for constrained data takes its depth, and its scalar
|
|
367
|
+
boundary seeds, from the types the law reaches rather than the whole
|
|
368
|
+
program, so adding an unrelated type no longer changes a law's tests.
|
|
272
369
|
Regenerating can change the boundary cases of laws over indexed families and
|
|
273
370
|
constrained data; among the bundled examples, `indexed_arithmetic`,
|
|
274
371
|
`domain_modeling` and the shop package's domain unit gain or lose cases.
|
|
275
372
|
|
|
276
|
-
## 0.17.1
|
|
373
|
+
## [0.17.1] - 2026-10-01
|
|
277
374
|
|
|
278
|
-
###
|
|
375
|
+
### Added
|
|
376
|
+
|
|
377
|
+
- `lawspec-dev ci` records passing results by content. Acceptance suites key
|
|
378
|
+
each run by the generated project and everything else its tests read, so a
|
|
379
|
+
compiler change that leaves a target's output unchanged skips that target's
|
|
380
|
+
native tests. Core steps key by the repository files they read.
|
|
381
|
+
- `lawspec-dev ci --fresh` (`make ci-fresh`) runs every step, and releases use
|
|
382
|
+
it. See [contributing](docs/how-to/contribute.md#checks).
|
|
383
|
+
|
|
384
|
+
### Changed
|
|
279
385
|
|
|
280
386
|
- The compiler reuses work for whatever did not change. A compiler instance
|
|
281
387
|
(one `createCompiler()`, one wasm instance or one process) compiles,
|
|
@@ -286,144 +392,130 @@
|
|
|
286
392
|
- `lawspec examples` and other multi-target runs compile once instead of once
|
|
287
393
|
per target: generating every bundled example for all eight targets takes
|
|
288
394
|
about 105 seconds instead of about 270.
|
|
289
|
-
- A single compile is faster
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
395
|
+
- A single compile is faster: kind lookups use a map instead of scanning every
|
|
396
|
+
type in the program, boundary candidates are deduplicated in `n log n`, and
|
|
397
|
+
long failure messages are split by bisection. Compiling all bundled examples
|
|
398
|
+
together takes a quarter less time.
|
|
399
|
+
|
|
400
|
+
## [0.17.0] - 2026-10-01
|
|
401
|
+
|
|
402
|
+
### Added
|
|
403
|
+
|
|
404
|
+
- Built-in collections `Set a`, `KeyVal k v`, `Queue a`, `Stack a` and
|
|
405
|
+
`Deque a`, with `Entry k v` and `Ordering`. Operations are total prelude
|
|
406
|
+
functions, such as `prelude.setOf`, `prelude.lookup`, `prelude.push` and
|
|
407
|
+
`prelude.popBack`, and `prelude.compare` orders two keyed values. A unit
|
|
408
|
+
that declares a type of the same name keeps its own. See
|
|
409
|
+
[collections](docs/reference/language/collections.md).
|
|
410
|
+
- The `Keyed` capability, needed by Set elements and KeyVal keys: a total
|
|
411
|
+
order shared by every target. Exact numbers order by value, text by code
|
|
412
|
+
point, lists element by element and data by constructor, then fields.
|
|
413
|
+
Floats, complex numbers and symbols are not keyed.
|
|
414
|
+
- Collection adapters use each target's own collections: `frozenset` and
|
|
415
|
+
`dict` in Python, `Set` and `Map` in JavaScript, sorted slices in Go,
|
|
416
|
+
`java.util.Set` and `Map` in Java and Kotlin, `BTreeSet` and `BTreeMap` in
|
|
417
|
+
Rust, and `Data.Set` and `Data.Map` in Haskell. Python and JavaScript use
|
|
418
|
+
sorted tuples or arrays where elements are structured. Codecs sort,
|
|
419
|
+
deduplicate and keep the last value for a repeated key.
|
|
420
|
+
- `async price :: Text -> Int32` declares an asynchronous adapter. It returns
|
|
421
|
+
a coroutine in Python, a `Promise` in JavaScript and TypeScript, a
|
|
422
|
+
`CompletableFuture` in Java, a `suspend fun` in Kotlin, a goroutine-backed
|
|
423
|
+
`lawspec.Task` in Go, an `IO` action in Haskell and a `Future` in Rust. The
|
|
424
|
+
generated tests await each call where it is made, and check contracts on the
|
|
425
|
+
awaited result. See
|
|
426
|
+
[asynchronous functions](docs/reference/language/async-functions.md).
|
|
427
|
+
- `examples/specs/collections.lawspec` covers the new collections.
|
|
428
|
+
|
|
429
|
+
### Changed
|
|
293
430
|
|
|
294
|
-
### Incremental local checks
|
|
295
|
-
|
|
296
|
-
- `lawspec-dev ci` records passing results by content. Acceptance suites key
|
|
297
|
-
each run by the generated project and everything else its tests read, so a
|
|
298
|
-
compiler change that leaves a target's output unchanged skips that target's
|
|
299
|
-
native tests. Core steps key by the repository files they read.
|
|
300
|
-
- `lawspec-dev ci --fresh` (`make ci-fresh`) runs every step, and releases use
|
|
301
|
-
it. See [CONTRIBUTING](CONTRIBUTING.md#checks).
|
|
302
|
-
|
|
303
|
-
## 0.17.0
|
|
304
|
-
|
|
305
|
-
### Collections
|
|
306
|
-
|
|
307
|
-
`Set a`, `KeyVal k v`, `Queue a`, `Stack a` and `Deque a` are built in, with
|
|
308
|
-
`Entry k v` and `Ordering`. Operations are total prelude functions, such as
|
|
309
|
-
`prelude.setOf`, `prelude.lookup`, `prelude.push` and `prelude.popBack`, and
|
|
310
|
-
`prelude.compare` orders two keyed values. A unit that declares a type of the
|
|
311
|
-
same name keeps its own.
|
|
312
|
-
|
|
313
|
-
- Set elements and KeyVal keys need the new `Keyed` capability: a total order
|
|
314
|
-
shared by every target. Exact numbers order by value, text by code point,
|
|
315
|
-
lists element by element and data by constructor, then fields. Floats,
|
|
316
|
-
complex numbers and symbols are not keyed.
|
|
317
|
-
- Adapters use each target's own collections: `frozenset` and `dict` in
|
|
318
|
-
Python, `Set` and `Map` in JavaScript, sorted slices in Go, `java.util.Set`
|
|
319
|
-
and `Map` in Java and Kotlin, `BTreeSet` and `BTreeMap` in Rust, and
|
|
320
|
-
`Data.Set` and `Data.Map` in Haskell. Python and JavaScript use sorted tuples
|
|
321
|
-
or arrays where elements are structured. Codecs sort, deduplicate and keep
|
|
322
|
-
the last value for a repeated key.
|
|
323
431
|
- Generated Haskell projects depend on `containers`. Rust and Haskell
|
|
324
432
|
generated data derive `Ord` when it is keyed.
|
|
325
|
-
|
|
326
|
-
See [collections](docs/reference/language/collections.md).
|
|
327
|
-
|
|
328
|
-
### Asynchronous functions
|
|
329
|
-
|
|
330
|
-
`async price :: Text -> Int32` declares an asynchronous adapter. It returns a
|
|
331
|
-
coroutine in Python, a `Promise` in JavaScript and TypeScript, a
|
|
332
|
-
`CompletableFuture` in Java, a `suspend fun` in Kotlin, a goroutine-backed
|
|
333
|
-
`lawspec.Task` in Go, an `IO` action in Haskell and a `Future` in Rust. The
|
|
334
|
-
generated tests await each call where it is made, and check contracts on the
|
|
335
|
-
awaited result. See
|
|
336
|
-
[asynchronous functions](docs/reference/language/async-functions.md).
|
|
337
|
-
|
|
338
|
-
### Other changes
|
|
339
|
-
|
|
340
433
|
- A numeric literal passed to a generic function takes the type its other
|
|
341
434
|
arguments fix: `prelude.insert 1 s` with `s :: Set Int32` needs no
|
|
342
435
|
annotation.
|
|
343
436
|
- Generated schemas no longer revalidate a whole value on each construction,
|
|
344
437
|
match or checked-definition call; values are checked at the adapter
|
|
345
438
|
boundary. Large recursive values test much faster.
|
|
346
|
-
- The list example is now `examples/specs/lists.lawspec
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
### Index arithmetic and shared indices
|
|
367
|
-
|
|
439
|
+
- The list example is now `examples/specs/lists.lawspec`.
|
|
440
|
+
|
|
441
|
+
## [0.16.0] - 2026-10-01
|
|
442
|
+
|
|
443
|
+
### Added
|
|
444
|
+
|
|
445
|
+
- GADTs: a constructor can fix a type parameter, so `| Number value :: BigInt
|
|
446
|
+
where a = BigInt` builds only `Expr BigInt`. Matching refines the parameter
|
|
447
|
+
in each branch, so `definition eval (e :: Expr a) :: a` type-checks. A
|
|
448
|
+
constructor that cannot build a type is no value of it: matches need no
|
|
449
|
+
branch for it, and decoding rejects it. See
|
|
450
|
+
[GADTs](docs/reference/language/gadts.md).
|
|
451
|
+
- Definitions may call themselves at other instances (polymorphic recursion),
|
|
452
|
+
up to 64 instances each.
|
|
453
|
+
- Existentials determined by the type (`where a = Pair b c`), and existentials
|
|
454
|
+
only a field mentions: each such value carries its type as a trailing
|
|
455
|
+
`witness` field, and generated values draw it from `Bool` and `Int32`.
|
|
456
|
+
- Native GADT types use each target's own form where it has one: sealed
|
|
457
|
+
interfaces of records in Java, Kotlin data classes, Haskell GADT syntax,
|
|
458
|
+
TypeScript conditional unions and `Expr[int]` in Python.
|
|
368
459
|
- Index expressions accept `+ - * div mod ^`. Subtraction never truncates:
|
|
369
460
|
`n = m - 1` requires `m >= 1`, as a runtime-checked constructor constraint.
|
|
461
|
+
See [indexed families](docs/reference/language/indexed-families.md).
|
|
370
462
|
- A variable bound by several fields makes their indices equal, so
|
|
371
463
|
`Node left :: Perfect m right :: Perfect m` declares perfect trees.
|
|
372
464
|
- An implicit index may first appear as `v + k` or `k * v`:
|
|
373
465
|
`dropFirst :: (xs :: Row (k + 1)) -> (r :: Rest k)`.
|
|
466
|
+
- Flow types: `pop :: Stack (n + 1) / Stack n -> Int8` declares a flow
|
|
467
|
+
parameter, which the call takes from one type to another. In laws, `~s`
|
|
468
|
+
passes a state and rebinds it to the state the call leaves, and `e1; e2`
|
|
469
|
+
sequences: `(push x ~s; pop ~s) = x`. Each clause is checked left to right,
|
|
470
|
+
so a pop the stack cannot take is a compile error that suggests a bound. A
|
|
471
|
+
definition updates its flow parameter with `~s := e`. Each flow function
|
|
472
|
+
returns a generated product (`PopFlow` with `result` and `state`), indexed by
|
|
473
|
+
the state it leaves, so adapters' output states are runtime checked. See
|
|
474
|
+
[flow types](docs/reference/language/flow-types.md).
|
|
475
|
+
- New acceptance suites `gadt` and `flow`, and `indexed` gains
|
|
476
|
+
`examples/specs/indexed_arithmetic.lawspec`, with mutants for every target.
|
|
477
|
+
- The [roadmap](docs/explanation/roadmap.md) records 0.12 to 0.19.
|
|
478
|
+
|
|
479
|
+
### Changed
|
|
480
|
+
|
|
374
481
|
- Products and powers are uninterpreted atoms in the prover, so `r * c` and
|
|
375
482
|
`c * r` agree. A definition's non-linear result index that cannot be proved
|
|
376
483
|
is checked on each result and reported as `runtime-checked`; a linear one is
|
|
377
484
|
still an error.
|
|
378
485
|
- Generation solves any equation backwards over the indices each constructor
|
|
379
|
-
can reach, in all seven runtimes
|
|
380
|
-
|
|
381
|
-
|
|
486
|
+
can reach, in all seven runtimes, and builds balanced trees even without a
|
|
487
|
+
fixed index.
|
|
488
|
+
- A type variable that only a field mentions is now an existential, not an
|
|
489
|
+
error.
|
|
490
|
+
- Rust property tests run on a thread with a 64 MiB stack, for deep generated
|
|
491
|
+
values.
|
|
382
492
|
|
|
383
|
-
|
|
493
|
+
### Fixed
|
|
384
494
|
|
|
385
|
-
|
|
495
|
+
- Generation for `n = m + m` used to build children of the wrong size.
|
|
386
496
|
|
|
387
|
-
|
|
388
|
-
takes the stack from one type to another. In laws, `~s` passes a state and
|
|
389
|
-
rebinds it to the state the call leaves, and `e1; e2` sequences:
|
|
390
|
-
`(push x ~s; pop ~s) = x`. Each clause is checked left to right, so a pop the
|
|
391
|
-
stack cannot take is a compile error that suggests a bound. A definition
|
|
392
|
-
updates its flow parameter with `~s := e`. Each flow function returns a
|
|
393
|
-
generated product (`PopFlow` with `result` and `state`), indexed by the state
|
|
394
|
-
it leaves, so adapters' output states are runtime checked. See
|
|
395
|
-
[flow types](docs/reference/language/flow-types.md).
|
|
497
|
+
## [0.15.2] - 2026-09-30
|
|
396
498
|
|
|
397
|
-
###
|
|
499
|
+
### Changed
|
|
398
500
|
|
|
399
|
-
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
- The [roadmap](docs/explanation/roadmap.md) records 0.12 to 0.19.
|
|
501
|
+
- Generated data types are the types you would write by hand, so adapters no
|
|
502
|
+
longer cast. A product (a type with one constructor) is named after its type
|
|
503
|
+
and read directly; a sum (several constructors) is a closed family that the
|
|
504
|
+
language's own pattern matching checks for exhaustiveness. Laws, tests,
|
|
505
|
+
evidence and codec checks are unchanged, but the generated types adapters
|
|
506
|
+
compile against change:
|
|
406
507
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
|
417
|
-
|
|
|
418
|
-
| Java | `var d = (Drink.DrinkCase) value0; d.shots` | `value0.shots()` (a `record`) |
|
|
419
|
-
| Java | `new Size.LargeCase()`, `x instanceof Size.LargeCase` | `new Size.Large()`, `case Size.Large large ->` (sealed interface of records) |
|
|
420
|
-
| Kotlin | `(value0 as Drink.DrinkCase).shots` | `value0.shots` (a `data class`) |
|
|
421
|
-
| Kotlin | `Size.SmallCase()`, `is Size.LargeCase` | `Size.Small` (a `data object`), `is Size.Large` |
|
|
422
|
-
| Go | `value0.(DrinkDrink).Shots`, `DrinkDrink{...}` | `value0.Shots`, `Drink{...}` (a plain struct) |
|
|
423
|
-
| Rust | `let Drink::Drink { shots, .. } = value0;` | `value0.shots` (a `struct` with public fields) |
|
|
424
|
-
| Python | `data.DrinkDrink(...)` | `data.Drink(...)` |
|
|
425
|
-
| JavaScript, TypeScript | `new data.DrinkDrink(...)` | `new data.Drink(...)`; TypeScript's `Drink` is the class |
|
|
426
|
-
| Haskell | `Data.DrinkDrink size shots` | `Data.Drink size shots` |
|
|
508
|
+
| Target | Before | After |
|
|
509
|
+
| --- | --- | --- |
|
|
510
|
+
| Java | `var d = (Drink.DrinkCase) value0; d.shots` | `value0.shots()` (a `record`) |
|
|
511
|
+
| Java | `new Size.LargeCase()`, `x instanceof Size.LargeCase` | `new Size.Large()`, `case Size.Large large ->` (sealed interface of records) |
|
|
512
|
+
| Kotlin | `(value0 as Drink.DrinkCase).shots` | `value0.shots` (a `data class`) |
|
|
513
|
+
| Kotlin | `Size.SmallCase()`, `is Size.LargeCase` | `Size.Small` (a `data object`), `is Size.Large` |
|
|
514
|
+
| Go | `value0.(DrinkDrink).Shots`, `DrinkDrink{...}` | `value0.Shots`, `Drink{...}` (a plain struct) |
|
|
515
|
+
| Rust | `let Drink::Drink { shots, .. } = value0;` | `value0.shots` (a `struct` with public fields) |
|
|
516
|
+
| Python | `data.DrinkDrink(...)` | `data.Drink(...)` |
|
|
517
|
+
| JavaScript, TypeScript | `new data.DrinkDrink(...)` | `new data.Drink(...)`; TypeScript's `Drink` is the class |
|
|
518
|
+
| Haskell | `Data.DrinkDrink size shots` | `Data.Drink size shots` |
|
|
427
519
|
|
|
428
520
|
- A case is named after its constructor. When that name equals the type's name
|
|
429
521
|
or clashes with another case, Java and Kotlin keep a `Case` suffix.
|
|
@@ -435,21 +527,20 @@ compile against change:
|
|
|
435
527
|
- Sums in Go, Rust, Python, JavaScript, TypeScript and Haskell keep their
|
|
436
528
|
names (`SizeSmall`, `Size::Small`).
|
|
437
529
|
|
|
438
|
-
## 0.15.1
|
|
530
|
+
## [0.15.1] - 2026-09-30
|
|
439
531
|
|
|
440
532
|
A maintenance release. The language and generated code are unchanged.
|
|
441
533
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
- **Lessons.** Eight tutorials build a coffee shop's ordering system, in Java,
|
|
534
|
+
### Added
|
|
535
|
+
|
|
536
|
+
- Documentation in a [Diátaxis](https://diataxis.fr) site in `docs/`:
|
|
537
|
+
tutorials, how-to guides, reference and explanation.
|
|
538
|
+
- Eight tutorial lessons build a coffee shop's ordering system, in Java,
|
|
448
539
|
Python and JavaScript tracks. Each lesson's specification is editable and
|
|
449
540
|
compiles in the browser, and the JavaScript tests run in the page. The lesson
|
|
450
541
|
implementations are a new acceptance suite, `lessons`, with a mutant per
|
|
451
|
-
lesson on each of the three targets.
|
|
452
|
-
-
|
|
542
|
+
lesson on each of the three targets; the suite also covers TypeScript.
|
|
543
|
+
- The site is static and built with `make docs`: `make docs-serve` previews
|
|
453
544
|
it and `make docs-deploy` deploys it to Cloudflare Pages. It runs the npm
|
|
454
545
|
package's `core.wasm` through a browser launcher with a minimal WASI shim,
|
|
455
546
|
and highlights LawSpec and every target language, in the editor too. Every
|
|
@@ -457,480 +548,403 @@ A maintenance release. The language and generated code are unchanged.
|
|
|
457
548
|
lessons' **▶ Run** runs the generated JavaScript or TypeScript tests against
|
|
458
549
|
an editable implementation in an isolated frame, reporting each law's
|
|
459
550
|
examples, boundary cases and generated cases. Generated tests are read-only.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
`
|
|
515
|
-
`
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
definitions and generic laws can be imported. Adapters and concrete laws stay
|
|
533
|
-
with their unit. Import cycles, unknown units and missing or ambiguous names
|
|
534
|
-
reported at the import, with the reason: an adapter, a constructor listed
|
|
535
|
-
without its type, or a law without parameters.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
`
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
### Packages
|
|
549
|
-
|
|
550
|
-
A `lawspec-package.json` names a package, its version, its source directories
|
|
551
|
-
and the version ranges of its dependencies. Package units are named after the
|
|
552
|
-
package, a unit imports only from its own package and direct dependencies, and
|
|
553
|
-
every range must accept the supplied version. A project lists `dependencies` and
|
|
554
|
-
the `packages` directories in `lawspec.json`. A package's adapters and laws are a
|
|
555
|
-
published contract: dependent projects implement and test them as their own.
|
|
556
|
-
`lawspec package` checks a package and summarizes it. See
|
|
557
|
-
[imports and packages](docs/reference/language/imports-and-packages.md).
|
|
558
|
-
|
|
559
|
-
The compiler API accepts `dependencies`, `packages` and `package`, and reports
|
|
560
|
-
the resolved packages (see
|
|
561
|
-
[API migration](docs/explanation/api-migration.md#imports-and-packages-0140)).
|
|
562
|
-
|
|
563
|
-
### Other changes
|
|
564
|
-
|
|
565
|
-
- Rust: a law without quantified inputs no longer emits an untyped empty case
|
|
566
|
-
vector, which did not compile.
|
|
551
|
+
- The Makefile covers every task (`make` lists them), `lawspec-dev bump`
|
|
552
|
+
sets the version everywhere, and the [release guide](docs/how-to/release.md)
|
|
553
|
+
documents the release.
|
|
554
|
+
- The npm package ships `README.md`, `CHANGELOG.md` and `LICENSE`.
|
|
555
|
+
|
|
556
|
+
### Changed
|
|
557
|
+
|
|
558
|
+
- The documentation site replaces the README's version-history sections, the
|
|
559
|
+
per-target guides, `LANGUAGE.md`, `NATIVE-BINDINGS.md`, `PRIMITIVES.md`,
|
|
560
|
+
`REFINEMENTS.md`, `API-MIGRATION.md` and the separate release notes, which
|
|
561
|
+
this changelog now collects.
|
|
562
|
+
- A law whose equation compares two Boolean expressions shows its claim as
|
|
563
|
+
written (`isWeekend d == (d == 0 || d == 6)`), not as the equivalence the
|
|
564
|
+
prover uses.
|
|
565
|
+
- Every JavaScript file in the repository is generated from `templates/` by
|
|
566
|
+
`lawspec-dev generate`, with the version, targets, scaffolds and test
|
|
567
|
+
commands filled in from the Haskell sources.
|
|
568
|
+
- The TypeScript API type check is an npm test.
|
|
569
|
+
|
|
570
|
+
### Removed
|
|
571
|
+
|
|
572
|
+
- 121 unmaintained integration scripts; the acceptance suites and the Hspec
|
|
573
|
+
tests cover what they did.
|
|
574
|
+
|
|
575
|
+
## [0.15.0] - 2026-09-30
|
|
576
|
+
|
|
577
|
+
### Added
|
|
578
|
+
|
|
579
|
+
- Every obligation of a program reports how it is discharged, strongest first:
|
|
580
|
+
- `proved`: statically. Definition postconditions and indices, as since 0.12,
|
|
581
|
+
and now laws that call only checked definitions.
|
|
582
|
+
- `exhaustively-checked`: every input of a finite domain, by the compiler for
|
|
583
|
+
laws over checked definitions and otherwise by the generated tests. A law
|
|
584
|
+
with no inputs is a single case.
|
|
585
|
+
- `property-tested`: generated cases, boundary cases and examples.
|
|
586
|
+
- `runtime-checked`: adapter contracts, definition preconditions,
|
|
587
|
+
constructor constraints and native type bindings, at every native boundary.
|
|
588
|
+
- `assumed`: adapters, native functions, custom generators and codec hooks,
|
|
589
|
+
taken on trust. Each adapter reports how many laws call it, or that none
|
|
590
|
+
does.
|
|
591
|
+
- `lawspec check` summarizes the obligations by status, and the new
|
|
592
|
+
`lawspec evidence` lists each with its claim and reason (`--json` for the API
|
|
593
|
+
records, and a unit or `unit::declaration` filter). See
|
|
594
|
+
[evidence and discharge](docs/reference/language/evidence-and-discharge.md).
|
|
595
|
+
- A law over checked definitions is attempted as a proof by exact linear
|
|
596
|
+
arithmetic, from its input refinements, with definitions that have no
|
|
597
|
+
preconditions unfolded into the claim. When it is not proved and its domain
|
|
598
|
+
is finite, the compiler evaluates every input; a counterexample is a compile
|
|
599
|
+
error with code `refuted`, such as `law always positive is false for x =
|
|
600
|
+
-128`.
|
|
601
|
+
- The prover handles constant factors on integer expressions (`x * 2`), so
|
|
602
|
+
more definition results are proved.
|
|
603
|
+
- API `evidence` items have the five statuses above and new stages: `law`,
|
|
604
|
+
`adapter`, and, with native bindings, `binding`, `codec`, `generator` and
|
|
605
|
+
`native-function`. The TypeScript API declares `ObligationEvidence` and
|
|
606
|
+
`DischargeStatus`. See
|
|
607
|
+
[API migration](docs/explanation/api-migration.md#evidence-and-discharge-0150).
|
|
608
|
+
|
|
609
|
+
### Changed
|
|
610
|
+
|
|
611
|
+
- Specifications that compiled before may be rejected if a law over
|
|
612
|
+
definitions is false.
|
|
613
|
+
- `claim` is `null` for obligations without one.
|
|
614
|
+
|
|
615
|
+
## [0.14.0] - 2026-09-29
|
|
616
|
+
|
|
617
|
+
### Added
|
|
618
|
+
|
|
619
|
+
- A unit imports other units by name: ``import shop.domain as domain (Money,
|
|
620
|
+
Cents, `commutative`)``. Every declaration of an imported unit is available
|
|
621
|
+
through the alias (`domain.Usd`, `domain.centsOf`), and listed names also
|
|
622
|
+
unqualified. Types, wrappers, indexed families, refinements, checked
|
|
623
|
+
definitions and generic laws can be imported. Adapters and concrete laws stay
|
|
624
|
+
with their unit. Import cycles, unknown units and missing or ambiguous names
|
|
625
|
+
are reported at the import, with the reason: an adapter, a constructor listed
|
|
626
|
+
without its type, or a law without parameters.
|
|
627
|
+
- A `lawspec-package.json` names a package, its version, its source
|
|
628
|
+
directories and the version ranges of its dependencies. Package units are
|
|
629
|
+
named after the package, a unit imports only from its own package and direct
|
|
630
|
+
dependencies, and every range must accept the supplied version. A project
|
|
631
|
+
lists `dependencies` and the `packages` directories in `lawspec.json`. A
|
|
632
|
+
package's adapters and laws are a published contract: dependent projects
|
|
633
|
+
implement and test them as their own. `lawspec package` checks a package and
|
|
634
|
+
summarizes it. See
|
|
635
|
+
[imports and packages](docs/reference/language/imports-and-packages.md).
|
|
636
|
+
- The compiler API accepts `dependencies`, `packages` and `package`, and
|
|
637
|
+
reports the resolved packages (see
|
|
638
|
+
[API migration](docs/explanation/api-migration.md#imports-and-packages-0140)).
|
|
567
639
|
- The VS Code grammar highlights `import` and `as`.
|
|
568
640
|
- A new acceptance suite, `packages`, runs the
|
|
569
641
|
[package example](examples/packages) on all eight targets in both machine
|
|
570
|
-
profiles and rejects five adapter mutants plus the bare stubs.
|
|
571
|
-
includes it.
|
|
642
|
+
profiles and rejects five adapter mutants plus the bare stubs.
|
|
643
|
+
`lawspec-dev ci` includes it.
|
|
572
644
|
|
|
573
|
-
|
|
645
|
+
### Changed
|
|
646
|
+
|
|
647
|
+
- Names are scoped to their unit, so units compiled together no longer need
|
|
648
|
+
distinct constructor names. Targets with one data namespace (Python,
|
|
649
|
+
JavaScript, TypeScript, Go and Haskell) name colliding types after their
|
|
650
|
+
unit, `ShopDomainCurrency` and `ShopOrdersCurrency`, and their constructors
|
|
651
|
+
`ShopDomainCurrencyUsd`. Java, Kotlin and Rust qualify only the type.
|
|
652
|
+
Earlier versions qualified only the colliding names, for example
|
|
653
|
+
`ShopDomainTypeCurrencyUsd` next to `CurrencyEur`.
|
|
654
|
+
|
|
655
|
+
### Fixed
|
|
656
|
+
|
|
657
|
+
- Rust: a law without quantified inputs no longer emits an untyped empty case
|
|
658
|
+
vector, which did not compile.
|
|
659
|
+
|
|
660
|
+
## [0.13.2] - 2026-09-29
|
|
574
661
|
|
|
575
662
|
A maintenance release. The language, generated code and API are unchanged.
|
|
576
663
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
664
|
+
### Added
|
|
665
|
+
|
|
666
|
+
- `stack run lawspec-dev -- ci` (or `make ci`) runs the complete check
|
|
667
|
+
locally: compiler, npm, parity, package and editor checks, then for each
|
|
668
|
+
target the dependency bootstrap, every acceptance suite in both machine
|
|
669
|
+
profiles, and the installed native-binding example. It logs each step to
|
|
581
670
|
`.artifacts/ci/` and exits non-zero on any failure. `--target`, `--core`,
|
|
582
671
|
`--fail-fast`, `--rust-toolchains` and `--rust-targets` select what to run.
|
|
583
|
-
|
|
672
|
+
|
|
673
|
+
### Changed
|
|
674
|
+
|
|
675
|
+
- The repository has no hosted CI.
|
|
676
|
+
- The package smoke test's per-command timeout is ten minutes.
|
|
677
|
+
|
|
678
|
+
### Removed
|
|
679
|
+
|
|
584
680
|
- The JavaScript acceptance runners and fixture modules replaced by
|
|
585
|
-
`lawspec-acceptance
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
- The integration bootstrap restores missing scaffold files in existing projects.
|
|
681
|
+
`lawspec-acceptance`.
|
|
682
|
+
|
|
683
|
+
### Fixed
|
|
589
684
|
|
|
590
|
-
|
|
685
|
+
- Exporting every bundled example exceeded the package smoke test's former
|
|
686
|
+
two-minute limit on slower machines.
|
|
687
|
+
- The integration bootstrap restores missing scaffold files in existing
|
|
688
|
+
projects.
|
|
689
|
+
|
|
690
|
+
## [0.13.1] - 2026-09-29
|
|
591
691
|
|
|
592
692
|
A maintenance release. The language, generated code and API are unchanged from
|
|
593
693
|
0.13.0.
|
|
594
694
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
695
|
+
### Added
|
|
696
|
+
|
|
697
|
+
- A new npm test checks that generation never rewrites build files and that
|
|
698
|
+
regeneration is a no-op on every target.
|
|
699
|
+
|
|
700
|
+
### Changed
|
|
701
|
+
|
|
702
|
+
- Repository checks move from JavaScript to Haskell. `lawspec-dev boundaries`
|
|
703
|
+
and `lawspec-dev integrity` replace `tools/check-boundaries.mjs` and
|
|
704
|
+
`tools/build-integrity.mjs`. The integrity check also rejects staged npm
|
|
598
705
|
copies of documentation and examples that differ from their sources.
|
|
599
706
|
- `lawspec-acceptance` runs the bundled-example acceptance suites
|
|
600
707
|
(`integration`, `algebra`, `scalar`, `refinement`, `indexed`, `domain`) in
|
|
601
708
|
process. Adapters and mutants are real files under `acceptance/`, and a
|
|
602
|
-
mutant that only breaks the build now fails the suite.
|
|
603
|
-
TypeScript scalar mutant that previously counted as rejected because it
|
|
604
|
-
failed type-checking; it now exercises the laws.
|
|
709
|
+
mutant that only breaks the build now fails the suite.
|
|
605
710
|
- Build-file scaffolds are defined once in Haskell (`LawSpec.Scaffold`) and
|
|
606
711
|
checked against the npm templates byte for byte.
|
|
607
712
|
- Compiler API contract tests formerly in `npm/test` run in hspec against the
|
|
608
|
-
same JSON boundary that `core.wasm` exports.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
0.9 had narrowed Kotlin and Haskell adapters whose result is the abstract
|
|
760
|
-
`Integer` to `BigInteger` and `Integer`. They again return `Number` (Kotlin) and
|
|
761
|
-
`LS.IntegerValue` (Haskell), as in 0.8 and as Java always did. `Integer` is the top
|
|
762
|
-
of the integral tower: an implementation may return any integral native value,
|
|
763
|
-
and the result bridge rejects non-integral values and checks the logical domain.
|
|
764
|
-
Adapters written against 0.9 or 0.10 stubs that return `BigInteger` or `Integer`
|
|
765
|
-
still compile, because both are integral.
|
|
766
|
-
|
|
767
|
-
This regression had kept the Kotlin and Haskell target checks failing since
|
|
768
|
-
0.9. Those checks, and the scalar mutation fixtures, now pass with the documented
|
|
769
|
-
typed Symbol, Decimal, Utf16Text and Optional representations.
|
|
770
|
-
|
|
771
|
-
### Compatibility
|
|
772
|
-
|
|
773
|
-
Specifications without indexed families generate the same code as 0.10, apart
|
|
774
|
-
from the Integer result signatures above. API schemas 3 and 4 are unchanged.
|
|
775
|
-
GADTs that refine type arguments, non-linear indices and index equalities between
|
|
776
|
-
sibling fields remain future work.
|
|
777
|
-
|
|
778
|
-
## 0.10.0
|
|
779
|
-
|
|
780
|
-
### Existing application models
|
|
781
|
-
|
|
782
|
-
Native bindings connect LawSpec products and sums to existing application types
|
|
783
|
-
on Java, Python, JavaScript, TypeScript, Go, Haskell, Kotlin and Rust. Configure
|
|
784
|
-
constructor and field mappings, bind adapter declarations to existing functions,
|
|
785
|
-
or supply paired conversion hooks for representations requiring custom code.
|
|
786
|
-
Bindings resolve against typed declaration identities; they do not change the
|
|
787
|
-
meaning of arithmetic, equality, definitions or refinements. See
|
|
788
|
-
[Bind native types and functions](docs/how-to/bind-native-types.md).
|
|
789
|
-
|
|
790
|
-
Checked bridges compose through generic and recursive types and the built-in
|
|
791
|
-
containers. They preserve exact numeric values, Symbol identity and distinct
|
|
792
|
-
absence states. Invalid native inputs, results, generator samples and shrink
|
|
793
|
-
candidates fail with context.
|
|
794
|
-
|
|
795
|
-
### Native generators
|
|
796
|
-
|
|
797
|
-
Factories return their framework's generator: JetCheck, Hypothesis, fast-check,
|
|
798
|
-
Rapid, Hedgehog, Kotest or Proptest. Generic factories receive child generators.
|
|
799
|
-
Composition retains native shrinking. Explicit examples, deterministic boundaries
|
|
800
|
-
and finite-domain enumeration still run when the factory's distribution excludes
|
|
801
|
-
those values.
|
|
802
|
-
|
|
803
|
-
A factory can ignore an uninhabited parameter, as in `Phantom Empty`. Requesting a
|
|
804
|
-
value from that parameter fails generation; it cannot turn a property into a
|
|
805
|
-
vacuous success. Finite inhabited containers such as `List Empty` still enumerate.
|
|
806
|
-
|
|
807
|
-
Optional `stub: true` generator bindings create user-owned implementation files.
|
|
808
|
-
Regeneration preserves edits and reports changed factory signatures for review.
|
|
809
|
-
|
|
810
|
-
### API and migration
|
|
811
|
-
|
|
812
|
-
Native binding requests negotiate schema 4. Schema 3 remains supported for
|
|
813
|
-
specifications without bindings. Structured native references and strict
|
|
814
|
-
configuration validation prevent older compilers from silently ignoring mappings.
|
|
815
|
-
Go additionally supports explicit import aliases; Rust binds tests to the
|
|
816
|
-
application library's type identities.
|
|
817
|
-
|
|
818
|
-
Existing adapter files cannot be overwritten by adopting a binding. Move their
|
|
819
|
-
implementations into the application module and save the old adapters before
|
|
820
|
-
generation. Generated source bridges, test helpers and user-owned application
|
|
821
|
-
files retain separate placement and ownership. See the
|
|
822
|
-
[migration guide](docs/explanation/api-migration.md#native-bindings-schema-4-0100) and
|
|
823
|
-
[adopting bindings](docs/how-to/bind-native-types.md#adopt-bindings-in-an-existing-project).
|
|
824
|
-
|
|
825
|
-
### Runnable payment projects
|
|
826
|
-
|
|
827
|
-
`lawspec examples --example payments` exports a project for every target; use
|
|
828
|
-
`--target rust` or another language to select one. Each project includes an
|
|
829
|
-
application model, native generator, configuration, build files and instructions.
|
|
830
|
-
The shared specification checks exact fees, currency preservation, sum payloads,
|
|
831
|
-
ordered archives, duplicates and absence. Re-exporting preserves application
|
|
832
|
-
edits and the separate compiler generation manifest.
|
|
833
|
-
|
|
834
|
-
Both 32-bit and 64-bit logical machine profiles and readable/compact output are
|
|
835
|
-
covered by the acceptance matrices. Java 25+, Python 3.13+ and the other published
|
|
836
|
-
toolchain baselines remain unchanged. Python output follows PEP 8.
|
|
837
|
-
|
|
838
|
-
## 0.9.0
|
|
839
|
-
|
|
840
|
-
This release adds structural data and checked total definitions across Java,
|
|
841
|
-
Python, JavaScript, TypeScript, Go, Haskell, Kotlin and Rust.
|
|
842
|
-
|
|
843
|
-
### Language
|
|
844
|
-
|
|
845
|
-
- `List a` supports nested contextual literals, structural equality, exact
|
|
846
|
-
length, deterministic boundaries, and native framework generation/shrinking.
|
|
847
|
-
- Algebraic `Maybe a` and `Either a b` provide `Nothing`/`Just` and `Left`/`Right`.
|
|
848
|
-
They remain distinct from interoperability `Nullable` and `Optional` values.
|
|
849
|
-
- Named parameterized products and sums have constructors and ordered fields.
|
|
850
|
-
Generated native types and typed adapters preserve their structure.
|
|
851
|
-
- Total definitions support exhaustive matching and checked structural recursion.
|
|
713
|
+
same JSON boundary that `core.wasm` exports.
|
|
714
|
+
|
|
715
|
+
### Fixed
|
|
716
|
+
|
|
717
|
+
- A TypeScript scalar mutant counted as rejected because it failed
|
|
718
|
+
type-checking; it now exercises the laws.
|
|
719
|
+
|
|
720
|
+
## [0.13.0] - 2026-09-29
|
|
721
|
+
|
|
722
|
+
### Added
|
|
723
|
+
|
|
724
|
+
- `wrapper UnitQuantity is Int32 where value >= 1 && value <= 1000 end`
|
|
725
|
+
declares a distinct nominal type with one field, `value`, and an optional
|
|
726
|
+
constraint. Its constructor checks the constraint, so an invalid value
|
|
727
|
+
cannot be constructed in an example (the compiler rejects `UnitQuantity 0`),
|
|
728
|
+
produced by a generator, or decoded from native code. `valueOf<Name>`
|
|
729
|
+
unwraps a value. Wrappers may take type parameters (`wrapper NonEmptyList (a
|
|
730
|
+
:: Type) is List a where prelude.length value > 0 end`), and all eight
|
|
731
|
+
targets represent them natively.
|
|
732
|
+
- A `workflow` declares its steps as adapters and checks the pipeline: each
|
|
733
|
+
step must accept the previous step's state, and fallible steps must share an
|
|
734
|
+
error type. The workflow's result must match `Either E T` when any step can
|
|
735
|
+
fail, or `T` otherwise. The compiler adds the law `placeOrder composes its
|
|
736
|
+
steps`: the native workflow must equal the railway composition of the native
|
|
737
|
+
steps. Diagnostics name the step and the mismatched types, with the
|
|
738
|
+
workflow's source location. See
|
|
739
|
+
[domain modeling](docs/reference/language/domain-modeling.md).
|
|
740
|
+
- Constructor field constraints, including wrapper constraints, appear in the
|
|
741
|
+
evidence as `construction` obligations with status `runtime-checked`. The
|
|
742
|
+
TypeScript API declares these records as `ObligationEvidence`.
|
|
743
|
+
- `examples/specs/domain_modeling.lawspec` combines wrappers, a parameterized
|
|
744
|
+
`NonEmptyList`, order states and the workflow. It runs on all eight targets
|
|
745
|
+
in both machine profiles, with mutants for wrapper invariants, the railway
|
|
746
|
+
composition and non-empty list operations.
|
|
747
|
+
|
|
748
|
+
### Changed
|
|
749
|
+
|
|
750
|
+
- `wrapper` and `workflow` begin new declarations. Specifications that do not
|
|
751
|
+
use them compile as in 0.12. API schemas 3 and 4 are unchanged, apart from
|
|
752
|
+
the additive `construction` stage in `evidence`.
|
|
753
|
+
|
|
754
|
+
## [0.12.0] - 2026-09-29
|
|
755
|
+
|
|
756
|
+
### Added
|
|
757
|
+
|
|
758
|
+
- Checked definitions may return natural-indexed families, and the compiler
|
|
759
|
+
proves their result indices statically, as in `definition concatV (xs :: Vec
|
|
760
|
+
n Int8) (ys :: Vec m Int8) :: Vec (n + m) Int8`. See
|
|
761
|
+
[proved indices](docs/reference/language/indexed-families.md#proved-indices).
|
|
762
|
+
- Every contract obligation is recorded as `proved` or `runtime-checked`.
|
|
763
|
+
`lawspec check` prints a summary, and API responses include an additive
|
|
764
|
+
`evidence` array; see
|
|
765
|
+
[API migration](docs/explanation/api-migration.md#evidence-0120).
|
|
766
|
+
- The indexed example includes proved definitions `concatV` and `flattenV`,
|
|
767
|
+
used as reference models for the native `append` and `flatten` adapters.
|
|
768
|
+
|
|
769
|
+
### Changed
|
|
770
|
+
|
|
771
|
+
- The totality prover treats calls of checked definitions as pure linear
|
|
772
|
+
atoms, so equal calls have equal results. A single-argument definition that
|
|
773
|
+
matches on its argument unfolds on a known constructor, so `nOfVec (VCons h
|
|
774
|
+
t)` is `nOfVec t + 1`. Natural measures are non-negative. The prover rejects
|
|
775
|
+
definitions whose result indices do not follow.
|
|
776
|
+
- Definition postconditions are proved, and generated code on all eight
|
|
777
|
+
targets no longer re-checks them at runtime. This changes generated output
|
|
778
|
+
but not behavior. Definition preconditions and adapter contracts remain
|
|
779
|
+
runtime-checked.
|
|
780
|
+
- Specifications that compiled with 0.11 compile unchanged. API schemas 3 and
|
|
781
|
+
4 are unchanged apart from the additive `evidence` field. See the
|
|
782
|
+
[current limits](docs/reference/language/index.md#current-limits).
|
|
783
|
+
|
|
784
|
+
## [0.11.0] - 2026-09-29
|
|
785
|
+
|
|
786
|
+
### Added
|
|
787
|
+
|
|
788
|
+
- Data declarations may take `Natural` parameters, and each constructor states
|
|
789
|
+
its index equation (`type Vec (n :: Natural) (a :: Type) is | VNil where n =
|
|
790
|
+
0 | VCons head :: a tail :: Vec m a where n = m + 1 end`). Native code works
|
|
791
|
+
with the erased type, and every index claim is evidence checked at test
|
|
792
|
+
time: a dependent result such as `Vec (n + m) Int8` is an adapter
|
|
793
|
+
postcondition. An otherwise unbound index variable is implicit. Index
|
|
794
|
+
expressions are sums of natural literals and index variables. `Natural` is
|
|
795
|
+
also available as a value type. Diagnostics use the `indexed` code. See
|
|
796
|
+
[indexed families](docs/reference/language/indexed-families.md).
|
|
797
|
+
- A quantifier constrained by a linear structural measure, including a fixed
|
|
798
|
+
index (`Vec 3 Int8`) or a shared one, is generated by solving the
|
|
799
|
+
constructor equations backwards instead of filtering, natively on all eight
|
|
800
|
+
targets, and framework shrinking stays within the index. The same applies to
|
|
801
|
+
user-written linear measures over declared data.
|
|
802
|
+
- `examples/specs/indexed_families.lawspec` runs on all eight targets.
|
|
803
|
+
|
|
804
|
+
### Fixed
|
|
805
|
+
|
|
806
|
+
- Kotlin and Haskell adapters whose result is the abstract `Integer` again
|
|
807
|
+
return `Number` (Kotlin) and `LS.IntegerValue` (Haskell), as in 0.8 and as
|
|
808
|
+
Java always did; 0.9 had narrowed them to `BigInteger` and `Integer`.
|
|
809
|
+
Adapters written against 0.9 or 0.10 stubs still compile.
|
|
810
|
+
- The Kotlin and Haskell target checks and the scalar mutation fixtures, which
|
|
811
|
+
had failed since 0.9, pass again.
|
|
812
|
+
|
|
813
|
+
## [0.10.0] - 2026-09-29
|
|
814
|
+
|
|
815
|
+
### Added
|
|
816
|
+
|
|
817
|
+
- Native bindings connect LawSpec products and sums to existing application
|
|
818
|
+
types on Java, Python, JavaScript, TypeScript, Go, Haskell, Kotlin and Rust:
|
|
819
|
+
constructor and field mappings, adapter declarations bound to existing
|
|
820
|
+
functions, or paired conversion hooks. See
|
|
821
|
+
[Bind native types and functions](docs/how-to/bind-native-types.md).
|
|
822
|
+
- Checked bridges compose through generic and recursive types and the
|
|
823
|
+
built-in containers. They preserve exact numeric values, Symbol identity and
|
|
824
|
+
distinct absence states. Invalid native inputs, results, generator samples
|
|
825
|
+
and shrink candidates fail with context.
|
|
826
|
+
- Native generator factories return their framework's generator: JetCheck,
|
|
827
|
+
Hypothesis, fast-check, Rapid, Hedgehog, Kotest or Proptest. Generic
|
|
828
|
+
factories receive child generators, and composition keeps native shrinking.
|
|
829
|
+
Explicit examples, boundaries and finite-domain enumeration still run.
|
|
830
|
+
- A factory can ignore an uninhabited parameter, as in `Phantom Empty`;
|
|
831
|
+
requesting a value from it fails generation instead of passing vacuously.
|
|
832
|
+
- Optional `stub: true` generator bindings create user-owned implementation
|
|
833
|
+
files. Regeneration preserves edits and reports changed factory signatures.
|
|
834
|
+
- API schema 4 for native binding requests. Go supports explicit import
|
|
835
|
+
aliases; Rust binds tests to the application library's type identities.
|
|
836
|
+
- `lawspec examples --example payments` exports a runnable project for every
|
|
837
|
+
target (`--target` selects one), with an application model, native
|
|
838
|
+
generator, configuration, build files and instructions. Re-exporting
|
|
839
|
+
preserves application edits.
|
|
840
|
+
|
|
841
|
+
### Changed
|
|
842
|
+
|
|
843
|
+
- Schema 3 remains supported for specifications without bindings. Strict
|
|
844
|
+
configuration validation prevents older compilers from silently ignoring
|
|
845
|
+
mappings.
|
|
846
|
+
- Adopting a binding never overwrites existing adapter files: move their
|
|
847
|
+
implementations into the application module first. See the
|
|
848
|
+
[migration guide](docs/explanation/api-migration.md#native-bindings-schema-4-0100) and
|
|
849
|
+
[adopting bindings](docs/how-to/bind-native-types.md#adopt-bindings-in-an-existing-project).
|
|
850
|
+
- Python output follows PEP 8.
|
|
851
|
+
|
|
852
|
+
## [0.9.0] - 2026-09-28
|
|
853
|
+
|
|
854
|
+
### Added
|
|
855
|
+
|
|
856
|
+
- `List a` with nested contextual literals, structural equality, exact
|
|
857
|
+
length, deterministic boundaries, and native framework generation and
|
|
858
|
+
shrinking.
|
|
859
|
+
- Algebraic `Maybe a` and `Either a b`, with `Nothing`/`Just` and
|
|
860
|
+
`Left`/`Right`, distinct from interoperability `Nullable` and `Optional`.
|
|
861
|
+
- Named parameterized products and sums with constructors and ordered fields,
|
|
862
|
+
preserved by generated native types and typed adapters.
|
|
863
|
+
- Total definitions with exhaustive matching and checked structural recursion.
|
|
852
864
|
The compiler rejects partial matches and recursion it cannot establish as
|
|
853
865
|
terminating. Generic definitions specialize to their concrete uses.
|
|
854
866
|
- Refined definition signatures become executable native contracts. Scoped
|
|
855
|
-
payload predicates preserve type-parameter roles through recursive and
|
|
856
|
-
data declarations, including predicates that depend on preceding
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
and
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
## 0.8.0
|
|
897
|
-
|
|
898
|
-
Rust support and a shared typed compiler boundary are the focus of this release.
|
|
899
|
-
The compiler remains implemented in Haskell and ships as prebuilt WebAssembly.
|
|
900
|
-
|
|
901
|
-
### Changes
|
|
902
|
-
|
|
903
|
-
- Rust 2024, with Rust 1.85 as the minimum toolchain, Cargo scaffolding, Proptest
|
|
904
|
-
generation/shrinking, the complete scalar catalog, refinements, and contracts.
|
|
905
|
-
- An independent numeric Rust runtime with owned native bridges, exact arithmetic,
|
|
906
|
-
checked conversions, direct IEEE rounding, raw text, Symbol identity, and
|
|
907
|
-
distinct nested absence states. Proptest support is emitted separately.
|
|
908
|
-
- A typed core and proposition tree shared by all eight emitters. Resolved IDs,
|
|
909
|
-
parsed source ranges, contextual literals, arithmetic evidence, and conversions
|
|
910
|
-
survive elaboration. Emitters no longer import source syntax or inference.
|
|
911
|
-
- An independent core validator and evaluator. Testing plans distinguish semantic
|
|
912
|
-
validity from execution feasibility and preserve dependent refinement domains.
|
|
913
|
-
- API schema v3 with explicit wire views and unchanged lossless scalar encodings.
|
|
914
|
-
Explicit schema-v2 requests receive a migration diagnostic.
|
|
867
|
+
payload predicates preserve type-parameter roles through recursive and
|
|
868
|
+
mutual data declarations, including predicates that depend on preceding
|
|
869
|
+
inputs.
|
|
870
|
+
- `--minify` selects compact output for `init`, `generate` and `examples`; the
|
|
871
|
+
compiler API accepts `minify: true`.
|
|
872
|
+
- API schema 3 adds named data declarations, structural values, checked
|
|
873
|
+
definitions, construction and matching expressions, and scoped payload
|
|
874
|
+
predicates. Exhaustive expression visitors must handle the new variants; see
|
|
875
|
+
[API migration](docs/explanation/api-migration.md#structural-data-and-definitions-090).
|
|
876
|
+
- Bundled examples for reverse involution, sorting, nested presence, products
|
|
877
|
+
and sums, exhaustive matches, total functions and recursive payload
|
|
878
|
+
refinements.
|
|
879
|
+
|
|
880
|
+
### Changed
|
|
881
|
+
|
|
882
|
+
- Readable code is the default for runtimes, declarations, definitions,
|
|
883
|
+
adapters, tests and scaffolds. Output follows Google language-specific
|
|
884
|
+
guidance where applicable, PEP 8 for Python, standard Go and Rust
|
|
885
|
+
formatting, and an 80-column Haskell layout. Formatting is deterministic in
|
|
886
|
+
native and WASM compilation and needs no formatter download. Changing the
|
|
887
|
+
formatting mode does not overwrite edited adapters or create false
|
|
888
|
+
adapter-signature updates.
|
|
889
|
+
|
|
890
|
+
## [0.8.0] - 2026-09-25
|
|
891
|
+
|
|
892
|
+
### Added
|
|
893
|
+
|
|
894
|
+
- Rust 2024, with Rust 1.85 as the minimum toolchain, Cargo scaffolding,
|
|
895
|
+
Proptest generation and shrinking, the complete scalar catalog, refinements
|
|
896
|
+
and contracts. See [Rust](docs/how-to/targets/rust.md).
|
|
897
|
+
- An independent numeric Rust runtime with owned native bridges, exact
|
|
898
|
+
arithmetic, checked conversions, direct IEEE rounding, raw text, Symbol
|
|
899
|
+
identity and distinct nested absence states.
|
|
900
|
+
- A typed core and proposition tree shared by all eight emitters.
|
|
901
|
+
- An independent core validator and evaluator. Testing plans distinguish
|
|
902
|
+
semantic validity from execution feasibility and preserve dependent
|
|
903
|
+
refinement domains.
|
|
904
|
+
- API schema v3 with explicit wire views and unchanged lossless scalar
|
|
905
|
+
encodings. See
|
|
906
|
+
[API migration](docs/explanation/api-migration.md#schema-2-to-schema-3-080).
|
|
915
907
|
- Rust module wiring, custom layouts, Cargo preflight, adapter preservation,
|
|
916
|
-
generation manifests, bundled examples
|
|
917
|
-
- Exact algebra and numeric currying examples
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
wrapping adapters are rejected on every target.
|
|
921
|
-
|
|
922
|
-
See [Rust](docs/how-to/targets/rust.md), [the language reference](docs/reference/language/index.md),
|
|
923
|
-
[primitives](docs/reference/primitives.md), [refinements](docs/reference/refinements.md), and
|
|
924
|
-
[API migration](docs/explanation/api-migration.md#schema-2-to-schema-3-080).
|
|
908
|
+
generation manifests, bundled examples and installed-package coverage.
|
|
909
|
+
- Exact algebra and numeric currying examples, covering Int32 overflow, large
|
|
910
|
+
products, Int32-minimum negation, and values beyond machine and safe-number
|
|
911
|
+
bounds.
|
|
925
912
|
|
|
926
|
-
###
|
|
913
|
+
### Changed
|
|
927
914
|
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
915
|
+
- API clients must migrate to schema v3; explicit schema-v2 requests receive a
|
|
916
|
+
migration diagnostic.
|
|
917
|
+
- Logical `Integer` replaces the examples' former modular Int32 contracts;
|
|
918
|
+
wrapping adapters are rejected on every target.
|
|
919
|
+
- All nonempty plans emit scalar runtime source; existing Haskell projects
|
|
920
|
+
need direct `text` and `bytestring` dependencies in the component compiling
|
|
921
|
+
that source.
|
|
922
|
+
- Machine-sized domains use an explicit 32/64-bit profile, and native
|
|
923
|
+
machine-sized bindings reject an architecture mismatch. Rust adapters take
|
|
924
|
+
owned values.
|
|
925
|
+
|
|
926
|
+
[Unreleased]: https://github.com/brain-fuel/lawspec/compare/v0.20.1...HEAD
|
|
927
|
+
[0.20.1]: https://github.com/brain-fuel/lawspec/compare/v0.20.0...v0.20.1
|
|
928
|
+
[0.20.0]: https://github.com/brain-fuel/lawspec/compare/v0.19.1...v0.20.0
|
|
929
|
+
[0.19.1]: https://github.com/brain-fuel/lawspec/compare/v0.19.0...v0.19.1
|
|
930
|
+
[0.19.0]: https://github.com/brain-fuel/lawspec/compare/v0.18.0...v0.19.0
|
|
931
|
+
[0.18.0]: https://github.com/brain-fuel/lawspec/compare/v0.17.5...v0.18.0
|
|
932
|
+
[0.17.5]: https://github.com/brain-fuel/lawspec/compare/v0.17.4...v0.17.5
|
|
933
|
+
[0.17.4]: https://github.com/brain-fuel/lawspec/compare/v0.17.3...v0.17.4
|
|
934
|
+
[0.17.3]: https://github.com/brain-fuel/lawspec/compare/v0.17.2...v0.17.3
|
|
935
|
+
[0.17.2]: https://github.com/brain-fuel/lawspec/compare/v0.17.1...v0.17.2
|
|
936
|
+
[0.17.1]: https://github.com/brain-fuel/lawspec/compare/v0.17.0...v0.17.1
|
|
937
|
+
[0.17.0]: https://github.com/brain-fuel/lawspec/compare/v0.16.0...v0.17.0
|
|
938
|
+
[0.16.0]: https://github.com/brain-fuel/lawspec/compare/v0.15.2...v0.16.0
|
|
939
|
+
[0.15.2]: https://github.com/brain-fuel/lawspec/compare/v0.15.1...v0.15.2
|
|
940
|
+
[0.15.1]: https://github.com/brain-fuel/lawspec/compare/v0.15.0...v0.15.1
|
|
941
|
+
[0.15.0]: https://github.com/brain-fuel/lawspec/compare/v0.14.0...v0.15.0
|
|
942
|
+
[0.14.0]: https://github.com/brain-fuel/lawspec/compare/v0.13.2...v0.14.0
|
|
943
|
+
[0.13.2]: https://github.com/brain-fuel/lawspec/compare/v0.13.1...v0.13.2
|
|
944
|
+
[0.13.1]: https://github.com/brain-fuel/lawspec/compare/v0.13.0...v0.13.1
|
|
945
|
+
[0.13.0]: https://github.com/brain-fuel/lawspec/compare/v0.12.0...v0.13.0
|
|
946
|
+
[0.12.0]: https://github.com/brain-fuel/lawspec/compare/v0.11.0...v0.12.0
|
|
947
|
+
[0.11.0]: https://github.com/brain-fuel/lawspec/compare/v0.10.0...v0.11.0
|
|
948
|
+
[0.10.0]: https://github.com/brain-fuel/lawspec/compare/v0.9.0...v0.10.0
|
|
949
|
+
[0.9.0]: https://github.com/brain-fuel/lawspec/compare/4bf7fe5...v0.9.0
|
|
950
|
+
[0.8.0]: https://github.com/brain-fuel/lawspec/compare/v0.7.0...4bf7fe5
|