eutaxy 0.15.0 → 0.15.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 +6 -6
- package/dist/aws.mjs +2 -2
- package/dist/bin.mjs +1 -1
- package/dist/{cli-CzGCMudc.mjs → cli-DT4lxaPK.mjs} +231 -39
- package/dist/cli-DT4lxaPK.mjs.map +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/cloudflare.mjs +2 -2
- package/dist/{delivery-invariants-BCtvzAfW.mjs → delivery-invariants-Dr658H1W.mjs} +2 -2
- package/dist/{delivery-invariants-BCtvzAfW.mjs.map → delivery-invariants-Dr658H1W.mjs.map} +1 -1
- package/dist/explore-B52m-wmk.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{src-ud5wEfnx.mjs → src-CPuihHZh.mjs} +217 -238
- package/dist/src-CPuihHZh.mjs.map +1 -0
- package/dist/{src-nwQA9Xwr.mjs → src-wa0JZa-T.mjs} +2 -2
- package/dist/{src-nwQA9Xwr.mjs.map → src-wa0JZa-T.mjs.map} +1 -1
- package/dist/{workerd-Be43_PZo.mjs → workerd-DvhVDnQW.mjs} +14 -7
- package/dist/workerd-DvhVDnQW.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/cli-CzGCMudc.mjs.map +0 -1
- package/dist/src-ud5wEfnx.mjs.map +0 -1
- package/dist/workerd-Be43_PZo.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -21,8 +21,8 @@ on state that was still current.
|
|
|
21
21
|
|
|
22
22
|
**Status: early.** The documentation is at
|
|
23
23
|
[eutaxy.dev](https://eutaxy.dev). The design is in
|
|
24
|
-
[docs/design.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.
|
|
25
|
-
[docs/roadmap.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.
|
|
24
|
+
[docs/design.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.1/docs/design.md); the phases and their gates are in
|
|
25
|
+
[docs/roadmap.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.1/docs/roadmap.md).
|
|
26
26
|
|
|
27
27
|
## Verdicts
|
|
28
28
|
|
|
@@ -76,9 +76,9 @@ Write a scenario beside your Worker and run the check:
|
|
|
76
76
|
eutaxy check ./payments.sim.ts
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
[examples/payments-queue](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.
|
|
79
|
+
[examples/payments-queue](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.1/examples/payments-queue) is a complete, runnable
|
|
80
80
|
version of this: a queue consumer with a bug the check finds, and the fixed
|
|
81
|
-
Worker it reports `BOUNDED` for. [examples/](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.
|
|
81
|
+
Worker it reports `BOUNDED` for. [examples/](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.1/examples) holds the others,
|
|
82
82
|
each a Worker, its scenario, the bug and the fix: a webhook with an
|
|
83
83
|
idempotency key, a lease pool object with an alarm, an Agent with a
|
|
84
84
|
schedule and WebSocket connections, two Workers over a service binding,
|
|
@@ -153,8 +153,8 @@ pnpm install
|
|
|
153
153
|
pnpm check # lint, typecheck, test
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
-
See [CONTRIBUTING.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.
|
|
156
|
+
See [CONTRIBUTING.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.1/CONTRIBUTING.md).
|
|
157
157
|
|
|
158
158
|
## License
|
|
159
159
|
|
|
160
|
-
[Apache-2.0](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.
|
|
160
|
+
[Apache-2.0](https://github.com/Kaisenwerk/eutaxy/blob/v0.15.1/LICENSE).
|
package/dist/aws.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-C1I3wEg2.mjs";
|
|
2
|
-
import { A as readFaults, C as patchProperty, E as validateScenario, L as canonicalJson, T as defaultBounds, b as realTick, i as proxiedSide, j as writeFaults, k as decisionFaults, l as runInvocation, n as DifferentialStuck, p as installScriptedFetch, r as compareSides, u as CrashSignal, w as toJson$1, x as settleOn, y as patchGlobals } from "./src-
|
|
3
|
-
import { a as redelivery, i as invocationOf, n as atLeastOncePerMessage$1, r as atMostOncePerKey } from "./delivery-invariants-
|
|
2
|
+
import { A as readFaults, C as patchProperty, E as validateScenario, L as canonicalJson, T as defaultBounds, b as realTick, i as proxiedSide, j as writeFaults, k as decisionFaults, l as runInvocation, n as DifferentialStuck, p as installScriptedFetch, r as compareSides, u as CrashSignal, w as toJson$1, x as settleOn, y as patchGlobals } from "./src-CPuihHZh.mjs";
|
|
3
|
+
import { a as redelivery, i as invocationOf, n as atLeastOncePerMessage$1, r as atMostOncePerKey } from "./delivery-invariants-Dr658H1W.mjs";
|
|
4
4
|
import { $ as booleanSelector, $t as ServiceException, A as BinaryDecisionDiagram, An as isValidHostLabel, B as NODE_REGION_CONFIG_FILE_OPTIONS, C as isIpAddress, Ct as dateToUtcString, Dt as parseRfc7231DateTime, E as EndpointError, En as normalizeProvider$1, Et as parseRfc3339DateTimeWithOffset, F as init_config$1, Fn as hasOwn, G as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, H as REGION_ENV_NAME, Ht as NoOpLogger, It as fromBase64, Jt as resolveDefaultRuntimeConfig, Kt as getDefaultExtensionConfiguration, L as resolveDefaultsModeConfig, Ln as getSmithyContext, N as resolveParams, Nn as HttpRequest, Nt as toBase64, O as EndpointCache, On as isValidHostname, Ot as expectUnion, P as config_exports, Pt as fromUtf8, Qt as loadConfigsForDefaultMode, Rt as client_exports$1, Sn as parseUrl, Tt as parseEpochTimestamp, U as REGION_INI_NAME, V as NODE_REGION_CONFIG_OPTIONS, Vt as makeBuilder, Wt as getValueFromTextNode, X as loadConfig, Yt as emitWarningIfUnsupportedVersion$1, Z as SelectorType, _ as resolveEndpointConfig, _t as _parseRfc7231DateTime, b as decideEndpoint, bn as init_transport, bt as quoteHeader, c as generateIdempotencyToken, cn as TypeRegistry, ct as NumericValue, d as v4, en as decorateServiceException, ft as splitHeader, g as init_endpoints, gn as deref, gt as _parseRfc3339DateTimeWithOffset, h as getEndpointPlugin, ht as _parseEpochTimestamp, in as Command, jn as HttpResponse, jt as toUtf8, l as init_serde, m as endpoints_exports, mn as getSchemaSerdePlugin, mt as splitEvery, n as init_checksum, nn as createAggregatedClient, on as init_schema, p as sdkStreamMixin, pn as translateTraits, q as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, r as Sha256Node, rt as calculateBodyLength, s as Uint8ArrayBlobAdapter, sn as schema_exports, t as checksum_exports, tt as ProviderError, u as serde_exports, un as NormalizedSchema, ut as nv, vn as Client$1, w as customEndpointFunctions, wn as parseQueryString, xt as LazyJsonString, y as resolveEndpoint, z as resolveRegionConfig, zn as require_dist_cjs$20, zt as init_client$1 } from "./checksum-75EliDEr.mjs";
|
|
5
5
|
import { Readable } from "node:stream";
|
|
6
6
|
import { platform, release } from "node:os";
|
package/dist/bin.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { L as canonicalJson } from "./src-
|
|
2
|
-
import { _ as render, a as renderText, c as checkSpecModule, d as shrinkRefutation, g as endpointNumber, h as endpointBigInt, i as renderSpecs, m as conforms, n as renderSpecReport, p as evaluate, r as renderSpecReportJson, v as describeType } from "./src-
|
|
1
|
+
import { L as canonicalJson } from "./src-CPuihHZh.mjs";
|
|
2
|
+
import { _ as render, a as renderText, c as checkSpecModule, d as shrinkRefutation, g as endpointNumber, h as endpointBigInt, i as renderSpecs, m as conforms, n as renderSpecReport, p as evaluate, r as renderSpecReportJson, v as describeType } from "./src-wa0JZa-T.mjs";
|
|
3
3
|
import { n as isSpec } from "./combinators-CLfsPfhT.mjs";
|
|
4
4
|
import { t as aggregate } from "./provers-DS44OeEm.mjs";
|
|
5
|
-
import { G as cloudflareRegressionTest, n as globKey, r as specKey } from "./workerd-
|
|
5
|
+
import { G as cloudflareRegressionTest, n as globKey, r as specKey } from "./workerd-DvhVDnQW.mjs";
|
|
6
6
|
import { createRequire, registerHooks } from "node:module";
|
|
7
7
|
import { Readable } from "node:stream";
|
|
8
8
|
import { createHash, randomBytes } from "node:crypto";
|
|
9
|
-
import { chmodSync, closeSync, copyFileSync, createReadStream, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, renameSync, rmSync, symlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
10
|
-
import { homedir, tmpdir } from "node:os";
|
|
9
|
+
import { chmodSync, closeSync, copyFileSync, createReadStream, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, symlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
10
|
+
import { availableParallelism, homedir, tmpdir } from "node:os";
|
|
11
11
|
import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
12
12
|
import { createZstdDecompress, inflateRawSync } from "node:zlib";
|
|
13
13
|
import { fork, spawn } from "node:child_process";
|
|
@@ -17,6 +17,65 @@ import { API, DiagnosticCategory, SymbolFlags, TypeFlags, TypeFormatFlags } from
|
|
|
17
17
|
import * as is from "typescript/ast/is";
|
|
18
18
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
19
19
|
import { createInterface } from "node:readline";
|
|
20
|
+
import { StringDecoder } from "node:string_decoder";
|
|
21
|
+
// packages/prover/src/pool.ts
|
|
22
|
+
/**
|
|
23
|
+
* Independent jobs run a few at a time, with their results in the order of
|
|
24
|
+
* the items whatever order the jobs finish in: what an engine needs to run
|
|
25
|
+
* one solver process per property, or the report one process per module,
|
|
26
|
+
* without the answer depending on which finished first. A job that throws
|
|
27
|
+
* rejects the pool, and no job is started after it.
|
|
28
|
+
*/
|
|
29
|
+
/** `work` on every item, at most `limit` at once; the results in item order. */
|
|
30
|
+
async function inPool(items, limit, work) {
|
|
31
|
+
const results = new Array(items.length);
|
|
32
|
+
let next = 0;
|
|
33
|
+
let failed = false;
|
|
34
|
+
const worker = async () => {
|
|
35
|
+
while (next < items.length && !failed) {
|
|
36
|
+
const i = next++;
|
|
37
|
+
try {
|
|
38
|
+
results[i] = await work(items[i], i);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
failed = true;
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const workers = Math.max(1, Math.min(Math.floor(limit), items.length));
|
|
46
|
+
await Promise.all(Array.from({ length: workers }, worker));
|
|
47
|
+
return results;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `inPool`, and no item starts `size` or more places past the earliest one
|
|
51
|
+
* not yet finished: when an early job is slow, the jobs behind it wait
|
|
52
|
+
* rather than run ahead, so whatever the finished ones hold for their turn
|
|
53
|
+
* (the report's held output) is never more than `size - 1` items' worth.
|
|
54
|
+
*/
|
|
55
|
+
async function inWindow(items, size, work) {
|
|
56
|
+
const n = Math.max(1, Math.floor(size));
|
|
57
|
+
const finished = items.map(() => false);
|
|
58
|
+
let earliest = 0;
|
|
59
|
+
let failed = false;
|
|
60
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
61
|
+
return inPool(items, n, async (item, i) => {
|
|
62
|
+
if (i >= earliest + n) await new Promise((go) => waiting.set(i, go));
|
|
63
|
+
if (failed) throw new Error("an earlier job failed");
|
|
64
|
+
try {
|
|
65
|
+
return await work(item, i);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
failed = true;
|
|
68
|
+
throw err;
|
|
69
|
+
} finally {
|
|
70
|
+
finished[i] = true;
|
|
71
|
+
while (finished[earliest]) earliest++;
|
|
72
|
+
for (const [j, go] of waiting) if (j < earliest + n) {
|
|
73
|
+
waiting.delete(j);
|
|
74
|
+
go();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
20
79
|
// packages/cli/src/args.ts
|
|
21
80
|
function parseArgs(argv, booleans = []) {
|
|
22
81
|
const positionals = [];
|
|
@@ -5397,8 +5456,9 @@ function prelude(module) {
|
|
|
5397
5456
|
* One property's script: the binders as constants, what their types say
|
|
5398
5457
|
* beyond their sorts, the precondition asserted, the claim's negation
|
|
5399
5458
|
* asserted. `unsat` proves the claim; `sat` comes with the binders' values.
|
|
5459
|
+
* `definitions` is the module's `prelude`, when the caller already has it.
|
|
5400
5460
|
*/
|
|
5401
|
-
function propertyScript(property, module) {
|
|
5461
|
+
function propertyScript(property, module, definitions = prelude(module)) {
|
|
5402
5462
|
if (property.kind !== "forall" || !property.ensures) fail("not a forall property");
|
|
5403
5463
|
const e = env(module);
|
|
5404
5464
|
const types = property.binders.map((b) => binderType(b.name, b.type, module));
|
|
@@ -5409,7 +5469,7 @@ function propertyScript(property, module) {
|
|
|
5409
5469
|
}));
|
|
5410
5470
|
return {
|
|
5411
5471
|
script: `${[
|
|
5412
|
-
|
|
5472
|
+
definitions,
|
|
5413
5473
|
...binders.map((b) => `(declare-const ${b.symbol} ${sort(b.type, module)})`),
|
|
5414
5474
|
...binders.flatMap((b) => {
|
|
5415
5475
|
const c = wellFormed(b.symbol, b.type, module);
|
|
@@ -5786,7 +5846,7 @@ function prepare(input) {
|
|
|
5786
5846
|
for (const property of fn.properties) {
|
|
5787
5847
|
if (property.kind !== "forall") continue;
|
|
5788
5848
|
try {
|
|
5789
|
-
scripts.set(key(fn.name, property.name), propertyScript(property, module));
|
|
5849
|
+
scripts.set(key(fn.name, property.name), propertyScript(property, module, pre));
|
|
5790
5850
|
} catch (err) {
|
|
5791
5851
|
if (!(err instanceof OutsideSubset)) throw err;
|
|
5792
5852
|
skipped.set(key(fn.name, property.name), err.message);
|
|
@@ -5813,6 +5873,8 @@ function prepare(input) {
|
|
|
5813
5873
|
* Node does not, is completed in a sibling copy that is imported and then
|
|
5814
5874
|
* removed, so the copy's own relative imports still resolve.
|
|
5815
5875
|
*/
|
|
5876
|
+
/** Names each sibling copy apart from another made in the same millisecond. */
|
|
5877
|
+
let copies = 0;
|
|
5816
5878
|
async function importSpecFile(specPath) {
|
|
5817
5879
|
try {
|
|
5818
5880
|
return await import(pathToFileURL(specPath).href);
|
|
@@ -5823,7 +5885,7 @@ async function importSpecFile(specPath) {
|
|
|
5823
5885
|
const dir = dirname(specPath);
|
|
5824
5886
|
const rewritten = source.replace(/(from\s*["'])(\.{1,2}\/[^"']+?)(\.js)?(["'])/g, (whole, pre, rel, _js, post) => existsSync(join(dir, `${rel}.ts`)) ? `${pre}${rel}.ts${post}` : whole);
|
|
5825
5887
|
if (rewritten === source) throw err;
|
|
5826
|
-
const copy = join(dir, `.eutaxy-replay-${process.pid}-${Date.now()}.props.ts`);
|
|
5888
|
+
const copy = join(dir, `.eutaxy-replay-${process.pid}-${Date.now()}-${copies++}.props.ts`);
|
|
5827
5889
|
writeFileSync(copy, rewritten);
|
|
5828
5890
|
try {
|
|
5829
5891
|
return await import(pathToFileURL(copy).href);
|
|
@@ -5832,12 +5894,23 @@ async function importSpecFile(specPath) {
|
|
|
5832
5894
|
}
|
|
5833
5895
|
}
|
|
5834
5896
|
}
|
|
5897
|
+
function specLoader() {
|
|
5898
|
+
const loaded = /* @__PURE__ */ new Map();
|
|
5899
|
+
return (specPath) => {
|
|
5900
|
+
let ns = loaded.get(specPath);
|
|
5901
|
+
if (ns === void 0) {
|
|
5902
|
+
ns = importSpecFile(specPath);
|
|
5903
|
+
loaded.set(specPath, ns);
|
|
5904
|
+
}
|
|
5905
|
+
return ns;
|
|
5906
|
+
};
|
|
5907
|
+
}
|
|
5835
5908
|
/** The spec file's export for a property, loaded for replay, or why it could not be. */
|
|
5836
|
-
async function loadSpec(specPath, property, fn) {
|
|
5909
|
+
async function loadSpec(load, specPath, property, fn) {
|
|
5837
5910
|
if (specPath === void 0) return "the engine was not given the spec file's path to replay the counterexample";
|
|
5838
5911
|
let ns;
|
|
5839
5912
|
try {
|
|
5840
|
-
ns = await
|
|
5913
|
+
ns = await load(specPath);
|
|
5841
5914
|
} catch (err) {
|
|
5842
5915
|
return `the spec file could not be loaded to replay the counterexample: ${String(err)}`;
|
|
5843
5916
|
}
|
|
@@ -5893,41 +5966,40 @@ async function proveModule(input) {
|
|
|
5893
5966
|
const errors = readAnswer(checked.run.stdout).errors;
|
|
5894
5967
|
if (checked.run.code !== 0 || errors.length > 0 || answers.length !== input.extra.length || failed >= 0) return allWith(unknown("unsupported", `the emitted SMT failed a translation check${failed >= 0 ? ` (${input.extra[failed]})` : ""}: ${errors[0] ?? (checked.run.stderr || checked.run.stdout).trim().split("\n")[0] ?? ""}`));
|
|
5895
5968
|
}
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5969
|
+
const load = specLoader();
|
|
5970
|
+
const proofs = await inPool(inSubset.flatMap((fn) => fn.properties.map((property) => ({
|
|
5971
|
+
fn,
|
|
5972
|
+
property
|
|
5973
|
+
}))), Math.min(8, availableParallelism()), async ({ fn, property }) => {
|
|
5974
|
+
if (property.kind === "total") return {
|
|
5975
|
+
function: fn.name,
|
|
5976
|
+
property: property.name,
|
|
5977
|
+
outcome: unknown("unsupported", "total is not decided by this engine (Lean proves it by acceptance)")
|
|
5978
|
+
};
|
|
5905
5979
|
const k = key(fn.name, property.name);
|
|
5906
5980
|
const why = skipped.get(k);
|
|
5907
|
-
if (why !== void 0) {
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
});
|
|
5913
|
-
continue;
|
|
5914
|
-
}
|
|
5981
|
+
if (why !== void 0) return {
|
|
5982
|
+
function: fn.name,
|
|
5983
|
+
property: property.name,
|
|
5984
|
+
outcome: unknown("unsupported", why)
|
|
5985
|
+
};
|
|
5915
5986
|
const script = scripts.get(k);
|
|
5916
|
-
if (!script)
|
|
5987
|
+
if (!script) return void 0;
|
|
5917
5988
|
const solved = await solve(solver, script.script, options);
|
|
5918
|
-
|
|
5989
|
+
return {
|
|
5919
5990
|
function: fn.name,
|
|
5920
5991
|
property: property.name,
|
|
5921
|
-
outcome: await outcomeOf(solved, script, module, property, fn.name, input)
|
|
5922
|
-
}
|
|
5923
|
-
}
|
|
5992
|
+
outcome: await outcomeOf(solved, script, module, property, fn.name, input, load)
|
|
5993
|
+
};
|
|
5994
|
+
});
|
|
5995
|
+
for (const proof of proofs) if (proof) results.push(proof);
|
|
5924
5996
|
return {
|
|
5925
5997
|
results,
|
|
5926
5998
|
smt,
|
|
5927
5999
|
specErrors
|
|
5928
6000
|
};
|
|
5929
6001
|
}
|
|
5930
|
-
async function outcomeOf(solved, script, module, property, fn, input) {
|
|
6002
|
+
async function outcomeOf(solved, script, module, property, fn, input, load) {
|
|
5931
6003
|
if (solved.run.timedOut) return unknown("gave_up", `Z3 did not finish within ${input.timeoutMs ?? 12e4} ms`);
|
|
5932
6004
|
if (solved.run.code === null) return unknown("unavailable", `Z3 could not be run: ${solved.run.stderr.trim()}`);
|
|
5933
6005
|
const answer = readAnswer(solved.run.stdout);
|
|
@@ -5948,7 +6020,7 @@ async function outcomeOf(solved, script, module, property, fn, input) {
|
|
|
5948
6020
|
}
|
|
5949
6021
|
const rendered = property.binders.map((b, i) => `${b.name} = ${render(values[i])}`).join(", ");
|
|
5950
6022
|
if (!property.binders.every((b, i) => conforms(b.type, values[i]))) return unknown("unsupported", `Z3's model lies outside the parameter types (${rendered}): the engine's model of the types is wider than the types`);
|
|
5951
|
-
const spec = await loadSpec(input.specPath, property, fn);
|
|
6023
|
+
const spec = await loadSpec(load, input.specPath, property, fn);
|
|
5952
6024
|
if (typeof spec === "string") return unknown("unsupported", `${spec} (the model: ${rendered})`);
|
|
5953
6025
|
const evaluation = evaluate(spec, values);
|
|
5954
6026
|
if ("malformed" in evaluation) return unknown("unsupported", `the property could not be evaluated on the model (${rendered}): ${evaluation.malformed}`);
|
|
@@ -7917,6 +7989,75 @@ async function runInstall(options) {
|
|
|
7917
7989
|
return exitCodes.error;
|
|
7918
7990
|
}
|
|
7919
7991
|
}
|
|
7992
|
+
// packages/cli/src/held-output.ts
|
|
7993
|
+
/**
|
|
7994
|
+
* What a module running ahead of its turn writes, held until its turn:
|
|
7995
|
+
* in memory up to a limit, then in a file, so a module that writes a lot
|
|
7996
|
+
* while an earlier one is still running cannot exhaust the report's heap.
|
|
7997
|
+
* Drained, it gives back exactly the text it was given, in order.
|
|
7998
|
+
*/
|
|
7999
|
+
var HeldOutput = class {
|
|
8000
|
+
#limit;
|
|
8001
|
+
#readBytes;
|
|
8002
|
+
#chunks = [];
|
|
8003
|
+
#bytes = 0;
|
|
8004
|
+
#dir;
|
|
8005
|
+
#fd;
|
|
8006
|
+
/** `limitBytes` is held in memory; past it, everything goes to a file, read back `readBytes` at a time. */
|
|
8007
|
+
constructor(limitBytes = 1 << 20, readBytes = 65536) {
|
|
8008
|
+
this.#limit = limitBytes;
|
|
8009
|
+
this.#readBytes = readBytes;
|
|
8010
|
+
}
|
|
8011
|
+
/** Whether the text held so far went past the limit into a file. */
|
|
8012
|
+
get spilled() {
|
|
8013
|
+
return this.#fd !== void 0;
|
|
8014
|
+
}
|
|
8015
|
+
push(text) {
|
|
8016
|
+
const bytes = Buffer.byteLength(text);
|
|
8017
|
+
if (this.#fd === void 0 && this.#bytes + bytes <= this.#limit) {
|
|
8018
|
+
this.#chunks.push(text);
|
|
8019
|
+
this.#bytes += bytes;
|
|
8020
|
+
return;
|
|
8021
|
+
}
|
|
8022
|
+
if (this.#fd === void 0) {
|
|
8023
|
+
this.#dir = mkdtempSync(join(tmpdir(), "eutaxy-report-"));
|
|
8024
|
+
this.#fd = openSync(join(this.#dir, "held"), "w+");
|
|
8025
|
+
}
|
|
8026
|
+
writeSync(this.#fd, text);
|
|
8027
|
+
}
|
|
8028
|
+
/** Everything held, in order, to `out`; then nothing is held and the file is gone. */
|
|
8029
|
+
drain(out) {
|
|
8030
|
+
for (const text of this.#chunks) out(text);
|
|
8031
|
+
this.#chunks = [];
|
|
8032
|
+
this.#bytes = 0;
|
|
8033
|
+
if (this.#fd === void 0) return;
|
|
8034
|
+
try {
|
|
8035
|
+
const decoder = new StringDecoder("utf8");
|
|
8036
|
+
const buffer = Buffer.alloc(this.#readBytes);
|
|
8037
|
+
for (let at = 0;;) {
|
|
8038
|
+
const n = readSync(this.#fd, buffer, 0, buffer.length, at);
|
|
8039
|
+
if (n === 0) break;
|
|
8040
|
+
at += n;
|
|
8041
|
+
const text = decoder.write(buffer.subarray(0, n));
|
|
8042
|
+
if (text !== "") out(text);
|
|
8043
|
+
}
|
|
8044
|
+
const rest = decoder.end();
|
|
8045
|
+
if (rest !== "") out(rest);
|
|
8046
|
+
} finally {
|
|
8047
|
+
this.discard();
|
|
8048
|
+
}
|
|
8049
|
+
}
|
|
8050
|
+
/** Drop the file, if any. */
|
|
8051
|
+
discard() {
|
|
8052
|
+
if (this.#fd !== void 0) closeSync(this.#fd);
|
|
8053
|
+
if (this.#dir !== void 0) rmSync(this.#dir, {
|
|
8054
|
+
recursive: true,
|
|
8055
|
+
force: true
|
|
8056
|
+
});
|
|
8057
|
+
this.#fd = void 0;
|
|
8058
|
+
this.#dir = void 0;
|
|
8059
|
+
}
|
|
8060
|
+
};
|
|
7920
8061
|
// packages/cli/src/report.ts
|
|
7921
8062
|
/**
|
|
7922
8063
|
* `eutaxy report [dir]`: every spec file under a directory through the
|
|
@@ -8027,6 +8168,36 @@ function testModule(m, seed, budgetMs, stderr) {
|
|
|
8027
8168
|
});
|
|
8028
8169
|
}
|
|
8029
8170
|
/**
|
|
8171
|
+
* Every module's verdicts, a few modules' processes at a time. The verdicts
|
|
8172
|
+
* come back in module order, and what each module writes reaches `stderr`
|
|
8173
|
+
* in module order too: a module's output is held until every module before
|
|
8174
|
+
* it has finished (in memory up to a limit, then in a file), so the report
|
|
8175
|
+
* reads as if they ran one after another. No module starts eight or more
|
|
8176
|
+
* places past the earliest unfinished one, so at most seven modules' output
|
|
8177
|
+
* is held at once.
|
|
8178
|
+
*/
|
|
8179
|
+
async function testModules(modules, seed, budgetMs, stderr) {
|
|
8180
|
+
const held = modules.map(() => new HeldOutput());
|
|
8181
|
+
const finished = modules.map(() => false);
|
|
8182
|
+
let current = 0;
|
|
8183
|
+
try {
|
|
8184
|
+
return await inWindow(modules, Math.min(8, availableParallelism()), async (m, i) => {
|
|
8185
|
+
const verdicts = await testModule(m, seed, budgetMs, (text) => {
|
|
8186
|
+
if (i === current) stderr(text);
|
|
8187
|
+
else held[i]?.push(text);
|
|
8188
|
+
});
|
|
8189
|
+
finished[i] = true;
|
|
8190
|
+
while (finished[current]) {
|
|
8191
|
+
current++;
|
|
8192
|
+
held[current]?.drain(stderr);
|
|
8193
|
+
}
|
|
8194
|
+
return verdicts;
|
|
8195
|
+
});
|
|
8196
|
+
} finally {
|
|
8197
|
+
for (const h of held) h.discard();
|
|
8198
|
+
}
|
|
8199
|
+
}
|
|
8200
|
+
/**
|
|
8030
8201
|
* Write a module's open Lean goals beside its spec file as
|
|
8031
8202
|
* `<spec>.goals.lean`, a proof file with every proof open, and list them.
|
|
8032
8203
|
* No open goal removes a goal file left from an earlier run.
|
|
@@ -8090,8 +8261,7 @@ async function runReport(o) {
|
|
|
8090
8261
|
for (const e of errors) o.stderr(`${e}\n`);
|
|
8091
8262
|
return exitCodes.error;
|
|
8092
8263
|
}
|
|
8093
|
-
let specs =
|
|
8094
|
-
for (const m of modules) specs = [...specs, ...await testModule(m, o.seed ?? "report", o.moduleBudgetMs ?? 6e4, o.stderr)];
|
|
8264
|
+
let specs = (await testModules(modules, o.seed ?? "report", o.moduleBudgetMs ?? 6e4, o.stderr)).flat();
|
|
8095
8265
|
const goals = [];
|
|
8096
8266
|
if (engines.length > 0) specs = await proveSpecs(root, modules.map((m) => ({
|
|
8097
8267
|
module: m.key,
|
|
@@ -8115,7 +8285,7 @@ async function runReport(o) {
|
|
|
8115
8285
|
}
|
|
8116
8286
|
// packages/cli/src/version.ts
|
|
8117
8287
|
/** The published package's version, as the MCP server reports it; the release tooling keeps it in step. */
|
|
8118
|
-
const eutaxyVersion = "0.15.
|
|
8288
|
+
const eutaxyVersion = "0.15.1";
|
|
8119
8289
|
// packages/cli/src/mcp.ts
|
|
8120
8290
|
/**
|
|
8121
8291
|
* `eutaxy mcp`: a Model Context Protocol server over stdio, so a coding
|
|
@@ -8819,6 +8989,28 @@ async function main(argv, io) {
|
|
|
8819
8989
|
io.stderr(`check needs a scenario file\n\n${usage}`);
|
|
8820
8990
|
return exitCodes.error;
|
|
8821
8991
|
}
|
|
8992
|
+
if (positionals.length > 2) {
|
|
8993
|
+
io.stderr(`check takes one scenario file\n\n${usage}`);
|
|
8994
|
+
return exitCodes.error;
|
|
8995
|
+
}
|
|
8996
|
+
const checkFlags = [
|
|
8997
|
+
"wrangler",
|
|
8998
|
+
"seed",
|
|
8999
|
+
"max-runs",
|
|
9000
|
+
"budget-ms",
|
|
9001
|
+
"exhaustive",
|
|
9002
|
+
"prover",
|
|
9003
|
+
"json",
|
|
9004
|
+
"out",
|
|
9005
|
+
"no-regression",
|
|
9006
|
+
"expect-violation",
|
|
9007
|
+
"keep"
|
|
9008
|
+
];
|
|
9009
|
+
const unknownFlag = Object.keys(flags).find((k) => !checkFlags.includes(k));
|
|
9010
|
+
if (unknownFlag !== void 0) {
|
|
9011
|
+
io.stderr(`check does not take --${unknownFlag}\n`);
|
|
9012
|
+
return exitCodes.error;
|
|
9013
|
+
}
|
|
8822
9014
|
const maxRunsText = str("max-runs");
|
|
8823
9015
|
const maxRuns = maxRunsText === void 0 ? void 0 : Number(maxRunsText);
|
|
8824
9016
|
if (maxRuns !== void 0 && !(Number.isInteger(maxRuns) && maxRuns > 0)) {
|
|
@@ -8851,4 +9043,4 @@ async function main(argv, io) {
|
|
|
8851
9043
|
}
|
|
8852
9044
|
export { main as t };
|
|
8853
9045
|
|
|
8854
|
-
//# sourceMappingURL=cli-
|
|
9046
|
+
//# sourceMappingURL=cli-DT4lxaPK.mjs.map
|