eutaxy 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/aws.d.mts +7 -5
- package/dist/aws.d.mts.map +1 -1
- package/dist/aws.mjs +41 -135
- package/dist/aws.mjs.map +1 -1
- package/dist/bin.mjs +2 -2
- package/dist/checked-CGpA2-F0.d.mts +285 -0
- package/dist/checked-CGpA2-F0.d.mts.map +1 -0
- package/dist/cli-IJrKkeYS.mjs +2 -0
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cloudflare.d.mts +232 -51
- package/dist/cloudflare.d.mts.map +1 -1
- package/dist/cloudflare.mjs +3 -1083
- package/dist/delivery-invariants-BraYqcYN.d.mts +5 -0
- package/dist/delivery-invariants-BraYqcYN.d.mts.map +1 -0
- package/dist/delivery-invariants-Cuxdna28.mjs +39 -0
- package/dist/delivery-invariants-Cuxdna28.mjs.map +1 -0
- package/dist/index.d.mts +66 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +81 -5
- package/dist/index.mjs.map +1 -0
- package/dist/{platform-TwATAkL3.d.mts → platform-DfMwknw1.d.mts} +179 -42
- package/dist/platform-DfMwknw1.d.mts.map +1 -0
- package/dist/src-Bqc9Eyb1.mjs +2655 -0
- package/dist/src-Bqc9Eyb1.mjs.map +1 -0
- package/dist/src-DKb-fkdb.mjs +3399 -0
- package/dist/src-DKb-fkdb.mjs.map +1 -0
- package/dist/src-Dxl9ZlKn.mjs +1752 -0
- package/dist/src-Dxl9ZlKn.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/cli-Dr-Ziogu.mjs +0 -2
- package/dist/cloudflare.mjs.map +0 -1
- package/dist/explore-YVHTRjjS.d.mts +0 -63
- package/dist/explore-YVHTRjjS.d.mts.map +0 -1
- package/dist/platform-TwATAkL3.d.mts.map +0 -1
- package/dist/src-BBXd0WEp.mjs +0 -117
- package/dist/src-BBXd0WEp.mjs.map +0 -1
- package/dist/src-BGdIBGkN.mjs +0 -311
- package/dist/src-BGdIBGkN.mjs.map +0 -1
- package/dist/src-Brt0dfNL.mjs +0 -1286
- package/dist/src-Brt0dfNL.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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-Dxl9ZlKn.mjs","names":["endsOperand","isPunct"],"sources":["../../spec/src/ir.ts","../../spec/src/tokens.ts","../../spec/src/parse.ts","../../spec/src/extract.ts","../../spec/src/predicate.ts","../../prover/src/checked.ts","../../core/src/verdict.ts","../../report/src/regression.ts","../../report/src/render.ts"],"sourcesContent":["/**\n * SpecIR: function specs as plain data. The surface syntax is Lemma\n * (https://github.com/jessealama/lemma-lang, grammar.ebnf and\n * semantics.md); the IR is Eutaxy's own, so engines and the simulator read\n * one shape whatever the annotation looked like. Leaves are opaque\n * TypeScript expressions, kept as written.\n */\n\n/** Lemma's binder domains. */\nexport type Domain = \"int\" | \"nat\" | \"number\" | \"boolean\" | \"string\" | \"bigint\";\n\nexport const domains: readonly Domain[] = [\"int\", \"nat\", \"number\", \"boolean\", \"string\", \"bigint\"];\n\n/**\n * One end of an interval: a numeric literal as written (sign included), or\n * `∞` / `-∞` for either infinity. `[` and `]` include the endpoint.\n */\nexport interface Endpoint {\n readonly value: string;\n readonly inclusive: boolean;\n}\n\n/** A binder's constraint: an interval for numeric domains, a whole-string regex for `string`. */\nexport type Guard =\n | { readonly kind: \"interval\"; readonly lower: Endpoint; readonly upper: Endpoint }\n | { readonly kind: \"regex\"; readonly pattern: string; readonly flags: string };\n\nexport interface Binder {\n readonly name: string;\n readonly domain: Domain;\n readonly guard?: Guard;\n}\n\n/**\n * A formula over boolean atoms. Atoms and equation sides are TypeScript\n * expressions, verbatim. `and` and `or` are n-ary (both are associative);\n * `implies` keeps Lemma's chain: every segment but the last is an\n * antecedent. An implication at a property's root is not a formula node but\n * the property's preconditions (`Property.requires`).\n */\nexport type Formula =\n | { readonly kind: \"atom\"; readonly text: string }\n | {\n readonly kind: \"equation\";\n readonly left: string;\n readonly right: string;\n /** `≢` rather than `≡`. */\n readonly negated: boolean;\n }\n | { readonly kind: \"not\"; readonly operand: Formula }\n | { readonly kind: \"and\" | \"or\"; readonly operands: readonly Formula[] }\n | {\n readonly kind: \"implies\";\n readonly antecedents: readonly Formula[];\n readonly consequent: Formula;\n }\n | { readonly kind: \"iff\"; readonly left: Formula; readonly right: Formula };\n\n/**\n * A universally quantified claim: for every assignment of the binders from\n * their (guarded) domains where every precondition holds, `claim` holds.\n * Assignments failing a precondition are outside the claim.\n */\nexport interface Property {\n readonly binders: readonly Binder[];\n readonly requires: readonly Formula[];\n readonly claim: Formula;\n}\n\n/** An `@ensures{name}` annotation. */\nexport interface NamedProperty {\n readonly name: string;\n readonly property: Property;\n /** The annotation's property text, as written. */\n readonly text: string;\n}\n\n/** The specs on one exported function. */\nexport interface FunctionSpec {\n readonly name: string;\n /** Parameter names in order; null for a destructured or rest parameter. */\n readonly params: readonly (string | null)[];\n readonly ensures: readonly NamedProperty[];\n /** `@total`: the function terminates on every input. */\n readonly total: boolean;\n /** `@throws`: the function throws (Lemma has not fixed its semantics yet). */\n readonly throws: boolean;\n /** 1-based line of the declaration. */\n readonly line: number;\n}\n\n/** A problem with an annotation, located in the module. */\nexport interface SpecError {\n readonly line: number;\n readonly message: string;\n}\n\n/** Every spec in one module, the names it exports, and the annotations that did not parse. */\nexport interface ModuleSpecs {\n readonly functions: readonly FunctionSpec[];\n readonly exports: readonly string[];\n readonly errors: readonly SpecError[];\n}\n","/**\n * A tokenizer shaped like TypeScript's scanner, which is how Lemma\n * tokenizes an annotation: glyphs inside string, template and regex\n * literals are text, never operators, and a template substitution nests.\n * It knows Lemma's operators besides JavaScript's punctuators; which ones\n * count where is the parser's business.\n */\n\nexport type TokenKind =\n | \"ident\"\n | \"number\"\n | \"string\"\n | \"template\"\n | \"regex\"\n | \"punct\"\n | \"op\"\n | \"comment\";\n\n/** Lemma operators, by canonical name. */\nexport type LemmaOp =\n | \"and\"\n | \"or\"\n | \"not\"\n | \"implies\"\n | \"iff\"\n | \"equiv\"\n | \"nequiv\"\n | \"neq\"\n | \"forall\"\n | \"exists\"\n | \"member\"\n | \"infinity\";\n\nexport interface Token {\n readonly kind: TokenKind;\n readonly text: string;\n /** Offsets into the scanned text: [start, end). */\n readonly start: number;\n readonly end: number;\n /** For kind \"op\". */\n readonly op?: LemmaOp;\n}\n\nconst glyphs: { readonly [glyph: string]: LemmaOp } = {\n \"∧\": \"and\",\n \"∨\": \"or\",\n \"¬\": \"not\",\n \"→\": \"implies\",\n \"↔\": \"iff\",\n \"≡\": \"equiv\",\n \"≢\": \"nequiv\",\n \"≠\": \"neq\",\n \"∀\": \"forall\",\n \"∃\": \"exists\",\n \"∈\": \"member\",\n \"∞\": \"infinity\",\n};\n\n/** ASCII spellings of Lemma connectives, longest first. */\nconst asciiOps: readonly (readonly [string, LemmaOp])[] = [\n [\"<->\", \"iff\"],\n [\"==>\", \"implies\"],\n [\"->\", \"implies\"],\n [\"\\\\/\", \"or\"],\n];\n\nconst punctuators = [\n \">>>=\",\n \"...\",\n \"===\",\n \"!==\",\n \"**=\",\n \"<<=\",\n \">>=\",\n \">>>\",\n \"&&=\",\n \"||=\",\n \"??=\",\n \"=>\",\n \"==\",\n \"!=\",\n \"<=\",\n \">=\",\n \"&&\",\n \"||\",\n \"??\",\n \"?.\",\n \"++\",\n \"--\",\n \"+=\",\n \"-=\",\n \"*=\",\n \"/=\",\n \"%=\",\n \"&=\",\n \"|=\",\n \"^=\",\n \"**\",\n \"<<\",\n \">>\",\n];\n\n/** Keywords after which a `/` starts a regular expression rather than a division. */\nconst regexAfter = new Set([\n \"in\",\n \"of\",\n \"typeof\",\n \"instanceof\",\n \"return\",\n \"new\",\n \"delete\",\n \"void\",\n \"case\",\n \"do\",\n \"else\",\n \"yield\",\n \"await\",\n]);\n\nconst identStart = /[\\p{ID_Start}$_]/u;\nconst identPart = /[\\p{ID_Continue}$]/u;\nconst numberAt =\n /^(?:0[xXoObB][0-9a-fA-F_]+n?|(?:\\d[\\d_]*(?:\\.[\\d_]*)?|\\.\\d[\\d_]*)(?:[eE][+-]?\\d[\\d_]*)?n?)/;\n\nexport class TokenizeError extends Error {}\n\n/** Keywords whose parenthesized condition is followed by a statement, not an operator. */\nconst controlKeywords = new Set([\"if\", \"while\", \"for\", \"with\"]);\n\n/**\n * Whether the code tokens up to `k` end an operand, so a `/` after them\n * divides. `conditions` holds the `)` that close a control statement's\n * condition (`if (x) /re/.test(s)`), after which a statement starts.\n */\nfunction endsOperand(\n tokens: readonly Token[],\n k: number,\n conditions: ReadonlySet<number>,\n blocks: ReadonlySet<number>,\n): boolean {\n while (k >= 0 && tokens[k]?.kind === \"comment\") k--;\n const t = tokens[k];\n if (!t) return false;\n switch (t.kind) {\n case \"ident\": {\n // After `.`, a word is a member name, whatever its spelling (`obj.in`).\n const before = tokens.slice(0, k).findLast((u) => u.kind !== \"comment\");\n if (before?.kind === \"punct\" && (before.text === \".\" || before.text === \"?.\")) return true;\n return !regexAfter.has(t.text);\n }\n case \"punct\":\n // After an operand, `!` (TypeScript's non-null assertion), `++` and `--` are postfix and end one too.\n if (t.text === \"!\" || t.text === \"++\" || t.text === \"--\")\n return endsOperand(tokens, k - 1, conditions, blocks);\n if (t.text === \")\") return !conditions.has(k);\n // A `}` closing a statement block ends no expression; one closing an object literal does.\n if (t.text === \"}\") return !blocks.has(k);\n return t.text === \"]\";\n case \"op\":\n return false;\n default:\n return true;\n }\n}\n\n/** The end of a quoted string starting at `i`. */\nfunction endOfString(text: string, i: number): number {\n const quote = text[i];\n for (let j = i + 1; j < text.length; j++) {\n const c = text[j];\n if (c === \"\\\\\") j++;\n else if (c === quote) return j + 1;\n else if (c === \"\\n\") break;\n }\n throw new TokenizeError(`unterminated string at offset ${i}`);\n}\n\n/** The end of the template literal starting at `i`, substitutions included. */\nfunction endOfTemplate(text: string, i: number): number {\n for (let j = i + 1; j < text.length; j++) {\n const c = text[j];\n if (c === \"\\\\\") j++;\n else if (c === \"`\") return j + 1;\n else if (c === \"$\" && text[j + 1] === \"{\") j = endOfSubstitution(text, j + 2) - 1;\n }\n throw new TokenizeError(`unterminated template literal at offset ${i}`);\n}\n\n/** The offset just past the `}` that closes a substitution whose body starts at `i`, scanned as code. */\nfunction endOfSubstitution(text: string, i: number): number {\n return scan(text, i, { untilBrace: true }).end;\n}\n\n/** The source of each `${…}` substitution in a template literal's text, outermost only. */\nexport function templateSubstitutions(template: string): string[] {\n const out: string[] = [];\n for (let j = 1; j < template.length; j++) {\n const c = template[j];\n if (c === \"\\\\\") j++;\n else if (c === \"$\" && template[j + 1] === \"{\") {\n const end = endOfSubstitution(template, j + 2);\n out.push(template.slice(j + 2, end - 1));\n j = end - 1;\n }\n }\n return out;\n}\n\n/** The end of the regex literal starting at `i`, flags included. */\nfunction endOfRegex(text: string, i: number): number {\n let inClass = false;\n for (let j = i + 1; j < text.length; j++) {\n const c = text[j];\n if (c === \"\\\\\") j++;\n else if (c === \"\\n\") break;\n else if (inClass) {\n if (c === \"]\") inClass = false;\n } else if (c === \"[\") inClass = true;\n else if (c === \"/\") {\n let k = j + 1;\n while (k < text.length && identPart.test(text[k] as string)) k++;\n return k;\n }\n }\n throw new TokenizeError(`unterminated regular expression at offset ${i}`);\n}\n\n/** Tokens of `text`; comments are dropped unless `comments` is set (then they are \"comment\" tokens). */\nexport function tokenize(text: string, options: { readonly comments?: boolean } = {}): Token[] {\n return scan(text, 0, options).tokens;\n}\n\n/**\n * Scan from `start`. With `untilBrace`, stop after the `}` that closes an\n * enclosing substitution (one not opened in the scanned code) and return\n * the offset after it.\n */\nfunction scan(\n text: string,\n start: number,\n options: { readonly comments?: boolean; readonly untilBrace?: boolean },\n): { tokens: Token[]; end: number } {\n const tokens: Token[] = [];\n const push = (kind: TokenKind, start: number, end: number, op?: LemmaOp): void => {\n tokens.push({ kind, text: text.slice(start, end), start, end, ...(op ? { op } : {}) });\n };\n // Comments are always tracked here, so regex detection can skip them; they are dropped at the end if unwanted.\n let braces = 0;\n // Open parentheses (true for a control statement's condition), and the `)` that closed a condition.\n const parens: boolean[] = [];\n const conditions = new Set<number>();\n // Open braces (true for a statement block), and the `}` that closed a block.\n const curlies: boolean[] = [];\n const blocks = new Set<number>();\n let i = start;\n while (i < text.length) {\n const c = text[i] as string;\n if (/\\s/u.test(c)) {\n i++;\n continue;\n }\n if (c === \"/\" && text[i + 1] === \"/\") {\n const from = i;\n while (i < text.length && text[i] !== \"\\n\") i++;\n push(\"comment\", from, i);\n continue;\n }\n if (c === \"/\" && text[i + 1] === \"*\") {\n const close = text.indexOf(\"*/\", i + 2);\n if (close < 0) throw new TokenizeError(`unterminated comment at offset ${i}`);\n push(\"comment\", i, close + 2);\n i = close + 2;\n continue;\n }\n const glyph = glyphs[c];\n if (glyph) {\n push(\"op\", i, i + 1, glyph);\n i++;\n continue;\n }\n const ascii = asciiOps.find(([s]) => text.startsWith(s, i));\n if (ascii) {\n push(\"op\", i, i + ascii[0].length, ascii[1]);\n i += ascii[0].length;\n continue;\n }\n if (c === \"/\") {\n if (!endsOperand(tokens, tokens.length - 1, conditions, blocks)) {\n const end = endOfRegex(text, i);\n push(\"regex\", i, end);\n i = end;\n continue;\n }\n if (text[i + 1] === \"\\\\\") {\n push(\"op\", i, i + 2, \"and\");\n i += 2;\n continue;\n }\n }\n if (c === '\"' || c === \"'\") {\n const end = endOfString(text, i);\n push(\"string\", i, end);\n i = end;\n continue;\n }\n if (c === \"`\") {\n const end = endOfTemplate(text, i);\n push(\"template\", i, end);\n i = end;\n continue;\n }\n const num = numberAt.exec(text.slice(i));\n if (num && (/\\d/.test(c) || (c === \".\" && /\\d/.test(text[i + 1] ?? \"\")))) {\n push(\"number\", i, i + num[0].length);\n i += num[0].length;\n continue;\n }\n if (identStart.test(c)) {\n let j = i + 1;\n while (j < text.length && identPart.test(text[j] as string)) j++;\n // Words (`forall`, `in`, `iff`, ...) stay identifiers: whether they are Lemma's depends on where.\n push(\"ident\", i, j);\n i = j;\n continue;\n }\n const p = punctuators.find((s) => text.startsWith(s, i)) ?? c;\n if (p === \"(\") {\n const before = tokens.findLast((t) => t.kind !== \"comment\");\n parens.push(before?.kind === \"ident\" && controlKeywords.has(before.text));\n } else if (p === \")\" && parens.pop()) conditions.add(tokens.length);\n if (p === \"{\") {\n const before = tokens.findLast((t) => t.kind !== \"comment\");\n curlies.push(\n before === undefined ||\n (before.kind === \"punct\" && [\")\", \"{\", \"}\", \";\", \"=>\"].includes(before.text)) ||\n (before.kind === \"ident\" && [\"else\", \"do\", \"try\", \"finally\"].includes(before.text)),\n );\n } else if (p === \"}\" && curlies.pop()) blocks.add(tokens.length);\n if (p === \"{\") braces++;\n if (p === \"}\" && braces-- === 0 && options.untilBrace) {\n return { tokens: keep(tokens, options), end: i + 1 };\n }\n push(\"punct\", i, i + p.length);\n i += p.length;\n }\n if (options.untilBrace)\n throw new TokenizeError(`unterminated template substitution at offset ${start}`);\n return { tokens: keep(tokens, options), end: i };\n}\n\nfunction keep(tokens: Token[], options: { readonly comments?: boolean }): Token[] {\n return options.comments ? tokens : tokens.filter((t) => t.kind !== \"comment\");\n}\n","/**\n * The Lemma `@ensures` property parser: grammar.ebnf of lemma-lang, with\n * the side conditions it states on atoms. A property is a quantifier\n * prefix and a braced formula body; the body's structure (connectives,\n * equations, grouping) is Lemma, and its leaves are TypeScript expressions\n * kept verbatim. Validation that needs the enclosing module (free\n * identifiers exported) is left to whoever evaluates the leaves.\n */\n\nimport {\n type Binder,\n type Domain,\n domains,\n type Endpoint,\n type Formula,\n type Guard,\n type Property,\n} from \"./ir.ts\";\nimport {\n type LemmaOp,\n type Token,\n TokenizeError,\n templateSubstitutions,\n tokenize,\n} from \"./tokens.ts\";\n\n/** A property that is not Lemma. `stage` says which part rejected it. */\nexport class LemmaSyntaxError extends Error {\n readonly stage: \"prefix\" | \"formula\";\n constructor(stage: \"prefix\" | \"formula\", message: string) {\n super(message);\n this.stage = stage;\n }\n}\n\nconst numeric = new Set<Domain>([\"int\", \"nat\", \"number\", \"bigint\"]);\n\nconst literalSyntax: { readonly [d in Domain]?: RegExp } = {\n int: /^[+-]?\\d[\\d_]*$/,\n nat: /^[+-]?\\d[\\d_]*$/,\n bigint: /^[+-]?\\d[\\d_]*n?$/,\n number: /^[+-]?(?:\\d[\\d_]*(?:\\.[\\d_]*)?|\\.\\d[\\d_]*)(?:[eE][+-]?\\d+)?$/,\n};\n\nconst assignments = new Set([\n \"=\",\n \"+=\",\n \"-=\",\n \"*=\",\n \"/=\",\n \"%=\",\n \"**=\",\n \"<<=\",\n \">>=\",\n \">>>=\",\n \"&=\",\n \"|=\",\n \"^=\",\n \"&&=\",\n \"||=\",\n \"??=\",\n]);\n\n/** Parse the text after `@ensures{name}`. Throws LemmaSyntaxError. */\nexport function parseProperty(text: string): Property {\n let tokens: Token[];\n try {\n tokens = tokenize(text);\n } catch (err) {\n if (err instanceof TokenizeError) throw new LemmaSyntaxError(\"formula\", err.message);\n throw err;\n }\n const prefix = new Prefix(tokens);\n const binders = prefix.parse();\n const body = new Body(text, tokens, prefix.at);\n return { binders, ...body.parse() };\n}\n\nconst isOp = (t: Token | undefined, op: LemmaOp): boolean => t?.kind === \"op\" && t.op === op;\nconst isPunct = (t: Token | undefined, p: string): boolean => t?.kind === \"punct\" && t.text === p;\n\nclass Prefix {\n readonly tokens: readonly Token[];\n at = 0;\n constructor(tokens: readonly Token[]) {\n this.tokens = tokens;\n }\n\n private fail(message: string): never {\n throw new LemmaSyntaxError(\"prefix\", message);\n }\n\n private peek(): Token | undefined {\n return this.tokens[this.at];\n }\n\n private next(what: string): Token {\n const t = this.tokens[this.at++];\n if (!t) this.fail(`expected ${what}, found the end of the annotation`);\n return t;\n }\n\n parse(): Binder[] {\n const first = this.next(\"forall\");\n if (isOp(first, \"exists\") || (first.kind === \"ident\" && first.text === \"exists\")) {\n this.fail(\n \"existential quantifiers are not Lemma: sampling cannot confirm that something exists, so state the property with forall\",\n );\n }\n if (!(isOp(first, \"forall\") || (first.kind === \"ident\" && first.text === \"forall\")))\n this.fail(`a property starts with forall, not ${JSON.stringify(first.text)}`);\n const binders: Binder[] = [];\n while (isPunct(this.peek(), \"(\")) binders.push(...this.group());\n if (binders.length === 0) this.fail(\"forall needs at least one binder group, as in (x: int)\");\n const seen = new Set<string>();\n for (const b of binders) {\n if (seen.has(b.name)) this.fail(`${b.name} is bound twice`);\n seen.add(b.name);\n }\n if (!isPunct(this.peek(), \"{\"))\n this.fail(\"expected { to open the property body after the binders\");\n return binders;\n }\n\n private group(): Binder[] {\n this.next(\"(\");\n const names: string[] = [];\n while (this.peek()?.kind === \"ident\") names.push(this.next(\"a name\").text);\n const colon = this.next(\":\");\n if (!isPunct(colon, \":\")) {\n this.fail(\n names.length === 0\n ? \"a binder group needs at least one name before the colon, as in (x: int)\"\n : `expected : before the domain, found ${JSON.stringify(colon.text)}`,\n );\n }\n if (names.length === 0)\n this.fail(\"a binder group needs at least one name before the colon, as in (x: int)\");\n for (const n of names)\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n))\n this.fail(`${JSON.stringify(n)} is not a binder name`);\n const d = this.next(\"a domain\");\n if (d.kind !== \"ident\" || !(domains as readonly string[]).includes(d.text))\n this.fail(`${JSON.stringify(d.text)} is not a Lemma domain (one of ${domains.join(\", \")})`);\n const domain = d.text as Domain;\n let guard: Guard | undefined;\n const member = this.peek();\n if (isOp(member, \"member\") || (member?.kind === \"ident\" && member.text === \"in\")) {\n this.at++;\n guard = this.guard(domain);\n }\n const close = this.next(\")\");\n if (!isPunct(close, \")\"))\n this.fail(`expected ) to close the binder group, found ${JSON.stringify(close.text)}`);\n return names.map((name) => ({ name, domain, ...(guard ? { guard } : {}) }));\n }\n\n private guard(domain: Domain): Guard {\n const t = this.peek();\n if (t?.kind === \"regex\") {\n this.at++;\n if (domain !== \"string\") this.fail(`a regex guard applies to string, not ${domain}`);\n const slash = t.text.lastIndexOf(\"/\");\n const pattern = t.text.slice(1, slash);\n const flags = t.text.slice(slash + 1);\n if (!/^[su]*$/.test(flags) || new Set(flags).size !== flags.length)\n this.fail(`a regex guard takes only the s and u flags, not ${JSON.stringify(flags)}`);\n try {\n new RegExp(`^(?:${pattern})$`, flags);\n } catch (err) {\n this.fail(`the regex guard does not compile: ${String(err)}`);\n }\n return { kind: \"regex\", pattern, flags };\n }\n if (!numeric.has(domain))\n this.fail(`an interval guard applies to numeric domains only, not ${domain}`);\n const open = this.next(\"[ or (\");\n if (!(isPunct(open, \"[\") || isPunct(open, \"(\")))\n this.fail(`expected an interval or a regex after ∈, found ${JSON.stringify(open.text)}`);\n const lower = this.endpoint(domain, isPunct(open, \"[\"));\n const comma = this.next(\",\");\n if (!isPunct(comma, \",\"))\n this.fail(`expected , between the interval's endpoints, found ${JSON.stringify(comma.text)}`);\n const upperValue = this.endpointValue(domain);\n const close = this.next(\"] or )\");\n if (isPunct(close, \",\")) this.fail(\"an interval has exactly two endpoints\");\n if (!(isPunct(close, \"]\") || isPunct(close, \")\")))\n this.fail(`expected ] or ) to close the interval, found ${JSON.stringify(close.text)}`);\n const upper: Endpoint = { value: upperValue, inclusive: isPunct(close, \"]\") };\n this.checkInterval(domain, lower, upper);\n return { kind: \"interval\", lower, upper };\n }\n\n private endpoint(domain: Domain, inclusive: boolean): Endpoint {\n return { value: this.endpointValue(domain), inclusive };\n }\n\n private endpointValue(domain: Domain): string {\n let sign = \"\";\n const s = this.peek();\n if (isPunct(s, \"-\") || isPunct(s, \"+\")) {\n this.at++;\n sign = s?.text === \"-\" ? \"-\" : \"\";\n }\n const t = this.next(\"an endpoint\");\n if (isOp(t, \"infinity\") || (t.kind === \"ident\" && t.text === \"Infinity\")) return `${sign}∞`;\n if (t.kind !== \"number\") this.fail(`${JSON.stringify(t.text)} is not an interval endpoint`);\n const value = `${sign}${t.text}`;\n const syntax = literalSyntax[domain];\n if (syntax && !syntax.test(value)) this.fail(`${value} is not a ${domain} literal`);\n return value;\n }\n\n private checkInterval(domain: Domain, lower: Endpoint, upper: Endpoint): void {\n const integral = domain !== \"number\";\n for (const e of [lower, upper])\n if (e.value.endsWith(\"∞\") && e.inclusive && integral)\n this.fail(`an ∞ endpoint must be exclusive for ${domain}`);\n if (lower.value === \"∞\") this.fail(\"the lower endpoint cannot be +∞\");\n if (upper.value === \"-∞\") this.fail(\"the upper endpoint cannot be -∞\");\n // Integer literals compare exactly (a double would merge neighbours beyond 2^53).\n const exact = (v: string): number | bigint =>\n integral && !v.endsWith(\"∞\")\n ? BigInt(v.replace(/_/g, \"\").replace(/n$/, \"\"))\n : endpointNumber(v);\n const lo = exact(lower.value);\n const hi = exact(upper.value);\n if (lo > hi || (lo === hi && !(lower.inclusive && upper.inclusive)))\n this.fail(`the interval from ${lower.value} to ${upper.value} is empty`);\n }\n}\n\n/** An endpoint's value for ordering: exact for integer literals, as a double otherwise. */\nexport function endpointNumber(value: string): number {\n if (value === \"∞\") return Number.POSITIVE_INFINITY;\n if (value === \"-∞\") return Number.NEGATIVE_INFINITY;\n return Number(value.replace(/_/g, \"\").replace(/n$/, \"\"));\n}\n\nconst connectives = new Set<LemmaOp>([\"and\", \"or\", \"not\", \"implies\", \"iff\"]);\n\nclass Body {\n private readonly text: string;\n private readonly tokens: readonly Token[];\n private readonly open: number;\n /** Per token of the body: how many brackets enclose it inside the body braces. */\n private readonly depth = new Map<number, number>();\n /** Bracket matches, both ways. */\n private readonly match = new Map<number, number>();\n /** Per token: the innermost enclosing opening bracket, or -1. */\n private readonly enclosing = new Map<number, number>();\n\n constructor(text: string, tokens: readonly Token[], open: number) {\n this.text = text;\n this.tokens = tokens;\n this.open = open;\n }\n\n private fail(message: string): never {\n throw new LemmaSyntaxError(\"formula\", message);\n }\n\n parse(): { requires: Formula[]; claim: Formula } {\n const pairs: { [close: string]: string } = { \")\": \"(\", \"]\": \"[\", \"}\": \"{\" };\n const stack: number[] = [];\n let close = -1;\n for (let i = this.open; i < this.tokens.length; i++) {\n const t = this.tokens[i] as Token;\n this.depth.set(i, stack.length - 1);\n this.enclosing.set(i, stack[stack.length - 1] ?? -1);\n if (t.kind !== \"punct\") continue;\n if (t.text === \"(\" || t.text === \"[\" || t.text === \"{\") stack.push(i);\n else if (pairs[t.text]) {\n const o = stack.pop();\n if (o === undefined || this.tokens[o]?.text !== pairs[t.text])\n this.fail(`unbalanced ${t.text} in the property body`);\n this.match.set(o, i);\n this.match.set(i, o);\n if (stack.length === 0) {\n close = i;\n break;\n }\n }\n }\n if (close < 0) this.fail(\"the property body is not closed with }\");\n if (close !== this.tokens.length - 1)\n this.fail(\"the } closing the property body must be the annotation's last token\");\n const s = this.open + 1;\n const e = close;\n if (s >= e) this.fail(\"the property body is empty\");\n const grouped = isPunct(this.tokens[s], \"(\") && this.match.get(s) === e - 1;\n const f = this.formula(s, e, 0);\n if (!grouped && f.kind === \"implies\")\n return { requires: [...f.antecedents], claim: f.consequent };\n return { requires: [], claim: f };\n }\n\n private at(i: number, base: number): boolean {\n return this.depth.get(i) === base;\n }\n\n /** Base-level positions of tokens satisfying `pred` in [s, e). */\n private split(\n s: number,\n e: number,\n base: number,\n pred: (t: Token, i: number) => boolean,\n ): number[] {\n const out: number[] = [];\n for (let i = s; i < e; i++)\n if (this.at(i, base) && pred(this.tokens[i] as Token, i)) out.push(i);\n return out;\n }\n\n private segments(s: number, e: number, cuts: readonly number[]): [number, number][] {\n const out: [number, number][] = [];\n let from = s;\n for (const c of cuts) {\n out.push([from, c]);\n from = c + 1;\n }\n out.push([from, e]);\n return out;\n }\n\n private formula(s: number, e: number, base: number): Formula {\n if (s >= e) this.fail(\"a connective is missing an operand\");\n // The word iff is the connective, except as a member name (`api.iff`).\n const iff = this.split(s, e, base, (t, i) => {\n if (t.op === \"iff\") return true;\n const prev = this.tokens[i - 1];\n return t.kind === \"ident\" && t.text === \"iff\" && !isPunct(prev, \".\") && !isPunct(prev, \"?.\");\n });\n if (iff.length > 1) this.fail(\"↔ is non-associative: parenthesize a ↔ b ↔ c\");\n if (iff.length === 1) {\n const k = iff[0] as number;\n return { kind: \"iff\", left: this.formula(s, k, base), right: this.formula(k + 1, e, base) };\n }\n const implies = this.split(s, e, base, (t) => t.op === \"implies\");\n if (implies.length > 0) {\n const parts = this.segments(s, e, implies).map(([a, b]) => this.formula(a, b, base));\n return {\n kind: \"implies\",\n antecedents: parts.slice(0, -1),\n consequent: parts[parts.length - 1] as Formula,\n };\n }\n for (const kind of [\"or\", \"and\"] as const) {\n const cuts = this.split(s, e, base, (t) => t.op === kind);\n if (cuts.length > 0)\n return {\n kind,\n operands: this.segments(s, e, cuts).map(([a, b]) => this.formula(a, b, base)),\n };\n }\n if (isOp(this.tokens[s], \"not\")) return { kind: \"not\", operand: this.formula(s + 1, e, base) };\n if (isPunct(this.tokens[s], \"(\") && this.match.get(s) === e - 1)\n return this.formula(s + 1, e - 1, base + 1);\n return this.atom(s, e, base);\n }\n\n private slice(s: number, e: number): string {\n return this.text\n .slice((this.tokens[s] as Token).start, (this.tokens[e - 1] as Token).end)\n .trim();\n }\n\n private atom(s: number, e: number, base: number): Formula {\n const equations: number[] = [];\n for (let i = s; i < e; i++) {\n const t = this.tokens[i] as Token;\n const prev = i > s ? this.tokens[i - 1] : undefined;\n this.checkToken(t, prev);\n if (t.kind === \"op\") {\n if (t.op === \"equiv\" || t.op === \"nequiv\") {\n if (!this.at(i, base))\n this.fail(\n `${t.text} only joins an atom's two sides; in nested positions call Object.is`,\n );\n equations.push(i);\n } else if (connectives.has(t.op as LemmaOp))\n this.fail(\n `${t.text} inside a JavaScript expression: use && || ! there, or parenthesize the whole formula`,\n );\n else this.fail(`${t.text} belongs in a binder group, not the property body`);\n }\n if (t.kind !== \"punct\") continue;\n if (assignments.has(t.text) && !this.inParameterList(i))\n this.fail(`assignments are not allowed in a property (${t.text})`);\n if (!this.at(i, base)) continue;\n if (t.text === \"&&\" || t.text === \"||\")\n this.fail(`${t.text} at an atom's top level: use ${t.text === \"&&\" ? \"∧\" : \"∨\"}`);\n if (t.text === \"!\" && !endsOperand(prev)) this.fail(\"prefix ! at an atom's top level: use ¬\");\n }\n if (equations.length > 1) this.fail(\"≡ is non-associative: write a ≡ b ∧ b ≡ c\");\n if (equations.length === 0) return { kind: \"atom\", text: this.slice(s, e) };\n const k = equations[0] as number;\n for (let i = s; i < e; i++) {\n const t = this.tokens[i] as Token;\n if (\n this.at(i, base) &&\n t.kind === \"punct\" &&\n [\"??\", \"?\", \"===\", \"!==\", \",\", \"=>\"].includes(t.text)\n )\n this.fail(`${t.text} beside an equation is ambiguous: parenthesize the side it belongs to`);\n }\n if (k === s || k === e - 1)\n this.fail(`${this.tokens[k]?.text} needs an expression on both sides`);\n return {\n kind: \"equation\",\n left: this.slice(s, k),\n right: this.slice(k + 1, e),\n negated: this.tokens[k]?.op === \"nequiv\",\n };\n }\n\n /**\n * What no position in a property allows, for one token of an atom or of\n * an expression nested in one: ≠, quantifiers, loose equality; a\n * template's substitutions are nested expressions under the same rules.\n */\n private checkToken(t: Token, prev: Token | undefined): void {\n if (t.kind === \"op\") {\n if (t.op === \"neq\") this.fail(\"≠ is not Lemma: write ≢ (not the same value) or !==\");\n if (t.op === \"forall\" || t.op === \"exists\") this.fail(\"quantifiers nest only in the prefix\");\n }\n if (\n t.kind === \"ident\" &&\n (t.text === \"forall\" || t.text === \"exists\") &&\n !isPunct(prev, \".\") &&\n !isPunct(prev, \"?.\")\n )\n this.fail(\"quantifiers nest only in the prefix\");\n if (t.kind === \"template\") for (const sub of templateSubstitutions(t.text)) this.nested(sub);\n if (t.kind === \"punct\" && (t.text === \"==\" || t.text === \"!=\"))\n this.fail(`loose ${t.text} is not allowed: use ≡ / ≢ or === / !==`);\n }\n\n /** Check an expression nested in an atom (a template substitution): what no position allows. */\n private nested(text: string): void {\n let tokens: Token[];\n try {\n tokens = tokenize(text);\n } catch (err) {\n if (err instanceof TokenizeError) this.fail(err.message);\n throw err;\n }\n const stack: number[] = [];\n const enclosing: number[] = [];\n const match = new Map<number, number>();\n tokens.forEach((t, i) => {\n enclosing.push(stack[stack.length - 1] ?? -1);\n if (t.kind !== \"punct\") return;\n if (t.text === \"(\" || t.text === \"[\" || t.text === \"{\") stack.push(i);\n else if (t.text === \")\" || t.text === \"]\" || t.text === \"}\") {\n const o = stack.pop();\n if (o !== undefined) match.set(o, i);\n }\n });\n tokens.forEach((t, i) => {\n this.checkToken(t, tokens[i - 1]);\n if (t.kind === \"op\") {\n if (t.op === \"equiv\" || t.op === \"nequiv\")\n this.fail(`${t.text} only joins an atom's two sides; in nested positions call Object.is`);\n this.fail(\n `${t.text} inside a JavaScript expression: use && || ! there, or parenthesize the whole formula`,\n );\n }\n if (t.kind !== \"punct\") return;\n if (assignments.has(t.text)) {\n const open = enclosing[i] ?? -1;\n const close = open >= 0 ? match.get(open) : undefined;\n const defaultValue =\n t.text === \"=\" &&\n isPunct(tokens[open], \"(\") &&\n close !== undefined &&\n isPunct(tokens[close + 1], \"=>\");\n if (!defaultValue) this.fail(`assignments are not allowed in a property (${t.text})`);\n }\n });\n }\n\n /** A default initializer: `=` directly inside the parentheses of an arrow function's parameters. */\n private inParameterList(i: number): boolean {\n if (this.tokens[i]?.text !== \"=\") return false;\n const open = this.enclosing.get(i) ?? -1;\n if (open < 0 || !isPunct(this.tokens[open], \"(\")) return false;\n const close = this.match.get(open);\n return close !== undefined && isPunct(this.tokens[close + 1], \"=>\");\n }\n}\n\n/** Whether a token ends an operand, so a `!` after it is postfix (non-null assertion). */\nfunction endsOperand(t: Token | undefined): boolean {\n if (!t) return false;\n if (t.kind === \"punct\") return t.text === \")\" || t.text === \"]\" || t.text === \"}\";\n return t.kind !== \"op\";\n}\n","/**\n * Find the Lemma annotations in a TypeScript module: JSDoc blocks with\n * `@ensures{name}`, `@total` or `@throws` on exported function\n * declarations, where Lemma says they attach. A tag counts at the start of\n * a JSDoc line; an `@ensures` property runs to the next tag or the end of\n * the comment. Also lists the module's exported value names, which are the\n * free identifiers a property may use.\n */\n\nimport type { FunctionSpec, ModuleSpecs, NamedProperty, SpecError } from \"./ir.ts\";\nimport { LemmaSyntaxError, parseProperty } from \"./parse.ts\";\nimport { type Token, TokenizeError, tokenize } from \"./tokens.ts\";\n\nconst tagLine = /^@(\\w+)(?:\\{([^}]*)\\})?/;\n\ninterface Tag {\n readonly name: string;\n readonly label: string | undefined;\n readonly text: string;\n readonly line: number;\n}\n\n/** The JSDoc's tags, each with its text up to the next tag. */\nfunction tags(comment: Token, lineOf: (offset: number) => number): Tag[] {\n const body = comment.text.slice(3, -2);\n const first = lineOf(comment.start);\n const out: { name: string; label: string | undefined; lines: string[]; line: number }[] = [];\n body.split(\"\\n\").forEach((raw, i) => {\n const line = raw.replace(/^\\s*\\*?\\s?/, \"\");\n const m = tagLine.exec(line.trimStart());\n if (m) {\n out.push({\n name: m[1] as string,\n label: m[2],\n lines: [line.trimStart().slice(m[0].length)],\n line: first + i,\n });\n } else out[out.length - 1]?.lines.push(line);\n });\n return out.map((t) => ({\n name: t.name,\n label: t.label,\n text: t.lines.join(\"\\n\").trim(),\n line: t.line,\n }));\n}\n\nconst isWord = (t: Token | undefined, w: string): boolean => t?.kind === \"ident\" && t.text === w;\nconst isPunct = (t: Token | undefined, p: string): boolean => t?.kind === \"punct\" && t.text === p;\n\n/** `export [async] function [*] name(` at `i`: the name and the index of `(`. */\nfunction functionAt(tokens: readonly Token[], i: number): { name: string; open: number } | null {\n if (!isWord(tokens[i], \"export\")) return null;\n let j = i + 1;\n if (isWord(tokens[j], \"async\")) j++;\n if (!isWord(tokens[j], \"function\")) return null;\n j++;\n if (isPunct(tokens[j], \"*\")) j++;\n const name = tokens[j];\n if (name?.kind !== \"ident\") return null;\n j++;\n if (isPunct(tokens[j], \"<\")) j = skipAngles(tokens, j);\n return isPunct(tokens[j], \"(\") ? { name: name.text, open: j } : null;\n}\n\n/** The index after the `>` closing the type parameters opened at `i`. */\nfunction skipAngles(tokens: readonly Token[], i: number): number {\n let depth = 0;\n for (let j = i; j < tokens.length; j++) {\n const t = tokens[j] as Token;\n if (t.kind !== \"punct\") continue;\n if (t.text === \"<\") depth++;\n else if (t.text === \">\" || t.text === \">>\" || t.text === \">>>\") {\n depth -= t.text.length;\n if (depth <= 0) return j + 1;\n }\n }\n return tokens.length;\n}\n\n/**\n * Parameter names of the list opened at `open`; null for destructured and\n * rest parameters. `ambiguous` when a default value has a top-level `<` or\n * `>`: a comparison or a generic call's type arguments (`pair<A, B>()`),\n * which a token scan cannot tell apart, and guessing wrong would bind a\n * binder to another parameter's argument.\n */\nfunction params(\n tokens: readonly Token[],\n open: number,\n): { names: (string | null)[]; ambiguous: boolean } {\n const firsts: Token[] = [];\n let depth = 0;\n let start = true;\n // Angle brackets are type arguments only in a parameter's type annotation, not its default value.\n let inType = false;\n let inDefault = false;\n let ambiguous = false;\n for (let j = open + 1; j < tokens.length; j++) {\n const t = tokens[j] as Token;\n if (depth === 0 && isPunct(t, \")\")) break;\n if (start) firsts.push(t);\n start = false;\n if (t.kind !== \"punct\") continue;\n if (inDefault && depth === 0 && /^(<|>)/.test(t.text) && t.text !== \">=\" && t.text !== \"<=\")\n ambiguous = true;\n if ([\"(\", \"[\", \"{\"].includes(t.text) || (inType && t.text === \"<\")) depth++;\n else if ([\")\", \"]\", \"}\"].includes(t.text)) depth--;\n // Closing type arguments: `>`, or `>>` closing two.\n else if (inType && /^>+$/.test(t.text)) depth -= t.text.length;\n else if (depth === 0 && t.text === \":\") inType = true;\n else if (depth === 0 && t.text === \"=\") {\n inType = false;\n inDefault = true;\n } else if (t.text === \",\" && depth === 0) {\n start = true;\n inType = false;\n inDefault = false;\n }\n }\n // A `this` parameter is a type annotation only, not an argument.\n const names = firsts\n .filter((t) => !isWord(t, \"this\"))\n .map((t) => (t.kind === \"ident\" ? t.text : null));\n return { names, ambiguous };\n}\n\n/** Names the module exports as values (not types). */\nfunction exportedNames(tokens: readonly Token[]): string[] {\n const names = new Set<string>();\n for (let i = 0; i < tokens.length; i++) {\n if (!isWord(tokens[i], \"export\")) continue;\n let j = i + 1;\n if (isWord(tokens[j], \"declare\")) j++;\n if (isWord(tokens[j], \"default\")) continue;\n if (isWord(tokens[j], \"async\")) j++;\n if (isWord(tokens[j], \"abstract\")) j++;\n const kw = tokens[j];\n if ([\"function\", \"class\", \"enum\"].some((w) => isWord(kw, w))) {\n let k = j + 1;\n if (isPunct(tokens[k], \"*\")) k++;\n if (tokens[k]?.kind === \"ident\") names.add((tokens[k] as Token).text);\n } else if ([\"const\", \"let\", \"var\"].some((w) => isWord(kw, w))) {\n // Every name declared at this declaration's top level: `export const a = 1, b = 2`.\n let depth = 0;\n let expectName = true;\n for (let k = j + 1; k < tokens.length; k++) {\n const t = tokens[k] as Token;\n if (expectName && depth === 0 && t.kind === \"ident\") names.add(t.text);\n expectName = false;\n if (t.kind !== \"punct\") continue;\n if ([\"(\", \"[\", \"{\"].includes(t.text)) depth++;\n else if ([\")\", \"]\", \"}\"].includes(t.text)) depth--;\n else if (t.text === \",\" && depth === 0) expectName = true;\n else if (t.text === \";\" && depth === 0) break;\n if (depth < 0) break;\n }\n } else if (isPunct(kw, \"{\")) {\n const close = tokens.findIndex((t, k) => k > j && isPunct(t, \"}\"));\n if (close < 0 || isWord(tokens[close + 1], \"from\")) continue;\n for (let k = j + 1; k < close; k++) {\n const t = tokens[k] as Token;\n if (t.kind !== \"ident\" || isWord(tokens[k - 1], \"type\")) continue;\n if (isWord(tokens[k + 1], \"as\")) continue;\n if (isWord(t, \"as\") || isWord(t, \"type\")) continue;\n names.add(t.text);\n }\n }\n }\n return [...names];\n}\n\nexport function extractSpecs(source: string): ModuleSpecs {\n const starts = [0];\n for (let i = 0; i < source.length; i++) if (source[i] === \"\\n\") starts.push(i + 1);\n const lineOf = (offset: number): number => {\n let lo = 0;\n let hi = starts.length - 1;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if ((starts[mid] as number) <= offset) lo = mid;\n else hi = mid - 1;\n }\n return lo + 1;\n };\n let all: Token[];\n try {\n all = tokenize(source, { comments: true });\n } catch (err) {\n if (err instanceof TokenizeError)\n return { functions: [], exports: [], errors: [{ line: 1, message: err.message }] };\n throw err;\n }\n const code = all.filter((t) => t.kind !== \"comment\");\n const indexOf = new Map(code.map((t, i) => [t, i]));\n const errors: SpecError[] = [];\n const functions: FunctionSpec[] = [];\n all.forEach((comment, i) => {\n if (comment.kind !== \"comment\" || !comment.text.startsWith(\"/**\")) return;\n const found = tags(comment, lineOf).filter((t) =>\n [\"ensures\", \"total\", \"throws\"].includes(t.name),\n );\n if (found.length === 0) return;\n const next = all.slice(i + 1).find((t) => t.kind !== \"comment\");\n const decl = next ? functionAt(code, indexOf.get(next) ?? -1) : null;\n if (!decl) {\n errors.push({\n line: found[0]?.line ?? lineOf(comment.start),\n message: \"Lemma annotations attach to an exported function declaration\",\n });\n return;\n }\n const ensures: NamedProperty[] = [];\n for (const t of found) {\n if (t.name !== \"ensures\") continue;\n const name = t.label?.trim();\n if (!name) {\n errors.push({\n line: t.line,\n message: \"@ensures needs a name, as in @ensures{non-negative}\",\n });\n continue;\n }\n if (ensures.some((e) => e.name === name)) {\n errors.push({ line: t.line, message: `${decl.name} has two properties named ${name}` });\n continue;\n }\n try {\n ensures.push({ name, property: parseProperty(t.text), text: t.text });\n } catch (err) {\n if (!(err instanceof LemmaSyntaxError)) throw err;\n errors.push({ line: t.line, message: `@ensures{${name}} on ${decl.name}: ${err.message}` });\n }\n }\n if (functions.some((f) => f.name === decl.name)) {\n // Overloads: each declaration's binders could differ, and a property is checked against one signature.\n errors.push({\n line: lineOf((code[decl.open] as Token).start),\n message: `${decl.name} is annotated on more than one declaration (overloads): put its annotations on one`,\n });\n return;\n }\n const signature = params(code, decl.open);\n if (signature.ambiguous)\n errors.push({\n line: lineOf((code[decl.open] as Token).start),\n message: `cannot tell the parameters of ${decl.name} apart: a default value has a top-level < or >; parenthesize it`,\n });\n functions.push({\n name: decl.name,\n params: signature.names,\n ensures,\n total: found.some((t) => t.name === \"total\"),\n throws: found.some((t) => t.name === \"throws\"),\n line: lineOf((code[decl.open] as Token).start),\n });\n });\n return { functions, exports: exportedNames(code), errors };\n}\n","/**\n * A property as TypeScript source: an arrow function from the binders to\n * \"held\", \"discarded\" (a precondition failed, so the assignment is outside\n * the claim) or \"refuted\". Atoms are the islands as written, each checked to\n * be a genuine boolean by a helper the surrounding module defines; `≡` is\n * `Object.is`. The source is code to compile, not to `eval`: runtimes such\n * as workerd refuse dynamic code.\n */\n\nimport type { Domain, Formula, Property } from \"./ir.ts\";\nimport { type Token, templateSubstitutions, tokenize } from \"./tokens.ts\";\n\n/** The outcome a predicate returns for one assignment. */\nexport type PredicateOutcome = \"held\" | \"discarded\" | \"refuted\";\n\nconst tsType: { readonly [d in Domain]: string } = {\n int: \"number\",\n nat: \"number\",\n number: \"number\",\n boolean: \"boolean\",\n string: \"string\",\n bigint: \"bigint\",\n};\n\n/** Names in the surrounding generated module that the predicate's source refers to. */\nexport interface PredicateHelpers {\n /** Returns its argument when it is a boolean, throws a TypeError otherwise. */\n readonly bool: string;\n /** `Object.is`. */\n readonly same: string;\n /** The annotated module's namespace: where a property's free identifiers come from. */\n readonly scope: string;\n /** Throws for the free names that neither the namespace nor the globals define. */\n readonly unresolved: string;\n}\n\n/** Words that cannot name a binding. */\nconst reserved = new Set(\n \"await break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield arguments eval\".split(\n \" \",\n ),\n);\n\nfunction islands(f: Formula): string[] {\n switch (f.kind) {\n case \"atom\":\n return [f.text];\n case \"equation\":\n return [f.left, f.right];\n case \"not\":\n return islands(f.operand);\n case \"and\":\n case \"or\":\n return f.operands.flatMap(islands);\n case \"implies\":\n return [...f.antecedents, f.consequent].flatMap(islands);\n case \"iff\":\n return [...islands(f.left), ...islands(f.right)];\n }\n}\n\n/** Names an arrow function binds, over the tokens of its parameters and body. */\ninterface ArrowScope {\n readonly names: ReadonlySet<string>;\n readonly from: number;\n readonly to: number;\n}\n\n/**\n * Indices of the tokens that are TypeScript type positions or binding\n * names, not references, and the scopes arrow functions bind names in.\n */\nfunction notReferences(tokens: readonly Token[]): { skip: Set<number>; scopes: ArrowScope[] } {\n const skip = new Set<number>();\n const scopes: ArrowScope[] = [];\n const match = new Map<number, number>();\n const stack: number[] = [];\n /** Per token, the innermost open bracket around it, or -1. */\n const enclosing: number[] = [];\n tokens.forEach((t, i) => {\n enclosing.push(stack[stack.length - 1] ?? -1);\n if (t.kind !== \"punct\") return;\n if (t.text === \"(\" || t.text === \"[\" || t.text === \"{\") stack.push(i);\n else if (t.text === \")\" || t.text === \"]\" || t.text === \"}\") {\n const o = stack.pop();\n if (o !== undefined) match.set(o, i);\n }\n });\n const is = (k: number, text: string) => tokens[k]?.kind === \"punct\" && tokens[k]?.text === text;\n /** The last token of an arrow body starting at `k`: a block, or an expression up to a top-level `,` or close. */\n const bodyEnd = (k: number): number => {\n if (is(k, \"{\")) return match.get(k) ?? tokens.length - 1;\n let depth = 0;\n for (let m = k; m < tokens.length; m++) {\n const u = tokens[m] as Token;\n if (u.kind !== \"punct\") continue;\n if (u.text === \"(\" || u.text === \"[\" || u.text === \"{\") depth++;\n else if (u.text === \")\" || u.text === \"]\" || u.text === \"}\") {\n if (depth === 0) return m - 1;\n depth--;\n } else if (u.text === \",\" && depth === 0) return m - 1;\n }\n return tokens.length - 1;\n };\n /**\n * The index just after a type starting at `k`: names, dots, brackets,\n * unions and intersections, and type arguments, but a `<` only when its\n * `>` closes before anything that cannot be in a type (else it compares).\n */\n const typeEnd = (k: number): number => {\n const typeish = (u: Token | undefined, angles: number) =>\n u !== undefined &&\n (u.kind === \"ident\" ||\n u.kind === \"string\" ||\n u.kind === \"number\" ||\n (u.kind === \"punct\" && [\".\", \"[\", \"]\", \"|\", \"&\"].includes(u.text)) ||\n (angles > 0 &&\n u.kind === \"punct\" &&\n [\",\", \"(\", \")\", \"=>\", \":\", \"{\", \"}\", \";\"].includes(u.text)));\n let m = k;\n while (m < tokens.length) {\n const u = tokens[m] as Token;\n if (u.kind === \"punct\" && u.text === \"<\") {\n let angles = 0;\n let n = m;\n for (; n < tokens.length; n++) {\n const w = tokens[n] as Token;\n if (w.kind === \"punct\" && w.text === \"<\") angles++;\n else if (w.kind === \"punct\" && /^>+$/.test(w.text)) {\n angles -= w.text.length;\n if (angles <= 0) break;\n } else if (!typeish(w, angles)) break;\n }\n if (angles > 0 || n >= tokens.length || !/^>+$/.test((tokens[n] as Token).text)) return m;\n m = n + 1;\n continue;\n }\n if (!typeish(u, 0)) return m;\n m++;\n }\n return m;\n };\n /** After the `)` of a parameter list at `close`: an optional `: ReturnType`, then the index of what follows. */\n const afterReturnType = (close: number): number => {\n if (!is(close + 1, \":\")) return close + 1;\n const end = typeEnd(close + 2);\n for (let m = close + 2; m < end; m++) skip.add(m);\n return end;\n };\n /**\n * The names a parameter list from `open` to `close` binds, skipping them and\n * their type annotations. A `:` directly in the list starts a type; inside a\n * destructuring pattern it renames (`{ a: b }` binds b).\n */\n const parameters = (open: number, close: number): Set<string> => {\n const names = new Set<string>();\n const nesting: string[] = [];\n let inType = false;\n // Inside a default value (`v = limit`, `{ a = f(b) }`): references, not names, until it ends.\n let inDefault = false;\n let defaultDepth = 0;\n for (let k = open + 1; k < close; k++) {\n const u = tokens[k] as Token;\n if (inDefault) {\n if (u.kind !== \"punct\") continue;\n if (u.text === \"(\" || u.text === \"[\" || u.text === \"{\") {\n defaultDepth++;\n continue;\n }\n if ((u.text === \")\" || u.text === \"]\" || u.text === \"}\") && defaultDepth > 0) {\n defaultDepth--;\n continue;\n }\n if (\n defaultDepth > 0 ||\n !(u.text === \",\" || u.text === \")\" || u.text === \"]\" || u.text === \"}\")\n )\n continue;\n inDefault = false; // The default ends at a `,` or the pattern's close, handled below.\n }\n if (u.kind === \"punct\") {\n if (!inType && u.text === \"=\") {\n inDefault = true;\n defaultDepth = 0;\n continue;\n }\n if (inType) {\n if (u.text === \"(\" || u.text === \"[\" || u.text === \"{\" || u.text === \"<\")\n nesting.push(u.text);\n else if (nesting.length > 0 && [\")\", \"]\", \"}\"].includes(u.text)) nesting.pop();\n else if (nesting.length > 0 && /^>+$/.test(u.text)) nesting.splice(-u.text.length);\n else if (nesting.length === 0 && u.text === \",\") inType = false;\n else if (nesting.length === 0 && u.text === \"=\") {\n inType = false;\n inDefault = true;\n defaultDepth = 0;\n }\n continue;\n }\n if (u.text === \"{\" || u.text === \"[\") nesting.push(u.text);\n else if (u.text === \"}\" || u.text === \"]\") nesting.pop();\n else if (u.text === \":\" && nesting.length === 0) inType = true;\n continue;\n }\n if (inType) {\n skip.add(k);\n continue;\n }\n if (u.kind !== \"ident\") continue;\n const prev = tokens[k - 1];\n const next = tokens[k + 1];\n // In a pattern, a key followed by `:` is renamed; the name after the `:` is bound.\n if (nesting.length > 0 && next?.kind === \"punct\" && next.text === \":\") {\n skip.add(k);\n continue;\n }\n if (prev?.kind === \"punct\" && [\"(\", \",\", \"...\", \"{\", \"[\", \":\"].includes(prev.text)) {\n names.add(u.text);\n skip.add(k);\n }\n }\n return names;\n };\n tokens.forEach((t, i) => {\n if (t.kind === \"ident\" && is(i + 1, \"=>\")) {\n skip.add(i); // x => …\n scopes.push({ names: new Set([t.text]), from: i, to: bodyEnd(i + 2) });\n }\n const close = is(i, \"(\") ? match.get(i) : undefined;\n const arrow = close === undefined ? -1 : afterReturnType(close);\n if (close !== undefined && is(arrow, \"=>\")) {\n scopes.push({ names: parameters(i, close), from: i, to: bodyEnd(arrow + 1) });\n }\n if (t.kind === \"ident\" && is(i + 1, \"(\") && (is(i - 1, \"{\") || is(i - 1, \",\"))) {\n // { name(a) { … } }: an object method, named like a key, binding its parameters in its body.\n const end = match.get(i + 1);\n const body = end === undefined ? -1 : afterReturnType(end);\n if (end !== undefined && is(body, \"{\")) {\n skip.add(i);\n scopes.push({\n names: parameters(i + 1, end),\n from: i + 1,\n to: match.get(body) ?? tokens.length - 1,\n });\n }\n }\n if (t.kind === \"ident\" && t.text === \"for\" && is(i + 1, \"(\")) {\n // for (const y of xs) …, for (const k in o) …: the head's names are the loop's.\n const end = match.get(i + 1);\n const decl = tokens[i + 2];\n if (\n end !== undefined &&\n decl?.kind === \"ident\" &&\n [\"const\", \"let\", \"var\"].includes(decl.text)\n ) {\n const names = new Set<string>();\n for (let k = i + 3; k < end; k++) {\n const u = tokens[k] as Token;\n if (u.kind === \"ident\" && (u.text === \"of\" || u.text === \"in\")) {\n skip.add(k);\n break;\n }\n if (u.kind === \"ident\" && !is(k + 1, \":\")) {\n names.add(u.text);\n skip.add(k);\n }\n }\n const body = end + 1;\n const to = is(body, \"{\") ? (match.get(body) ?? tokens.length - 1) : bodyEnd(body);\n scopes.push({ names, from: i, to });\n }\n }\n if (t.kind === \"ident\" && t.text === \"catch\" && is(i + 1, \"(\")) {\n // catch (err) { … }: the binding is the following block's.\n const end = match.get(i + 1);\n if (end !== undefined && is(end + 1, \"{\"))\n scopes.push({\n names: parameters(i + 1, end),\n from: i + 1,\n to: match.get(end + 1) ?? tokens.length - 1,\n });\n }\n if (t.kind === \"ident\" && t.text === \"function\") {\n // function [name](a, b) { … }: its parameters are bound in it. A declaration (in statement\n // position) binds its name in the enclosing block; an expression's name only in itself.\n const named = tokens[i + 1]?.kind === \"ident\";\n const statement = i === 0 || [\"{\", \"}\", \";\"].some((p) => is(i - 1, p));\n if (named && statement) {\n const open = enclosing[i] ?? -1;\n skip.add(i + 1);\n scopes.push({\n names: new Set([(tokens[i + 1] as Token).text]),\n from: open,\n to: open >= 0 ? (match.get(open) ?? tokens.length - 1) : tokens.length - 1,\n });\n }\n const open = named ? i + 2 : i + 1;\n const end = is(open, \"(\") ? match.get(open) : undefined;\n const body = end === undefined ? -1 : afterReturnType(end);\n if (end !== undefined && is(body, \"{\")) {\n const names = parameters(open, end);\n if (named) {\n names.add((tokens[i + 1] as Token).text);\n skip.add(i + 1);\n }\n scopes.push({ names, from: i, to: match.get(body) ?? tokens.length - 1 });\n }\n }\n if (t.kind === \"ident\" && is(i + 1, \":\") && (is(i - 1, \"{\") || is(i - 1, \",\"))) skip.add(i); // { key: … }\n if (t.kind === \"ident\" && (t.text === \"as\" || t.text === \"satisfies\")) {\n // The operator and the type after it.\n skip.add(i);\n for (let k = i + 1; k < typeEnd(i + 1); k++) skip.add(k);\n }\n if (t.kind === \"ident\" && is(i + 1, \"<\")) {\n // f<A, B>(…): a generic call's type arguments, only when they read as a type and a call follows.\n const end = typeEnd(i + 1);\n if (end > i + 1 && is(end, \"(\")) for (let m = i + 2; m < end; m++) skip.add(m);\n }\n });\n return { skip, scopes };\n}\n\n/**\n * Identifiers the islands refer to from outside: not after a `.`, not a\n * binder, not an object key, an arrow function's parameter or a type. What\n * is left may still over-approximate (a `function` expression's parameter),\n * which only costs a binding the inner name shadows.\n */\nexport function freeNames(p: Property): string[] {\n const bound = new Set(p.binders.map((b) => b.name));\n const names = new Set<string>();\n // `outer`: names bound where the text sits, for a template substitution inside an arrow.\n const scan = (text: string, outer: ReadonlySet<string>): void => {\n const tokens = tokenize(text);\n const { skip, scopes } = notReferences(tokens);\n // A name an arrow function binds is its own inside that function.\n const local = (n: string, i: number) =>\n scopes.some((sc) => sc.names.has(n) && sc.from <= i && i <= sc.to);\n tokens.forEach((t, i) => {\n // A template's substitutions are expressions too.\n if (t.kind === \"template\") {\n const inScope = new Set(outer);\n for (const sc of scopes)\n if (sc.from <= i && i <= sc.to) for (const n of sc.names) inScope.add(n);\n for (const sub of templateSubstitutions(t.text)) scan(sub, inScope);\n }\n const prev = tokens[i - 1];\n if (\n t.kind !== \"ident\" ||\n skip.has(i) ||\n bound.has(t.text) ||\n reserved.has(t.text) ||\n outer.has(t.text) ||\n local(t.text, i)\n )\n return;\n if (prev?.kind === \"punct\" && (prev.text === \".\" || prev.text === \"?.\")) return;\n names.add(t.text);\n });\n };\n for (const text of [...p.requires, p.claim].flatMap(islands)) scan(text, new Set());\n return [...names];\n}\n\nfunction expression(f: Formula, h: { bool: string; same: string }): string {\n switch (f.kind) {\n case \"atom\":\n return `${h.bool}((${f.text}))`;\n case \"equation\":\n return `${f.negated ? \"!\" : \"\"}${h.same}((${f.left}), (${f.right}))`;\n case \"not\":\n return `!${expression(f.operand, h)}`;\n case \"and\":\n case \"or\":\n return `(${f.operands.map((o) => expression(o, h)).join(f.kind === \"and\" ? \" && \" : \" || \")})`;\n case \"implies\":\n return `(!(${f.antecedents.map((a) => expression(a, h)).join(\" && \")}) || ${expression(f.consequent, h)})`;\n case \"iff\":\n return `(${expression(f.left, h)} === ${expression(f.right, h)})`;\n }\n}\n\n/**\n * The predicate's source: an expression evaluating to the arrow function.\n * It takes the helpers as parameters under names fresh for this property,\n * so no binder or identifier in it can shadow them, and binds each free\n * name from the module's namespace when it has it, else from the globals,\n * which is the scope Lemma gives a property (re-exports included).\n */\nexport function predicateSource(p: Property, helpers: PredicateHelpers): string {\n // The globals that name fixed values, and `globalThis` itself, are never rebound.\n const free = freeNames(p).filter(\n (n) => ![\"globalThis\", \"undefined\", \"NaN\", \"Infinity\"].includes(n),\n );\n const taken = new Set([...p.binders.map((b) => b.name), ...free, \"globalThis\"]);\n const fresh = (base: string): string => {\n let name = base;\n while (taken.has(name)) name = `${name}$`;\n taken.add(name);\n return name;\n };\n const local = {\n bool: fresh(\"__bool\"),\n same: fresh(\"__same\"),\n scope: fresh(\"__scope\"),\n unresolved: fresh(\"__unresolved\"),\n missing: fresh(\"__missing\"),\n };\n const params = p.binders.map((b) => `${b.name}: ${tsType[b.domain]}`).join(\", \");\n const lines = [\n `((${local.bool}: (v: unknown) => boolean, ${local.same}: (a: unknown, b: unknown) => boolean, ${local.scope}: any, ${local.unresolved}: (names: string[]) => never) => {`,\n ` const ${local.missing}: string[] = [];`,\n // A name the module does not have comes from the globals (`globalThis` itself is never rebound);\n // one neither defines is noted, and evaluating the property then throws rather than reading undefined.\n ...free.map((n) => {\n const k = JSON.stringify(n);\n return ` const ${n} = ${k} in ${local.scope} ? ${local.scope}[${k}] : ${k} in globalThis ? (globalThis as any)[${k}] : (${local.missing}.push(${k}), undefined);`;\n }),\n ` return (${params}): \"held\" | \"discarded\" | \"refuted\" => {`,\n ` if (${local.missing}.length > 0) ${local.unresolved}(${local.missing});`,\n ...p.requires.map((r) => ` if (!${expression(r, local)}) return \"discarded\";`),\n ` return ${expression(p.claim, local)} ? \"held\" : \"refuted\";`,\n \" };\",\n `})(${helpers.bool}, ${helpers.same}, ${helpers.scope}, ${helpers.unresolved})`,\n ];\n return lines.join(\"\\n\");\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","/** Simulation verdicts, with what each one rests on. */\n\nimport type { EffectLog } from \"./effect-log.ts\";\nimport type { Schedule } from \"./faults.ts\";\nimport type { Violation } from \"./invariants.ts\";\nimport type { Bounds } from \"./scenario.ts\";\n\nexport interface BoundsReached {\n readonly runs: number;\n readonly effectPoints: number;\n readonly faultsInjected: number;\n readonly elapsedMs: number;\n /**\n * Present when exploration was exhaustive: how many distinct schedules ran\n * (runs that only repeated an order the reduction had covered are not\n * counted), and whether every schedule within the bounds was reached\n * before the budget ran out.\n */\n readonly exhaustive?: {\n readonly complete: boolean;\n readonly schedules: number;\n readonly reduction: boolean;\n };\n}\n\ninterface VerdictBase {\n readonly scenario: string;\n readonly seed: number | string;\n readonly reached: BoundsReached;\n readonly assumptions: readonly string[];\n}\n\nexport interface Shrunk {\n readonly faultsRemoved: number;\n readonly eventsRemoved: number;\n readonly runs: number;\n}\n\nexport interface Violated extends VerdictBase {\n readonly kind: \"VIOLATED\";\n readonly violation: Violation;\n /** The replayed, shrunk trace that breaks the invariant. */\n readonly trace: EffectLog;\n readonly schedule: Schedule;\n /** Ids of the drive's events that remain after shrinking. */\n readonly keptEvents: readonly string[];\n readonly shrunk: Shrunk;\n}\n\nexport interface Bounded extends VerdictBase {\n readonly kind: \"BOUNDED\";\n readonly bounds: Bounds;\n}\n\nexport type UnsupportedCause =\n | \"unsupported_api\"\n | \"not_replayable\"\n | \"module_state_leak\"\n | \"unsupported_bounds\";\n\nexport interface Unsupported extends VerdictBase {\n readonly kind: \"UNSUPPORTED\";\n readonly cause: UnsupportedCause;\n readonly reason: string;\n}\n\nexport type ScenarioVerdict = Violated | Bounded | Unsupported;\n\n/** One line per verdict, for error messages; full rendering lives in `report`. */\nexport function describeVerdict(v: ScenarioVerdict): string {\n switch (v.kind) {\n case \"VIOLATED\":\n return `VIOLATED ${v.scenario}: ${v.violation.message} (seed ${v.schedule.seed}, ${v.reached.runs} run(s))`;\n case \"BOUNDED\":\n return `BOUNDED ${v.scenario}: no violation in ${v.reached.runs} run(s), ${v.reached.effectPoints} effect point(s), ${v.reached.faultsInjected} fault(s)`;\n case \"UNSUPPORTED\":\n return `UNSUPPORTED ${v.scenario}: ${v.cause}: ${v.reason}`;\n }\n}\n","/**\n * The Vitest regression emitter. Given a violation, produce a test file that\n * replays its shrunk schedule on the restricted scenario. By default the\n * test expects the invariants to hold, so it fails while the bug exists and\n * passes once it is fixed. With `expect: \"violates\"` it asserts the recorded\n * violation instead, which is how Eutaxy's own corpus exercises the emitter.\n *\n * The emitter knows nothing about any platform: the caller supplies the\n * import lines and the expression that builds the platform.\n */\n\nimport { canonicalJson, type JsonValue, type Violated } from \"@eutaxy/core\";\n\nexport interface RegressionTestOptions {\n /** Import lines for the scenario, the platform's dependencies, and anything the platform expression needs. */\n readonly imports: readonly string[];\n /** An expression evaluating to the `Platform` (may reference the imports). */\n readonly platform: string;\n /** An expression evaluating to the `ScenarioSpec`. */\n readonly scenario: string;\n /** Module that exports `replay`, `restrictSpec` and `checkInvariants`; the public facade by default. */\n readonly engineModule?: string;\n readonly expect?: \"holds\" | \"violates\";\n /**\n * Core functions to observe during the replay, as `refines` needs their\n * decisions in the log: an expression for each module's namespace (from\n * the imports) and the functions to observe on it.\n */\n readonly observe?: readonly {\n readonly namespace: string;\n readonly functions: readonly string[];\n }[];\n}\n\nexport function emitRegressionTest(verdict: Violated, options: RegressionTestOptions): string {\n const engineModule = options.engineModule ?? \"eutaxy\";\n const mode = options.expect ?? \"holds\";\n const schedule = canonicalJson(verdict.schedule as unknown as JsonValue);\n const kept = canonicalJson([...verdict.keptEvents]);\n const keys = canonicalJson([...verdict.violation.keys]);\n const title =\n mode === \"holds\"\n ? `${verdict.scenario}: ${verdict.violation.invariant} holds on the recorded schedule`\n : `${verdict.scenario}: ${verdict.violation.invariant} is still violated on the recorded schedule`;\n const assertion =\n mode === \"holds\"\n ? ` expect(violations.map((v) => \\`\\${v.invariant}: \\${v.message}\\`)).toEqual([]);`\n : ` expect(violations.map((v) => [v.invariant, v.keys])).toContainEqual([${JSON.stringify(verdict.violation.invariant)}, ${keys}]);`;\n const observe = options.observe ?? [];\n const replayLines =\n observe.length === 0\n ? [\" const log = await replay(spec, platform, schedule);\"]\n : [\n ` const observers = [${observe.map((o) => `observeCore(${o.namespace}, ${JSON.stringify(o.functions)})`).join(\", \")}];`,\n \" const log = await replay(spec, platform, schedule).finally(() => {\",\n \" for (const o of observers) o.restore();\",\n \" });\",\n ];\n const lines = [\n \"// Generated by Eutaxy. Replays a recorded violation; regenerate rather than edit.\",\n `// Scenario ${verdict.scenario}, seed ${String(verdict.seed)}: ${verdict.violation.message}`,\n `import { checkInvariants, ${observe.length > 0 ? \"observeCore, \" : \"\"}replay, restrictSpec } from ${JSON.stringify(engineModule)};`,\n ...options.imports,\n 'import { expect, test } from \"vitest\";',\n \"\",\n `const schedule = ${schedule} as const;`,\n `const keptEvents = ${kept} as const;`,\n \"\",\n `test(${JSON.stringify(title)}, async () => {`,\n ` const platform = ${options.platform};`,\n ` const spec = restrictSpec(platform, ${options.scenario}, keptEvents);`,\n ...replayLines,\n \" const violations = checkInvariants(log, spec.invariants);\",\n assertion,\n \"});\",\n \"\",\n ];\n return lines.join(\"\\n\");\n}\n","/**\n * Rendering verdicts: a text form for people and a versioned JSON form for\n * CI and coding agents. Both are pure functions over the verdict data.\n */\n\nimport {\n canonicalJson,\n type EffectLog,\n type JsonValue,\n type ScenarioVerdict,\n type SpecVerdict,\n} from \"@eutaxy/core\";\n\nexport const reportSchemaVersion = 1;\n\n/**\n * The JSON report: one object, canonical, with a schema version at the top.\n * Spec verdicts, when there are any, sit beside the scenario's, never in it.\n */\nexport function renderJson(verdict: ScenarioVerdict, specs: readonly SpecVerdict[] = []): string {\n return canonicalJson({\n schemaVersion: reportSchemaVersion,\n generator: \"eutaxy\",\n verdict: verdict as unknown as JsonValue,\n ...(specs.length > 0 ? { specs: specs as unknown as JsonValue } : {}),\n });\n}\n\n/** Spec verdicts as text: one line each, a counterexample under a refutation. */\nexport function renderSpecs(specs: readonly SpecVerdict[]): string {\n if (specs.length === 0) return \"\";\n const out = [\"Specs (CHECKED means held on the inputs the simulator passed; it is not a proof)\"];\n for (const v of specs) {\n const what = `${v.function} ${v.property}`;\n switch (v.kind) {\n case \"CHECKED\":\n out.push(\n ` CHECKED ${what}: held on ${v.inputs} input(s)${v.discarded > 0 ? `, ${v.discarded} outside the claim` : \"\"}`,\n );\n break;\n case \"REFUTED\": {\n const c = v.counterexample;\n out.push(\n ` REFUTED ${what}: false at ${c.call}${c.error ? `, which threw ${c.error}` : \"\"}`,\n );\n out.push(` ${c.binders.map((b) => `${b.name} = ${b.value}`).join(\", \")}`);\n out.push(` ${v.text.replace(/\\s+/g, \" \")}`);\n break;\n }\n case \"UNKNOWN\":\n out.push(` UNKNOWN ${what}: ${v.cause}: ${v.reason}`);\n break;\n }\n }\n return out.join(\"\\n\");\n}\n\nfunction clip(s: string, max: number): string {\n return s.length <= max ? s : `${s.slice(0, max - 1)}…`;\n}\n\nfunction pad(s: string, width: number): string {\n return s.length >= width ? s : s + \" \".repeat(width - s.length);\n}\n\n/** The trace as a fixed-width table; evidence rows are marked with `*`. */\nexport function renderTrace(log: EffectLog, evidence: readonly number[] = []): string {\n const rows = log.entries.map((e) => [\n evidence.includes(e.seq) ? \"*\" : \" \",\n String(e.seq),\n e.invocation,\n e.kind,\n e.target,\n e.op,\n clip(canonicalJson(e.payload), 72),\n ]);\n const header = [\" \", \"seq\", \"invocation\", \"kind\", \"target\", \"op\", \"payload\"];\n const widths = header.map((h, i) =>\n Math.max(h.length, ...rows.map((r) => (r[i] as string).length)),\n );\n const line = (cells: readonly string[]) =>\n cells\n .map((c, i) => (i === cells.length - 1 ? c : pad(c, widths[i] as number)))\n .join(\" \")\n .trimEnd();\n return [line(header), ...rows.map(line)].join(\"\\n\");\n}\n\n/** A readable report: verdict, what it rests on, and for a violation the schedule and trace. */\nexport function renderText(verdict: ScenarioVerdict): string {\n const out: string[] = [];\n const r = verdict.reached;\n out.push(`${verdict.kind} ${verdict.scenario} (seed ${String(verdict.seed)})`);\n switch (verdict.kind) {\n case \"VIOLATED\": {\n out.push(\"\");\n out.push(\n `Invariant ${verdict.violation.invariant} is violated: ${verdict.violation.message}`,\n );\n out.push(`Keys: ${verdict.violation.keys.join(\", \")}`);\n out.push(\"\");\n out.push(\n `Schedule (run seed ${verdict.schedule.seed}), events kept: ${verdict.keptEvents.join(\", \")}`,\n );\n if (verdict.schedule.faults.length === 0) out.push(\" no injected faults\");\n for (const f of verdict.schedule.faults) {\n out.push(` ${f.fault} at ${f.invocation} effect #${f.ordinal} (${f.target} ${f.op})`);\n }\n out.push(\n `Shrunk: ${verdict.shrunk.eventsRemoved} event(s) and ${verdict.shrunk.faultsRemoved} fault(s) removed in ${verdict.shrunk.runs} run(s)`,\n );\n out.push(\"\");\n out.push(\"Trace:\");\n out.push(renderTrace(verdict.trace, verdict.violation.evidence));\n break;\n }\n case \"BOUNDED\": {\n const b = verdict.bounds;\n out.push(\"\");\n out.push(\"No violation found within the stated bounds. This is not a proof.\");\n out.push(\n `Bounds: faults per run ≤ ${b.maxFaultsPerRun}, redeliveries ≤ ${b.maxRedeliveries}, concurrent invocations ≤ ${b.maxConcurrentInvocations}, budget ${b.budgetMs} ms`,\n );\n break;\n }\n case \"UNSUPPORTED\": {\n out.push(\"\");\n out.push(`Eutaxy could not decide this scenario (${verdict.cause}): ${verdict.reason}`);\n break;\n }\n }\n out.push(\"\");\n out.push(\n `Explored: ${r.runs} run(s), ${r.effectPoints} effect point(s), ${r.faultsInjected} fault(s) injected, ${r.elapsedMs} ms`,\n );\n const e = r.exhaustive;\n if (e) {\n const stopped = {\n VIOLATED: \"stopped at the first violation\",\n BOUNDED: \"stopped at the budget before every schedule ran\",\n UNSUPPORTED: \"stopped where the scenario could not be decided\",\n }[verdict.kind];\n out.push(\n `Exhaustive: ${e.complete ? \"every schedule within the bounds ran\" : stopped} (${e.schedules} schedules${e.reduction ? \", partial-order reduction\" : \"\"})`,\n );\n }\n out.push(\"Assumptions:\");\n for (const a of verdict.assumptions) out.push(` - ${a}`);\n return out.join(\"\\n\");\n}\n"],"mappings":";;AAWA,MAAa,UAA6B;CAAC;CAAO;CAAO;CAAU;CAAW;CAAU;AAAQ;;ACgChG,MAAM,SAAgD;CACpD,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACP;;AAGA,MAAM,WAAoD;CACxD,CAAC,OAAO,KAAK;CACb,CAAC,OAAO,SAAS;CACjB,CAAC,MAAM,SAAS;CAChB,CAAC,OAAO,IAAI;AACd;AAEA,MAAM,cAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAM,6BAAa,IAAI,IAAI;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,aAAa;AACnB,MAAM,YAAY;AAClB,MAAM,WACJ;AAEF,IAAa,gBAAb,cAAmC,MAAM,CAAC;;AAG1C,MAAM,kCAAkB,IAAI,IAAI;CAAC;CAAM;CAAS;CAAO;AAAM,CAAC;;;;;;AAO9D,SAASA,cACP,QACA,GACA,YACA,QACS;CACT,OAAO,KAAK,KAAK,OAAO,EAAE,EAAE,SAAS,WAAW;CAChD,MAAM,IAAI,OAAO;CACjB,IAAI,CAA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AI,KAAK,EAAE;GACX,IAAI,KAAK,0CAA0C,QAAQ,MAAM,KAAK,QAAQ,QAAQ;CAG1F;CACA,IAAI,KAAK,EAAE;CACX,IAAI,KACF,aAAa,EAAE,KAAK,WAAW,EAAE,aAAa,oBAAoB,EAAE,eAAe,sBAAsB,EAAE,UAAU,IACvH;CACA,MAAM,IAAI,EAAE;CACZ,IAAI,GAAG;EACL,MAAM,UAAU;GACd,UAAU;GACV,SAAS;GACT,aAAa;EACf,EAAE,QAAQ;EACV,IAAI,KACF,eAAe,EAAE,WAAW,yCAAyC,QAAQ,IAAI,EAAE,UAAU,YAAY,EAAE,YAAY,8BAA8B,GAAG,EAC1J;CACF;CACA,IAAI,KAAK,cAAc;CACvB,KAAK,MAAM,KAAK,QAAQ,aAAa,IAAI,KAAK,OAAO,GAAG;CACxD,OAAO,IAAI,KAAK,IAAI;AACtB"}
|
package/package.json
CHANGED
package/dist/cli-Dr-Ziogu.mjs
DELETED
package/dist/cloudflare.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare.mjs","names":["isD1"],"sources":["../../cloudflare/src/check.ts","../../cloudflare/src/json.ts","../../cloudflare/src/d1.ts","../../cloudflare/src/platform.ts","../../cloudflare/src/differential.ts","../../cloudflare/src/scenario.ts"],"sourcesContent":["import {\n describeVerdict,\n type Platform,\n type ScenarioSpec,\n type ScenarioVerdict,\n} from \"@eutaxy/core\";\nimport { type ExploreOptions, explore } from \"@eutaxy/engine\";\n\n/** Explore a scenario on a platform and return its verdict. */\nexport function check(\n spec: ScenarioSpec,\n platform: Platform,\n options: ExploreOptions = { seed: spec.name },\n): Promise<ScenarioVerdict> {\n return explore(spec, platform, options);\n}\n\n/** For use from a test: passes only when the scenario is BOUNDED. */\nexport async function expectHolds(\n spec: ScenarioSpec,\n platform: Platform,\n options?: ExploreOptions,\n): Promise<void> {\n const verdict = await check(spec, platform, options);\n if (verdict.kind !== \"BOUNDED\") throw new Error(describeVerdict(verdict));\n}\n","import type { JsonValue } from \"@eutaxy/core\";\n\n/** Reduce any runtime value to JSON data for the effect log; never throws. */\nexport function toJson(value: unknown, depth = 0): JsonValue {\n if (value === null || value === undefined) return null;\n switch (typeof value) {\n case \"boolean\":\n case \"string\":\n return value;\n case \"number\":\n return Number.isFinite(value) ? value : String(value);\n case \"bigint\":\n return value.toString();\n case \"object\": {\n if (depth > 8) return \"<nested>\";\n if (Array.isArray(value)) return value.map((v) => toJson(v, depth + 1));\n if (value instanceof ArrayBuffer) return `<bytes ${value.byteLength}>`;\n if (ArrayBuffer.isView(value)) return `<bytes ${value.byteLength}>`;\n if (value instanceof Date) return value.toISOString();\n const out: Record<string, JsonValue> = {};\n for (const k of Object.keys(value).sort()) {\n out[k] = toJson((value as Record<string, unknown>)[k], depth + 1);\n }\n return out;\n }\n default:\n return `<${typeof value}>`;\n }\n}\n","/**\n * The D1 binding proxy. Every statement execution is an effect point: the\n * engine decides the fault, the real Miniflare-backed D1 performs the query,\n * and the log records call, result and fault in the documented shape.\n */\n\nimport {\n canonicalJson,\n type EffectPoint,\n type FaultKind,\n type JsonValue,\n type RunHooks,\n} from \"@eutaxy/core\";\nimport { toJson } from \"./json.ts\";\n\nconst WRITE: readonly FaultKind[] = [\"crash_before\", \"crash_after\", \"ambiguous\", \"error\"];\nconst READ: readonly FaultKind[] = [\"crash_before\", \"crash_after\", \"error\"];\n\nexport interface ProxyContext {\n readonly hooks: RunHooks;\n /** The invocation currently running; one at a time for now. */\n readonly currentInvocation: () => string;\n}\n\nfunction point(\n ctx: ProxyContext,\n target: string,\n op: string,\n args: JsonValue,\n allowed: readonly FaultKind[],\n): EffectPoint {\n return { invocation: ctx.currentInvocation(), target, op, args, allowed };\n}\n\nfunction metaOf(result: D1Result<unknown>): JsonValue {\n return { changes: result.meta.changes ?? 0, lastRowId: result.meta.last_row_id ?? null };\n}\n\nclass StatementProxy {\n private readonly real: D1PreparedStatement;\n private readonly target: string;\n private readonly ctx: ProxyContext;\n readonly sql: string;\n readonly params: readonly unknown[];\n\n constructor(\n real: D1PreparedStatement,\n target: string,\n ctx: ProxyContext,\n sql: string,\n params: readonly unknown[],\n ) {\n this.real = real;\n this.target = target;\n this.ctx = ctx;\n this.sql = sql;\n this.params = params;\n }\n\n /** The real statement, for `batch()`. */\n get statement(): D1PreparedStatement {\n return this.real;\n }\n\n private args(): JsonValue {\n return { sql: this.sql, params: toJson(this.params) };\n }\n\n bind(...values: unknown[]): StatementProxy {\n return new StatementProxy(this.real.bind(...values), this.target, this.ctx, this.sql, values);\n }\n\n run<T = Record<string, unknown>>(): Promise<D1Result<T>> {\n return this.ctx.hooks.effect(\n point(this.ctx, this.target, \"run\", this.args(), WRITE),\n () => this.real.run<T>(),\n (r) => metaOf(r),\n );\n }\n\n all<T = Record<string, unknown>>(): Promise<D1Result<T>> {\n return this.ctx.hooks.effect(\n point(this.ctx, this.target, \"all\", this.args(), READ),\n () => this.real.all<T>(),\n (r) => ({ rows: r.results.length, changes: r.meta.changes ?? 0 }),\n );\n }\n\n first<T = unknown>(colName?: string): Promise<T | null> {\n return this.ctx.hooks.effect(\n point(\n this.ctx,\n this.target,\n \"first\",\n { ...(this.args() as object), column: colName ?? null } as JsonValue,\n READ,\n ),\n () => (colName === undefined ? this.real.first<T>() : this.real.first<T>(colName)),\n (r) => ({ row: toJson(r) }),\n );\n }\n\n raw<T = unknown[]>(options?: { columnNames?: boolean }): Promise<T[]> {\n return this.ctx.hooks.effect(\n point(this.ctx, this.target, \"raw\", this.args(), READ),\n () =>\n (options\n ? this.real.raw<T>(options as { columnNames: true })\n : this.real.raw<T>()) as Promise<T[]>,\n (r) => ({ rows: r.length }),\n );\n }\n}\n\n/** Wrap a D1 binding. Methods not modelled fall through to the real binding and mark the run unsupported. */\nexport function proxyD1(real: D1Database, binding: string, ctx: ProxyContext): D1Database {\n const target = `D1:${binding}`;\n const modelled = {\n prepare(sql: string): StatementProxy {\n return new StatementProxy(real.prepare(sql), target, ctx, sql, []);\n },\n batch<T = Record<string, unknown>>(\n statements: readonly (StatementProxy | D1PreparedStatement)[],\n ): Promise<D1Result<T>[]> {\n const unwrapped = statements.map((s) => (s instanceof StatementProxy ? s.statement : s));\n const args = {\n statements: statements.map((s) =>\n s instanceof StatementProxy\n ? { sql: s.sql, params: toJson(s.params) }\n : \"<unproxied statement>\",\n ),\n };\n return ctx.hooks.effect(\n point(ctx, target, \"batch\", args, WRITE),\n () => real.batch<T>(unwrapped as D1PreparedStatement[]),\n (rs) => ({\n changes: rs.reduce((n, r) => n + (r.meta.changes ?? 0), 0),\n statements: rs.length,\n }),\n );\n },\n exec(sql: string): Promise<D1ExecResult> {\n return ctx.hooks.effect(\n point(ctx, target, \"exec\", { sql }, WRITE),\n () => real.exec(sql),\n (r) => ({ count: r.count, duration: 0 }),\n );\n },\n };\n return new Proxy(real, {\n get(obj, prop, receiver) {\n if (prop in modelled) return modelled[prop as keyof typeof modelled];\n const value = Reflect.get(obj, prop, receiver) as unknown;\n if (typeof value === \"function\") {\n ctx.hooks.unsupported(`D1 ${binding}.${String(prop)} is not modelled`);\n return (value as (...a: unknown[]) => unknown).bind(obj);\n }\n return value;\n },\n }) as D1Database;\n}\n\n/**\n * Statements in a schema file. Splits on semicolons outside string literals,\n * quoted identifiers and comments, and keeps CREATE TRIGGER bodies (and CASE\n * expressions) whole by tracking BEGIN/CASE ... END nesting.\n */\nexport function splitSql(sql: string): readonly string[] {\n const out: string[] = [];\n let cur = \"\";\n let depth = 0;\n let i = 0;\n const isWordChar = (c: string | undefined): boolean => c !== undefined && /[A-Za-z0-9_]/.test(c);\n while (i < sql.length) {\n const c = sql[i] as string;\n const next = sql[i + 1];\n if (c === \"-\" && next === \"-\") {\n while (i < sql.length && sql[i] !== \"\\n\") i++;\n continue;\n }\n if (c === \"/\" && next === \"*\") {\n const end = sql.indexOf(\"*/\", i + 2);\n i = end === -1 ? sql.length : end + 2;\n continue;\n }\n if (c === \"'\" || c === '\"' || c === \"`\" || c === \"[\") {\n const close = c === \"[\" ? \"]\" : c;\n let j = i + 1;\n for (;;) {\n const k = sql.indexOf(close, j);\n if (k === -1) {\n j = sql.length;\n break;\n }\n if (close !== \"]\" && sql[k + 1] === close) {\n j = k + 2; // a doubled quote inside the literal\n continue;\n }\n j = k + 1;\n break;\n }\n cur += sql.slice(i, j);\n i = j;\n continue;\n }\n if (isWordChar(c) && !isWordChar(sql[i - 1])) {\n let j = i;\n while (isWordChar(sql[j])) j++;\n const word = sql.slice(i, j);\n const upper = word.toUpperCase();\n if (upper === \"BEGIN\" || upper === \"CASE\") depth++;\n else if (upper === \"END\" && depth > 0) depth--;\n cur += word;\n i = j;\n continue;\n }\n if (c === \";\" && depth === 0) {\n const statement = cur.trim();\n if (statement.length > 0) out.push(statement);\n cur = \"\";\n i++;\n continue;\n }\n cur += c;\n i++;\n }\n const last = cur.trim();\n if (last.length > 0) out.push(last);\n return out;\n}\n\n/** Drop every user table and re-apply the schema, using the real binding (not an effect). */\nexport async function resetD1(real: D1Database, schema: string): Promise<void> {\n const tables = await real\n .prepare(\n \"SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '\\\\_cf\\\\_%' ESCAPE '\\\\'\",\n )\n .all<{ name: string }>();\n for (const { name } of tables.results) {\n await real.prepare(`DROP TABLE IF EXISTS \"${name.replace(/\"/g, '\"\"')}\"`).run();\n }\n for (const statement of splitSql(schema)) {\n await real.prepare(statement).run();\n }\n}\n\n/** Every user table's rows, sorted canonically, read through the real binding (not an effect). */\nexport async function snapshotD1(\n real: D1Database,\n): Promise<{ readonly [table: string]: readonly JsonValue[] }> {\n const tables = await real\n .prepare(\n \"SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '\\\\_cf\\\\_%' ESCAPE '\\\\' ORDER BY name\",\n )\n .all<{ name: string }>();\n const out: Record<string, JsonValue[]> = {};\n for (const { name } of tables.results) {\n const rows = await real\n .prepare(`SELECT * FROM \"${name.replace(/\"/g, '\"\"')}\"`)\n .all<Record<string, unknown>>();\n out[name] = rows.results\n .map((r) => toJson(r))\n .map((j) => [canonicalJson(j), j] as const)\n .sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))\n .map(([, j]) => j);\n }\n return out;\n}\n","/**\n * The Cloudflare platform: delivers queue messages to the Worker's `queue()`\n * handler and inbound requests to its `fetch()` handler, with proxied\n * bindings, and applies Queues' at-least-once semantics (explicit and\n * implicit ack, retry, redelivery up to max_retries, dead-lettering) as\n * documented by Cloudflare, and for requests the caller's retry policy\n * declared in the drive.\n */\n\nimport type {\n DeliveryResult,\n EventRef,\n FaultKind,\n JsonValue,\n Platform,\n RunHooks,\n ScenarioSpec,\n} from \"@eutaxy/core\";\nimport { CrashSignal } from \"@eutaxy/engine\";\nimport { type ProxyContext, proxyD1, resetD1, snapshotD1 } from \"./d1.ts\";\nimport type { HttpDrive, HttpRequestSpec, QueueDrive } from \"./scenario.ts\";\n\nconst ACK: readonly FaultKind[] = [\"crash_before\", \"crash_after\"];\nconst CUT_OFF: readonly FaultKind[] = [\"cut_off\"];\n/** The response point: a crash before it is a response the caller never saw. */\nconst RESPOND: readonly FaultKind[] = [\"crash_before\"];\n\n/** The Worker's default export, as far as the platform drives it. */\nexport interface WorkerHandler {\n queue?(batch: MessageBatch<unknown>, env: unknown, ctx: ExecutionContext): void | Promise<void>;\n fetch?(request: Request, env: unknown, ctx: ExecutionContext): Response | Promise<Response>;\n}\n\n/** The former name of `WorkerHandler`, kept for callers written against 0.1. */\nexport type QueueHandler = WorkerHandler;\n\n/** The URL inbound requests are addressed to; handlers read only the path. */\nexport const requestOrigin = \"https://worker.test\";\n\n/** Build the `Request` a drive entry describes. */\nexport function requestFor(r: HttpRequestSpec): Request {\n const headers = new Headers(r.headers);\n let body: string | null = null;\n if (r.body !== undefined) {\n if (typeof r.body === \"string\") body = r.body;\n else {\n // Any JSON value, `null` included, travels as application/json.\n body = JSON.stringify(r.body);\n if (!headers.has(\"content-type\")) headers.set(\"content-type\", \"application/json\");\n }\n }\n return new Request(`${requestOrigin}${r.path}`, { method: r.method, headers, body });\n}\n\n/** A compact record of a response for the effect log: status, ok, and a bounded body. */\nexport async function summarizeResponse(response: Response): Promise<JsonValue> {\n const text = await response.clone().text();\n let body: JsonValue = text.length > 1000 ? `${text.slice(0, 1000)}…` : text;\n if (text && (response.headers.get(\"content-type\") ?? \"\").includes(\"json\")) {\n try {\n body = JSON.parse(text) as JsonValue;\n } catch {\n // keep the text\n }\n }\n return { status: response.status, ok: response.ok, body };\n}\n\nexport interface CloudflarePlatformOptions {\n /** The bindings from `cloudflare:workers`. */\n readonly env: object;\n /** The Worker's default export. */\n readonly handler: WorkerHandler;\n /** Schema SQL per D1 binding named in the scenario's setup. */\n readonly schemas: Readonly<Record<string, string>>;\n /** Cloudflare's default when the consumer does not set max_retries. */\n readonly maxRetries?: number;\n}\n\nfunction isD1(value: unknown): value is D1Database {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { prepare?: unknown }).prepare === \"function\" &&\n typeof (value as { batch?: unknown }).batch === \"function\"\n );\n}\n\nfunction isBindingLike(value: unknown): boolean {\n if (typeof value === \"function\") return true;\n if (typeof value !== \"object\" || value === null) return false;\n const proto = Object.getPrototypeOf(value) as object | null;\n const names = [...Object.getOwnPropertyNames(value), ...Object.getOwnPropertyNames(proto ?? {})];\n return names.some(\n (k) => k !== \"constructor\" && typeof (value as Record<string, unknown>)[k] === \"function\",\n );\n}\n\n/** Deep-copy JSON data so a handler that mutates its message cannot leak into other runs. */\nfunction cloneJson(value: JsonValue): JsonValue {\n return JSON.parse(JSON.stringify(value)) as JsonValue;\n}\n\nconst assumptions: readonly string[] = [\n \"platform model: Cloudflare Queues at-least-once delivery; the first ack or retry decision per message wins; unacked messages are redelivered up to max_retries then dead-lettered\",\n \"D1 statements run against Miniflare's SQLite; each run/first/all/raw/batch/exec is one effect\",\n \"message.timestamp is the virtual clock's time at delivery\",\n \"only D1 bindings are proxied; touching any other binding makes the run UNSUPPORTED\",\n \"state invariants read a snapshot of every D1 binding named in setup, taken after the last event\",\n \"work passed to ctx.waitUntil runs after the handler returns and never affects acknowledgement or the response; a cut_off fault at that point loses work not yet started, and an effect in flight commits without its continuation\",\n \"inbound requests: one invocation per attempt; an uncaught exception is a 500 response; the drive's caller resends a request it got no acceptable response for (crash before the response, or a status its retryOn policy rejects) up to its retries\",\n];\n\nexport function createCloudflarePlatform(options: CloudflarePlatformOptions): Platform {\n const env = options.env as Record<string, unknown>;\n const maxRetries = options.maxRetries ?? 3;\n let currentInvocation = \"\";\n let hooksRef: RunHooks | null = null;\n\n const ctx: ProxyContext = {\n get hooks() {\n if (!hooksRef) throw new Error(\"no run in progress\");\n return hooksRef;\n },\n currentInvocation: () => currentInvocation,\n };\n\n const d1Proxies = new Map<string, D1Database>();\n const proxiedEnv = new Proxy(env, {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver) as unknown;\n if (typeof prop !== \"string\") return value;\n if (isD1(value)) {\n let p = d1Proxies.get(prop);\n if (!p) {\n p = proxyD1(value, prop, ctx);\n d1Proxies.set(prop, p);\n }\n return p;\n }\n if (isBindingLike(value)) ctx.hooks.unsupported(`binding ${prop} is not proxied`);\n return value;\n },\n });\n\n /** Platform-level actions (dead-lettering) are recorded under an invocation no fault can crash. */\n const platformInvocations = new WeakMap<RunHooks, string>();\n function platformInvocation(hooks: RunHooks): string {\n let id = platformInvocations.get(hooks);\n if (id === undefined) {\n id = \"platform\";\n hooks.startInvocation(id);\n platformInvocations.set(hooks, id);\n }\n return id;\n }\n\n return {\n name: \"cloudflare\",\n assumptions,\n\n async reset(spec: ScenarioSpec): Promise<void> {\n for (const step of spec.setup) {\n if (step.kind !== \"d1\") continue;\n const binding = String(step[\"binding\"]);\n const schema = options.schemas[binding];\n if (schema === undefined) throw new Error(`no schema provided for D1 binding ${binding}`);\n const real = env[binding];\n if (!isD1(real)) throw new Error(`env.${binding} is not a D1 binding`);\n await resetD1(real, schema);\n }\n },\n\n restrictEvents(spec: ScenarioSpec, keepIds: readonly string[]): ScenarioSpec {\n const drive = spec.drive as QueueDrive | HttpDrive;\n if (drive.kind === \"http\") {\n return {\n ...spec,\n drive: { ...drive, requests: drive.requests.filter((r) => keepIds.includes(r.id)) },\n };\n }\n return {\n ...spec,\n drive: { ...drive, messages: drive.messages.filter((m) => keepIds.includes(m.id)) },\n };\n },\n\n async finish(spec: ScenarioSpec, hooks: RunHooks): Promise<void> {\n for (const step of spec.setup) {\n if (step.kind !== \"d1\") continue;\n const binding = String(step[\"binding\"]);\n const real = env[binding];\n if (!isD1(real)) continue;\n const tables = await snapshotD1(real);\n hooks.snapshot(platformInvocation(hooks), `D1:${binding}`, { tables });\n }\n },\n\n initialEvents(spec: ScenarioSpec): readonly EventRef[] {\n const drive = spec.drive as QueueDrive | HttpDrive;\n if (drive.kind === \"http\") {\n return drive.requests.map((r) => ({\n id: r.id,\n attempt: 1,\n data: r as unknown as JsonValue,\n }));\n }\n return drive.messages.map((m) => ({ id: m.id, attempt: 1, data: m.body }));\n },\n\n async deliver(event: EventRef, hooks: RunHooks, spec: ScenarioSpec): Promise<DeliveryResult> {\n const drive = spec.drive as QueueDrive | HttpDrive;\n const invocation = `${event.id}#${event.attempt}`;\n hooksRef = hooks;\n currentInvocation = invocation;\n try {\n return drive.kind === \"http\"\n ? await deliverRequest(event, hooks, spec, drive, invocation)\n : await deliverMessage(event, hooks, spec, drive, invocation);\n } finally {\n currentInvocation = \"\";\n }\n },\n };\n\n /** The `ExecutionContext` handed to a handler; `waitUntil` work is collected to run after it returns. */\n function executionContext(background: Promise<unknown>[]): ExecutionContext {\n return {\n waitUntil: (promise: Promise<unknown>) => {\n background.push(\n promise.then(\n () => undefined,\n () => undefined,\n ),\n );\n },\n passThroughOnException: () => {},\n props: {},\n } as unknown as ExecutionContext;\n }\n\n /**\n * Background work extends the invocation but never changes the acknowledgement or the response.\n * A cut-off here is the isolate dying after them: work not yet started is lost.\n */\n async function drainBackground(\n hooks: RunHooks,\n inv: { isCrashed(): boolean; readonly crashed: Promise<void> },\n invocation: string,\n target: string,\n background: readonly Promise<unknown>[],\n ): Promise<boolean> {\n if (background.length === 0 || inv.isCrashed()) return false;\n try {\n hooks.effectSync(\n {\n invocation,\n target,\n op: \"background\",\n args: { pending: background.length },\n allowed: CUT_OFF,\n },\n () => null,\n () => null,\n );\n await Promise.race([hooks.settle(Promise.all(background), invocation), inv.crashed]);\n return false;\n } catch (err) {\n if (!(err instanceof CrashSignal)) throw err;\n return true;\n }\n }\n\n async function deliverRequest(\n event: EventRef,\n hooks: RunHooks,\n spec: ScenarioSpec,\n drive: HttpDrive,\n invocation: string,\n ): Promise<DeliveryResult> {\n const req = event.data as unknown as HttpRequestSpec;\n const target = `Http:${req.path}`;\n const inv = hooks.startInvocation(invocation);\n const background: Promise<unknown>[] = [];\n const handler = options.handler.fetch;\n if (!handler) throw new Error(\"the Worker has no fetch() handler\");\n const args: JsonValue = { requestId: event.id, method: req.method, path: req.path };\n\n let response: Response | undefined;\n const outcome = Promise.resolve()\n .then(() =>\n handler.call(options.handler, requestFor(req), proxiedEnv, executionContext(background)),\n )\n .then(\n (r) => {\n response = r;\n return \"completed\" as const;\n },\n (err: unknown) =>\n err instanceof CrashSignal ? (\"crashed\" as const) : (\"errored\" as const),\n );\n let status = await Promise.race([\n hooks.settle(outcome, invocation),\n inv.crashed.then(() => \"crashed\" as const),\n ]);\n\n let summary: { status: number; ok: boolean } | null = null;\n let read: { status: number; ok: boolean; body: JsonValue } | \"crashed\" | \"errored\" = \"errored\";\n if (status === \"completed\" && response) {\n // The body is read before the point so the record is complete; the point itself is the send.\n // Streaming bodies run handler code: a crash inside it abandons the read, an error fails the delivery.\n read = await Promise.race([\n hooks.settle(summarizeResponse(response), invocation).then(\n (s) => s as { status: number; ok: boolean; body: JsonValue },\n (err: unknown) =>\n err instanceof CrashSignal ? (\"crashed\" as const) : (\"errored\" as const),\n ),\n inv.crashed.then(() => \"crashed\" as const),\n ]);\n if (read === \"crashed\" || read === \"errored\") status = read;\n }\n if (status === \"completed\" && typeof read === \"object\") {\n const s = read;\n try {\n hooks.effectSync(\n { invocation, target, op: \"response\", args, allowed: RESPOND },\n () => s,\n (v) => v,\n );\n summary = s;\n } catch (err) {\n if (err instanceof CrashSignal) status = \"crashed\";\n else throw err;\n }\n } else if (status === \"errored\") {\n // Cloudflare answers an uncaught exception with a 500 (workers runtime behaviour); the caller sees that.\n const s = { status: 500, ok: false, body: \"\" };\n hooks.effectSync(\n { invocation, target, op: \"response\", args, allowed: [] },\n () => s,\n (v) => v,\n );\n summary = s;\n }\n\n if (await drainBackground(hooks, inv, invocation, target, background)) status = \"crashed\";\n\n const accepted =\n summary !== null && (drive.retryOn === \"5xx\" ? summary.status < 500 : summary.ok);\n const followUps: EventRef[] = [];\n if (!accepted) {\n const redeliveries = event.attempt - 1;\n if (redeliveries < drive.retries && redeliveries < spec.bounds.maxRedeliveries) {\n followUps.push({ ...event, attempt: event.attempt + 1 });\n } else {\n hooks.effectSync(\n {\n invocation: platformInvocation(hooks),\n target,\n op: \"gave_up\",\n args: { requestId: event.id, attempts: event.attempt },\n allowed: [],\n },\n () => null,\n () => null,\n );\n }\n }\n return { status, followUps };\n }\n\n async function deliverMessage(\n event: EventRef,\n hooks: RunHooks,\n spec: ScenarioSpec,\n drive: QueueDrive,\n invocation: string,\n ): Promise<DeliveryResult> {\n {\n const queueTarget = `Queue:${drive.queue}`;\n const inv = hooks.startInvocation(invocation);\n /** Cloudflare honours the first ack or retry decision per message; later ones are ignored. */\n const state: { decision: \"ack\" | \"retry\" | null } = { decision: null };\n const background: Promise<unknown>[] = [];\n\n /** Records the call; the result says whether it took effect (the first decision wins). */\n const decide = (op: \"ack\" | \"retry\", args: JsonValue): void => {\n hooks.effectSync(\n { invocation, target: queueTarget, op, args, allowed: ACK },\n () => {\n if (state.decision !== null) return false;\n state.decision = op;\n return true;\n },\n (effective) => ({ effective }),\n );\n };\n const message: Message<unknown> = {\n id: event.id,\n timestamp: new Date(),\n body: cloneJson(event.data),\n attempts: event.attempt,\n ack: () => decide(\"ack\", { messageId: event.id, implicit: false, body: event.data }),\n retry: () => decide(\"retry\", { messageId: event.id, body: event.data }),\n };\n const batch: MessageBatch<unknown> = {\n queue: drive.queue,\n messages: [message],\n metadata: { metrics: { backlogCount: 0, backlogBytes: 0 } },\n ackAll: () => message.ack(),\n retryAll: () => message.retry(),\n };\n const execution = executionContext(background);\n\n const handler = options.handler.queue;\n if (!handler) throw new Error(\"the Worker has no queue() handler\");\n const outcome = Promise.resolve()\n .then(() => handler.call(options.handler, batch, proxiedEnv, execution))\n .then(\n () => \"completed\" as const,\n (err: unknown) =>\n err instanceof CrashSignal ? (\"crashed\" as const) : (\"errored\" as const),\n );\n let status = await Promise.race([\n hooks.settle(outcome, invocation),\n inv.crashed.then(() => \"crashed\" as const),\n ]);\n\n if (status === \"completed\" && state.decision === null) {\n try {\n decide(\"ack\", { messageId: event.id, implicit: true, body: event.data });\n } catch (err) {\n if (err instanceof CrashSignal) status = \"crashed\";\n else throw err;\n }\n }\n\n if (await drainBackground(hooks, inv, invocation, queueTarget, background))\n status = \"crashed\";\n\n const followUps: EventRef[] = [];\n if (state.decision !== \"ack\") {\n const redeliveries = event.attempt - 1;\n if (event.attempt <= maxRetries && redeliveries < spec.bounds.maxRedeliveries) {\n followUps.push({ ...event, attempt: event.attempt + 1 });\n } else {\n hooks.effectSync(\n {\n invocation: platformInvocation(hooks),\n target: queueTarget,\n op: \"dead_letter\",\n args: { messageId: event.id, attempts: event.attempt },\n allowed: [],\n },\n () => null,\n () => null,\n );\n }\n }\n return { status, followUps };\n }\n }\n}\n","/**\n * Differential check: the same fault-free scenario run once through Eutaxy's\n * proxies and once against the raw bindings, with the queue model (or the\n * HTTP caller's retry policy) applied by hand on the raw side. Any difference in the per-attempt decisions or in\n * the final D1 state is a bug in the proxies or the platform model, not in\n * the Worker. The raw side shares Eutaxy's *reading* of Cloudflare's queue\n * semantics; what it does not share is any proxy code.\n */\n\nimport {\n canonicalJson,\n type EventRef,\n getPath,\n type JsonValue,\n type ScenarioSpec,\n} from \"@eutaxy/core\";\nimport {\n CrashSignal,\n effectLatencyMs,\n installScriptedFetch,\n patchGlobals,\n Run,\n settleOn,\n type VirtualClock,\n} from \"@eutaxy/engine\";\nimport { resetD1, snapshotD1 } from \"./d1.ts\";\nimport {\n type CloudflarePlatformOptions,\n createCloudflarePlatform,\n requestFor,\n} from \"./platform.ts\";\nimport type { HttpDrive, HttpRequestSpec, QueueDrive } from \"./scenario.ts\";\n\nexport interface AttemptRecord {\n readonly event: string;\n readonly attempt: number;\n readonly status: \"completed\" | \"errored\";\n /** Queue drive: the acknowledgement that took effect. */\n readonly decision: \"ack\" | \"retry\" | null;\n /** HTTP drive: the response status the caller saw (500 for an uncaught exception). */\n readonly response?: number;\n}\n\nexport interface Side {\n readonly attempts: readonly AttemptRecord[];\n readonly state: {\n readonly [binding: string]: { readonly [table: string]: readonly JsonValue[] };\n };\n}\n\nexport interface DifferentialResult {\n /** True only when both sides agree and the proxied run touched nothing unmodelled. */\n readonly equal: boolean;\n readonly eutaxy: Side;\n readonly raw: Side;\n readonly differences: readonly string[];\n /** What the proxied run could not control; non-empty means the comparison proves nothing. */\n readonly unsupported: readonly string[];\n}\n\n/** The raw side cannot abandon an invocation the way the engine does; a stuck handler ends the comparison. */\nclass StuckError extends Error {\n override readonly name = \"StuckError\";\n constructor(\n message = \"the handler is waiting on something outside the run (no timer due, no effect in flight)\",\n ) {\n super(message);\n }\n}\n\n/**\n * The raw side's only wrapper: counts D1 calls in flight (so the settle loop\n * knows real I/O is pending) and advances the clock as the proxies do. It\n * records nothing and injects nothing.\n */\nfunction countingD1(real: D1Database, io: { n: number }, clock: VirtualClock): D1Database {\n const realOf = new WeakMap<object, D1PreparedStatement>();\n const track = async <T>(p: Promise<T>): Promise<T> => {\n io.n++;\n try {\n return await p;\n } finally {\n io.n--;\n clock.advance(effectLatencyMs);\n }\n };\n const wrapStatement = (s: D1PreparedStatement): D1PreparedStatement => {\n const proxy = new Proxy(s, {\n get(t, prop, r) {\n const v = Reflect.get(t, prop, r) as unknown;\n if (prop === \"bind\") return (...a: unknown[]) => wrapStatement(t.bind(...a));\n if (prop === \"run\" || prop === \"all\" || prop === \"first\" || prop === \"raw\") {\n return (...a: unknown[]) =>\n track((v as (...x: unknown[]) => Promise<unknown>).apply(t, a));\n }\n return typeof v === \"function\" ? (v as (...x: unknown[]) => unknown).bind(t) : v;\n },\n });\n realOf.set(proxy, s);\n return proxy;\n };\n return new Proxy(real, {\n get(t, prop, r) {\n const v = Reflect.get(t, prop, r) as unknown;\n if (prop === \"prepare\") return (sql: string) => wrapStatement(t.prepare(sql));\n if (prop === \"batch\") {\n return (stmts: D1PreparedStatement[]) =>\n track(t.batch(stmts.map((s) => realOf.get(s) ?? s)));\n }\n if (prop === \"exec\") return (sql: string) => track(t.exec(sql));\n return typeof v === \"function\" ? (v as (...x: unknown[]) => unknown).bind(t) : v;\n },\n });\n}\n\nfunction isD1(value: unknown): value is D1Database {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { prepare?: unknown }).prepare === \"function\"\n );\n}\n\nasync function snapshotAll(\n spec: ScenarioSpec,\n options: CloudflarePlatformOptions,\n): Promise<Side[\"state\"]> {\n const env = options.env as Record<string, unknown>;\n const out: Record<string, { readonly [table: string]: readonly JsonValue[] }> = {};\n for (const step of spec.setup) {\n if (step.kind !== \"d1\") continue;\n const binding = String(step[\"binding\"]);\n const real = env[binding];\n if (isD1(real)) out[binding] = await snapshotD1(real);\n }\n return out;\n}\n\n/** The Eutaxy side: one run with no faults, driven like `runOnce` but keeping each delivery's status. */\nasync function eutaxySide(\n spec: ScenarioSpec,\n options: CloudflarePlatformOptions,\n): Promise<Side & { readonly unsupported: readonly string[] }> {\n const platform = createCloudflarePlatform(options);\n const run = new Run({\n mode: \"replay\",\n schedule: { seed: 0, faults: [] },\n bounds: spec.bounds,\n faultProbability: 0,\n });\n const attempts: AttemptRecord[] = [];\n await platform.reset(spec);\n run.install(spec.externals);\n try {\n const pending: EventRef[] = [...platform.initialEvents(spec)];\n while (pending.length > 0) {\n const event = pending.shift() as EventRef;\n const invocation = `${event.id}#${event.attempt}`;\n const before = run.log.entries.length;\n const result = await platform.deliver(event, run, spec);\n const mine = run.log.entries.slice(before).filter((e) => e.invocation === invocation);\n const decision = mine.find(\n (e) =>\n e.kind === \"result\" &&\n (e.op === \"ack\" || e.op === \"retry\") &&\n getPath(e.payload, \"result.effective\") === true,\n )?.op as \"ack\" | \"retry\" | undefined;\n const response = mine.find((e) => e.kind === \"result\" && e.op === \"response\");\n attempts.push({\n event: event.id,\n attempt: event.attempt,\n status: result.status === \"completed\" ? \"completed\" : \"errored\",\n decision: decision ?? null,\n ...(response ? { response: getPath(response.payload, \"result.status\") as number } : {}),\n });\n pending.push(...result.followUps);\n }\n } finally {\n run.uninstall();\n }\n await platform.finish?.(spec, run);\n return { attempts, state: await snapshotAll(spec, options), unsupported: run.unsupportedReasons };\n}\n\n/** The raw side: the handler called directly with the real bindings and plain message or Request objects. */\nasync function rawSide(spec: ScenarioSpec, options: CloudflarePlatformOptions): Promise<Side> {\n const env = options.env as Record<string, unknown>;\n const drive = spec.drive as QueueDrive | HttpDrive;\n const maxRetries = options.maxRetries ?? 3;\n for (const step of spec.setup) {\n if (step.kind !== \"d1\") continue;\n const binding = String(step[\"binding\"]);\n const schema = options.schemas[binding];\n const real = env[binding];\n if (schema !== undefined && isD1(real)) await resetD1(real, schema);\n }\n const attempts: AttemptRecord[] = [];\n const pending: EventRef[] =\n drive.kind === \"http\"\n ? drive.requests.map((r) => ({ id: r.id, attempt: 1, data: r as unknown as JsonValue }))\n : drive.messages.map((m) => ({ id: m.id, attempt: 1, data: m.body }));\n // The same virtual globals as the proxied side, from the same seed, so Date.now and randomness agree,\n // and the same scripted externals, without recording.\n const patched = patchGlobals(0);\n const unsupported: string[] = [];\n const restoreFetch = installScriptedFetch(\n spec.externals,\n null,\n (r) => unsupported.push(r),\n () => patched.clock.advance(effectLatencyMs), // the proxied side advances per effect; match it\n );\n const io = { n: 0 };\n const counting = new Map<string, D1Database>();\n const countedEnv = new Proxy(env, {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver) as unknown;\n if (typeof prop !== \"string\" || !isD1(value)) return value;\n let c = counting.get(prop);\n if (!c) {\n c = countingD1(value, io, patched.clock);\n counting.set(prop, c);\n }\n return c;\n },\n });\n const settle = <T>(p: Promise<T>): Promise<T> =>\n settleOn(p, {\n clock: patched.clock,\n inFlight: () => io.n,\n crashed: () => false,\n stuck: () => {\n throw new StuckError();\n },\n });\n const ctxFor = (background: Promise<unknown>[]) =>\n ({\n waitUntil: (p: Promise<unknown>) => {\n background.push(\n p.then(\n () => undefined,\n () => undefined,\n ),\n );\n },\n passThroughOnException: () => {},\n props: {},\n }) as unknown as ExecutionContext;\n try {\n if (drive.kind === \"http\") {\n const handler = options.handler.fetch;\n if (!handler) throw new Error(\"the Worker has no fetch() handler\");\n while (pending.length > 0) {\n const event = pending.shift() as EventRef;\n const req = event.data as unknown as HttpRequestSpec;\n const background: Promise<unknown>[] = [];\n let status: \"completed\" | \"errored\";\n let response = 500;\n try {\n const r = await settle(\n Promise.resolve().then(() =>\n handler.call(options.handler, requestFor(req), countedEnv, ctxFor(background)),\n ),\n );\n await settle(r.clone().text());\n response = r.status;\n status = \"completed\";\n } catch (err) {\n if (err instanceof CrashSignal || err instanceof StuckError) throw err;\n status = \"errored\";\n }\n await settle(Promise.all(background));\n attempts.push({\n event: event.id,\n attempt: event.attempt,\n status,\n decision: null,\n response,\n });\n const accepted =\n drive.retryOn === \"5xx\" ? response < 500 : response >= 200 && response < 300;\n if (\n !accepted &&\n event.attempt - 1 < drive.retries &&\n event.attempt - 1 < spec.bounds.maxRedeliveries\n ) {\n pending.push({ ...event, attempt: event.attempt + 1 });\n }\n }\n } else {\n const handler = options.handler.queue;\n if (!handler) throw new Error(\"the Worker has no queue() handler\");\n while (pending.length > 0) {\n const event = pending.shift() as EventRef;\n let decision: \"ack\" | \"retry\" | null = null;\n const background: Promise<unknown>[] = [];\n const message: Message<unknown> = {\n id: event.id,\n timestamp: new Date(),\n body: JSON.parse(JSON.stringify(event.data)) as JsonValue,\n attempts: event.attempt,\n ack: () => {\n decision ??= \"ack\";\n },\n retry: () => {\n decision ??= \"retry\";\n },\n };\n const batch: MessageBatch<unknown> = {\n queue: drive.queue,\n messages: [message],\n metadata: { metrics: { backlogCount: 0, backlogBytes: 0 } },\n ackAll: () => message.ack(),\n retryAll: () => message.retry(),\n };\n const ctx = ctxFor(background);\n let status: \"completed\" | \"errored\";\n try {\n await settle(\n Promise.resolve().then(() => handler.call(options.handler, batch, countedEnv, ctx)),\n );\n status = \"completed\";\n } catch (err) {\n if (err instanceof CrashSignal || err instanceof StuckError) throw err;\n status = \"errored\";\n }\n if (status === \"completed\") decision ??= \"ack\";\n await settle(Promise.all(background));\n attempts.push({ event: event.id, attempt: event.attempt, status, decision });\n if (\n decision !== \"ack\" &&\n event.attempt <= maxRetries &&\n event.attempt - 1 < spec.bounds.maxRedeliveries\n ) {\n pending.push({ ...event, attempt: event.attempt + 1 });\n }\n }\n }\n } finally {\n restoreFetch();\n patched.restore();\n }\n if (unsupported.length > 0) throw new StuckError(`raw side: ${unsupported.join(\"; \")}`);\n return { attempts, state: await snapshotAll(spec, options) };\n}\n\n/** Run both sides and compare. The Eutaxy side runs first; both start from the schema. */\nexport async function runDifferential(\n spec: ScenarioSpec,\n options: CloudflarePlatformOptions,\n): Promise<DifferentialResult> {\n const { unsupported, ...eutaxy } = await eutaxySide(spec, options);\n const raw = await rawSide(spec, options);\n const differences: string[] = [];\n if (unsupported.length > 0) {\n differences.push(`the proxied run touched unsupported APIs: ${unsupported.join(\"; \")}`);\n }\n const a = canonicalJson(eutaxy.attempts as unknown as JsonValue);\n const b = canonicalJson(raw.attempts as unknown as JsonValue);\n if (a !== b) differences.push(`attempts differ:\\n eutaxy ${a}\\n raw ${b}`);\n const bindings = new Set([...Object.keys(eutaxy.state), ...Object.keys(raw.state)]);\n for (const binding of [...bindings].sort()) {\n const tables = new Set([\n ...Object.keys(eutaxy.state[binding] ?? {}),\n ...Object.keys(raw.state[binding] ?? {}),\n ]);\n for (const table of [...tables].sort()) {\n const x = canonicalJson((eutaxy.state[binding]?.[table] ?? []) as unknown as JsonValue);\n const y = canonicalJson((raw.state[binding]?.[table] ?? []) as unknown as JsonValue);\n if (x !== y) differences.push(`${binding}.${table} differs:\\n eutaxy ${x}\\n raw ${y}`);\n }\n }\n return { equal: differences.length === 0, eutaxy, raw, differences, unsupported };\n}\n","/**\n * Typed construction of scenario specs for Cloudflare Workers. Everything here\n * produces the plain-data `ScenarioSpec` from core; this module only knows the\n * Cloudflare shapes (queues, D1 bindings) and the effect conventions the\n * proxies follow.\n */\n\nimport {\n type AtLeastOnce,\n type AtMostOncePerKey,\n type Bounds,\n defaultBounds,\n type EffectSelector,\n type EveryRow,\n type ExternalDecl,\n getPath,\n type Implies,\n type Invariant,\n type JsonValue,\n type PlatformData,\n type RowCondition,\n type ScenarioSpec,\n type ScriptedResponse,\n type StateQuery,\n validateScenario,\n type WorkerRef,\n} from \"@eutaxy/core\";\n\n/** One queue message to deliver; `id` defaults to its position. */\nexport interface QueueMessage {\n readonly id?: string;\n readonly body: JsonValue;\n}\n\n/** Drive the Worker's `queue()` handler with these messages. */\nexport interface QueueDrive extends PlatformData {\n readonly kind: \"queue\";\n readonly queue: string;\n readonly messages: readonly { readonly id: string; readonly body: JsonValue }[];\n}\n\n/** One inbound request; `id` defaults to its position, `method` to POST with a body and GET without. */\nexport interface HttpRequestInput {\n readonly id?: string;\n readonly method?: string;\n readonly path: string;\n readonly headers?: { readonly [name: string]: string };\n /** JSON body (sent as application/json) or a string body. */\n readonly body?: JsonValue;\n}\n\n/** A type alias, not an interface, so it is assignable to the JSON shape of `PlatformData`. */\nexport type HttpRequestSpec = {\n readonly id: string;\n readonly method: string;\n readonly path: string;\n readonly headers: { readonly [name: string]: string };\n /** Absent: no body at all. `null` is a JSON body, sent as `null`. */\n readonly body?: JsonValue;\n};\n\n/**\n * Drive the Worker's `fetch()` handler with these requests. The caller's\n * retry policy decides redelivery: a webhook provider resends a request it\n * got no 2xx for (`retryOn: \"non-2xx\"`, the default) or only on 5xx and\n * failures (`\"5xx\"`), up to `retries` times; a browser-like caller has\n * `retries: 0`.\n */\nexport interface HttpDrive extends PlatformData {\n readonly kind: \"http\";\n readonly requests: readonly HttpRequestSpec[];\n readonly retries: number;\n readonly retryOn: \"non-2xx\" | \"5xx\";\n}\n\nexport function http(\n requests: readonly HttpRequestInput[],\n options: { readonly retries?: number; readonly retryOn?: \"non-2xx\" | \"5xx\" } = {},\n): HttpDrive {\n return {\n kind: \"http\",\n requests: requests.map((r, i) => ({\n id: r.id ?? `req-${i + 1}`,\n method: (r.method ?? (r.body === undefined ? \"GET\" : \"POST\")).toUpperCase(),\n path: r.path,\n headers: r.headers ?? {},\n ...(r.body === undefined ? {} : { body: r.body }),\n })),\n retries: options.retries ?? 3,\n retryOn: options.retryOn ?? \"non-2xx\",\n };\n}\n\n/** Apply a SQL file to a D1 binding before each run. */\nexport interface D1Setup extends PlatformData {\n readonly kind: \"d1\";\n readonly binding: string;\n readonly schemaFile: string;\n}\n\nexport interface CloudflareScenarioInput {\n readonly name: string;\n readonly worker: WorkerRef;\n readonly drive:\n | QueueDrive\n | HttpDrive\n | {\n readonly kind: \"queue\";\n readonly queue: string;\n readonly messages: readonly QueueMessage[];\n };\n readonly setup?: readonly D1Setup[];\n readonly externals?: readonly ExternalDecl[];\n readonly invariants: readonly Invariant[];\n readonly bounds?: Partial<Bounds>;\n}\n\nexport function queue(name: string, messages: readonly QueueMessage[]): QueueDrive {\n return {\n kind: \"queue\",\n queue: name,\n messages: messages.map((m, i) => ({ id: m.id ?? `msg-${i + 1}`, body: m.body })),\n };\n}\n\nexport function d1Schema(binding: string, schemaFile: string): D1Setup {\n return { kind: \"d1\", binding, schemaFile };\n}\n\n/**\n * Effect conventions for D1 (what the proxies record):\n * call payload { args: { sql, params } }\n * result payload { args: { sql, params }, result: { changes, lastRowId } }\n * A committed write is a `result` whose `result.changes` is at least 1.\n */\nexport function d1Write(binding: string, op: \"run\" | \"batch\" = \"run\"): EffectSelector {\n return { target: `D1:${binding}`, op, kind: \"result\", atLeast: { \"result.changes\": 1 } };\n}\n\n/** Dot path to the Nth bound parameter of a D1 statement, in an effect payload. */\nexport function d1Param(index: number): string {\n return `args.params.${index}`;\n}\n\nexport function atMostOncePerKey(\n name: string,\n effect: EffectSelector,\n key: string,\n): AtMostOncePerKey {\n return { kind: \"atMostOncePerKey\", name, effect, key };\n}\n\nexport function atLeastOnce(\n name: string,\n effect: EffectSelector,\n key: string,\n expected: readonly JsonValue[],\n): AtLeastOnce {\n return { kind: \"atLeastOnce\", name, effect, key, expected };\n}\n\n/**\n * Every message's (or request's) `bodyKey` value must appear at least once\n * as `key` in a selected effect: nothing the drive delivered may be lost.\n */\nexport function atLeastOncePerMessage(\n name: string,\n drive: QueueDrive | HttpDrive,\n effect: EffectSelector,\n key: string,\n bodyKey: string,\n): AtLeastOnce {\n const expected: JsonValue[] = [];\n const items =\n drive.kind === \"queue\"\n ? drive.messages.map((m) => ({ id: m.id, body: m.body }))\n : drive.requests.map((r) => ({ id: r.id, body: r.body ?? null }));\n for (const m of items) {\n const v = getPath(m.body, bodyKey);\n if (v === undefined) {\n throw new Error(`${drive.kind} event ${m.id} has no ${JSON.stringify(bodyKey)} in its body`);\n }\n expected.push(v);\n }\n // An HTTP event's data is the whole request, so the path to re-derive from starts at its body.\n const perMessage = {\n bodyKey: drive.kind === \"queue\" ? bodyKey : bodyKey === \"\" ? \"body\" : `body.${bodyKey}`,\n };\n return { ...atLeastOnce(name, effect, key, expected), perMessage };\n}\n\n/**\n * Selects the responses the Worker returned for a path (`ok` narrows to 2xx\n * or to everything else). One `result` per attempt: a crash before the\n * response leaves none, a thrown error records status 500.\n */\nexport function httpResponse(\n path: string,\n options: { readonly ok?: boolean } = {},\n): EffectSelector {\n return {\n target: `Http:${path}`,\n op: \"response\",\n kind: \"result\",\n ...(options.ok === undefined ? {} : { where: { \"result.ok\": options.ok } }),\n };\n}\n\n/** Rows of a D1 table in the end-of-run snapshot, optionally filtered. */\nexport function d1Rows(\n binding: string,\n table: string,\n where?: readonly RowCondition[],\n): StateQuery {\n return where ? { target: `D1:${binding}`, table, where } : { target: `D1:${binding}`, table };\n}\n\n/** Every row the query selects satisfies all conditions. */\nexport function everyRow(\n name: string,\n query: StateQuery,\n holds: readonly RowCondition[],\n): EveryRow {\n return { kind: \"everyRow\", name, query, holds };\n}\n\n/** Every selected effect has a row whose column equals the effect's key. */\nexport function implies(\n name: string,\n when: EffectSelector,\n key: string,\n state: StateQuery,\n column: string,\n): Implies {\n return { kind: \"implies\", name, when, key, state, column };\n}\n\n/** Selects the acknowledgement that took effect for each message (explicit or implicit; not one ignored after a retry). */\nexport function queueAck(queueName: string): EffectSelector {\n return {\n target: `Queue:${queueName}`,\n op: \"ack\",\n kind: \"result\",\n where: { \"result.effective\": true },\n };\n}\n\n/**\n * Declare an external service: requests to `host` are answered from\n * `responses` (every request gets 200 and an empty body when omitted), and\n * `dedupeBy` names the header whose value makes repeated requests\n * idempotent at that service.\n */\nexport function external(\n name: string,\n host: string,\n options: { readonly dedupeBy?: string; readonly responses?: readonly ScriptedResponse[] } = {},\n): ExternalDecl {\n return {\n name,\n host,\n guarantees: options.dedupeBy ? { dedupeBy: options.dedupeBy } : {},\n ...(options.responses ? { responses: options.responses } : {}),\n };\n}\n\n/**\n * Selects the requests to an external that took effect: a request replayed\n * under a dedupe key the external had already seen is not counted.\n */\nexport function fetchCall(externalName: string, method?: string): EffectSelector {\n return {\n target: `Fetch:${externalName}`,\n ...(method ? { op: method.toUpperCase() } : {}),\n kind: \"result\",\n where: { \"result.effective\": true },\n };\n}\n\nfunction validateHttpDrive(drive: HttpDrive): readonly string[] {\n const errors: string[] = [];\n if (drive.requests.length === 0) errors.push(\"http drive needs at least one request\");\n const ids = new Set<string>();\n drive.requests.forEach((r, i) => {\n if (!r.path.startsWith(\"/\")) errors.push(`requests[${i}].path must start with \"/\"`);\n if (!r.method) errors.push(`requests[${i}].method must not be empty`);\n if (ids.has(r.id)) errors.push(`duplicate request id ${JSON.stringify(r.id)}`);\n ids.add(r.id);\n if ((r.method === \"GET\" || r.method === \"HEAD\") && r.body !== undefined)\n errors.push(`requests[${i}] is a ${r.method} and cannot carry a body`);\n });\n if (!(Number.isInteger(drive.retries) && drive.retries >= 0))\n errors.push(\"http drive retries must be a non-negative integer\");\n return errors;\n}\n\n/** Build and validate a scenario spec; throws with every problem listed. */\nexport function defineScenario(input: CloudflareScenarioInput): ScenarioSpec {\n const drive: QueueDrive | HttpDrive =\n input.drive.kind === \"http\"\n ? input.drive\n : \"messages\" in input.drive &&\n input.drive.messages.every((m) => \"id\" in m && typeof m.id === \"string\")\n ? (input.drive as QueueDrive)\n : queue(input.drive.queue, input.drive.messages);\n const spec: ScenarioSpec = {\n version: 1,\n name: input.name,\n platform: \"cloudflare\",\n worker: input.worker,\n drive,\n setup: input.setup ?? [],\n externals: input.externals ?? [],\n invariants: input.invariants,\n bounds: { ...defaultBounds, ...input.bounds },\n };\n const errors = [\n ...validateScenario(spec),\n ...(drive.kind === \"http\" ? validateHttpDrive(drive) : []),\n ];\n if (errors.length > 0) {\n throw new Error(`invalid scenario ${JSON.stringify(input.name)}:\\n- ${errors.join(\"\\n- \")}`);\n }\n return spec;\n}\n"],"mappings":";;;;;;AASA,SAAgB,MACd,MACA,UACA,UAA0B,EAAE,MAAM,KAAK,KAAK,GAClB;CAC1B,OAAO,QAAQ,MAAM,UAAU,OAAO;AACxC;;AAGA,eAAsB,YACpB,MACA,UACA,SACe;CACf,MAAM,UAAU,MAAM,MAAM,MAAM,UAAU,OAAO;CACnD,IAAI,QAAQ,SAAS,WAAW,MAAM,IAAI,MAAM,gBAAgB,OAAO,CAAC;AAC1E;;;ACtBA,SAAgB,OAAO,OAAg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CAAC,CAC1D;CACA,IAAI,OAAO,SAAS,GAClB,MAAM,IAAI,MAAM,oBAAoB,KAAK,UAAU,MAAM,IAAI,EAAE,OAAO,OAAO,KAAK,MAAM,GAAG;CAE7F,OAAO;AACT"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { C as Schedule, n as Platform, o as ScenarioSpec, r as Bounds, v as Violation, w as EffectLog } from "./platform-TwATAkL3.mjs";
|
|
2
|
-
interface BoundsReached {
|
|
3
|
-
readonly runs: number;
|
|
4
|
-
readonly effectPoints: number;
|
|
5
|
-
readonly faultsInjected: number;
|
|
6
|
-
readonly elapsedMs: number;
|
|
7
|
-
}
|
|
8
|
-
interface VerdictBase {
|
|
9
|
-
readonly scenario: string;
|
|
10
|
-
readonly seed: number | string;
|
|
11
|
-
readonly reached: BoundsReached;
|
|
12
|
-
readonly assumptions: readonly string[];
|
|
13
|
-
}
|
|
14
|
-
interface Shrunk {
|
|
15
|
-
readonly faultsRemoved: number;
|
|
16
|
-
readonly eventsRemoved: number;
|
|
17
|
-
readonly runs: number;
|
|
18
|
-
}
|
|
19
|
-
interface Violated extends VerdictBase {
|
|
20
|
-
readonly kind: "VIOLATED";
|
|
21
|
-
readonly violation: Violation;
|
|
22
|
-
/** The replayed, shrunk trace that breaks the invariant. */
|
|
23
|
-
readonly trace: EffectLog;
|
|
24
|
-
readonly schedule: Schedule;
|
|
25
|
-
/** Ids of the drive's events that remain after shrinking. */
|
|
26
|
-
readonly keptEvents: readonly string[];
|
|
27
|
-
readonly shrunk: Shrunk;
|
|
28
|
-
}
|
|
29
|
-
interface Bounded extends VerdictBase {
|
|
30
|
-
readonly kind: "BOUNDED";
|
|
31
|
-
readonly bounds: Bounds;
|
|
32
|
-
}
|
|
33
|
-
type UnsupportedCause = "unsupported_api" | "not_replayable" | "module_state_leak" | "unsupported_bounds";
|
|
34
|
-
interface Unsupported extends VerdictBase {
|
|
35
|
-
readonly kind: "UNSUPPORTED";
|
|
36
|
-
readonly cause: UnsupportedCause;
|
|
37
|
-
readonly reason: string;
|
|
38
|
-
}
|
|
39
|
-
type ScenarioVerdict = Violated | Bounded | Unsupported;
|
|
40
|
-
/** One line per verdict, for error messages; full rendering lives in `report`. */
|
|
41
|
-
declare function describeVerdict(v: ScenarioVerdict): string;
|
|
42
|
-
interface ExploreOptions {
|
|
43
|
-
readonly seed: number | string;
|
|
44
|
-
/** Hard cap on runs, in addition to the scenario's time budget. */
|
|
45
|
-
readonly maxRuns?: number;
|
|
46
|
-
/** Probability of injecting at an eligible effect point. */
|
|
47
|
-
readonly faultProbability?: number;
|
|
48
|
-
/** Clock for the time budget; injectable for tests. */
|
|
49
|
-
readonly now?: () => number;
|
|
50
|
-
/** Hard cap on replay runs spent shrinking a violation. */
|
|
51
|
-
readonly maxShrinkRuns?: number;
|
|
52
|
-
/**
|
|
53
|
-
* How many of the first exploration runs to replay in reverse order
|
|
54
|
-
* before reporting BOUNDED, to detect module-level state leaking between
|
|
55
|
-
* runs. 0 disables the pass.
|
|
56
|
-
*/
|
|
57
|
-
readonly leakCheckRuns?: number;
|
|
58
|
-
}
|
|
59
|
-
/** Re-run a recorded schedule exactly. */
|
|
60
|
-
declare function replay(spec: ScenarioSpec, platform: Platform, schedule: Schedule): Promise<EffectLog>;
|
|
61
|
-
declare function explore(spec: ScenarioSpec, platform: Platform, options: ExploreOptions): Promise<ScenarioVerdict>;
|
|
62
|
-
export { BoundsReached as a, Violated as c, Bounded as i, describeVerdict as l, explore as n, ScenarioVerdict as o, replay as r, Unsupported as s, ExploreOptions as t };
|
|
63
|
-
//# sourceMappingURL=explore-YVHTRjjS.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"explore-YVHTRjjS.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../engine/src/explore.ts"],"mappings":";UAOiB;WACN;WACA;WACA;WACA;;UAGD;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;UAGM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;UAGF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;UAMK,oBAAoB;WAC1B;WACA,OAAO;WACP;;KAGC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;UCnClB;WACN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;;iBAuDW,OACpB,MAAM,cACN,UAAU,UACV,UAAU,WACT,QAAQ;iBAIW,QACpB,MAAM,cACN,UAAU,UACV,SAAS,iBACR,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-TwATAkL3.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/effect-log.ts","../../core/src/faults.ts","../../core/src/invariants.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;;;;;;;KChBjB;UAUK;;WAEN;;WAEA;WACA,OAAO;;WAEP;WACA;;UAGM;;WAEN;WACA,iBAAiB;;;UC1BX;WACN;WACA;WACA,OAAO;;WAEP;cAAoB,eAAe;;;WAEnC;cAAsB;;;;UAIhB;WACN;WACA;WACA,QAAQ;;WAER;;;UAIM;WACN;WACA;WACA,QAAQ;WACR;WACA,mBAAmB;;WAEnB;aAAwB;;;;KAqBvB;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;;KAGC,YAAY,mBAAmB,cAAc,WAAW;UA2DnD;WACN;WACA;;WAEA;;WAEA;;iBA4EK,eAAe,KAAK,WAAW,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