eutaxy 0.6.0 → 0.8.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.
- package/README.md +55 -14
- package/dist/aws.d.mts +2 -2
- package/dist/bin.mjs +2 -2
- package/dist/cli-BT7zv5TL.mjs +2 -0
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cloudflare.d.mts +9 -9
- package/dist/cloudflare.d.mts.map +1 -1
- package/dist/cloudflare.mjs +1 -1
- package/dist/combinators-Bsd9HKtw.d.mts +42 -0
- package/dist/combinators-Bsd9HKtw.d.mts.map +1 -0
- package/dist/combinators-CVjxodAJ.mjs +27 -0
- package/dist/combinators-CVjxodAJ.mjs.map +1 -0
- package/dist/{delivery-invariants-BraYqcYN.d.mts → delivery-invariants-DfPkJL0Q.d.mts} +2 -2
- package/dist/{delivery-invariants-BraYqcYN.d.mts.map → delivery-invariants-DfPkJL0Q.d.mts.map} +1 -1
- package/dist/explore-Rwe1PPqX.d.mts +233 -0
- package/dist/explore-Rwe1PPqX.d.mts.map +1 -0
- package/dist/index.d.mts +141 -20
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -61
- package/dist/index.mjs.map +1 -1
- package/dist/{platform-DfMwknw1.d.mts → platform-Bpnav0kn.d.mts} +6 -4
- package/dist/{platform-DfMwknw1.d.mts.map → platform-Bpnav0kn.d.mts.map} +1 -1
- package/dist/spec.d.mts +2 -0
- package/dist/spec.mjs +1 -0
- package/dist/src-B9L96rZW.mjs +9521 -0
- package/dist/src-B9L96rZW.mjs.map +1 -0
- package/dist/src-BO7I3f-1.mjs.map +1 -1
- package/dist/src-BZtuuu_j.mjs +1706 -0
- package/dist/src-BZtuuu_j.mjs.map +1 -0
- package/package.json +12 -7
- package/dist/cli-CsiVEsS-.mjs +0 -2
- package/dist/explore-CDpJA9zX.d.mts +0 -342
- package/dist/explore-CDpJA9zX.d.mts.map +0 -1
- package/dist/src-C43iUZgr.mjs +0 -5039
- package/dist/src-C43iUZgr.mjs.map +0 -1
- package/dist/src-Cs4Mg55e.mjs +0 -2672
- package/dist/src-Cs4Mg55e.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -15,12 +15,13 @@ runs in workerd.
|
|
|
15
15
|
|
|
16
16
|
Specs on a Worker's pure core functions are checked on the inputs the
|
|
17
17
|
simulator actually passed them, then on generated inputs, and proved in
|
|
18
|
-
Lean 4
|
|
19
|
-
carries out the core's decisions
|
|
18
|
+
Lean 4 (`--prover lean`) or with Z3 (`--prover smt`) when an engine is
|
|
19
|
+
named; `refines` checks that the Worker carries out the core's decisions
|
|
20
|
+
on state that was still current.
|
|
20
21
|
|
|
21
|
-
**Status: 0.
|
|
22
|
-
[docs/design.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.
|
|
23
|
-
[docs/roadmap.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.
|
|
22
|
+
**Status: 0.7, early.** The design is in
|
|
23
|
+
[docs/design.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.8.0/docs/design.md); the phases and their gates are in
|
|
24
|
+
[docs/roadmap.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.8.0/docs/roadmap.md).
|
|
24
25
|
|
|
25
26
|
## Verdicts
|
|
26
27
|
|
|
@@ -29,8 +30,10 @@ A scenario gets `VIOLATED`, `BOUNDED` or `UNSUPPORTED`. A spec gets
|
|
|
29
30
|
those and on inputs generated from the property's domains), `REFUTED`
|
|
30
31
|
(with the input that breaks it, shrunk), `PROVEN` (for every input, by a
|
|
31
32
|
named engine; `eutaxy check --prover lean` runs Eutaxy's own
|
|
32
|
-
TypeScript-to-Lean 4 engine
|
|
33
|
-
|
|
33
|
+
TypeScript-to-Lean 4 engine and `--prover smt` its TypeScript-to-SMT-LIB
|
|
34
|
+
engine over Z3, which between them prove properties of a pure subset over
|
|
35
|
+
integers, booleans, strings and records today, and over doubles, nullable
|
|
36
|
+
types and tagged unions with the SMT engine only), `CONFLICT` (engines disagree) or
|
|
34
37
|
`UNKNOWN`. Every verdict carries what it rests on:
|
|
35
38
|
seed and bounds, or the inputs it was checked on, and the assumptions.
|
|
36
39
|
Nothing is ever reported as verified when it was only explored or sampled:
|
|
@@ -40,7 +43,8 @@ Nothing is ever reported as verified when it was only explored or sampled:
|
|
|
40
43
|
|
|
41
44
|
```
|
|
42
45
|
packages/ spec, core, engine, cloudflare, aws, prover, prover-lean,
|
|
43
|
-
prover-thales, prover-lemmascript, report, cli,
|
|
46
|
+
prover-smt, prover-thales, prover-lemmascript, report, cli,
|
|
47
|
+
eutaxy
|
|
44
48
|
docs/ design and roadmap
|
|
45
49
|
```
|
|
46
50
|
|
|
@@ -54,7 +58,11 @@ declares exactly that, and pnpm links nothing else.
|
|
|
54
58
|
pnpm add -D eutaxy vitest @cloudflare/vitest-plugin
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
Requires Node 24. Published as `eutaxy` on npm.
|
|
61
|
+
Requires Node 24. Published as `eutaxy` on npm. A `--prover` engine also
|
|
62
|
+
needs its pinned toolchain on the machine: Lean through
|
|
63
|
+
[elan](https://elan.lean-lang.org) for `lean`, Z3 5.3.2 on the PATH for
|
|
64
|
+
`smt`. Without it that engine's properties are `UNKNOWN` (unavailable),
|
|
65
|
+
with how to install it.
|
|
58
66
|
|
|
59
67
|
## Checking a Worker
|
|
60
68
|
|
|
@@ -64,7 +72,7 @@ Write a scenario beside your Worker and run the check:
|
|
|
64
72
|
eutaxy check ./payments.sim.ts
|
|
65
73
|
```
|
|
66
74
|
|
|
67
|
-
[examples/payments-queue](https://github.com/Kaisenwerk/eutaxy/blob/v0.
|
|
75
|
+
[examples/payments-queue](https://github.com/Kaisenwerk/eutaxy/blob/v0.8.0/examples/payments-queue) is a complete, runnable
|
|
68
76
|
version of this: a queue consumer with a bug the check finds, and the fixed
|
|
69
77
|
Worker it reports `BOUNDED` for.
|
|
70
78
|
|
|
@@ -75,8 +83,27 @@ A scenario drives the Worker through its `queue()` handler or, with
|
|
|
75
83
|
interleave at their I/O, including a Durable Object's outbound I/O during
|
|
76
84
|
a call (its storage operations hold other events, as the runtime's input
|
|
77
85
|
gate does); alarms fire in virtual time. A scenario's `specs` names the
|
|
78
|
-
modules of its pure core
|
|
79
|
-
|
|
86
|
+
modules of its pure core; each module's specs live in a spec file beside
|
|
87
|
+
it (`domain.ts` has `domain.props.ts`), written in TypeScript so your own
|
|
88
|
+
compiler checks them against the functions they describe:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { forall } from "eutaxy/spec";
|
|
92
|
+
import { decideRefund } from "./domain.ts";
|
|
93
|
+
|
|
94
|
+
export const withinCaptured = forall(decideRefund, {
|
|
95
|
+
when: (captured, refunded) => 0 <= refunded && refunded <= captured,
|
|
96
|
+
ensures: (captured, refunded, amount) =>
|
|
97
|
+
decideRefund(captured, refunded, amount).refunded <= captured,
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Each property is checked on the inputs the simulator passed (`CHECKED`),
|
|
102
|
+
then on inputs drawn from the parameter types (`TESTED`), and proved for
|
|
103
|
+
every input by a named engine (`PROVEN`): `--prover lean` proves under an
|
|
104
|
+
integer model of `number` with the Lean 4 kernel, `--prover smt` proves
|
|
105
|
+
over the doubles themselves with Z3 and replays every model it finds, and
|
|
106
|
+
`--prover lean,smt` reports a `CONFLICT` where the two disagree.
|
|
80
107
|
|
|
81
108
|
It runs the scenario inside workerd through your Vitest and the Cloudflare
|
|
82
109
|
Vitest plugin, prints the verdict with its trace and assumptions (or
|
|
@@ -85,6 +112,20 @@ violation writes `payments.regression.test.ts`, which fails while the bug
|
|
|
85
112
|
exists and passes once it is fixed. It exits 0 for `BOUNDED`, 1 for
|
|
86
113
|
`VIOLATED` or a `REFUTED` spec, 2 for `UNSUPPORTED`, and 3 on an error.
|
|
87
114
|
|
|
115
|
+
To see every spec in a project at once, without a scenario:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
eutaxy report ./src --prover smt
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
It finds every spec file under the directory, runs each property through
|
|
122
|
+
`TESTED` and, with `--prover`, `PROVEN`, and prints the verdicts by module
|
|
123
|
+
with a count (or `--json`). No scenario runs, so nothing is `CHECKED`, and
|
|
124
|
+
the modules are loaded in Node, so one that only loads inside workerd stays
|
|
125
|
+
`UNKNOWN` until an engine reads it; so does a module whose properties do
|
|
126
|
+
not finish within 60 seconds. It exits 1 for a `REFUTED` or `CONFLICT`
|
|
127
|
+
spec and 0 otherwise.
|
|
128
|
+
|
|
88
129
|
## Developing
|
|
89
130
|
|
|
90
131
|
Requires Node 24 and pnpm.
|
|
@@ -94,8 +135,8 @@ pnpm install
|
|
|
94
135
|
pnpm check # lint, typecheck, test
|
|
95
136
|
```
|
|
96
137
|
|
|
97
|
-
See [CONTRIBUTING.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.
|
|
138
|
+
See [CONTRIBUTING.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.8.0/CONTRIBUTING.md).
|
|
98
139
|
|
|
99
140
|
## License
|
|
100
141
|
|
|
101
|
-
[Apache-2.0](https://github.com/Kaisenwerk/eutaxy/blob/v0.
|
|
142
|
+
[Apache-2.0](https://github.com/Kaisenwerk/eutaxy/blob/v0.8.0/LICENSE).
|
package/dist/aws.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as StateQuery, E as EffectSelector, S as RowCondition, a as PlatformData, c as WorkerRef, h as Invariant, i as ExternalDecl, k as JsonValue, n as Platform, o as ScenarioSpec, p as AtLeastOnce, r as Bounds } from "./platform-
|
|
2
|
-
import { n as atMostOncePerKey } from "./delivery-invariants-
|
|
1
|
+
import { C as StateQuery, E as EffectSelector, S as RowCondition, a as PlatformData, c as WorkerRef, h as Invariant, i as ExternalDecl, k as JsonValue, n as Platform, o as ScenarioSpec, p as AtLeastOnce, r as Bounds } from "./platform-Bpnav0kn.mjs";
|
|
2
|
+
import { n as atMostOncePerKey } from "./delivery-invariants-DfPkJL0Q.mjs";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
import { Agent, AgentOptions } from "node:http";
|
|
5
5
|
import { Agent as Agent$1, AgentOptions as AgentOptions$1 } from "node:https";
|
package/dist/bin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { N as main } from "./src-
|
|
3
|
-
import "./cli-
|
|
2
|
+
import { N as main } from "./src-B9L96rZW.mjs";
|
|
3
|
+
import "./cli-BT7zv5TL.mjs";
|
|
4
4
|
// packages/eutaxy/src/bin.ts
|
|
5
5
|
process.stdout.on("error", (err) => {
|
|
6
6
|
if (err.code === "EPIPE") process.exit(process.exitCode ?? 0);
|
package/dist/cli.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.mts","names":[],"sources":["../../cli/src/main.ts"],"mappings":"A,
|
|
1
|
+
{"version":3,"file":"cli.d.mts","names":[],"sources":["../../cli/src/main.ts"],"mappings":"A,UAiCiB;WACN;WACA,SAAS;WACT,SAAS;;wBAGE,KAAK,yBAAyB,IAAI,KAAK"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { N as main } from "./src-
|
|
2
|
-
import "./cli-
|
|
1
|
+
export { N as main } from "./src-B9L96rZW.mjs";
|
|
2
|
+
import "./cli-BT7zv5TL.mjs";
|
package/dist/cloudflare.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as StateQuery, E as EffectSelector, S as RowCondition, T as Refines, a as PlatformData, b as Implies, c as WorkerRef, h as Invariant, i as ExternalDecl, k as JsonValue, n as Platform, o as ScenarioSpec, p as AtLeastOnce, r as Bounds, s as ScriptedResponse, w as Unique, x as References, y as EveryRow } from "./platform-
|
|
2
|
-
import { n as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-
|
|
3
|
-
import {
|
|
1
|
+
import { C as StateQuery, E as EffectSelector, S as RowCondition, T as Refines, a as PlatformData, b as Implies, c as WorkerRef, h as Invariant, i as ExternalDecl, k as JsonValue, n as Platform, o as ScenarioSpec, p as AtLeastOnce, r as Bounds, s as ScriptedResponse, w as Unique, x as References, y as EveryRow } from "./platform-Bpnav0kn.mjs";
|
|
2
|
+
import { n as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-DfPkJL0Q.mjs";
|
|
3
|
+
import { c as ModuleSpecs, g as Violated, m as ScenarioVerdict, t as ExploreOptions } from "./explore-Rwe1PPqX.mjs";
|
|
4
4
|
interface CloudflareRegressionOptions {
|
|
5
5
|
/** Import path of the scenario module, relative to the emitted file. */
|
|
6
6
|
readonly scenarioPath: string;
|
|
@@ -254,7 +254,7 @@ interface CloudflareScenarioInput {
|
|
|
254
254
|
readonly externals?: readonly ExternalDecl[];
|
|
255
255
|
readonly invariants: readonly Invariant[];
|
|
256
256
|
readonly bounds?: Partial<Bounds>;
|
|
257
|
-
/** Modules of pure core functions with
|
|
257
|
+
/** Modules of pure core functions with spec files beside them, relative to the scenario (see ScenarioSpec.specs). */
|
|
258
258
|
readonly specs?: readonly string[];
|
|
259
259
|
}
|
|
260
260
|
export declare function queue(name: string, messages: readonly QueueMessage[]): QueueDrive;
|
|
@@ -322,7 +322,7 @@ export declare function defineScenario(input: CloudflareScenarioInput): Scenario
|
|
|
322
322
|
/** What the generated test stores in its task meta. */
|
|
323
323
|
interface CheckTransport {
|
|
324
324
|
readonly report: unknown;
|
|
325
|
-
/** Set instead of a report when a module the scenario's `specs` names has no usable
|
|
325
|
+
/** Set instead of a report when a module the scenario's `specs` names has no usable spec file. */
|
|
326
326
|
readonly specErrors?: readonly SpecError[];
|
|
327
327
|
readonly worker: {
|
|
328
328
|
readonly entry: string;
|
|
@@ -343,10 +343,10 @@ interface SpecError {
|
|
|
343
343
|
readonly line: number;
|
|
344
344
|
readonly message: string;
|
|
345
345
|
}
|
|
346
|
-
/** A generated spec
|
|
346
|
+
/** A generated spec entry: the module's specs, read on the Node side, and a loader of its spec file. */
|
|
347
347
|
interface SpecEntry {
|
|
348
348
|
readonly specs: ModuleSpecs;
|
|
349
|
-
readonly
|
|
349
|
+
readonly load: () => Promise<object>;
|
|
350
350
|
}
|
|
351
351
|
/** Vite globs, keyed as `import.meta.glob` keys them from `.eutaxy/` (see `globKey`). */
|
|
352
352
|
type ModuleGlob = Readonly<Record<string, () => Promise<unknown>>>;
|
|
@@ -361,8 +361,8 @@ interface WorkerdCheckInput {
|
|
|
361
361
|
readonly sqlFiles: Readonly<Record<string, string>>;
|
|
362
362
|
/** The TypeScript modules next to the scenario (the Worker and the spec modules among them). */
|
|
363
363
|
readonly modules: ModuleGlob;
|
|
364
|
-
/** The generated `specs.ts`
|
|
365
|
-
readonly
|
|
364
|
+
/** The generated `specs.ts` entries, by module key. */
|
|
365
|
+
readonly specEntries: Readonly<Record<string, SpecEntry>>;
|
|
366
366
|
readonly seed: string;
|
|
367
367
|
readonly maxRuns?: number;
|
|
368
368
|
readonly budgetMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../../cli/src/regression.ts","../../cloudflare/src/check.ts","../../cloudflare/src/d1.ts","../../cloudflare/src/durable-objects.ts","../../cloudflare/src/platform.ts","../../cloudflare/src/differential.ts","../../cloudflare/src/r2.ts","../../cloudflare/src/scenario.ts","../../cli/src/workerd.ts"],"mappings":"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
|
|
1
|
+
{"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../../cli/src/regression.ts","../../cloudflare/src/check.ts","../../cloudflare/src/d1.ts","../../cloudflare/src/durable-objects.ts","../../cloudflare/src/platform.ts","../../cloudflare/src/differential.ts","../../cloudflare/src/r2.ts","../../cloudflare/src/scenario.ts","../../cli/src/workerd.ts"],"mappings":"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"}
|
package/dist/cloudflare.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { r as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-hmhwh_qD.mjs";
|
|
2
|
-
import { A as snapshotD1, C as r2Rows, D as workflow, E as unique, M as expectHolds, O as workflowRows, P as cloudflareRegressionTest, S as r2Op, T as refines, _ as httpResponse, a as d1Param, b as queueAck, c as d1Schema, d as durableObject, f as durableObjectRows, g as http, h as fetchCall, i as atLeastOncePerMessage, j as check, k as workflowStep, l as d1Write, m as external, n as runDifferential, o as d1Read, p as everyRow, r as createCloudflarePlatform, s as d1Rows, t as checkInWorkerd, u as defineScenario, v as implies, w as references, x as r2Bucket, y as queue } from "./src-
|
|
2
|
+
import { A as snapshotD1, C as r2Rows, D as workflow, E as unique, M as expectHolds, O as workflowRows, P as cloudflareRegressionTest, S as r2Op, T as refines, _ as httpResponse, a as d1Param, b as queueAck, c as d1Schema, d as durableObject, f as durableObjectRows, g as http, h as fetchCall, i as atLeastOncePerMessage, j as check, k as workflowStep, l as d1Write, m as external, n as runDifferential, o as d1Read, p as everyRow, r as createCloudflarePlatform, s as d1Rows, t as checkInWorkerd, u as defineScenario, v as implies, w as references, x as r2Bucket, y as queue } from "./src-B9L96rZW.mjs";
|
|
3
3
|
export { atLeastOnce, atLeastOncePerMessage, atMostOncePerKey, check, checkInWorkerd, cloudflareRegressionTest, createCloudflarePlatform, d1Param, d1Read, d1Rows, d1Schema, d1Write, defineScenario, durableObject, durableObjectRows, everyRow, expectHolds, external, fetchCall, http, httpResponse, implies, queue, queueAck, r2Bucket, r2Op, r2Rows, references, refines, runDifferential, snapshotD1, unique, workflow, workflowRows, workflowStep };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a spec file writes: `forall(f, { sample, when, ensures })` and `total(f)`.
|
|
3
|
+
* Both return plain data holding the function itself, so the user's
|
|
4
|
+
* compiler types the arrows' parameters as `f`'s and a spec that does not
|
|
5
|
+
* match its function does not compile. Nothing here runs a check: the
|
|
6
|
+
* simulator's rungs evaluate the arrows on inputs, and the engines read
|
|
7
|
+
* the spec file's text.
|
|
8
|
+
*/
|
|
9
|
+
/** Any function; `never[]` so that every parameter list is accepted. */
|
|
10
|
+
type Fn = (...args: never[]) => unknown;
|
|
11
|
+
/**
|
|
12
|
+
* A universally quantified claim: for every input of `fn`'s parameter
|
|
13
|
+
* types where `when` holds, `ensures` holds. `ensures` is evaluated only
|
|
14
|
+
* where `when` does, so a guard such as `c !== null` protects what follows.
|
|
15
|
+
* `sample` is not part of the claim: it limits the inputs the `TESTED`
|
|
16
|
+
* rung draws (to keep each evaluation small, say), and the verdict says
|
|
17
|
+
* so; inputs the simulator passed are checked whatever it says, and an
|
|
18
|
+
* engine proves the claim for every input.
|
|
19
|
+
*/
|
|
20
|
+
interface Forall<F extends Fn> {
|
|
21
|
+
readonly kind: "forall";
|
|
22
|
+
readonly fn: F;
|
|
23
|
+
readonly sample?: (...args: Parameters<F>) => boolean;
|
|
24
|
+
readonly when?: (...args: Parameters<F>) => boolean;
|
|
25
|
+
readonly ensures: (...args: Parameters<F>) => boolean;
|
|
26
|
+
}
|
|
27
|
+
/** The claim that `fn` terminates on every input of its parameter types. */
|
|
28
|
+
interface Total<F extends Fn> {
|
|
29
|
+
readonly kind: "total";
|
|
30
|
+
readonly fn: F;
|
|
31
|
+
}
|
|
32
|
+
type Spec = Forall<Fn> | Total<Fn>;
|
|
33
|
+
declare function forall<F extends Fn>(fn: F, property: {
|
|
34
|
+
readonly sample?: (...args: Parameters<F>) => boolean;
|
|
35
|
+
readonly when?: (...args: Parameters<F>) => boolean;
|
|
36
|
+
readonly ensures: (...args: Parameters<F>) => boolean;
|
|
37
|
+
}): Forall<F>;
|
|
38
|
+
declare function total<F extends Fn>(fn: F): Total<F>;
|
|
39
|
+
/** Whether a spec file's export is one of the two spec shapes. */
|
|
40
|
+
declare function isSpec(value: unknown): value is Spec;
|
|
41
|
+
export { forall as a, Total as i, Forall as n, isSpec as o, Spec as r, total as s, Fn as t };
|
|
42
|
+
//# sourceMappingURL=combinators-Bsd9HKtw.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combinators-Bsd9HKtw.d.mts","names":[],"sources":["../../spec/src/combinators.ts"],"mappings":";;;;;;;;;KAUY,SAAS;;;;;;;;;;UAWJ,OAAO,UAAU;WACvB;WACA,IAAI;WACJ,aAAa,MAAM,WAAW;WAC9B,WAAW,MAAM,WAAW;WAC5B,aAAa,MAAM,WAAW;;;UAIxB,MAAM,UAAU;WACtB;WACA,IAAI;;KAGH,OAAO,OAAO,MAAM,MAAM;iBAEtB,OAAO,UAAU,IAC/B,IAAI,GACJ;WACW,aAAa,MAAM,WAAW;WAC9B,WAAW,MAAM,WAAW;WAC5B,aAAa,MAAM,WAAW;IAExC,OAAO;iBAUM,MAAM,UAAU,IAAI,IAAI,IAAI,MAAM;;iBAKlC,OAAO,iBAAiB,SAAS"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// packages/spec/src/combinators.ts
|
|
2
|
+
function forall(fn, property) {
|
|
3
|
+
return {
|
|
4
|
+
kind: "forall",
|
|
5
|
+
fn,
|
|
6
|
+
...property.sample === void 0 ? {} : { sample: property.sample },
|
|
7
|
+
...property.when === void 0 ? {} : { when: property.when },
|
|
8
|
+
ensures: property.ensures
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function total(fn) {
|
|
12
|
+
return {
|
|
13
|
+
kind: "total",
|
|
14
|
+
fn
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Whether a spec file's export is one of the two spec shapes. */
|
|
18
|
+
function isSpec(value) {
|
|
19
|
+
if (typeof value !== "object" || value === null) return false;
|
|
20
|
+
const v = value;
|
|
21
|
+
if (typeof v.fn !== "function") return false;
|
|
22
|
+
if (v.kind === "total") return true;
|
|
23
|
+
return v.kind === "forall" && typeof v.ensures === "function" && (v.when === void 0 || typeof v.when === "function") && (v.sample === void 0 || typeof v.sample === "function");
|
|
24
|
+
}
|
|
25
|
+
export { isSpec as n, total as r, forall as t };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=combinators-CVjxodAJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combinators-CVjxodAJ.mjs","names":[],"sources":["../../spec/src/combinators.ts"],"sourcesContent":["/**\n * What a spec file writes: `forall(f, { sample, when, ensures })` and `total(f)`.\n * Both return plain data holding the function itself, so the user's\n * compiler types the arrows' parameters as `f`'s and a spec that does not\n * match its function does not compile. Nothing here runs a check: the\n * simulator's rungs evaluate the arrows on inputs, and the engines read\n * the spec file's text.\n */\n\n/** Any function; `never[]` so that every parameter list is accepted. */\nexport type Fn = (...args: never[]) => unknown;\n\n/**\n * A universally quantified claim: for every input of `fn`'s parameter\n * types where `when` holds, `ensures` holds. `ensures` is evaluated only\n * where `when` does, so a guard such as `c !== null` protects what follows.\n * `sample` is not part of the claim: it limits the inputs the `TESTED`\n * rung draws (to keep each evaluation small, say), and the verdict says\n * so; inputs the simulator passed are checked whatever it says, and an\n * engine proves the claim for every input.\n */\nexport interface Forall<F extends Fn> {\n readonly kind: \"forall\";\n readonly fn: F;\n readonly sample?: (...args: Parameters<F>) => boolean;\n readonly when?: (...args: Parameters<F>) => boolean;\n readonly ensures: (...args: Parameters<F>) => boolean;\n}\n\n/** The claim that `fn` terminates on every input of its parameter types. */\nexport interface Total<F extends Fn> {\n readonly kind: \"total\";\n readonly fn: F;\n}\n\nexport type Spec = Forall<Fn> | Total<Fn>;\n\nexport function forall<F extends Fn>(\n fn: F,\n property: {\n readonly sample?: (...args: Parameters<F>) => boolean;\n readonly when?: (...args: Parameters<F>) => boolean;\n readonly ensures: (...args: Parameters<F>) => boolean;\n },\n): Forall<F> {\n return {\n kind: \"forall\",\n fn,\n ...(property.sample === undefined ? {} : { sample: property.sample }),\n ...(property.when === undefined ? {} : { when: property.when }),\n ensures: property.ensures,\n };\n}\n\nexport function total<F extends Fn>(fn: F): Total<F> {\n return { kind: \"total\", fn };\n}\n\n/** Whether a spec file's export is one of the two spec shapes. */\nexport function isSpec(value: unknown): value is Spec {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as {\n kind?: unknown;\n fn?: unknown;\n ensures?: unknown;\n when?: unknown;\n sample?: unknown;\n };\n if (typeof v.fn !== \"function\") return false;\n if (v.kind === \"total\") return true;\n return (\n v.kind === \"forall\" &&\n typeof v.ensures === \"function\" &&\n (v.when === undefined || typeof v.when === \"function\") &&\n (v.sample === undefined || typeof v.sample === \"function\")\n );\n}\n"],"mappings":";AAqCA,SAAgB,OACd,IACA,UAKW;CACX,OAAO;EACL,MAAM;EACN;EACA,GAAI,SAAS,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,SAAS,OAAO;EACnE,GAAI,SAAS,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,SAAS,KAAK;EAC7D,SAAS,SAAS;CACpB;AACF;AAEA,SAAgB,MAAoB,IAAiB;CACnD,OAAO;EAAE,MAAM;EAAS;CAAG;AAC7B;;AAGA,SAAgB,OAAO,OAA+B;CACpD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,IAAI;CAOV,IAAI,OAAO,EAAE,OAAO,YAAY,OAAO;CACvC,IAAI,EAAE,SAAS,SAAS,OAAO;CAC/B,OACE,EAAE,SAAS,YACX,OAAO,EAAE,YAAY,eACpB,EAAE,SAAS,KAAA,KAAa,OAAO,EAAE,SAAS,gBAC1C,EAAE,WAAW,KAAA,KAAa,OAAO,EAAE,WAAW;AAEnD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EffectSelector, k as JsonValue, m as AtMostOncePerKey, p as AtLeastOnce } from "./platform-
|
|
1
|
+
import { E as EffectSelector, k as JsonValue, m as AtMostOncePerKey, p as AtLeastOnce } from "./platform-Bpnav0kn.mjs";
|
|
2
2
|
declare function atMostOncePerKey(name: string, effect: EffectSelector, key: string): AtMostOncePerKey;
|
|
3
3
|
declare function atLeastOnce(name: string, effect: EffectSelector, key: string, expected: readonly JsonValue[]): AtLeastOnce;
|
|
4
4
|
export { atMostOncePerKey as n, atLeastOnce as t };
|
|
5
|
-
//# sourceMappingURL=delivery-invariants-
|
|
5
|
+
//# sourceMappingURL=delivery-invariants-DfPkJL0Q.d.mts.map
|
package/dist/{delivery-invariants-BraYqcYN.d.mts.map → delivery-invariants-DfPkJL0Q.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-invariants-
|
|
1
|
+
{"version":3,"file":"delivery-invariants-DfPkJL0Q.d.mts","names":[],"sources":["../../core/src/delivery-invariants.ts"],"mappings":";iBAUgB,iBACd,cACA,QAAQ,gBACR,cACC;iBAIa,YACd,cACA,QAAQ,gBACR,aACA,mBAAmB,cAClB"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { D as EffectLog, f as Schedule, g as Violation, n as Platform, o as ScenarioSpec, r as Bounds } from "./platform-Bpnav0kn.mjs";
|
|
2
|
+
interface BoundsReached {
|
|
3
|
+
readonly runs: number;
|
|
4
|
+
readonly effectPoints: number;
|
|
5
|
+
readonly faultsInjected: number;
|
|
6
|
+
readonly elapsedMs: number;
|
|
7
|
+
/**
|
|
8
|
+
* Present when exploration was exhaustive: how many distinct schedules ran
|
|
9
|
+
* (runs that only repeated an order the reduction had covered are not
|
|
10
|
+
* counted), and whether every schedule within the bounds was reached
|
|
11
|
+
* before the budget ran out.
|
|
12
|
+
*/
|
|
13
|
+
readonly exhaustive?: {
|
|
14
|
+
readonly complete: boolean;
|
|
15
|
+
readonly schedules: number;
|
|
16
|
+
readonly reduction: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface VerdictBase {
|
|
20
|
+
readonly scenario: string;
|
|
21
|
+
readonly seed: number | string;
|
|
22
|
+
readonly reached: BoundsReached;
|
|
23
|
+
readonly assumptions: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
interface Shrunk {
|
|
26
|
+
readonly faultsRemoved: number;
|
|
27
|
+
readonly eventsRemoved: number;
|
|
28
|
+
readonly runs: number;
|
|
29
|
+
}
|
|
30
|
+
interface Violated extends VerdictBase {
|
|
31
|
+
readonly kind: "VIOLATED";
|
|
32
|
+
readonly violation: Violation;
|
|
33
|
+
/** The replayed, shrunk trace that breaks the invariant. */
|
|
34
|
+
readonly trace: EffectLog;
|
|
35
|
+
readonly schedule: Schedule;
|
|
36
|
+
/** Ids of the drive's events that remain after shrinking. */
|
|
37
|
+
readonly keptEvents: readonly string[];
|
|
38
|
+
readonly shrunk: Shrunk;
|
|
39
|
+
}
|
|
40
|
+
interface Bounded extends VerdictBase {
|
|
41
|
+
readonly kind: "BOUNDED";
|
|
42
|
+
readonly bounds: Bounds;
|
|
43
|
+
}
|
|
44
|
+
type UnsupportedCause = "unsupported_api" | "not_replayable" | "module_state_leak" | "unsupported_bounds";
|
|
45
|
+
interface Unsupported extends VerdictBase {
|
|
46
|
+
readonly kind: "UNSUPPORTED";
|
|
47
|
+
readonly cause: UnsupportedCause;
|
|
48
|
+
readonly reason: string;
|
|
49
|
+
}
|
|
50
|
+
type ScenarioVerdict = Violated | Bounded | Unsupported;
|
|
51
|
+
/** One line per verdict, for error messages; full rendering lives in `report`. */
|
|
52
|
+
declare function describeVerdict(v: ScenarioVerdict): string;
|
|
53
|
+
/**
|
|
54
|
+
* SpecIR: function specs as plain data. The surface is TypeScript (a spec
|
|
55
|
+
* file beside the module, `forall(f, { when, ensures })` and `total(f)`
|
|
56
|
+
* from `eutaxy/spec`); the IR is Eutaxy's own, so the simulator's rungs
|
|
57
|
+
* and every engine read one shape. Binder domains are the function's
|
|
58
|
+
* parameter types, read from its declaration; the precondition and the
|
|
59
|
+
* claim are kept as the arrow functions' text, read by each engine into
|
|
60
|
+
* its own tree, and evaluated as code by the simulator's rungs.
|
|
61
|
+
*/
|
|
62
|
+
/** A TypeScript type as far as the reader can read it; `unknown` carries what it could not. */
|
|
63
|
+
type SpecType = {
|
|
64
|
+
readonly kind: "number";
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: "boolean";
|
|
67
|
+
} | {
|
|
68
|
+
readonly kind: "string";
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: "bigint";
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "literal";
|
|
73
|
+
readonly value: string | number | boolean;
|
|
74
|
+
} | {
|
|
75
|
+
readonly kind: "null";
|
|
76
|
+
} | {
|
|
77
|
+
readonly kind: "undefined";
|
|
78
|
+
} | {
|
|
79
|
+
readonly kind: "record";
|
|
80
|
+
/** The declared name, when the type is an `interface` or a `type` alias rather than inline. */
|
|
81
|
+
readonly name?: string;
|
|
82
|
+
readonly fields: readonly Field[];
|
|
83
|
+
} | {
|
|
84
|
+
readonly kind: "union";
|
|
85
|
+
readonly members: readonly SpecType[];
|
|
86
|
+
} |
|
|
87
|
+
/** `T[]`, `readonly T[]`, `Array<T>` or `ReadonlyArray<T>`: a JavaScript array, read-only or not. */
|
|
88
|
+
{
|
|
89
|
+
readonly kind: "array";
|
|
90
|
+
readonly element: SpecType;
|
|
91
|
+
} | {
|
|
92
|
+
readonly kind: "unknown";
|
|
93
|
+
readonly text: string;
|
|
94
|
+
};
|
|
95
|
+
interface Field {
|
|
96
|
+
readonly name: string;
|
|
97
|
+
readonly type: SpecType;
|
|
98
|
+
}
|
|
99
|
+
/** One end of a numeric range: the literal as written (sign included). `[` and `]` include the endpoint. */
|
|
100
|
+
interface Endpoint {
|
|
101
|
+
readonly value: string;
|
|
102
|
+
readonly inclusive: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* What the precondition says about one binder on its own, read from its
|
|
106
|
+
* conjuncts: `Number.isInteger(n)`, `0 <= n`, `n < 5`, `/^a+$/.test(s)`.
|
|
107
|
+
* Draws are steered by it; the precondition itself still has the last word.
|
|
108
|
+
*/
|
|
109
|
+
interface Hint {
|
|
110
|
+
readonly integer?: true;
|
|
111
|
+
readonly lower?: Endpoint;
|
|
112
|
+
readonly upper?: Endpoint;
|
|
113
|
+
readonly regex?: {
|
|
114
|
+
readonly pattern: string;
|
|
115
|
+
readonly flags: string;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** A parameter of the function under spec. */
|
|
119
|
+
interface Param {
|
|
120
|
+
/** Null for a destructured or rest parameter. */
|
|
121
|
+
readonly name: string | null;
|
|
122
|
+
readonly type: SpecType;
|
|
123
|
+
}
|
|
124
|
+
/** A quantified variable: a parameter, under the name the claim gives it. */
|
|
125
|
+
interface Binder {
|
|
126
|
+
readonly name: string;
|
|
127
|
+
readonly type: SpecType;
|
|
128
|
+
readonly hint?: Hint;
|
|
129
|
+
}
|
|
130
|
+
/** An arrow function from the spec file, as written. */
|
|
131
|
+
interface Arrow {
|
|
132
|
+
/** Parameter names in order; null for a destructured one. */
|
|
133
|
+
readonly params: readonly (string | null)[];
|
|
134
|
+
/** The body's source text: an expression, or the statements between the braces when `block`. */
|
|
135
|
+
readonly body: string;
|
|
136
|
+
readonly block: boolean;
|
|
137
|
+
/** 1-based line of the arrow in the spec file. */
|
|
138
|
+
readonly line: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* One exported spec: `forall(f, { when, ensures })`, a universally
|
|
142
|
+
* quantified claim over `f`'s parameters where the precondition holds, or
|
|
143
|
+
* `total(f)`, that `f` terminates on every input.
|
|
144
|
+
*/
|
|
145
|
+
interface Property {
|
|
146
|
+
/** The export's name in the spec file. */
|
|
147
|
+
readonly name: string;
|
|
148
|
+
readonly kind: "forall" | "total";
|
|
149
|
+
/** The parameters, named as `ensures` names them (the function's own names past its arity). */
|
|
150
|
+
readonly binders: readonly Binder[];
|
|
151
|
+
/** Where the `TESTED` rung draws inputs; not part of the claim (see `Forall`). */
|
|
152
|
+
readonly sample?: Arrow;
|
|
153
|
+
readonly when?: Arrow;
|
|
154
|
+
readonly ensures?: Arrow;
|
|
155
|
+
/**
|
|
156
|
+
* The module's functions the spec file imports, by the local name the
|
|
157
|
+
* arrows use: a claim's free names resolve here, never in the module.
|
|
158
|
+
*/
|
|
159
|
+
readonly imports: readonly {
|
|
160
|
+
readonly local: string;
|
|
161
|
+
readonly fn: string;
|
|
162
|
+
}[];
|
|
163
|
+
/** The claim as written, for reports. */
|
|
164
|
+
readonly text: string;
|
|
165
|
+
/** 1-based line of the export in the spec file. */
|
|
166
|
+
readonly line: number;
|
|
167
|
+
}
|
|
168
|
+
/** The specs on one exported function. */
|
|
169
|
+
interface FunctionSpec {
|
|
170
|
+
readonly name: string;
|
|
171
|
+
readonly params: readonly Param[];
|
|
172
|
+
readonly properties: readonly Property[];
|
|
173
|
+
/** 1-based line of the declaration in the module. */
|
|
174
|
+
readonly line: number;
|
|
175
|
+
/** Offset in the module's source of the `(` opening the parameters: the declaration's identity. */
|
|
176
|
+
readonly offset: number;
|
|
177
|
+
}
|
|
178
|
+
/** A problem with a spec, located in the spec file (or the module when `inModule`). */
|
|
179
|
+
interface SpecError {
|
|
180
|
+
readonly line: number;
|
|
181
|
+
readonly message: string;
|
|
182
|
+
readonly inModule?: true;
|
|
183
|
+
}
|
|
184
|
+
/** Every spec of one module, and what did not read. */
|
|
185
|
+
interface ModuleSpecs {
|
|
186
|
+
readonly functions: readonly FunctionSpec[];
|
|
187
|
+
readonly errors: readonly SpecError[];
|
|
188
|
+
}
|
|
189
|
+
interface ExploreOptions {
|
|
190
|
+
readonly seed: number | string;
|
|
191
|
+
/** Hard cap on runs, in addition to the scenario's time budget. */
|
|
192
|
+
readonly maxRuns?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Replaces the scenario's `budgetMs` for this exploration: the real time
|
|
195
|
+
* exploring and shrinking may take, and the real time one effect's I/O
|
|
196
|
+
* may take before it counts as hung. With a generous budget and
|
|
197
|
+
* `maxRuns`, the run cap ends exploration, so a seed decides the verdict
|
|
198
|
+
* on any machine.
|
|
199
|
+
*/
|
|
200
|
+
readonly budgetMs?: number;
|
|
201
|
+
/**
|
|
202
|
+
* The share of seeded runs after the first (which injects none) that
|
|
203
|
+
* inject faults (see `planFaults`). Default 0.9: the runs without faults
|
|
204
|
+
* also check the scenario as it runs without them, and measure how many
|
|
205
|
+
* eligible points a run without faults has, which can vary with the seed.
|
|
206
|
+
*/
|
|
207
|
+
readonly faultProbability?: number;
|
|
208
|
+
/** Clock for the time budget; injectable for tests. */
|
|
209
|
+
readonly now?: () => number;
|
|
210
|
+
/** Hard cap on replay runs spent shrinking a violation. */
|
|
211
|
+
readonly maxShrinkRuns?: number;
|
|
212
|
+
/**
|
|
213
|
+
* How many of the first exploration runs to replay in reverse order
|
|
214
|
+
* before reporting BOUNDED, to detect module-level state leaking between
|
|
215
|
+
* runs. 0 disables the pass.
|
|
216
|
+
*/
|
|
217
|
+
readonly leakCheckRuns?: number;
|
|
218
|
+
/**
|
|
219
|
+
* Explore every schedule within the bounds, each once, instead of drawing
|
|
220
|
+
* schedules from the seed: every fault (or none) at every effect point
|
|
221
|
+
* that may still take one, and every order of turns. With `reduction`
|
|
222
|
+
* (the default), turns of different invocations on different targets
|
|
223
|
+
* commute and only one order of them is run.
|
|
224
|
+
*/
|
|
225
|
+
readonly exhaustive?: boolean | {
|
|
226
|
+
readonly reduction?: boolean;
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/** Re-run a recorded schedule exactly. */
|
|
230
|
+
declare function replay(spec: ScenarioSpec, platform: Platform, schedule: Schedule): Promise<EffectLog>;
|
|
231
|
+
declare function explore(scenario: ScenarioSpec, platform: Platform, options: ExploreOptions): Promise<ScenarioVerdict>;
|
|
232
|
+
export { describeVerdict as _, Binder as a, ModuleSpecs as c, SpecType as d, Bounded as f, Violated as g, Unsupported as h, Arrow as i, Property as l, ScenarioVerdict as m, explore as n, FunctionSpec as o, BoundsReached as p, replay as r, Hint as s, ExploreOptions as t, SpecError as u };
|
|
233
|
+
//# sourceMappingURL=explore-Rwe1PPqX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore-Rwe1PPqX.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../spec/src/ir.ts","../../engine/src/explore.ts"],"mappings":";UAOiB;WACN;WACA;WACA;WACA;;;;;;;WAOA;aACE;aACA;aACA;;;UAIH;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;UAGM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;UAGF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;UAMK,oBAAoB;WAC1B;WACA,OAAO;WACP;;KAGC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;;;;;;;;;;;KC1DvB;WACG;;WACA;;WACA;;WACA;;WACA;WAA0B;;WAC1B;;WACA;;WAEA;;WAEA;WACA,iBAAiB;;WAEjB;WAAwB,kBAAkB;;;;WAE1C;WAAwB,SAAS;;WACjC;WAA0B;;UAExB;WACN;WACA,MAAM;;;UAIA;WACN;WACA;;;;;;;UAQM;WACN;WACA,QAAQ;WACR,QAAQ;WACR;aAAmB;aAA0B;;;;UAIvC;;WAEN;WACA,MAAM;;;UAIA;WACN;WACA,MAAM;WACN,OAAO;;;UAID;;WAEN;;WAEA;WACA;;WAEA;;;;;;;UAQM;;WAEN;WACA;;WAEA,kBAAkB;;WAElB,SAAS;WACT,OAAO;WACP,UAAU;;;;;WAKV;aAA6B;aAAwB;;;WAErD;;WAEA;;;UAIM;WACN;WACA,iBAAiB;WACjB,qBAAqB;;WAErB;;WAEA;;;UAIM;WACN;WACA;WACA;;;UAIM;WACN,oBAAoB;WACpB,iBAAiB;;UClGX;WACN;;WAEA;;;;;;;;WAQA;;;;;;;WAOA;;WAEA;;WAEA;;;;;;WAMA;;;;;;;;WAQA;aAAkC;;;;iBAqKvB,OACpB,MAAM,cACN,UAAU,UACV,UAAU,WACT,QAAQ;iBAIW,QACpB,UAAU,cACV,UAAU,UACV,SAAS,iBACR,QAAQ"}
|