eutaxy 0.13.0 → 0.15.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 +10 -6
- package/dist/aws.d.mts +28 -2
- package/dist/aws.d.mts.map +1 -1
- package/dist/aws.mjs +13 -2
- package/dist/aws.mjs.map +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/{cli-D3SPblWw.mjs → cli-CzGCMudc.mjs} +1269 -117
- package/dist/cli-CzGCMudc.mjs.map +1 -0
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/cloudflare.d.mts +180 -15
- package/dist/cloudflare.d.mts.map +1 -1
- package/dist/cloudflare.mjs +3 -3
- package/dist/{combinators-Bsd9HKtw.d.mts → combinators-BecOKcmi.d.mts} +7 -1
- package/dist/combinators-BecOKcmi.d.mts.map +1 -0
- package/dist/{combinators-CVjxodAJ.mjs → combinators-CLfsPfhT.mjs} +6 -1
- package/dist/combinators-CLfsPfhT.mjs.map +1 -0
- package/dist/{delivery-invariants-Br29H7Rg.mjs → delivery-invariants-BCtvzAfW.mjs} +7 -2
- package/dist/delivery-invariants-BCtvzAfW.mjs.map +1 -0
- package/dist/delivery-invariants-DzMy3iPs.d.mts +10 -0
- package/dist/delivery-invariants-DzMy3iPs.d.mts.map +1 -0
- package/dist/{explore-B7aR_5Hy.d.mts → explore-B52m-wmk.d.mts} +13 -2
- package/dist/explore-B52m-wmk.d.mts.map +1 -0
- package/dist/index.d.mts +25 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{platform-CCz48WF9.d.mts → platform-Ba1Kvdza.d.mts} +18 -1
- package/dist/platform-Ba1Kvdza.d.mts.map +1 -0
- package/dist/provers-DS44OeEm.mjs.map +1 -1
- package/dist/spec.d.mts +1 -1
- package/dist/spec.mjs +1 -1
- package/dist/{src-5pKRvj02.mjs → src-nwQA9Xwr.mjs} +9 -3
- package/dist/src-nwQA9Xwr.mjs.map +1 -0
- package/dist/{src-DGh7w877.mjs → src-ud5wEfnx.mjs} +111 -16
- package/dist/src-ud5wEfnx.mjs.map +1 -0
- package/dist/{workerd-BMJ-GKx8.mjs → workerd-Be43_PZo.mjs} +2050 -1503
- package/dist/workerd-Be43_PZo.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/cli-D3SPblWw.mjs.map +0 -1
- package/dist/combinators-Bsd9HKtw.d.mts.map +0 -1
- package/dist/combinators-CVjxodAJ.mjs.map +0 -1
- package/dist/delivery-invariants-Br29H7Rg.mjs.map +0 -1
- package/dist/delivery-invariants-DZOBkCMR.d.mts +0 -5
- package/dist/delivery-invariants-DZOBkCMR.d.mts.map +0 -1
- package/dist/explore-B7aR_5Hy.d.mts.map +0 -1
- package/dist/platform-CCz48WF9.d.mts.map +0 -1
- package/dist/src-5pKRvj02.mjs.map +0 -1
- package/dist/src-DGh7w877.mjs.map +0 -1
- package/dist/workerd-BMJ-GKx8.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as EffectSelector, D as FaultKind, E as FaultDecision, O as Schedule, S as Refines, T as EffectRecord, _ as Implies, b as StateQuery, d as AtMostOncePerKey, f as Invariant, g as EveryRow, h as checkInvariants, l as validateScenario, m as checkInvariant, n as Platform, o as ScenarioSpec, p as Violation, r as Bounds, t as EventRef, u as AtLeastOnce, w as EffectLog, x as Unique, y as RowCondition } from "./platform-
|
|
2
|
-
import { _ as describeVerdict, a as Binder, c as ModuleSpecs, d as SpecType, f as Bounded, g as Violated, h as Unsupported, i as Arrow, l as Property, m as ScenarioVerdict, n as explore, o as FunctionSpec, p as BoundsReached, r as replay, s as Hint, t as ExploreOptions, u as SpecError } from "./explore-
|
|
3
|
-
import { n as Forall, t as Fn } from "./combinators-
|
|
1
|
+
import { C as EffectSelector, D as FaultKind, E as FaultDecision, O as Schedule, S as Refines, T as EffectRecord, _ as Implies, b as StateQuery, d as AtMostOncePerKey, f as Invariant, g as EveryRow, h as checkInvariants, l as validateScenario, m as checkInvariant, n as Platform, o as ScenarioSpec, p as Violation, r as Bounds, t as EventRef, u as AtLeastOnce, w as EffectLog, x as Unique, y as RowCondition } from "./platform-Ba1Kvdza.mjs";
|
|
2
|
+
import { _ as describeVerdict, a as Binder, c as ModuleSpecs, d as SpecType, f as Bounded, g as Violated, h as Unsupported, i as Arrow, l as Property, m as ScenarioVerdict, n as explore, o as FunctionSpec, p as BoundsReached, r as replay, s as Hint, t as ExploreOptions, u as SpecError } from "./explore-B52m-wmk.mjs";
|
|
3
|
+
import { n as Forall, t as Fn } from "./combinators-BecOKcmi.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Spec verdicts: what is known about one property of one pure function.
|
|
6
6
|
* Kept apart from scenario verdicts in every report. The ladder runs
|
|
@@ -18,6 +18,7 @@ interface SpecVerdictBase {
|
|
|
18
18
|
readonly text: string;
|
|
19
19
|
readonly assumptions: readonly string[];
|
|
20
20
|
}
|
|
21
|
+
/** The property held on every distinct input the simulator passed the function during the scenario's runs. */
|
|
21
22
|
interface Checked extends SpecVerdictBase {
|
|
22
23
|
readonly kind: "CHECKED";
|
|
23
24
|
/** Distinct inputs the property was evaluated on. */
|
|
@@ -49,6 +50,7 @@ interface Counterexample {
|
|
|
49
50
|
/** Set when evaluating the property threw instead of returning false. */
|
|
50
51
|
readonly error?: string;
|
|
51
52
|
}
|
|
53
|
+
/** A counterexample breaks the property, found by the simulator's inputs, generated ones, or an engine. */
|
|
52
54
|
interface Refuted extends SpecVerdictBase {
|
|
53
55
|
readonly kind: "REFUTED";
|
|
54
56
|
/** The rung that found the counterexample: a rung of the simulator, or an engine by name. */
|
|
@@ -86,11 +88,13 @@ interface Conflict extends SpecVerdictBase {
|
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
type SpecUnknownCause = "gave_up" | "unsupported" | "unavailable";
|
|
91
|
+
/** Nothing is known about the property: the engine gave up, the construct is not supported, or no engine was available. */
|
|
89
92
|
interface SpecUnknown extends SpecVerdictBase {
|
|
90
93
|
readonly kind: "UNKNOWN";
|
|
91
94
|
readonly cause: SpecUnknownCause;
|
|
92
95
|
readonly reason: string;
|
|
93
96
|
}
|
|
97
|
+
/** What is known about one property of one pure function, from the highest rung that reached it. */
|
|
94
98
|
type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;
|
|
95
99
|
/** One line per spec verdict, for error messages; full rendering lives in `report`. */
|
|
96
100
|
export declare function describeSpecVerdict(v: SpecVerdict): string;
|
|
@@ -107,7 +111,9 @@ interface CheckedInput {
|
|
|
107
111
|
/** Why the function's calls could not be observed, when they could not. */
|
|
108
112
|
readonly unobservable?: string;
|
|
109
113
|
}
|
|
114
|
+
/** The `CHECKED` rung: evaluate the property on every distinct input the simulator passed the function. */
|
|
110
115
|
export declare function checkedRung(input: CheckedInput): SpecVerdict;
|
|
116
|
+
/** The `TESTED` rung's seed, and how many distinct generated inputs a property must hold on (default 100). */
|
|
111
117
|
interface TestedOptions {
|
|
112
118
|
/** The check's seed; each property derives its own stream from it and its name. */
|
|
113
119
|
readonly seed: string;
|
|
@@ -121,7 +127,9 @@ interface TestedInput extends TestedOptions {
|
|
|
121
127
|
/** The spec file's export, or undefined when it could not be loaded. */
|
|
122
128
|
readonly spec: Forall<Fn> | undefined;
|
|
123
129
|
}
|
|
130
|
+
/** The `TESTED` rung: evaluate the property on inputs generated from its binders' domains, drawn from the seed. */
|
|
124
131
|
export declare function testedRung(input: TestedInput): SpecVerdict;
|
|
132
|
+
/** How far `specLadder` climbs: the `TESTED` rung's options (or none), and whether a scenario ran for `CHECKED`. */
|
|
125
133
|
interface LadderOptions {
|
|
126
134
|
/** Run the `TESTED` rung with these options; `false` stops the ladder at `CHECKED`. */
|
|
127
135
|
readonly tested?: TestedOptions | false;
|
|
@@ -130,10 +138,12 @@ interface LadderOptions {
|
|
|
130
138
|
}
|
|
131
139
|
/** One property through the ladder's rungs. */
|
|
132
140
|
export declare function specLadder(input: CheckedInput, options?: LadderOptions): SpecVerdict;
|
|
141
|
+
/** A proof engine's name and version, as verdicts record it. */
|
|
133
142
|
interface EngineId {
|
|
134
143
|
readonly name: string;
|
|
135
144
|
readonly version: string;
|
|
136
145
|
}
|
|
146
|
+
/** What an engine said about one property: proven, refuted (with a counterexample when it has one), or unknown and why. */
|
|
137
147
|
type ProofOutcome = {
|
|
138
148
|
readonly kind: "PROVEN";
|
|
139
149
|
readonly engine: EngineId;
|
|
@@ -148,6 +158,7 @@ type ProofOutcome = {
|
|
|
148
158
|
readonly cause: "gave_up" | "unsupported" | "unavailable";
|
|
149
159
|
readonly reason: string;
|
|
150
160
|
};
|
|
161
|
+
/** An engine's outcome for one property of one function. */
|
|
151
162
|
interface PropertyProof {
|
|
152
163
|
readonly function: string;
|
|
153
164
|
/** The property's export name in the spec file. */
|
|
@@ -163,6 +174,7 @@ interface OpenGoal {
|
|
|
163
174
|
/** Why the engine gave up: its own words, first line. */
|
|
164
175
|
readonly reason: string;
|
|
165
176
|
}
|
|
177
|
+
/** An engine's answer for one module: an outcome per property, the specs that did not read, and the open goals. */
|
|
166
178
|
interface ModuleProofs {
|
|
167
179
|
readonly results: readonly PropertyProof[];
|
|
168
180
|
/** Specs that did not read: properties asked for and never checked. */
|
|
@@ -173,6 +185,7 @@ interface ModuleProofs {
|
|
|
173
185
|
*/
|
|
174
186
|
readonly goals?: readonly OpenGoal[];
|
|
175
187
|
}
|
|
188
|
+
/** What an engine is given: the module's source and specs, the functions to prove, and where they live. */
|
|
176
189
|
interface ProveInput {
|
|
177
190
|
/** The module's source text. */
|
|
178
191
|
readonly source: string;
|
|
@@ -186,6 +199,7 @@ interface ProveInput {
|
|
|
186
199
|
readonly specPath?: string;
|
|
187
200
|
readonly timeoutMs?: number;
|
|
188
201
|
}
|
|
202
|
+
/** A proof engine: whether it can run here, and proving a module's properties. */
|
|
189
203
|
interface Prover {
|
|
190
204
|
readonly name: string;
|
|
191
205
|
/** Whether the engine can run here, or why not. */
|
|
@@ -224,12 +238,14 @@ export declare function aggregate(module: string, verdicts: readonly SpecVerdict
|
|
|
224
238
|
* configurable properties (Vite, so Vitest and the Cloudflare plugin); a
|
|
225
239
|
* native ESM namespace is frozen, and the function is reported unobservable.
|
|
226
240
|
*/
|
|
241
|
+
/** One call of an observed core function from outside its module: the function, its arguments, whether it threw. */
|
|
227
242
|
interface ObservedCall {
|
|
228
243
|
readonly function: string;
|
|
229
244
|
/** The arguments as passed; primitives exactly, objects by reference. */
|
|
230
245
|
readonly args: readonly unknown[];
|
|
231
246
|
readonly threw: boolean;
|
|
232
247
|
}
|
|
248
|
+
/** The calls an `observeCore` has recorded, the functions it could not observe, and how to undo it. */
|
|
233
249
|
interface CoreObserver {
|
|
234
250
|
readonly calls: readonly ObservedCall[];
|
|
235
251
|
/** Functions that could not be observed, with why. */
|
|
@@ -239,9 +255,11 @@ interface CoreObserver {
|
|
|
239
255
|
/** Put the original exports back. Safe to call twice. */
|
|
240
256
|
restore(): void;
|
|
241
257
|
}
|
|
258
|
+
/** Observe the named exports of a module's namespace while runs are installed; see the module comment. */
|
|
242
259
|
export declare function observeCore(namespace: object, functions: readonly string[]): CoreObserver;
|
|
243
260
|
/** The scenario restricted to the kept events, with per-message invariants re-derived. */
|
|
244
261
|
export declare function restrictSpec(platform: Platform, spec: ScenarioSpec, keepIds: readonly string[]): ScenarioSpec;
|
|
262
|
+
/** What the emitted test imports, the expressions for its platform and scenario, and what it expects. */
|
|
245
263
|
interface RegressionTestOptions {
|
|
246
264
|
/** Import lines for the scenario, the platform's dependencies, and anything the platform expression needs. */
|
|
247
265
|
readonly imports: readonly string[];
|
|
@@ -262,6 +280,10 @@ interface RegressionTestOptions {
|
|
|
262
280
|
readonly functions: readonly string[];
|
|
263
281
|
}[];
|
|
264
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* A Vitest test file that replays a violation's shrunk schedule: by default it fails while the bug is
|
|
285
|
+
* there and passes once it is fixed.
|
|
286
|
+
*/
|
|
265
287
|
export declare function emitRegressionTest(verdict: Violated, options: RegressionTestOptions): string;
|
|
266
288
|
/**
|
|
267
289
|
* The JSON report: one object, canonical, with a schema version at the top.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../core/src/spec-verdict.ts","../../prover/src/checked.ts","../../prover/src/tested.ts","../../prover/src/ladder.ts","../../prover/src/provers.ts","../../engine/src/observe.ts","../../engine/src/shrink.ts","../../report/src/regression.ts","../../report/src/render.ts"],"mappings":";;;;;;;;;;UAQU;;WAEC;WACA;;WAEA;;WAEA;WACA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../core/src/spec-verdict.ts","../../prover/src/checked.ts","../../prover/src/tested.ts","../../prover/src/ladder.ts","../../prover/src/provers.ts","../../engine/src/observe.ts","../../engine/src/shrink.ts","../../report/src/regression.ts","../../report/src/render.ts"],"mappings":";;;;;;;;;;UAQU;;WAEC;WACA;;WAEA;;WAEA;WACA;;;UAIM,gBAAgB;WACtB;;WAEA;;WAEA;;;UAIM,eAAe;WACrB;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;;WAEN;aAA6B;aAAuB;;;WAEpD;;WAEA;;;UAIM,gBAAgB;WACtB;;WAEA;;WAEA;aAAoB;aAAuB;;WAC3C,gBAAgB;;;UAIV,eAAe;WACrB;WACA;aAAmB;aAAuB;;;WAE1C;;WAEA;;;UAIM,iBAAiB;WACvB;WACA;aAAmB;aAAuB;;WAC1C;aACE;aACA;aACA,iBAAiB;;;KAIlB;;UAGK,oBAAoB;WAC1B;WACA,OAAO;WACP;;;KAIC,cAAc,UAAU,SAAS,SAAS,UAAU,WAAW;;wBAG3D,oBAAoB,GAAG;UC7BtB;WACN;WACA,IAAI;WACJ,UAAU;;WAEV;aAA2B;;;WAE3B,MAAM,OAAO;;WAEb;;;wBAIK,YAAY,OAAO,eAAe;;UCvDjC;;WAEN;;WAEA;;UAGM,oBAAoB;WAC1B;WACA,IAAI;WACJ,UAAU;;WAEV,MAAM,OAAO;;;wBAIR,WAAW,OAAO,cAAc;;UC3B/B;;WAEN,SAAS;;WAET;;;wBAIK,WAAW,OAAO,cAAc,UAAS,gBAAqB;;UCL7D;WACN;WACA;;;KAIC;WACG;WAAyB,QAAQ;WAAmB;;WAEpD;WACA,QAAQ;WACR,iBAAiB;WACjB;;WAGA;WACA;WACA;;;UAIE;WACN;;WAEA;WACA,SAAS;;;UAIH;WACN;WACA;;WAEA;;WAEA;;;UAIM;WACN,kBAAkB;;WAElB,qBAAqB;;;;;WAKrB,iBAAiB;;;UAIX;;WAEN;;WAEA,OAAO;;WAEP;;WAEA;;WAEA;WACA;;;UAIM;WACN;;EAET,aAAa;aAAmB;;aAA+B;;EAC/D,MAAM,OAAO,aAAa,QAAQ;;;UAInB;WACN;WACA,QAAQ;;;;;;;;;;;wBAYH,UACd,gBACA,mBAAmB,eACnB,kBAAkB,iBACjB;;;;;;;;;;;;;;;UCzFc;WACN;;WAEA;WACA;;;UAIM;WACN,gBAAgB;;WAEhB;cAA0B;;;EAEnC;;;wBAIc,YAAY,mBAAmB,+BAA+B;;wBCE9D,aACd,UAAU,UACV,MAAM,cACN,6BACC;;UC5Bc;;WAEN;;WAEA;;WAEA;;WAEA;WACA;;;;;;WAMA;aACE;aACA;;;;;;;wBAQG,mBAAmB,SAAS,UAAU,SAAS;;;;;wBCpB/C,WAAW,SAAS,iBAAiB,iBAAgB;;wBAarD,YAAY,gBAAgB;;wBA6G5B,YAAY,KAAK,WAAW;;wBAuB5B,WAAW,SAAS"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { a as renderText, f as checkedRung, i as renderSpecs, l as specLadder, o as renderTrace, s as emitRegressionTest, t as renderJson, u as testedRung, y as describeVerdict } from "./src-
|
|
1
|
+
import { D as checkInvariant, E as validateScenario, O as checkInvariants, a as explore, o as replay, s as restrictSpec, t as observeCore } from "./src-ud5wEfnx.mjs";
|
|
2
|
+
import { a as renderText, f as checkedRung, i as renderSpecs, l as specLadder, o as renderTrace, s as emitRegressionTest, t as renderJson, u as testedRung, y as describeVerdict } from "./src-nwQA9Xwr.mjs";
|
|
3
3
|
import { t as aggregate } from "./provers-DS44OeEm.mjs";
|
|
4
4
|
// packages/core/src/spec-verdict.ts
|
|
5
5
|
/** One line per spec verdict, for error messages; full rendering lives in `report`. */
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/spec-verdict.ts"],"sourcesContent":["/**\n * Spec verdicts: what is known about one property of one pure function.\n * Kept apart from scenario verdicts in every report. The ladder runs\n * `CHECKED` (held on every input the simulator passed), then `TESTED` (held\n * on inputs generated from the binders' domains), then `PROVEN` (an engine\n * proved it for every input); `CONFLICT` when engines disagree.\n */\n\ninterface SpecVerdictBase {\n /** The module, as the scenario names it. */\n readonly module: string;\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n /** The property as written. */\n readonly text: string;\n readonly assumptions: readonly string[];\n}\n\nexport interface Checked extends SpecVerdictBase {\n readonly kind: \"CHECKED\";\n /** Distinct inputs the property was evaluated on. */\n readonly inputs: number;\n /** Distinct inputs outside the claim: a precondition failed, or a value fell outside its binder's domain. */\n readonly discarded: number;\n}\n\n/** The property held on inputs generated from its binders' domains, and on the simulator's where it passed any. */\nexport interface Tested extends SpecVerdictBase {\n readonly kind: \"TESTED\";\n /** Generated assignments the property held on. */\n readonly inputs: number;\n /** Generated assignments outside the claim: a precondition failed. */\n readonly discarded: number;\n /** The seed the assignments were drawn from; the same seed draws the same assignments. */\n readonly seed: string;\n /** Distinct inputs the simulator passed that the property also held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** One assignment that breaks the property, as JavaScript literals, and where it came from. */\nexport interface Counterexample {\n /** In the property's binder order. */\n readonly binders: readonly { readonly name: string; readonly value: string }[];\n /** The simulator's call the assignment was taken from; absent when it was generated. */\n readonly call?: string;\n /** Set when evaluating the property threw instead of returning false. */\n readonly error?: string;\n}\n\nexport interface Refuted extends SpecVerdictBase {\n readonly kind: \"REFUTED\";\n /** The rung that found the counterexample: a rung of the simulator, or an engine by name. */\n readonly rung: \"CHECKED\" | \"TESTED\" | \"PROVEN\";\n /** The engine, when the rung is PROVEN. */\n readonly engine?: { readonly name: string; readonly version: string };\n readonly counterexample: Counterexample;\n}\n\n/** Proved for every input by a named engine; the lower rungs' evidence is kept beside it. */\nexport interface Proven extends SpecVerdictBase {\n readonly kind: \"PROVEN\";\n readonly engine: { readonly name: string; readonly version: string };\n /** Generated inputs the TESTED rung held on, when it ran. */\n readonly tested?: number;\n /** Distinct inputs the simulator passed that the CHECKED rung held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** Two engines disagree: one proves, one refutes. Never resolved automatically. */\nexport interface Conflict extends SpecVerdictBase {\n readonly kind: \"CONFLICT\";\n readonly proven: { readonly name: string; readonly version: string };\n readonly refuted: {\n readonly name: string;\n readonly version: string;\n readonly counterexample?: Counterexample;\n };\n}\n\nexport type SpecUnknownCause = \"gave_up\" | \"unsupported\" | \"unavailable\";\n\nexport interface SpecUnknown extends SpecVerdictBase {\n readonly kind: \"UNKNOWN\";\n readonly cause: SpecUnknownCause;\n readonly reason: string;\n}\n\nexport type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;\n\n/** One line per spec verdict, for error messages; full rendering lives in `report`. */\nexport function describeSpecVerdict(v: SpecVerdict): string {\n const what = `${v.function} ${v.property}`;\n switch (v.kind) {\n case \"CHECKED\":\n return `CHECKED ${what}: held on ${v.inputs} input(s) the simulator passed`;\n case \"TESTED\":\n return `TESTED ${what}: held on ${v.inputs} generated input(s)`;\n case \"PROVEN\":\n return `PROVEN ${what}: by ${v.engine.name} ${v.engine.version}`;\n case \"CONFLICT\":\n return `CONFLICT ${what}: ${v.proven.name} proves it, ${v.refuted.name} refutes it`;\n case \"REFUTED\": {\n const c = v.counterexample;\n const where = c.call ?? c.binders.map((b) => `${b.name} = ${b.value}`).join(\", \");\n return `REFUTED ${what}: ${where}${c.error ? ` threw ${c.error}` : \"\"}`;\n }\n case \"UNKNOWN\":\n return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;\n }\n}\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/spec-verdict.ts"],"sourcesContent":["/**\n * Spec verdicts: what is known about one property of one pure function.\n * Kept apart from scenario verdicts in every report. The ladder runs\n * `CHECKED` (held on every input the simulator passed), then `TESTED` (held\n * on inputs generated from the binders' domains), then `PROVEN` (an engine\n * proved it for every input); `CONFLICT` when engines disagree.\n */\n\ninterface SpecVerdictBase {\n /** The module, as the scenario names it. */\n readonly module: string;\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n /** The property as written. */\n readonly text: string;\n readonly assumptions: readonly string[];\n}\n\n/** The property held on every distinct input the simulator passed the function during the scenario's runs. */\nexport interface Checked extends SpecVerdictBase {\n readonly kind: \"CHECKED\";\n /** Distinct inputs the property was evaluated on. */\n readonly inputs: number;\n /** Distinct inputs outside the claim: a precondition failed, or a value fell outside its binder's domain. */\n readonly discarded: number;\n}\n\n/** The property held on inputs generated from its binders' domains, and on the simulator's where it passed any. */\nexport interface Tested extends SpecVerdictBase {\n readonly kind: \"TESTED\";\n /** Generated assignments the property held on. */\n readonly inputs: number;\n /** Generated assignments outside the claim: a precondition failed. */\n readonly discarded: number;\n /** The seed the assignments were drawn from; the same seed draws the same assignments. */\n readonly seed: string;\n /** Distinct inputs the simulator passed that the property also held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** One assignment that breaks the property, as JavaScript literals, and where it came from. */\nexport interface Counterexample {\n /** In the property's binder order. */\n readonly binders: readonly { readonly name: string; readonly value: string }[];\n /** The simulator's call the assignment was taken from; absent when it was generated. */\n readonly call?: string;\n /** Set when evaluating the property threw instead of returning false. */\n readonly error?: string;\n}\n\n/** A counterexample breaks the property, found by the simulator's inputs, generated ones, or an engine. */\nexport interface Refuted extends SpecVerdictBase {\n readonly kind: \"REFUTED\";\n /** The rung that found the counterexample: a rung of the simulator, or an engine by name. */\n readonly rung: \"CHECKED\" | \"TESTED\" | \"PROVEN\";\n /** The engine, when the rung is PROVEN. */\n readonly engine?: { readonly name: string; readonly version: string };\n readonly counterexample: Counterexample;\n}\n\n/** Proved for every input by a named engine; the lower rungs' evidence is kept beside it. */\nexport interface Proven extends SpecVerdictBase {\n readonly kind: \"PROVEN\";\n readonly engine: { readonly name: string; readonly version: string };\n /** Generated inputs the TESTED rung held on, when it ran. */\n readonly tested?: number;\n /** Distinct inputs the simulator passed that the CHECKED rung held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** Two engines disagree: one proves, one refutes. Never resolved automatically. */\nexport interface Conflict extends SpecVerdictBase {\n readonly kind: \"CONFLICT\";\n readonly proven: { readonly name: string; readonly version: string };\n readonly refuted: {\n readonly name: string;\n readonly version: string;\n readonly counterexample?: Counterexample;\n };\n}\n\nexport type SpecUnknownCause = \"gave_up\" | \"unsupported\" | \"unavailable\";\n\n/** Nothing is known about the property: the engine gave up, the construct is not supported, or no engine was available. */\nexport interface SpecUnknown extends SpecVerdictBase {\n readonly kind: \"UNKNOWN\";\n readonly cause: SpecUnknownCause;\n readonly reason: string;\n}\n\n/** What is known about one property of one pure function, from the highest rung that reached it. */\nexport type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;\n\n/** One line per spec verdict, for error messages; full rendering lives in `report`. */\nexport function describeSpecVerdict(v: SpecVerdict): string {\n const what = `${v.function} ${v.property}`;\n switch (v.kind) {\n case \"CHECKED\":\n return `CHECKED ${what}: held on ${v.inputs} input(s) the simulator passed`;\n case \"TESTED\":\n return `TESTED ${what}: held on ${v.inputs} generated input(s)`;\n case \"PROVEN\":\n return `PROVEN ${what}: by ${v.engine.name} ${v.engine.version}`;\n case \"CONFLICT\":\n return `CONFLICT ${what}: ${v.proven.name} proves it, ${v.refuted.name} refutes it`;\n case \"REFUTED\": {\n const c = v.counterexample;\n const where = c.call ?? c.binders.map((b) => `${b.name} = ${b.value}`).join(\", \");\n return `REFUTED ${what}: ${where}${c.error ? ` threw ${c.error}` : \"\"}`;\n }\n case \"UNKNOWN\":\n return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;\n }\n}\n"],"mappings":";;;;;AA+FA,SAAgB,oBAAoB,GAAwB;CAC1D,MAAM,OAAO,GAAG,EAAE,SAAS,GAAG,EAAE;CAChC,QAAQ,EAAE,MAAV;EACE,KAAK,WACH,OAAO,WAAW,KAAK,YAAY,EAAE,OAAO;EAC9C,KAAK,UACH,OAAO,UAAU,KAAK,YAAY,EAAE,OAAO;EAC7C,KAAK,UACH,OAAO,UAAU,KAAK,OAAO,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO;EACzD,KAAK,YACH,OAAO,YAAY,KAAK,IAAI,EAAE,OAAO,KAAK,cAAc,EAAE,QAAQ,KAAK;EACzE,KAAK,WAAW;GACd,MAAM,IAAI,EAAE;GAEZ,OAAO,WAAW,KAAK,IADT,EAAE,QAAQ,EAAE,QAAQ,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,IAC7C,EAAE,QAAQ,UAAU,EAAE,UAAU;EACrE;EACA,KAAK,WACH,OAAO,WAAW,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE;CAC7C;AACF"}
|
|
@@ -12,6 +12,7 @@ type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
|
12
12
|
* offer it at the point where that work would start.
|
|
13
13
|
*/
|
|
14
14
|
type FaultKind = "crash_before" | "crash_after" | "ambiguous" | "error" | "cut_off";
|
|
15
|
+
/** One injected fault: which effect of which invocation it hit, and what kind of fault it was. */
|
|
15
16
|
interface FaultDecision {
|
|
16
17
|
/** The invocation the effect belongs to, e.g. "msg-1#2". */
|
|
17
18
|
readonly invocation: string;
|
|
@@ -22,6 +23,7 @@ interface FaultDecision {
|
|
|
22
23
|
readonly target: string;
|
|
23
24
|
readonly op: string;
|
|
24
25
|
}
|
|
26
|
+
/** What decided one run: the seed it drew from, the faults injected, and the turns picked when they were picked. */
|
|
25
27
|
interface Schedule {
|
|
26
28
|
/** The per-run seed the decisions were drawn from. */
|
|
27
29
|
readonly seed: number;
|
|
@@ -36,6 +38,7 @@ interface Schedule {
|
|
|
36
38
|
}
|
|
37
39
|
/** `snapshot` records platform state (e.g. D1 tables) captured at the end of a run; it is not an effect point. */
|
|
38
40
|
type EffectKind = "call" | "result" | "fault" | "snapshot";
|
|
41
|
+
/** One entry of the effect log: an effect's call, its result, an injected fault, or an end-of-run snapshot. */
|
|
39
42
|
interface EffectRecord {
|
|
40
43
|
/** Position in the log, dense from 0. */
|
|
41
44
|
readonly seq: number;
|
|
@@ -49,6 +52,7 @@ interface EffectRecord {
|
|
|
49
52
|
/** Operation-specific data: arguments, results, or the injected fault. */
|
|
50
53
|
readonly payload: JsonValue;
|
|
51
54
|
}
|
|
55
|
+
/** The ordered record of what a run did at its effect boundaries, which invariants are checked against. */
|
|
52
56
|
interface EffectLog {
|
|
53
57
|
readonly entries: readonly EffectRecord[];
|
|
54
58
|
}
|
|
@@ -185,7 +189,9 @@ interface AtLeastOnce {
|
|
|
185
189
|
readonly bodyKey: string;
|
|
186
190
|
};
|
|
187
191
|
}
|
|
192
|
+
/** Anything a scenario says must hold after every run, over the effect log or the end-of-run state. */
|
|
188
193
|
type Invariant = AtMostOncePerKey | AtLeastOnce | EveryRow | Implies | Unique | References | Refines;
|
|
194
|
+
/** An invariant that did not hold: its name, what went wrong, the keys involved and the effects that show it. */
|
|
189
195
|
interface Violation {
|
|
190
196
|
readonly invariant: string;
|
|
191
197
|
readonly message: string;
|
|
@@ -194,7 +200,9 @@ interface Violation {
|
|
|
194
200
|
/** Sequence numbers of the effects that witness the violation. */
|
|
195
201
|
readonly evidence: readonly number[];
|
|
196
202
|
}
|
|
203
|
+
/** Check one invariant against a run's effect log; null when it holds. */
|
|
197
204
|
declare function checkInvariant(log: EffectLog, inv: Invariant): Violation | null;
|
|
205
|
+
/** Check every invariant against a run's effect log and return the violations, in the invariants' order. */
|
|
198
206
|
declare function checkInvariants(log: EffectLog, invariants: readonly Invariant[]): readonly Violation[];
|
|
199
207
|
/** Opaque, JSON-shaped data owned by a platform package. `kind` names its shape. */
|
|
200
208
|
interface PlatformData {
|
|
@@ -246,6 +254,10 @@ interface Bounds {
|
|
|
246
254
|
readonly maxConcurrentInvocations: number;
|
|
247
255
|
readonly budgetMs: number;
|
|
248
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* A scenario as plain data: the Worker, the drive, the setup, the externals, the invariants and the
|
|
259
|
+
* bounds, which `defineScenario` (or a platform's equivalent) builds and validates.
|
|
260
|
+
*/
|
|
249
261
|
interface ScenarioSpec {
|
|
250
262
|
readonly version: 1;
|
|
251
263
|
readonly name: string;
|
|
@@ -380,6 +392,11 @@ interface DeliveryResult {
|
|
|
380
392
|
/** Events the platform's semantics require next, e.g. redeliveries. */
|
|
381
393
|
readonly followUps: readonly EventRef[];
|
|
382
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* What a platform package gives the engine to run a scenario: its events, how each is delivered to the
|
|
397
|
+
* Worker or function, how state is reset before a run and snapshotted after it, and the assumptions a
|
|
398
|
+
* verdict rests on.
|
|
399
|
+
*/
|
|
383
400
|
interface Platform {
|
|
384
401
|
readonly name: string;
|
|
385
402
|
/** What a verdict rests on that this platform decides, one line each. */
|
|
@@ -405,4 +422,4 @@ interface Platform {
|
|
|
405
422
|
cleanup?(spec: ScenarioSpec): Promise<void>;
|
|
406
423
|
}
|
|
407
424
|
export { EffectSelector as C, FaultKind as D, FaultDecision as E, Schedule as O, Refines as S, EffectRecord as T, Implies as _, PlatformData as a, StateQuery as b, WorkerRef as c, AtMostOncePerKey as d, Invariant as f, EveryRow as g, checkInvariants as h, ExternalDecl as i, JsonValue as k, validateScenario as l, checkInvariant as m, Platform as n, ScenarioSpec as o, Violation as p, Bounds as r, ScriptedResponse as s, EventRef as t, AtLeastOnce as u, References as v, EffectLog as w, Unique as x, RowCondition as y };
|
|
408
|
-
//# sourceMappingURL=platform-
|
|
425
|
+
//# sourceMappingURL=platform-Ba1Kvdza.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-Ba1Kvdza.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/faults.ts","../../core/src/effect-log.ts","../../core/src/selectors.ts","../../core/src/refines.ts","../../core/src/state.ts","../../core/src/invariants.ts","../../core/src/scenario.ts","../../core/src/platform.ts"],"mappings":";;;;;KAMY,wDAKC;YACG,cAAc;;;;;;;KCAlB;;UAoBK;;WAEN;;WAEA;WACA,OAAO;;WAEP;WACA;;;UAIM;;WAEN;WACA,iBAAiB;;;;;;;WAOjB;;;KC3CC;;UAGK;;WAEN;WACA,MAAM;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;WACN,kBAAkB;;;UCxBZ;WACN;WACA;WACA,OAAO;;WAEP;cAAoB,eAAe;;;WAEnC;cAAsB;;;;;;;;;;;;;;UCYhB;WACN;WACA;;WAEA;WACA,QAAQ;WACR;aAA8B;aAAyB;;WACvD;aACE,MAAM;aACN,OAAO;;aAEP;;;;KC5BD;WACG;WAAyB;WAA2B,OAAO;;WAC3D;WAAyB;WAA0C;;WACnE;WAAyB;WAAmB,gBAAgB;;WAC5D;WAAyB;;;UAGvB;;WAEN;WACA;WACA,iBAAiB;;;UAIX;WACN;WACA;WACA,OAAO;WACP,gBAAgB;;;;;;;UAQV;WACN;WACA;WACA,MAAM;;WAEN;WACA,OAAO;WACP;;;;;;;;UASM;WACN;WACA;WACA,OAAO;WACP;;;;;;;;UASM;WACN;WACA;WACA,OAAO;WACP;WACA,IAAI;WACJ;;;UChDM;WACN;WACA;WACA,QAAQ;;WAER;;;UAIM;WACN;WACA;WACA,QAAQ;WACR;WACA,mBAAmB;;WAEnB;aAAwB;;;;KAqBvB,YACR,mBACA,cACA,WACA,UACA,SACA,aACA;;UAGa;WACN;WACA;;WAEA;;WAEA;;;iBAaK,eAAe,KAAK,WAAW,KAAK,YAAY;;iBAkDhD,gBACd,KAAK,WACL,qBAAqB,uBACX;;UClIK;WACN;YACC,cAAc;;;UAIT;WACN;WACA;;;UAIM;;WAEN;;WAEA;WACA;WACA;cAAsB;;;WAEtB,OAAO;;;;;;;UAQD;WACN;;WAEA;WACA;;;;;;aAME;;;WAGF,qBAAqB;;;UAIf;WACN;WACA;WACA;WACA;;;;;;UAOM;WACN;WACA;;WAEA;WACA,QAAQ;;WAER,OAAO;;WAEP,gBAAgB;WAChB,oBAAoB;WACpB,qBAAqB;WACrB,QAAQ;;;;;;;;WAQR;;;iBAeK,iBAAiB,MAAM;;UC1FtB;WACN;;WAEA;WACA,MAAM;;;;;;;WAON;;;;;WAKA;;;UAIM;WACN;WACA;WACA;WACA,MAAM;;WAEN,kBAAkB;;;;;;WAMlB;;UAGM;;;;;;;;WAQN;;;;;;;WAOA;;;UAIM;WACN;;WAEA,SAAS;EAClB;;;UAIe;;;;;;EAMf,gBAAgB,YAAY;aAAqB;MAA0B;;;;;;;;EAQ3E;;EAEA,OAAO,GACL,OAAO,aACP,eAAe,QAAQ,IACvB,YAAY,OAAO,MAAM,WACzB,UAAU,gBACT,QAAQ;;EAEX,WAAW,GAAG,OAAO,aAAa,eAAe,GAAG,YAAY,OAAO,MAAM,YAAY;;EAEzF,YAAY;;;;;;EAMZ;;;;;;;EAOA,QAAQ,OAAO;;EAEf,SAAS,oBAAoB,gBAAgB,SAAS;;;;;;;EAOtD,OAAO,GAAG,SAAS,QAAQ,IAAI,qBAAqB,QAAQ;;UAG7C;WACN;;WAEA,oBAAoB;;;;;;;UAQd;WACN;;WAEA;;;;;;;WAOA;;EAET,MAAM,MAAM,eAAe;;EAE3B,cAAc,MAAM,wBAAwB;;EAE5C,QAAQ,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe,QAAQ;;EAEvE,eAAe,MAAM,cAAc,6BAA6B;;EAEhE,QAAQ,MAAM,cAAc,OAAO,WAAW;;EAE9C,SAAS,MAAM,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provers-DS44OeEm.mjs","names":[],"sources":["../../prover/src/provers.ts"],"sourcesContent":["/**\n * The `Prover` interface every engine implements, first-party or not, and\n * the aggregation of what engines say into the ladder's verdicts. An\n * engine takes a module's source with its specs and the functions to\n * prove and answers per property: `PROVEN` with its name, version and\n * assumptions, or `UNKNOWN` as `gave_up` (a proof did not close, or timed\n * out), `unsupported` (outside its subset) or `unavailable` (not\n * installed). An engine that refutes gives `REFUTED` with a counterexample\n * when it has one. Engines run over a process boundary; nothing here\n * spawns anything.\n */\n\nimport type { Counterexample, SpecVerdict } from \"@eutaxy/core\";\nimport type { ModuleSpecs, SpecError } from \"@eutaxy/spec\";\n\nexport interface EngineId {\n readonly name: string;\n readonly version: string;\n}\n\nexport type ProofOutcome =\n | { readonly kind: \"PROVEN\"; readonly engine: EngineId; readonly assumptions: readonly string[] }\n | {\n readonly kind: \"REFUTED\";\n readonly engine: EngineId;\n readonly counterexample?: Counterexample;\n readonly assumptions: readonly string[];\n }\n | {\n readonly kind: \"UNKNOWN\";\n readonly cause: \"gave_up\" | \"unsupported\" | \"unavailable\";\n readonly reason: string;\n };\n\nexport interface PropertyProof {\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n readonly outcome: ProofOutcome;\n}\n\n/** A property an engine gave up on, with the statement it tried to prove, for a proof to be supplied. */\nexport interface OpenGoal {\n readonly function: string;\n readonly property: string;\n /** The statement in the engine's language, as it emitted it. */\n readonly statement: string;\n /** Why the engine gave up: its own words, first line. */\n readonly reason: string;\n}\n\nexport interface ModuleProofs {\n readonly results: readonly PropertyProof[];\n /** Specs that did not read: properties asked for and never checked. */\n readonly specErrors: readonly SpecError[];\n /**\n * The properties given up on that a supplied proof could close, when the engine takes supplied proofs\n * and answered (empty when it closed every one; absent when it could not run or finish).\n */\n readonly goals?: readonly OpenGoal[];\n}\n\nexport interface ProveInput {\n /** The module's source text. */\n readonly source: string;\n /** The module's specs, read from its spec file. */\n readonly specs: ModuleSpecs;\n /** The functions to prove; every one with specs when omitted. */\n readonly functions?: readonly string[];\n /** The module's path, under which its imports resolve; without it the module stands alone. */\n readonly modulePath?: string;\n /** The spec file's path, for an engine that replays a counterexample through the spec itself. */\n readonly specPath?: string;\n readonly timeoutMs?: number;\n}\n\nexport interface Prover {\n readonly name: string;\n /** Whether the engine can run here, or why not. */\n available(): Promise<{ readonly version: string } | { readonly unavailable: string }>;\n prove(input: ProveInput): Promise<ModuleProofs>;\n}\n\n/** What an engine said about one module, by its name. */\nexport interface EngineReport {\n readonly engine: string;\n readonly proofs: ModuleProofs;\n}\n\n/**\n * The simulator's verdicts for a module (CHECKED, TESTED, REFUTED, UNKNOWN,\n * `total` included) combined with what the engines proved. A simulator\n * counterexample stands. One engine proving is `PROVEN`, the lower rungs'\n * counts kept beside it; an engine refuting where nothing else did is\n * `REFUTED` at the PROVEN rung; one proving and another refuting is\n * `CONFLICT`. An engine that gave up, could not run or does not take the\n * function leaves the verdict as it was, with why among the assumptions.\n */\nexport function aggregate(\n module: string,\n verdicts: readonly SpecVerdict[],\n reports: readonly EngineReport[],\n): SpecVerdict[] {\n return verdicts.map((v) => {\n if (v.module !== module) return v;\n const says = reports\n .map((r) => ({\n engine: r.engine,\n outcome: r.proofs.results.find(\n (p) => p.function === v.function && p.property === v.property,\n )?.outcome,\n }))\n .filter((x): x is { engine: string; outcome: ProofOutcome } => x.outcome !== undefined);\n if (says.length === 0) return v;\n const proven = says.find((x) => x.outcome.kind === \"PROVEN\");\n const refuted = says.find((x) => x.outcome.kind === \"REFUTED\");\n if (v.kind === \"REFUTED\" || v.kind === \"CONFLICT\") {\n // The simulator's counterexample is a fact; an engine proving against it is a conflict too.\n if (v.kind === \"REFUTED\" && proven?.outcome.kind === \"PROVEN\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"CONFLICT\",\n proven: proven.outcome.engine,\n refuted: { name: \"simulator\", version: v.rung, counterexample: v.counterexample },\n assumptions: [...v.assumptions, ...proven.outcome.assumptions],\n };\n return v;\n }\n if (proven?.outcome.kind === \"PROVEN\" && refuted?.outcome.kind === \"REFUTED\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"CONFLICT\",\n proven: proven.outcome.engine,\n refuted: {\n name: refuted.outcome.engine.name,\n version: refuted.outcome.engine.version,\n ...(refuted.outcome.counterexample\n ? { counterexample: refuted.outcome.counterexample }\n : {}),\n },\n assumptions: [...proven.outcome.assumptions, ...refuted.outcome.assumptions],\n };\n if (refuted?.outcome.kind === \"REFUTED\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"REFUTED\",\n rung: \"PROVEN\",\n engine: refuted.outcome.engine,\n counterexample: refuted.outcome.counterexample ?? { binders: [] },\n assumptions: refuted.outcome.assumptions,\n };\n if (proven?.outcome.kind === \"PROVEN\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"PROVEN\",\n engine: proven.outcome.engine,\n ...(v.kind === \"TESTED\" ? { tested: v.inputs } : {}),\n ...(v.kind === \"TESTED\" && v.checked !== undefined\n ? { checked: v.checked }\n : v.kind === \"CHECKED\"\n ? { checked: v.inputs }\n : {}),\n assumptions: [...proven.outcome.assumptions, ...v.assumptions],\n };\n // Every engine fell short: say so beside the verdict that stands.\n const notes = says.map((x) =>\n x.outcome.kind === \"UNKNOWN\"\n ? `not PROVEN by ${x.engine}: ${x.outcome.cause}: ${x.outcome.reason}`\n : `${x.engine}: ${x.outcome.kind}`,\n );\n return { ...v, assumptions: [...v.assumptions, ...notes] };\n });\n}\n"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"provers-DS44OeEm.mjs","names":[],"sources":["../../prover/src/provers.ts"],"sourcesContent":["/**\n * The `Prover` interface every engine implements, first-party or not, and\n * the aggregation of what engines say into the ladder's verdicts. An\n * engine takes a module's source with its specs and the functions to\n * prove and answers per property: `PROVEN` with its name, version and\n * assumptions, or `UNKNOWN` as `gave_up` (a proof did not close, or timed\n * out), `unsupported` (outside its subset) or `unavailable` (not\n * installed). An engine that refutes gives `REFUTED` with a counterexample\n * when it has one. Engines run over a process boundary; nothing here\n * spawns anything.\n */\n\nimport type { Counterexample, SpecVerdict } from \"@eutaxy/core\";\nimport type { ModuleSpecs, SpecError } from \"@eutaxy/spec\";\n\n/** A proof engine's name and version, as verdicts record it. */\nexport interface EngineId {\n readonly name: string;\n readonly version: string;\n}\n\n/** What an engine said about one property: proven, refuted (with a counterexample when it has one), or unknown and why. */\nexport type ProofOutcome =\n | { readonly kind: \"PROVEN\"; readonly engine: EngineId; readonly assumptions: readonly string[] }\n | {\n readonly kind: \"REFUTED\";\n readonly engine: EngineId;\n readonly counterexample?: Counterexample;\n readonly assumptions: readonly string[];\n }\n | {\n readonly kind: \"UNKNOWN\";\n readonly cause: \"gave_up\" | \"unsupported\" | \"unavailable\";\n readonly reason: string;\n };\n\n/** An engine's outcome for one property of one function. */\nexport interface PropertyProof {\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n readonly outcome: ProofOutcome;\n}\n\n/** A property an engine gave up on, with the statement it tried to prove, for a proof to be supplied. */\nexport interface OpenGoal {\n readonly function: string;\n readonly property: string;\n /** The statement in the engine's language, as it emitted it. */\n readonly statement: string;\n /** Why the engine gave up: its own words, first line. */\n readonly reason: string;\n}\n\n/** An engine's answer for one module: an outcome per property, the specs that did not read, and the open goals. */\nexport interface ModuleProofs {\n readonly results: readonly PropertyProof[];\n /** Specs that did not read: properties asked for and never checked. */\n readonly specErrors: readonly SpecError[];\n /**\n * The properties given up on that a supplied proof could close, when the engine takes supplied proofs\n * and answered (empty when it closed every one; absent when it could not run or finish).\n */\n readonly goals?: readonly OpenGoal[];\n}\n\n/** What an engine is given: the module's source and specs, the functions to prove, and where they live. */\nexport interface ProveInput {\n /** The module's source text. */\n readonly source: string;\n /** The module's specs, read from its spec file. */\n readonly specs: ModuleSpecs;\n /** The functions to prove; every one with specs when omitted. */\n readonly functions?: readonly string[];\n /** The module's path, under which its imports resolve; without it the module stands alone. */\n readonly modulePath?: string;\n /** The spec file's path, for an engine that replays a counterexample through the spec itself. */\n readonly specPath?: string;\n readonly timeoutMs?: number;\n}\n\n/** A proof engine: whether it can run here, and proving a module's properties. */\nexport interface Prover {\n readonly name: string;\n /** Whether the engine can run here, or why not. */\n available(): Promise<{ readonly version: string } | { readonly unavailable: string }>;\n prove(input: ProveInput): Promise<ModuleProofs>;\n}\n\n/** What an engine said about one module, by its name. */\nexport interface EngineReport {\n readonly engine: string;\n readonly proofs: ModuleProofs;\n}\n\n/**\n * The simulator's verdicts for a module (CHECKED, TESTED, REFUTED, UNKNOWN,\n * `total` included) combined with what the engines proved. A simulator\n * counterexample stands. One engine proving is `PROVEN`, the lower rungs'\n * counts kept beside it; an engine refuting where nothing else did is\n * `REFUTED` at the PROVEN rung; one proving and another refuting is\n * `CONFLICT`. An engine that gave up, could not run or does not take the\n * function leaves the verdict as it was, with why among the assumptions.\n */\nexport function aggregate(\n module: string,\n verdicts: readonly SpecVerdict[],\n reports: readonly EngineReport[],\n): SpecVerdict[] {\n return verdicts.map((v) => {\n if (v.module !== module) return v;\n const says = reports\n .map((r) => ({\n engine: r.engine,\n outcome: r.proofs.results.find(\n (p) => p.function === v.function && p.property === v.property,\n )?.outcome,\n }))\n .filter((x): x is { engine: string; outcome: ProofOutcome } => x.outcome !== undefined);\n if (says.length === 0) return v;\n const proven = says.find((x) => x.outcome.kind === \"PROVEN\");\n const refuted = says.find((x) => x.outcome.kind === \"REFUTED\");\n if (v.kind === \"REFUTED\" || v.kind === \"CONFLICT\") {\n // The simulator's counterexample is a fact; an engine proving against it is a conflict too.\n if (v.kind === \"REFUTED\" && proven?.outcome.kind === \"PROVEN\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"CONFLICT\",\n proven: proven.outcome.engine,\n refuted: { name: \"simulator\", version: v.rung, counterexample: v.counterexample },\n assumptions: [...v.assumptions, ...proven.outcome.assumptions],\n };\n return v;\n }\n if (proven?.outcome.kind === \"PROVEN\" && refuted?.outcome.kind === \"REFUTED\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"CONFLICT\",\n proven: proven.outcome.engine,\n refuted: {\n name: refuted.outcome.engine.name,\n version: refuted.outcome.engine.version,\n ...(refuted.outcome.counterexample\n ? { counterexample: refuted.outcome.counterexample }\n : {}),\n },\n assumptions: [...proven.outcome.assumptions, ...refuted.outcome.assumptions],\n };\n if (refuted?.outcome.kind === \"REFUTED\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"REFUTED\",\n rung: \"PROVEN\",\n engine: refuted.outcome.engine,\n counterexample: refuted.outcome.counterexample ?? { binders: [] },\n assumptions: refuted.outcome.assumptions,\n };\n if (proven?.outcome.kind === \"PROVEN\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"PROVEN\",\n engine: proven.outcome.engine,\n ...(v.kind === \"TESTED\" ? { tested: v.inputs } : {}),\n ...(v.kind === \"TESTED\" && v.checked !== undefined\n ? { checked: v.checked }\n : v.kind === \"CHECKED\"\n ? { checked: v.inputs }\n : {}),\n assumptions: [...proven.outcome.assumptions, ...v.assumptions],\n };\n // Every engine fell short: say so beside the verdict that stands.\n const notes = says.map((x) =>\n x.outcome.kind === \"UNKNOWN\"\n ? `not PROVEN by ${x.engine}: ${x.outcome.cause}: ${x.outcome.reason}`\n : `${x.engine}: ${x.outcome.kind}`,\n );\n return { ...v, assumptions: [...v.assumptions, ...notes] };\n });\n}\n"],"mappings":";;;;;;;;;;AAwGA,SAAgB,UACd,QACA,UACA,SACe;CACf,OAAO,SAAS,KAAK,MAAM;EACzB,IAAI,EAAE,WAAW,QAAQ,OAAO;EAChC,MAAM,OAAO,QACV,KAAK,OAAO;GACX,QAAQ,EAAE;GACV,SAAS,EAAE,OAAO,QAAQ,MACvB,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,QACvD,CAAC,EAAE;EACL,EAAE,CAAC,CACF,QAAQ,MAAsD,EAAE,YAAY,KAAA,CAAS;EACxF,IAAI,KAAK,WAAW,GAAG,OAAO;EAC9B,MAAM,SAAS,KAAK,MAAM,MAAM,EAAE,QAAQ,SAAS,QAAQ;EAC3D,MAAM,UAAU,KAAK,MAAM,MAAM,EAAE,QAAQ,SAAS,SAAS;EAC7D,IAAI,EAAE,SAAS,aAAa,EAAE,SAAS,YAAY;GAEjD,IAAI,EAAE,SAAS,aAAa,QAAQ,QAAQ,SAAS,UACnD,OAAO;IACL,QAAQ,EAAE;IACV,UAAU,EAAE;IACZ,UAAU,EAAE;IACZ,MAAM,EAAE;IACR,MAAM;IACN,QAAQ,OAAO,QAAQ;IACvB,SAAS;KAAE,MAAM;KAAa,SAAS,EAAE;KAAM,gBAAgB,EAAE;IAAe;IAChF,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,QAAQ,WAAW;GAC/D;GACF,OAAO;EACT;EACA,IAAI,QAAQ,QAAQ,SAAS,YAAY,SAAS,QAAQ,SAAS,WACjE,OAAO;GACL,QAAQ,EAAE;GACV,UAAU,EAAE;GACZ,UAAU,EAAE;GACZ,MAAM,EAAE;GACR,MAAM;GACN,QAAQ,OAAO,QAAQ;GACvB,SAAS;IACP,MAAM,QAAQ,QAAQ,OAAO;IAC7B,SAAS,QAAQ,QAAQ,OAAO;IAChC,GAAI,QAAQ,QAAQ,iBAChB,EAAE,gBAAgB,QAAQ,QAAQ,eAAe,IACjD,CAAC;GACP;GACA,aAAa,CAAC,GAAG,OAAO,QAAQ,aAAa,GAAG,QAAQ,QAAQ,WAAW;EAC7E;EACF,IAAI,SAAS,QAAQ,SAAS,WAC5B,OAAO;GACL,QAAQ,EAAE;GACV,UAAU,EAAE;GACZ,UAAU,EAAE;GACZ,MAAM,EAAE;GACR,MAAM;GACN,MAAM;GACN,QAAQ,QAAQ,QAAQ;GACxB,gBAAgB,QAAQ,QAAQ,kBAAkB,EAAE,SAAS,CAAC,EAAE;GAChE,aAAa,QAAQ,QAAQ;EAC/B;EACF,IAAI,QAAQ,QAAQ,SAAS,UAC3B,OAAO;GACL,QAAQ,EAAE;GACV,UAAU,EAAE;GACZ,UAAU,EAAE;GACZ,MAAM,EAAE;GACR,MAAM;GACN,QAAQ,OAAO,QAAQ;GACvB,GAAI,EAAE,SAAS,WAAW,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC;GAClD,GAAI,EAAE,SAAS,YAAY,EAAE,YAAY,KAAA,IACrC,EAAE,SAAS,EAAE,QAAQ,IACrB,EAAE,SAAS,YACT,EAAE,SAAS,EAAE,OAAO,IACpB,CAAC;GACP,aAAa,CAAC,GAAG,OAAO,QAAQ,aAAa,GAAG,EAAE,WAAW;EAC/D;EAEF,MAAM,QAAQ,KAAK,KAAK,MACtB,EAAE,QAAQ,SAAS,YACf,iBAAiB,EAAE,OAAO,IAAI,EAAE,QAAQ,MAAM,IAAI,EAAE,QAAQ,WAC5D,GAAG,EAAE,OAAO,IAAI,EAAE,QAAQ,MAChC;EACA,OAAO;GAAE,GAAG;GAAG,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,KAAK;EAAE;CAC3D,CAAC;AACH"}
|
package/dist/spec.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as forall, i as Total, n as Forall, o as isSpec, r as Spec, s as total, t as Fn } from "./combinators-
|
|
1
|
+
import { a as forall, i as Total, n as Forall, o as isSpec, r as Spec, s as total, t as Fn } from "./combinators-BecOKcmi.mjs";
|
|
2
2
|
export { type Fn, type Forall, type Spec, type Total, forall, isSpec, total };
|
package/dist/spec.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as forall, n as isSpec, r as total } from "./combinators-
|
|
1
|
+
export { t as forall, n as isSpec, r as total } from "./combinators-CLfsPfhT.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as isSpec } from "./combinators-
|
|
1
|
+
import { F as seedPrng, L as canonicalJson, M as nextFloat, N as nextInt, P as nextU32 } from "./src-ud5wEfnx.mjs";
|
|
2
|
+
import { n as isSpec } from "./combinators-CLfsPfhT.mjs";
|
|
3
3
|
// packages/core/src/verdict.ts
|
|
4
4
|
/** One line per verdict, for error messages; full rendering lives in `report`. */
|
|
5
5
|
function describeVerdict(v) {
|
|
@@ -1114,6 +1114,7 @@ function evaluate(spec, values, copied = false) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
/** How every rung words an `UNKNOWN` for a property that cannot be evaluated; the ladder recognizes it. */
|
|
1116
1116
|
const malformedReason = (detail) => `the property could not be evaluated: ${detail}`;
|
|
1117
|
+
/** The `CHECKED` rung: evaluate the property on every distinct input the simulator passed the function. */
|
|
1117
1118
|
function checkedRung(input) {
|
|
1118
1119
|
const { module, fn, property } = input;
|
|
1119
1120
|
const base = {
|
|
@@ -1234,6 +1235,7 @@ function inSample(spec, values) {
|
|
|
1234
1235
|
* `TESTED`: evidence from sampling, which says nothing about the inputs
|
|
1235
1236
|
* never drawn.
|
|
1236
1237
|
*/
|
|
1238
|
+
/** The `TESTED` rung: evaluate the property on inputs generated from its binders' domains, drawn from the seed. */
|
|
1237
1239
|
function testedRung(input) {
|
|
1238
1240
|
const { module, fn, property } = input;
|
|
1239
1241
|
const base = {
|
|
@@ -1428,6 +1430,10 @@ function checkSpecModule(module, specs, props, namespace, observed, options = {}
|
|
|
1428
1430
|
* The emitter knows nothing about any platform: the caller supplies the
|
|
1429
1431
|
* import lines and the expression that builds the platform.
|
|
1430
1432
|
*/
|
|
1433
|
+
/**
|
|
1434
|
+
* A Vitest test file that replays a violation's shrunk schedule: by default it fails while the bug is
|
|
1435
|
+
* there and passes once it is fixed.
|
|
1436
|
+
*/
|
|
1431
1437
|
function emitRegressionTest(verdict, options) {
|
|
1432
1438
|
const engineModule = options.engineModule ?? "eutaxy";
|
|
1433
1439
|
const mode = options.expect ?? "holds";
|
|
@@ -1623,4 +1629,4 @@ function renderText(verdict) {
|
|
|
1623
1629
|
}
|
|
1624
1630
|
export { render as _, renderText as a, checkSpecModule as c, shrinkRefutation as d, checkedRung as f, endpointNumber as g, endpointBigInt as h, renderSpecs as i, specLadder as l, conforms as m, renderSpecReport as n, renderTrace as o, evaluate as p, renderSpecReportJson as r, emitRegressionTest as s, renderJson as t, testedRung as u, describeType as v, describeVerdict as y };
|
|
1625
1631
|
|
|
1626
|
-
//# sourceMappingURL=src-
|
|
1632
|
+
//# sourceMappingURL=src-nwQA9Xwr.mjs.map
|