eutaxy 0.5.0 → 0.6.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 +96 -12
- package/dist/aws.d.mts +7 -5
- package/dist/aws.d.mts.map +1 -1
- package/dist/aws.mjs +44 -138
- package/dist/aws.mjs.map +1 -1
- package/dist/bin.mjs +2 -2
- package/dist/{checksum-DhS6ofSm.mjs → checksum-DHr5qb3Y.mjs} +2 -2
- package/dist/{checksum-DhS6ofSm.mjs.map → checksum-DHr5qb3Y.mjs.map} +1 -1
- package/dist/cli-CsiVEsS-.mjs +2 -0
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cloudflare.d.mts +156 -54
- package/dist/cloudflare.d.mts.map +1 -1
- package/dist/cloudflare.mjs +3 -1815
- package/dist/delivery-invariants-BraYqcYN.d.mts +5 -0
- package/dist/delivery-invariants-BraYqcYN.d.mts.map +1 -0
- package/dist/delivery-invariants-hmhwh_qD.mjs +39 -0
- package/dist/delivery-invariants-hmhwh_qD.mjs.map +1 -0
- package/dist/{event-streams-BANyO9xt.mjs → event-streams-i8OGzuFN.mjs} +2 -2
- package/dist/{event-streams-BANyO9xt.mjs.map → event-streams-i8OGzuFN.mjs.map} +1 -1
- package/dist/explore-CDpJA9zX.d.mts +342 -0
- package/dist/explore-CDpJA9zX.d.mts.map +1 -0
- package/dist/index.d.mts +84 -195
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -191
- package/dist/index.mjs.map +1 -1
- package/dist/{platform-eVgCMbX0.d.mts → platform-DfMwknw1.d.mts} +94 -73
- package/dist/platform-DfMwknw1.d.mts.map +1 -0
- package/dist/{src-C19_yfMM.mjs → src-BO7I3f-1.mjs} +961 -543
- package/dist/src-BO7I3f-1.mjs.map +1 -0
- package/dist/src-C43iUZgr.mjs +5039 -0
- package/dist/src-C43iUZgr.mjs.map +1 -0
- package/dist/{src-CgfGiH25.mjs → src-Cs4Mg55e.mjs} +1148 -22
- package/dist/src-Cs4Mg55e.mjs.map +1 -0
- package/package.json +16 -1
- package/dist/cli-NqY61bpo.mjs +0 -2
- package/dist/cloudflare.mjs.map +0 -1
- package/dist/explore-BHYvAZKN.d.mts +0 -84
- package/dist/explore-BHYvAZKN.d.mts.map +0 -1
- package/dist/platform-eVgCMbX0.d.mts.map +0 -1
- package/dist/src-BD3jkjgG.mjs +0 -477
- package/dist/src-BD3jkjgG.mjs.map +0 -1
- package/dist/src-C19_yfMM.mjs.map +0 -1
- package/dist/src-CgfGiH25.mjs.map +0 -1
- package/dist/src-s6uYyC0B.mjs +0 -89
- package/dist/src-s6uYyC0B.mjs.map +0 -1
- package/dist/verdict-evEM5Gxx.mjs +0 -12
- package/dist/verdict-evEM5Gxx.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import "./src-
|
|
2
|
-
import { g as
|
|
3
|
-
import { t as describeVerdict } from "./verdict-evEM5Gxx.mjs";
|
|
4
|
-
import { a as emitRegressionTest, c as LemmaSyntaxError, i as renderTrace, l as endpointNumber, n as renderSpecs, r as renderText, s as extractSpecs, t as renderJson, u as parseProperty } from "./src-CgfGiH25.mjs";
|
|
1
|
+
import { a as explore, b as checkInvariants, o as replay, s as restrictSpec, t as observeCore, v as validateScenario, y as checkInvariant } from "./src-BO7I3f-1.mjs";
|
|
2
|
+
import { a as emitRegressionTest, b as describeVerdict, c as specLadder, g as parseProperty, h as LemmaSyntaxError, i as renderTrace, l as testedRung, m as extractSpecs, n as renderSpecs, o as aggregate, r as renderText, t as renderJson, u as checkedRung } from "./src-Cs4Mg55e.mjs";
|
|
5
3
|
// packages/core/src/spec-verdict.ts
|
|
6
4
|
/** One line per spec verdict, for error messages; full rendering lives in `report`. */
|
|
7
5
|
function describeSpecVerdict(v) {
|
|
8
6
|
const what = `${v.function} ${v.property}`;
|
|
9
7
|
switch (v.kind) {
|
|
10
8
|
case "CHECKED": return `CHECKED ${what}: held on ${v.inputs} input(s) the simulator passed`;
|
|
11
|
-
case "
|
|
9
|
+
case "TESTED": return `TESTED ${what}: held on ${v.inputs} generated input(s)`;
|
|
10
|
+
case "PROVEN": return `PROVEN ${what}: by ${v.engine.name} ${v.engine.version}`;
|
|
11
|
+
case "CONFLICT": return `CONFLICT ${what}: ${v.proven.name} proves it, ${v.refuted.name} refutes it`;
|
|
12
|
+
case "REFUTED": {
|
|
13
|
+
const c = v.counterexample;
|
|
14
|
+
return `REFUTED ${what}: ${c.call ?? c.binders.map((b) => `${b.name} = ${b.value}`).join(", ")}${c.error ? ` threw ${c.error}` : ""}`;
|
|
15
|
+
}
|
|
12
16
|
case "UNKNOWN": return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;
|
|
13
17
|
}
|
|
14
18
|
}
|
|
@@ -71,191 +75,6 @@ function printProperty(p) {
|
|
|
71
75
|
const body = p.requires.length > 0 ? [...p.requires, p.claim].map((f) => printFormula(f, precedence.or)).join(" → ") : printFormula(p.claim, p.claim.kind === "implies" ? precedence.or : 0);
|
|
72
76
|
return `${prefixText(p.binders)} { ${body} }`;
|
|
73
77
|
}
|
|
74
|
-
|
|
75
|
-
/** Thrown by `lemmaBool` when an atom is not a genuine boolean: the property is malformed, not false. */
|
|
76
|
-
var AtomNotBoolean = class extends TypeError {};
|
|
77
|
-
/** Thrown by `lemmaUnresolved`: the property names something neither its module nor the globals define. */
|
|
78
|
-
var UnresolvedName = class extends ReferenceError {};
|
|
79
|
-
/** What generated predicates call when free names did not resolve. */
|
|
80
|
-
function lemmaUnresolved(names) {
|
|
81
|
-
throw new UnresolvedName(`the property refers to ${names.join(", ")}, which neither its module exports nor the globals define`);
|
|
82
|
-
}
|
|
83
|
-
/** The atom check generated predicates call: its argument when it is a boolean. */
|
|
84
|
-
function lemmaBool(value) {
|
|
85
|
-
if (typeof value !== "boolean") throw new AtomNotBoolean(`a Lemma atom evaluated to ${render(value)}, not a boolean`);
|
|
86
|
-
return value;
|
|
87
|
-
}
|
|
88
|
-
/** A value as a JavaScript literal, exact for the binder domains. */
|
|
89
|
-
function render(value) {
|
|
90
|
-
switch (typeof value) {
|
|
91
|
-
case "bigint": return `${value}n`;
|
|
92
|
-
case "number": return Object.is(value, -0) ? "-0" : String(value);
|
|
93
|
-
case "string": return JSON.stringify(value);
|
|
94
|
-
case "undefined": return "undefined";
|
|
95
|
-
case "boolean": return String(value);
|
|
96
|
-
case "function": return "[function]";
|
|
97
|
-
}
|
|
98
|
-
try {
|
|
99
|
-
const text = JSON.stringify(value, (_, v) => typeof v === "bigint" ? `${v}n` : v);
|
|
100
|
-
return text === void 0 ? String(value) : text.length > 200 ? `${text.slice(0, 200)}…` : text;
|
|
101
|
-
} catch {
|
|
102
|
-
return String(value);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function bound(value, integral) {
|
|
106
|
-
if (integral && !value.endsWith("∞")) return BigInt(value.replace(/_/g, "").replace(/n$/, ""));
|
|
107
|
-
return endpointNumber(value);
|
|
108
|
-
}
|
|
109
|
-
/** Whether a value lies in a binder's domain and guard. */
|
|
110
|
-
function inDomain(b, v) {
|
|
111
|
-
switch (b.domain) {
|
|
112
|
-
case "int":
|
|
113
|
-
if (!(typeof v === "number" && Number.isInteger(v))) return false;
|
|
114
|
-
break;
|
|
115
|
-
case "nat":
|
|
116
|
-
if (!(typeof v === "number" && Number.isInteger(v) && v >= 0)) return false;
|
|
117
|
-
break;
|
|
118
|
-
case "number":
|
|
119
|
-
if (typeof v !== "number") return false;
|
|
120
|
-
break;
|
|
121
|
-
case "bigint":
|
|
122
|
-
if (typeof v !== "bigint") return false;
|
|
123
|
-
break;
|
|
124
|
-
case "string":
|
|
125
|
-
if (typeof v !== "string") return false;
|
|
126
|
-
break;
|
|
127
|
-
case "boolean": return typeof v === "boolean";
|
|
128
|
-
}
|
|
129
|
-
const g = b.guard;
|
|
130
|
-
if (!g) return true;
|
|
131
|
-
if (g.kind === "regex") return new RegExp(`^(?:${g.pattern})$`, g.flags).test(v);
|
|
132
|
-
const integral = b.domain !== "number";
|
|
133
|
-
const x = integral ? BigInt(v) : v;
|
|
134
|
-
const lo = bound(g.lower.value, integral);
|
|
135
|
-
const hi = bound(g.upper.value, integral);
|
|
136
|
-
const aboveLower = g.lower.inclusive ? x >= lo : x > lo;
|
|
137
|
-
const belowUpper = g.upper.inclusive ? x <= hi : x < hi;
|
|
138
|
-
return aboveLower && belowUpper;
|
|
139
|
-
}
|
|
140
|
-
function checkedRung(input) {
|
|
141
|
-
const { module, fn, property } = input;
|
|
142
|
-
const base = {
|
|
143
|
-
module,
|
|
144
|
-
function: fn.name,
|
|
145
|
-
property: property.name,
|
|
146
|
-
text: property.text
|
|
147
|
-
};
|
|
148
|
-
const unknown = (cause, reason) => ({
|
|
149
|
-
...base,
|
|
150
|
-
kind: "UNKNOWN",
|
|
151
|
-
cause,
|
|
152
|
-
reason,
|
|
153
|
-
assumptions: []
|
|
154
|
-
});
|
|
155
|
-
if (input.unobservable) return unknown("unavailable", `calls to ${fn.name} could not be observed: ${input.unobservable}`);
|
|
156
|
-
const predicate = input.predicate;
|
|
157
|
-
if (!predicate) return unknown("unavailable", "the property's predicate was not compiled");
|
|
158
|
-
const binders = property.property.binders;
|
|
159
|
-
const positions = [];
|
|
160
|
-
for (const b of binders) {
|
|
161
|
-
const at = fn.params.indexOf(b.name);
|
|
162
|
-
if (at < 0) return unknown("unsupported", `binder ${b.name} is not a parameter of ${fn.name}, so the inputs the simulator passed do not determine it`);
|
|
163
|
-
positions.push(at);
|
|
164
|
-
}
|
|
165
|
-
const seen = /* @__PURE__ */ new Set();
|
|
166
|
-
let held = 0;
|
|
167
|
-
let discarded = 0;
|
|
168
|
-
for (const call of input.calls) {
|
|
169
|
-
const values = positions.map((p) => call.args[p]);
|
|
170
|
-
const key = values.map(render).join(", ");
|
|
171
|
-
if (seen.has(key)) continue;
|
|
172
|
-
seen.add(key);
|
|
173
|
-
if (!binders.every((b, i) => inDomain(b, values[i]))) {
|
|
174
|
-
discarded++;
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
const counterexample = (error) => ({
|
|
178
|
-
binders: binders.map((b, i) => ({
|
|
179
|
-
name: b.name,
|
|
180
|
-
value: render(values[i])
|
|
181
|
-
})),
|
|
182
|
-
call: `${fn.name}(${call.args.map(render).join(", ")})`,
|
|
183
|
-
...error === void 0 ? {} : { error }
|
|
184
|
-
});
|
|
185
|
-
let outcome;
|
|
186
|
-
try {
|
|
187
|
-
outcome = predicate(...values);
|
|
188
|
-
} catch (err) {
|
|
189
|
-
if (err instanceof AtomNotBoolean || err instanceof ReferenceError) return unknown("unsupported", `the property could not be evaluated: ${String(err)}`);
|
|
190
|
-
return {
|
|
191
|
-
...base,
|
|
192
|
-
kind: "REFUTED",
|
|
193
|
-
rung: "CHECKED",
|
|
194
|
-
counterexample: counterexample(String(err)),
|
|
195
|
-
assumptions: []
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
if (outcome === "refuted") return {
|
|
199
|
-
...base,
|
|
200
|
-
kind: "REFUTED",
|
|
201
|
-
rung: "CHECKED",
|
|
202
|
-
counterexample: counterexample(),
|
|
203
|
-
assumptions: []
|
|
204
|
-
};
|
|
205
|
-
if (outcome === "discarded") discarded++;
|
|
206
|
-
else held++;
|
|
207
|
-
}
|
|
208
|
-
if (held === 0) return unknown("gave_up", input.calls.length === 0 ? `the simulator never called ${fn.name}` : `none of the ${seen.size} distinct input(s) the simulator passed is inside the claim (domains, guards, preconditions)`);
|
|
209
|
-
return {
|
|
210
|
-
...base,
|
|
211
|
-
kind: "CHECKED",
|
|
212
|
-
inputs: held,
|
|
213
|
-
discarded,
|
|
214
|
-
assumptions: [`held on the ${held} distinct input(s) the simulator passed to ${fn.name}; inputs it never passed are not covered`]
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
/** Verdicts for the markers the CHECKED rung cannot decide. */
|
|
218
|
-
function markerVerdicts(module, fn) {
|
|
219
|
-
const out = [];
|
|
220
|
-
const base = {
|
|
221
|
-
module,
|
|
222
|
-
function: fn.name,
|
|
223
|
-
assumptions: []
|
|
224
|
-
};
|
|
225
|
-
if (fn.total) out.push({
|
|
226
|
-
...base,
|
|
227
|
-
property: "@total",
|
|
228
|
-
text: "@total",
|
|
229
|
-
kind: "UNKNOWN",
|
|
230
|
-
cause: "unsupported",
|
|
231
|
-
reason: "termination is not observable on the inputs the simulator passed; @total needs a prover"
|
|
232
|
-
});
|
|
233
|
-
if (fn.throws) out.push({
|
|
234
|
-
...base,
|
|
235
|
-
property: "@throws",
|
|
236
|
-
text: "@throws",
|
|
237
|
-
kind: "UNKNOWN",
|
|
238
|
-
cause: "unsupported",
|
|
239
|
-
reason: "Lemma has not fixed what @throws claims yet"
|
|
240
|
-
});
|
|
241
|
-
return out;
|
|
242
|
-
}
|
|
243
|
-
/** Every spec verdict for one module, from what was observed of its calls. */
|
|
244
|
-
function checkSpecModule(module, specs, predicates, observed) {
|
|
245
|
-
return specs.functions.flatMap((fn) => {
|
|
246
|
-
const calls = observed.calls.filter((c) => c.function === fn.name);
|
|
247
|
-
const unobservable = Object.hasOwn(observed.unobservable, fn.name) ? observed.unobservable[fn.name] : void 0;
|
|
248
|
-
const own = Object.hasOwn(predicates, fn.name) ? predicates[fn.name] : void 0;
|
|
249
|
-
return [...fn.ensures.map((property) => checkedRung({
|
|
250
|
-
module,
|
|
251
|
-
fn,
|
|
252
|
-
property,
|
|
253
|
-
calls,
|
|
254
|
-
predicate: own && Object.hasOwn(own, property.name) ? own[property.name] : void 0,
|
|
255
|
-
...unobservable === void 0 ? {} : { unobservable }
|
|
256
|
-
})), ...markerVerdicts(module, fn)];
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
export { LemmaSyntaxError, checkInvariant, checkInvariants, checkSpecModule, checkedRung, describeSpecVerdict, describeVerdict, emitRegressionTest, explore, extractSpecs, lemmaBool, lemmaUnresolved, observeCore, parseProperty, printProperty, renderJson, renderSpecs, renderText, renderTrace, replay, restrictSpec, validateScenario };
|
|
78
|
+
export { LemmaSyntaxError, aggregate, checkInvariant, checkInvariants, checkedRung, describeSpecVerdict, describeVerdict, emitRegressionTest, explore, extractSpecs, observeCore, parseProperty, printProperty, renderJson, renderSpecs, renderText, renderTrace, replay, restrictSpec, specLadder, testedRung, validateScenario };
|
|
260
79
|
|
|
261
80
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/spec-verdict.ts","../../spec/src/print.ts","../../prover/src/checked.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 starts at\n * `CHECKED` (held on every input the simulator passed); `TESTED` and\n * `PROVEN` come with the provers.\n */\n\ninterface SpecVerdictBase {\n /** The module, as the scenario names it. */\n readonly module: string;\n readonly function: string;\n /** The `@ensures` name, or `@total` / `@throws` for those markers. */\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/** One assignment that breaks the property, as JavaScript literals, and the call it came from. */\nexport interface Counterexample {\n /** In the property's binder order. */\n readonly binders: readonly { readonly name: string; readonly value: string }[];\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 readonly rung: \"CHECKED\";\n readonly counterexample: Counterexample;\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 | Refuted | 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 \"REFUTED\":\n return `REFUTED ${what}: ${v.counterexample.call}${v.counterexample.error ? ` threw ${v.counterexample.error}` : \"\"}`;\n case \"UNKNOWN\":\n return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;\n }\n}\n","/**\n * Print SpecIR back as Lemma, canonically: glyph connectives, binders with\n * the same domain and guard grouped, and parentheses only where precedence\n * or a root-level material implication needs them. Parsing what it prints\n * gives the same IR.\n */\n\nimport type { Binder, Formula, Guard, Property } from \"./ir.ts\";\n\nconst precedence: { readonly [k in Formula[\"kind\"]]: number } = {\n iff: 1,\n implies: 2,\n or: 3,\n and: 4,\n not: 5,\n atom: 6,\n equation: 6,\n};\n\nfunction guardText(g: Guard): string {\n if (g.kind === \"regex\") return `/${g.pattern}/${g.flags}`;\n return `${g.lower.inclusive ? \"[\" : \"(\"}${g.lower.value}, ${g.upper.value}${g.upper.inclusive ? \"]\" : \")\"}`;\n}\n\nfunction sameGroup(a: Binder, b: Binder): boolean {\n return (\n a.domain === b.domain &&\n (a.guard === undefined) === (b.guard === undefined) &&\n (a.guard === undefined || (b.guard !== undefined && guardText(a.guard) === guardText(b.guard)))\n );\n}\n\nfunction prefixText(binders: readonly Binder[]): string {\n const groups: Binder[][] = [];\n for (const b of binders) {\n const last = groups[groups.length - 1];\n if (last && sameGroup(last[0] as Binder, b)) last.push(b);\n else groups.push([b]);\n }\n const text = groups.map((g) => {\n const head = g[0] as Binder;\n const guard = head.guard ? ` ∈ ${guardText(head.guard)}` : \"\";\n return `(${g.map((b) => b.name).join(\" \")}: ${head.domain}${guard})`;\n });\n return `forall ${text.join(\" \")}`;\n}\n\n/** Print a formula, parenthesized when its precedence is below `min`. */\nexport function printFormula(f: Formula, min = 0): string {\n let s: string;\n switch (f.kind) {\n case \"atom\":\n s = f.text;\n break;\n case \"equation\":\n s = `${f.left} ${f.negated ? \"≢\" : \"≡\"} ${f.right}`;\n break;\n case \"not\":\n s = `¬${printFormula(f.operand, precedence.not)}`;\n break;\n case \"and\":\n case \"or\":\n s = f.operands\n .map((o) => printFormula(o, precedence[f.kind] + 1))\n .join(f.kind === \"and\" ? \" ∧ \" : \" ∨ \");\n break;\n case \"implies\":\n s = [...f.antecedents, f.consequent].map((o) => printFormula(o, precedence.or)).join(\" → \");\n break;\n case \"iff\":\n s = `${printFormula(f.left, precedence.implies)} ↔ ${printFormula(f.right, precedence.implies)}`;\n break;\n }\n return precedence[f.kind] < min ? `(${s})` : s;\n}\n\n/** The property as Lemma text (what follows `@ensures{name}`). */\nexport function printProperty(p: Property): string {\n // A root implication is the preconditions; a material one there needs its parentheses.\n const body =\n p.requires.length > 0\n ? [...p.requires, p.claim].map((f) => printFormula(f, precedence.or)).join(\" → \")\n : printFormula(p.claim, p.claim.kind === \"implies\" ? precedence.or : 0);\n return `${prefixText(p.binders)} { ${body} }`;\n}\n","/**\n * The `CHECKED` rung: a property evaluated on every input the simulator\n * actually passed to its function. Binders are matched to the function's\n * parameters by name, so each recorded call is one assignment; a value\n * outside its binder's domain or guard, or one failing a precondition, is\n * outside the claim and discarded. One assignment where the claim is false\n * refutes the property. Holding on all of them is `CHECKED`, which says\n * nothing about inputs the simulator never passed.\n */\n\nimport type { Counterexample, SpecVerdict } from \"@eutaxy/core\";\nimport {\n type Binder,\n endpointNumber,\n type FunctionSpec,\n type ModuleSpecs,\n type NamedProperty,\n type PredicateOutcome,\n} from \"@eutaxy/spec\";\n\n/** Thrown by `lemmaBool` when an atom is not a genuine boolean: the property is malformed, not false. */\nexport class AtomNotBoolean extends TypeError {}\n\n/** Thrown by `lemmaUnresolved`: the property names something neither its module nor the globals define. */\nexport class UnresolvedName extends ReferenceError {}\n\n/** What generated predicates call when free names did not resolve. */\nexport function lemmaUnresolved(names: readonly string[]): never {\n throw new UnresolvedName(\n `the property refers to ${names.join(\", \")}, which neither its module exports nor the globals define`,\n );\n}\n\n/** The atom check generated predicates call: its argument when it is a boolean. */\nexport function lemmaBool(value: unknown): boolean {\n if (typeof value !== \"boolean\")\n throw new AtomNotBoolean(`a Lemma atom evaluated to ${render(value)}, not a boolean`);\n return value;\n}\n\n/** A value as a JavaScript literal, exact for the binder domains. */\nexport function render(value: unknown): string {\n switch (typeof value) {\n case \"bigint\":\n return `${value}n`;\n case \"number\":\n return Object.is(value, -0) ? \"-0\" : String(value);\n case \"string\":\n return JSON.stringify(value);\n case \"undefined\":\n return \"undefined\";\n case \"boolean\":\n return String(value);\n case \"function\":\n return \"[function]\";\n }\n try {\n const text = JSON.stringify(value, (_, v: unknown) => (typeof v === \"bigint\" ? `${v}n` : v));\n return text === undefined ? String(value) : text.length > 200 ? `${text.slice(0, 200)}…` : text;\n } catch {\n return String(value);\n }\n}\n\nfunction bound(value: string, integral: boolean): number | bigint {\n if (integral && !value.endsWith(\"∞\")) return BigInt(value.replace(/_/g, \"\").replace(/n$/, \"\"));\n return endpointNumber(value);\n}\n\n/** Whether a value lies in a binder's domain and guard. */\nexport function inDomain(b: Binder, v: unknown): boolean {\n switch (b.domain) {\n case \"int\":\n if (!(typeof v === \"number\" && Number.isInteger(v))) return false;\n break;\n case \"nat\":\n if (!(typeof v === \"number\" && Number.isInteger(v) && v >= 0)) return false;\n break;\n case \"number\":\n if (typeof v !== \"number\") return false;\n break;\n case \"bigint\":\n if (typeof v !== \"bigint\") return false;\n break;\n case \"string\":\n if (typeof v !== \"string\") return false;\n break;\n case \"boolean\":\n return typeof v === \"boolean\";\n }\n const g = b.guard;\n if (!g) return true;\n if (g.kind === \"regex\") return new RegExp(`^(?:${g.pattern})$`, g.flags).test(v as string);\n // Integer domains compare exactly: an integer double converts to bigint without loss.\n const integral = b.domain !== \"number\";\n const x = integral ? BigInt(v as number | bigint) : (v as number);\n const lo = bound(g.lower.value, integral);\n const hi = bound(g.upper.value, integral);\n const aboveLower = g.lower.inclusive ? x >= lo : x > lo;\n const belowUpper = g.upper.inclusive ? x <= hi : x < hi;\n return aboveLower && belowUpper;\n}\n\nexport interface CheckedInput {\n readonly module: string;\n readonly fn: FunctionSpec;\n readonly property: NamedProperty;\n /** The calls the simulator made, with their arguments. */\n readonly calls: readonly { readonly args: readonly unknown[] }[];\n /** The compiled predicate over the binders, or undefined when it could not be built. */\n readonly predicate: ((...binders: never[]) => PredicateOutcome) | undefined;\n /** Why the function's calls could not be observed, when they could not. */\n readonly unobservable?: string;\n}\n\nexport function checkedRung(input: CheckedInput): SpecVerdict {\n const { module, fn, property } = input;\n const base = { module, function: fn.name, property: property.name, text: property.text };\n const unknown = (\n cause: \"gave_up\" | \"unsupported\" | \"unavailable\",\n reason: string,\n ): SpecVerdict => ({\n ...base,\n kind: \"UNKNOWN\",\n cause,\n reason,\n assumptions: [],\n });\n if (input.unobservable)\n return unknown(\n \"unavailable\",\n `calls to ${fn.name} could not be observed: ${input.unobservable}`,\n );\n const predicate = input.predicate as ((...binders: unknown[]) => PredicateOutcome) | undefined;\n if (!predicate) return unknown(\"unavailable\", \"the property's predicate was not compiled\");\n const binders = property.property.binders;\n const positions: number[] = [];\n for (const b of binders) {\n const at = fn.params.indexOf(b.name);\n if (at < 0)\n return unknown(\n \"unsupported\",\n `binder ${b.name} is not a parameter of ${fn.name}, so the inputs the simulator passed do not determine it`,\n );\n positions.push(at);\n }\n const seen = new Set<string>();\n let held = 0;\n let discarded = 0;\n for (const call of input.calls) {\n const values = positions.map((p) => call.args[p]);\n const key = values.map(render).join(\", \");\n if (seen.has(key)) continue;\n seen.add(key);\n if (!binders.every((b, i) => inDomain(b, values[i]))) {\n discarded++;\n continue;\n }\n const counterexample = (error?: string): Counterexample => ({\n binders: binders.map((b, i) => ({ name: b.name, value: render(values[i]) })),\n call: `${fn.name}(${call.args.map(render).join(\", \")})`,\n ...(error === undefined ? {} : { error }),\n });\n let outcome: PredicateOutcome;\n try {\n outcome = predicate(...values);\n } catch (err) {\n // An atom that is not a boolean, or a name nothing defines, is a malformed property. Any other throw, the function's own\n // included (JSON.parse's SyntaxError, say), means the claim is not true there.\n // A ReferenceError, likewise: compiled TypeScript under test hardly throws one, a name the\n // property's scope analysis missed does, and that must never pass for a refutation.\n if (err instanceof AtomNotBoolean || err instanceof ReferenceError)\n return unknown(\"unsupported\", `the property could not be evaluated: ${String(err)}`);\n return {\n ...base,\n kind: \"REFUTED\",\n rung: \"CHECKED\",\n counterexample: counterexample(String(err)),\n assumptions: [],\n };\n }\n\n if (outcome === \"refuted\")\n return {\n ...base,\n kind: \"REFUTED\",\n rung: \"CHECKED\",\n counterexample: counterexample(),\n assumptions: [],\n };\n if (outcome === \"discarded\") discarded++;\n else held++;\n }\n if (held === 0)\n return unknown(\n \"gave_up\",\n input.calls.length === 0\n ? `the simulator never called ${fn.name}`\n : `none of the ${seen.size} distinct input(s) the simulator passed is inside the claim (domains, guards, preconditions)`,\n );\n return {\n ...base,\n kind: \"CHECKED\",\n inputs: held,\n discarded,\n assumptions: [\n `held on the ${held} distinct input(s) the simulator passed to ${fn.name}; inputs it never passed are not covered`,\n ],\n };\n}\n\n/** Verdicts for the markers the CHECKED rung cannot decide. */\nexport function markerVerdicts(module: string, fn: FunctionSpec): SpecVerdict[] {\n const out: SpecVerdict[] = [];\n const base = { module, function: fn.name, assumptions: [] };\n if (fn.total)\n out.push({\n ...base,\n property: \"@total\",\n text: \"@total\",\n kind: \"UNKNOWN\",\n cause: \"unsupported\",\n reason:\n \"termination is not observable on the inputs the simulator passed; @total needs a prover\",\n });\n if (fn.throws)\n out.push({\n ...base,\n property: \"@throws\",\n text: \"@throws\",\n kind: \"UNKNOWN\",\n cause: \"unsupported\",\n reason: \"Lemma has not fixed what @throws claims yet\",\n });\n return out;\n}\n\n/** Compiled predicates of a module, by function and property name. */\nexport interface ModulePredicates {\n readonly [fn: string]: { readonly [property: string]: (...binders: never[]) => PredicateOutcome };\n}\n\n/** Every spec verdict for one module, from what was observed of its calls. */\nexport function checkSpecModule(\n module: string,\n specs: ModuleSpecs,\n predicates: ModulePredicates,\n observed: {\n readonly calls: readonly { readonly function: string; readonly args: readonly unknown[] }[];\n readonly unobservable: { readonly [fn: string]: string };\n },\n): SpecVerdict[] {\n return specs.functions.flatMap((fn) => {\n const calls = observed.calls.filter((c) => c.function === fn.name);\n // Own properties only: a function named toString must not find Object.prototype's.\n const unobservable = Object.hasOwn(observed.unobservable, fn.name)\n ? observed.unobservable[fn.name]\n : undefined;\n const own = Object.hasOwn(predicates, fn.name) ? predicates[fn.name] : undefined;\n return [\n ...fn.ensures.map((property) =>\n checkedRung({\n module,\n fn,\n property,\n calls,\n predicate: own && Object.hasOwn(own, property.name) ? own[property.name] : undefined,\n ...(unobservable === undefined ? {} : { unobservable }),\n }),\n ),\n ...markerVerdicts(module, fn),\n ];\n });\n}\n"],"mappings":";;;;;;AAoDA,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,WACH,OAAO,WAAW,KAAK,IAAI,EAAE,eAAe,OAAO,EAAE,eAAe,QAAQ,UAAU,EAAE,eAAe,UAAU;EACnH,KAAK,WACH,OAAO,WAAW,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE;CAC7C;AACF;;ACrDA,MAAM,aAA0D;CAC9D,KAAK;CACL,SAAS;CACT,IAAI;CACJ,KAAK;CACL,KAAK;CACL,MAAM;CACN,UAAU;AACZ;AAEA,SAAS,UAAU,GAAkB;CACnC,IAAI,EAAE,SAAS,SAAS,OAAO,IAAI,EAAE,QAAQ,GAAG,EAAE;CAClD,OAAO,GAAG,EAAE,MAAM,YAAY,MAAM,MAAM,EAAE,MAAM,MAAM,IAAI,EAAE,MAAM,QAAQ,EAAE,MAAM,YAAY,MAAM;AACxG;AAEA,SAA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G,IAAI,IAC7D,SAAS,aAAa,GAAG,QACzB,KAAA;EACJ,MAAM,MAAM,OAAO,OAAO,YAAY,GAAG,IAAI,IAAI,WAAW,GAAG,QAAQ,KAAA;EACvE,OAAO,CACL,GAAG,GAAG,QAAQ,KAAK,aACjB,YAAY;GACV;GACA;GACA;GACA;GACA,WAAW,OAAO,OAAO,OAAO,KAAK,SAAS,IAAI,IAAI,IAAI,SAAS,QAAQ,KAAA;GAC3E,GAAI,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa;EACvD,CAAC,CACH,GACA,GAAG,eAAe,QAAQ,EAAE,CAC9B;CACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/spec-verdict.ts","../../spec/src/print.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 `@ensures` name, or `@total` / `@throws` for those markers. */\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","/**\n * Print SpecIR back as Lemma, canonically: glyph connectives, binders with\n * the same domain and guard grouped, and parentheses only where precedence\n * or a root-level material implication needs them. Parsing what it prints\n * gives the same IR.\n */\n\nimport type { Binder, Formula, Guard, Property } from \"./ir.ts\";\n\nconst precedence: { readonly [k in Formula[\"kind\"]]: number } = {\n iff: 1,\n implies: 2,\n or: 3,\n and: 4,\n not: 5,\n atom: 6,\n equation: 6,\n};\n\nfunction guardText(g: Guard): string {\n if (g.kind === \"regex\") return `/${g.pattern}/${g.flags}`;\n return `${g.lower.inclusive ? \"[\" : \"(\"}${g.lower.value}, ${g.upper.value}${g.upper.inclusive ? \"]\" : \")\"}`;\n}\n\nfunction sameGroup(a: Binder, b: Binder): boolean {\n return (\n a.domain === b.domain &&\n (a.guard === undefined) === (b.guard === undefined) &&\n (a.guard === undefined || (b.guard !== undefined && guardText(a.guard) === guardText(b.guard)))\n );\n}\n\nfunction prefixText(binders: readonly Binder[]): string {\n const groups: Binder[][] = [];\n for (const b of binders) {\n const last = groups[groups.length - 1];\n if (last && sameGroup(last[0] as Binder, b)) last.push(b);\n else groups.push([b]);\n }\n const text = groups.map((g) => {\n const head = g[0] as Binder;\n const guard = head.guard ? ` ∈ ${guardText(head.guard)}` : \"\";\n return `(${g.map((b) => b.name).join(\" \")}: ${head.domain}${guard})`;\n });\n return `forall ${text.join(\" \")}`;\n}\n\n/** Print a formula, parenthesized when its precedence is below `min`. */\nexport function printFormula(f: Formula, min = 0): string {\n let s: string;\n switch (f.kind) {\n case \"atom\":\n s = f.text;\n break;\n case \"equation\":\n s = `${f.left} ${f.negated ? \"≢\" : \"≡\"} ${f.right}`;\n break;\n case \"not\":\n s = `¬${printFormula(f.operand, precedence.not)}`;\n break;\n case \"and\":\n case \"or\":\n s = f.operands\n .map((o) => printFormula(o, precedence[f.kind] + 1))\n .join(f.kind === \"and\" ? \" ∧ \" : \" ∨ \");\n break;\n case \"implies\":\n s = [...f.antecedents, f.consequent].map((o) => printFormula(o, precedence.or)).join(\" → \");\n break;\n case \"iff\":\n s = `${printFormula(f.left, precedence.implies)} ↔ ${printFormula(f.right, precedence.implies)}`;\n break;\n }\n return precedence[f.kind] < min ? `(${s})` : s;\n}\n\n/** The property as Lemma text (what follows `@ensures{name}`). */\nexport function printProperty(p: Property): string {\n // A root implication is the preconditions; a material one there needs its parentheses.\n const body =\n p.requires.length > 0\n ? [...p.requires, p.claim].map((f) => printFormula(f, precedence.or)).join(\" → \")\n : printFormula(p.claim, p.claim.kind === \"implies\" ? precedence.or : 0);\n return `${prefixText(p.binders)} { ${body} }`;\n}\n"],"mappings":";;;;AA2FA,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,E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AAI,EAAE;GACN;EACF,KAAK;GACH,IAAI,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,MAAM,IAAI,GAAG,EAAE;GAC5C;EACF,KAAK;GACH,IAAI,IAAI,aAAa,EAAE,SAAS,WAAW,GAAG;GAC9C;EACF,KAAK;EACL,KAAK;GACH,IAAI,EAAE,SACH,KAAK,MAAM,aAAa,GAAG,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CACnD,KAAK,EAAE,SAAS,QAAQ,QAAQ,KAAK;GACxC;EACF,KAAK;GACH,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,KAAK,MAAM,aAAa,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK;GAC1F;EACF,KAAK,OACH,IAAI,GAAG,aAAa,EAAE,MAAM,WAAW,OAAO,EAAE,KAAK,aAAa,EAAE,OAAO,WAAW,OAAO;CAEjG;CACA,OAAO,WAAW,EAAE,QAAQ,MAAM,IAAI,EAAE,KAAK;AAC/C;;AAGA,SAAgB,cAAc,GAAqB;CAEjD,MAAM,OACJ,EAAE,SAAS,SAAS,IAChB,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,KAAK,MAAM,aAAa,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAC9E,aAAa,EAAE,OAAO,EAAE,MAAM,SAAS,YAAY,WAAW,KAAK,CAAC;CAC1E,OAAO,GAAG,WAAW,EAAE,OAAO,EAAE,KAAK,KAAK;AAC5C"}
|
|
@@ -24,34 +24,6 @@ interface EffectRecord {
|
|
|
24
24
|
interface EffectLog {
|
|
25
25
|
readonly entries: readonly EffectRecord[];
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
* `cut_off` is a crash that happens after a response or acknowledgement was
|
|
29
|
-
* already sent, so only background work (ctx.waitUntil) is lost; platforms
|
|
30
|
-
* offer it at the point where that work would start.
|
|
31
|
-
*/
|
|
32
|
-
type FaultKind = "crash_before" | "crash_after" | "ambiguous" | "error" | "cut_off";
|
|
33
|
-
interface FaultDecision {
|
|
34
|
-
/** The invocation the effect belongs to, e.g. "msg-1#2". */
|
|
35
|
-
readonly invocation: string;
|
|
36
|
-
/** Position of the effect within that invocation, from 0. Stable when other invocations are removed. */
|
|
37
|
-
readonly ordinal: number;
|
|
38
|
-
readonly fault: FaultKind;
|
|
39
|
-
/** What the effect was, for people reading the schedule. */
|
|
40
|
-
readonly target: string;
|
|
41
|
-
readonly op: string;
|
|
42
|
-
}
|
|
43
|
-
interface Schedule {
|
|
44
|
-
/** The per-run seed the decisions were drawn from. */
|
|
45
|
-
readonly seed: number;
|
|
46
|
-
readonly faults: readonly FaultDecision[];
|
|
47
|
-
/**
|
|
48
|
-
* The turn picked at each scheduling decision with more than one option,
|
|
49
|
-
* in order, as an index into the options (parked invocations by start
|
|
50
|
-
* order, then starting the next event). Absent: turns follow the seed.
|
|
51
|
-
* Exhaustive exploration records them, since it picks rather than draws.
|
|
52
|
-
*/
|
|
53
|
-
readonly turns?: readonly number[];
|
|
54
|
-
}
|
|
55
27
|
/** Picks effect records by target, op, kind and payload fields. */
|
|
56
28
|
interface EffectSelector {
|
|
57
29
|
readonly target: string;
|
|
@@ -66,24 +38,32 @@ interface EffectSelector {
|
|
|
66
38
|
readonly [path: string]: number;
|
|
67
39
|
};
|
|
68
40
|
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The shell follows the core. Calls to a pure core function are recorded as
|
|
43
|
+
* decisions (`Core:<function>` results, payload `{ args, result }`). Every
|
|
44
|
+
* selected effect must come after a decision of `decision` in its own
|
|
45
|
+
* invocation; the latest such decision is the one it carries out. With
|
|
46
|
+
* `follows`, the effect's payload agrees with that decision at each pair of
|
|
47
|
+
* paths. With `state`, the decision rests on the last `read` its invocation
|
|
48
|
+
* made before it (none is a violation), and no other invocation's `write`
|
|
49
|
+
* (to the same `key`, when given) commits between that read and the effect:
|
|
50
|
+
* otherwise the effect carried out a decision made on a stale read.
|
|
51
|
+
*/
|
|
52
|
+
interface Refines {
|
|
53
|
+
readonly kind: "refines";
|
|
80
54
|
readonly name: string;
|
|
55
|
+
/** The core function, as recorded. */
|
|
56
|
+
readonly decision: string;
|
|
81
57
|
readonly effect: EffectSelector;
|
|
82
|
-
readonly
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
58
|
+
readonly follows?: readonly {
|
|
59
|
+
readonly effect: string;
|
|
60
|
+
readonly decision: string;
|
|
61
|
+
}[];
|
|
62
|
+
readonly state?: {
|
|
63
|
+
readonly read: EffectSelector;
|
|
64
|
+
readonly write: EffectSelector;
|
|
65
|
+
/** Dot path into the read's and the writes' payloads naming the state they touch. */
|
|
66
|
+
readonly key?: string;
|
|
87
67
|
};
|
|
88
68
|
}
|
|
89
69
|
/** A condition on one column of a row. */
|
|
@@ -144,34 +124,40 @@ interface Unique {
|
|
|
144
124
|
readonly path: string;
|
|
145
125
|
}
|
|
146
126
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* `follows`, the effect's payload agrees with that decision at each pair of
|
|
152
|
-
* paths. With `state`, the decision rests on the last `read` its invocation
|
|
153
|
-
* made before it (none is a violation), and no other invocation's `write`
|
|
154
|
-
* (to the same `key`, when given) commits between that read and the effect:
|
|
155
|
-
* otherwise the effect carried out a decision made on a stale read.
|
|
127
|
+
* Every row the query returns is pointed at: some row of `in` has its
|
|
128
|
+
* `column` equal to the row's value at `path`, as with a foreign key. Rows
|
|
129
|
+
* where the value is absent or null are skipped. Catches orphans across two
|
|
130
|
+
* stores, e.g. "no stored object without the row that names it".
|
|
156
131
|
*/
|
|
157
|
-
interface
|
|
158
|
-
readonly kind: "
|
|
132
|
+
interface References {
|
|
133
|
+
readonly kind: "references";
|
|
134
|
+
readonly name: string;
|
|
135
|
+
readonly query: StateQuery;
|
|
136
|
+
readonly path: string;
|
|
137
|
+
readonly in: StateQuery;
|
|
138
|
+
readonly column: string;
|
|
139
|
+
}
|
|
140
|
+
/** No two selected effects share the same key. Catches duplicate writes. */
|
|
141
|
+
interface AtMostOncePerKey {
|
|
142
|
+
readonly kind: "atMostOncePerKey";
|
|
159
143
|
readonly name: string;
|
|
160
|
-
/** The core function, as recorded. */
|
|
161
|
-
readonly decision: string;
|
|
162
144
|
readonly effect: EffectSelector;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
145
|
+
/** Dot path into the payload that identifies the key. */
|
|
146
|
+
readonly key: string;
|
|
147
|
+
}
|
|
148
|
+
/** Every expected key appears in at least one selected effect. Catches lost work. */
|
|
149
|
+
interface AtLeastOnce {
|
|
150
|
+
readonly kind: "atLeastOnce";
|
|
151
|
+
readonly name: string;
|
|
152
|
+
readonly effect: EffectSelector;
|
|
153
|
+
readonly key: string;
|
|
154
|
+
readonly expected: readonly JsonValue[];
|
|
155
|
+
/** Set when `expected` was derived from the drive's message bodies, so it can be re-derived when messages are removed. */
|
|
156
|
+
readonly perMessage?: {
|
|
157
|
+
readonly bodyKey: string;
|
|
172
158
|
};
|
|
173
159
|
}
|
|
174
|
-
type Invariant = AtMostOncePerKey | AtLeastOnce | EveryRow | Implies | Unique | Refines;
|
|
160
|
+
type Invariant = AtMostOncePerKey | AtLeastOnce | EveryRow | Implies | Unique | References | Refines;
|
|
175
161
|
interface Violation {
|
|
176
162
|
readonly invariant: string;
|
|
177
163
|
readonly message: string;
|
|
@@ -182,6 +168,34 @@ interface Violation {
|
|
|
182
168
|
}
|
|
183
169
|
declare function checkInvariant(log: EffectLog, inv: Invariant): Violation | null;
|
|
184
170
|
declare function checkInvariants(log: EffectLog, invariants: readonly Invariant[]): readonly Violation[];
|
|
171
|
+
/**
|
|
172
|
+
* `cut_off` is a crash that happens after a response or acknowledgement was
|
|
173
|
+
* already sent, so only background work (ctx.waitUntil) is lost; platforms
|
|
174
|
+
* offer it at the point where that work would start.
|
|
175
|
+
*/
|
|
176
|
+
type FaultKind = "crash_before" | "crash_after" | "ambiguous" | "error" | "cut_off";
|
|
177
|
+
interface FaultDecision {
|
|
178
|
+
/** The invocation the effect belongs to, e.g. "msg-1#2". */
|
|
179
|
+
readonly invocation: string;
|
|
180
|
+
/** Position of the effect within that invocation, from 0. Stable when other invocations are removed. */
|
|
181
|
+
readonly ordinal: number;
|
|
182
|
+
readonly fault: FaultKind;
|
|
183
|
+
/** What the effect was, for people reading the schedule. */
|
|
184
|
+
readonly target: string;
|
|
185
|
+
readonly op: string;
|
|
186
|
+
}
|
|
187
|
+
interface Schedule {
|
|
188
|
+
/** The per-run seed the decisions were drawn from. */
|
|
189
|
+
readonly seed: number;
|
|
190
|
+
readonly faults: readonly FaultDecision[];
|
|
191
|
+
/**
|
|
192
|
+
* The turn picked at each scheduling decision with more than one option,
|
|
193
|
+
* in order, as an index into the options (parked invocations by start
|
|
194
|
+
* order, then starting the next event). Absent: turns follow the seed.
|
|
195
|
+
* Exhaustive exploration records them, since it picks rather than draws.
|
|
196
|
+
*/
|
|
197
|
+
readonly turns?: readonly number[];
|
|
198
|
+
}
|
|
185
199
|
/** Opaque, JSON-shaped data owned by a platform package. `kind` names its shape. */
|
|
186
200
|
interface PlatformData {
|
|
187
201
|
readonly kind: string;
|
|
@@ -315,14 +329,21 @@ interface Invocation {
|
|
|
315
329
|
/** What the engine offers a platform during one run. */
|
|
316
330
|
interface RunHooks {
|
|
317
331
|
/**
|
|
318
|
-
* Start tracking an invocation; it becomes the running one.
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* cannot take over the effects of the handler it was started during.
|
|
332
|
+
* Start tracking an invocation; it becomes the running one.
|
|
333
|
+
* @param options.bookkeeping Deprecated: use `bookkeeping()`. Tracks the
|
|
334
|
+
* invocation without it ever becoming the running one.
|
|
322
335
|
*/
|
|
323
336
|
startInvocation(id: string, options?: {
|
|
324
337
|
readonly bookkeeping?: boolean;
|
|
325
338
|
}): Invocation;
|
|
339
|
+
/**
|
|
340
|
+
* The invocation the platform's own actions are recorded under (a dead
|
|
341
|
+
* letter, a caller giving up, an end-of-run snapshot), started on first
|
|
342
|
+
* use in the run. No fault crashes it and it never becomes the running
|
|
343
|
+
* one, so it cannot take over the effects of the handler it was started
|
|
344
|
+
* during.
|
|
345
|
+
*/
|
|
346
|
+
bookkeeping(): string;
|
|
326
347
|
/** Perform an asynchronous effect under fault injection and record it. */
|
|
327
348
|
effect<T>(point: EffectPoint, perform: () => Promise<T>, summarize: (value: T) => JsonValue, options?: EffectOptions): Promise<T>;
|
|
328
349
|
/** Perform a synchronous effect under fault injection and record it. */
|
|
@@ -381,5 +402,5 @@ interface Platform {
|
|
|
381
402
|
/** Called when a run ends for any reason, after `finish` or after a failure: undo any per-run patching. */
|
|
382
403
|
cleanup?(spec: ScenarioSpec): Promise<void>;
|
|
383
404
|
}
|
|
384
|
-
export {
|
|
385
|
-
//# sourceMappingURL=platform-
|
|
405
|
+
export { StateQuery as C, EffectLog as D, EffectSelector as E, EffectRecord as O, RowCondition as S, Refines as T, checkInvariant as _, PlatformData as a, Implies as b, WorkerRef as c, FaultKind as d, Schedule as f, Violation as g, Invariant as h, ExternalDecl as i, JsonValue as k, validateScenario as l, AtMostOncePerKey as m, Platform as n, ScenarioSpec as o, AtLeastOnce as p, Bounds as r, ScriptedResponse as s, EventRef as t, FaultDecision as u, checkInvariants as v, Unique as w, References as x, EveryRow as y };
|
|
406
|
+
//# sourceMappingURL=platform-DfMwknw1.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-DfMwknw1.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/effect-log.ts","../../core/src/selectors.ts","../../core/src/refines.ts","../../core/src/state.ts","../../core/src/invariants.ts","../../core/src/faults.ts","../../core/src/scenario.ts","../../core/src/platform.ts"],"mappings":";;;;;KAMY,wDAKC;YACG,cAAc;;;KCDlB;UAEK;;WAEN;WACA,MAAM;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;UAGH;WACN,kBAAkB;;;UCtBZ;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;;;KAoBvB,YACR,mBACA,cACA,WACA,UACA,SACA,aACA;UAEa;WACN;WACA;;WAEA;;WAEA;;iBAYK,eAAe,KAAK,WAAW,KAAK,YAAY;iBAiDhD,gBACd,KAAK,WACL,qBAAqB,uBACX;;;;;;KC7HA;UAEK;;WAEN;;WAEA;WACA,OAAO;;WAEP;WACA;;UAGM;;WAEN;WACA,iBAAiB;;;;;;;WAOjB;;;UCxBM;WACN;YACC,cAAc;;;UAIT;WACN;WACA;;;UAIM;;WAEN;;WAEA;WACA;WACA;cAAsB;;;WAEtB,OAAO;;;;;;;UAQD;WACN;;WAEA;WACA;;;;;;aAME;;;WAGF,qBAAqB;;;UAIf;WACN;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