eutaxy 0.9.0 → 0.9.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 +7 -6
- package/dist/aws.mjs +2 -2
- package/dist/bin.mjs +2 -2
- package/dist/cli-CVdHb_gU.mjs +2 -0
- package/dist/cli.mjs +2 -2
- package/dist/cloudflare.mjs +2 -2
- package/dist/{delivery-invariants-hmhwh_qD.mjs → delivery-invariants-Cg3eVKSw.mjs} +2 -2
- package/dist/{delivery-invariants-hmhwh_qD.mjs.map → delivery-invariants-Cg3eVKSw.mjs.map} +1 -1
- package/dist/explore-Rwe1PPqX.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{src-BO7I3f-1.mjs → src-BRjmbzMV.mjs} +116 -30
- package/dist/src-BRjmbzMV.mjs.map +1 -0
- package/dist/{src-BzZU6eGF.mjs → src-BnTcWa-4.mjs} +2354 -1532
- package/dist/src-BnTcWa-4.mjs.map +1 -0
- package/dist/{src-BZtuuu_j.mjs → src-Db2r3ZDr.mjs} +2 -2
- package/dist/{src-BZtuuu_j.mjs.map → src-Db2r3ZDr.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/cli-DpeAhtU5.mjs +0 -2
- package/dist/src-BO7I3f-1.mjs.map +0 -1
- package/dist/src-BzZU6eGF.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -19,9 +19,10 @@ Lean 4 (`--prover lean`) or with Z3 (`--prover smt`) when an engine is
|
|
|
19
19
|
named; `refines` checks that the Worker carries out the core's decisions
|
|
20
20
|
on state that was still current.
|
|
21
21
|
|
|
22
|
-
**Status:
|
|
23
|
-
[
|
|
24
|
-
[docs/
|
|
22
|
+
**Status: early.** The documentation is at
|
|
23
|
+
[eutaxy.dev](https://eutaxy.dev). The design is in
|
|
24
|
+
[docs/design.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.1/docs/design.md); the phases and their gates are in
|
|
25
|
+
[docs/roadmap.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.1/docs/roadmap.md).
|
|
25
26
|
|
|
26
27
|
## Verdicts
|
|
27
28
|
|
|
@@ -73,7 +74,7 @@ Write a scenario beside your Worker and run the check:
|
|
|
73
74
|
eutaxy check ./payments.sim.ts
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
[examples/payments-queue](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.
|
|
77
|
+
[examples/payments-queue](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.1/examples/payments-queue) is a complete, runnable
|
|
77
78
|
version of this: a queue consumer with a bug the check finds, and the fixed
|
|
78
79
|
Worker it reports `BOUNDED` for.
|
|
79
80
|
|
|
@@ -136,8 +137,8 @@ pnpm install
|
|
|
136
137
|
pnpm check # lint, typecheck, test
|
|
137
138
|
```
|
|
138
139
|
|
|
139
|
-
See [CONTRIBUTING.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.
|
|
140
|
+
See [CONTRIBUTING.md](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.1/CONTRIBUTING.md).
|
|
140
141
|
|
|
141
142
|
## License
|
|
142
143
|
|
|
143
|
-
[Apache-2.0](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.
|
|
144
|
+
[Apache-2.0](https://github.com/Kaisenwerk/eutaxy/blob/v0.9.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 { E as canonicalJson, _ as defaultBounds, c as CrashSignal, f as patchGlobals, g as toJson$1, h as patchProperty, i as proxiedSide, m as settleOn, n as DifferentialStuck, p as realTick, r as compareSides, u as installScriptedFetch, v as validateScenario } from "./src-
|
|
3
|
-
import { n as atLeastOncePerMessage$1, r as atMostOncePerKey } from "./delivery-invariants-
|
|
2
|
+
import { E as canonicalJson, _ as defaultBounds, c as CrashSignal, f as patchGlobals, g as toJson$1, h as patchProperty, i as proxiedSide, m as settleOn, n as DifferentialStuck, p as realTick, r as compareSides, u as installScriptedFetch, v as validateScenario } from "./src-BRjmbzMV.mjs";
|
|
3
|
+
import { n as atLeastOncePerMessage$1, r as atMostOncePerKey } from "./delivery-invariants-Cg3eVKSw.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-DHr5qb3Y.mjs";
|
|
5
5
|
import { platform, release } from "node:os";
|
|
6
6
|
import { Readable } from "node:stream";
|
package/dist/bin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { N as main } from "./src-
|
|
3
|
-
import "./cli-
|
|
2
|
+
import { N as main } from "./src-BnTcWa-4.mjs";
|
|
3
|
+
import "./cli-CVdHb_gU.mjs";
|
|
4
4
|
// packages/eutaxy/src/bin.ts
|
|
5
5
|
process.stdout.on("error", (err) => {
|
|
6
6
|
if (err.code === "EPIPE") process.exit(process.exitCode ?? 0);
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { N as main } from "./src-
|
|
2
|
-
import "./cli-
|
|
1
|
+
export { N as main } from "./src-BnTcWa-4.mjs";
|
|
2
|
+
import "./cli-CVdHb_gU.mjs";
|
package/dist/cloudflare.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-
|
|
2
|
-
import { A as snapshotD1, C as r2Rows, D as workflow, E as unique, M as expectHolds, O as workflowRows, P as cloudflareRegressionTest, S as r2Op, T as refines, _ as httpResponse, a as d1Param, b as queueAck, c as d1Schema, d as durableObject, f as durableObjectRows, g as http, h as fetchCall, i as atLeastOncePerMessage, j as check, k as workflowStep, l as d1Write, m as external, n as runDifferential, o as d1Read, p as everyRow, r as createCloudflarePlatform, s as d1Rows, t as checkInWorkerd, u as defineScenario, v as implies, w as references, x as r2Bucket, y as queue } from "./src-
|
|
1
|
+
import { r as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-Cg3eVKSw.mjs";
|
|
2
|
+
import { A as snapshotD1, C as r2Rows, D as workflow, E as unique, M as expectHolds, O as workflowRows, P as cloudflareRegressionTest, S as r2Op, T as refines, _ as httpResponse, a as d1Param, b as queueAck, c as d1Schema, d as durableObject, f as durableObjectRows, g as http, h as fetchCall, i as atLeastOncePerMessage, j as check, k as workflowStep, l as d1Write, m as external, n as runDifferential, o as d1Read, p as everyRow, r as createCloudflarePlatform, s as d1Rows, t as checkInWorkerd, u as defineScenario, v as implies, w as references, x as r2Bucket, y as queue } from "./src-BnTcWa-4.mjs";
|
|
3
3
|
export { atLeastOnce, atLeastOncePerMessage, atMostOncePerKey, check, checkInWorkerd, cloudflareRegressionTest, createCloudflarePlatform, d1Param, d1Read, d1Rows, d1Schema, d1Write, defineScenario, durableObject, durableObjectRows, everyRow, expectHolds, external, fetchCall, http, httpResponse, implies, queue, queueAck, r2Bucket, r2Op, r2Rows, references, refines, runDifferential, snapshotD1, unique, workflow, workflowRows, workflowStep };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as getPath } from "./src-
|
|
1
|
+
import { T as getPath } from "./src-BRjmbzMV.mjs";
|
|
2
2
|
// packages/core/src/delivery-invariants.ts
|
|
3
3
|
function atMostOncePerKey(name, effect, key) {
|
|
4
4
|
return {
|
|
@@ -36,4 +36,4 @@ function atLeastOncePerMessage(name, events, effect, key, bodyKey) {
|
|
|
36
36
|
}
|
|
37
37
|
export { atLeastOncePerMessage as n, atMostOncePerKey as r, atLeastOnce as t };
|
|
38
38
|
|
|
39
|
-
//# sourceMappingURL=delivery-invariants-
|
|
39
|
+
//# sourceMappingURL=delivery-invariants-Cg3eVKSw.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-invariants-
|
|
1
|
+
{"version":3,"file":"delivery-invariants-Cg3eVKSw.mjs","names":[],"sources":["../../core/src/delivery-invariants.ts"],"sourcesContent":["/**\n * Constructors for the delivery invariants every platform's scenarios use:\n * nothing delivered twice, nothing lost. Platforms wrap them to take their\n * own drive shapes.\n */\n\nimport type { JsonValue } from \"./canonical-json.ts\";\nimport type { AtLeastOnce, AtMostOncePerKey } from \"./invariants.ts\";\nimport { type EffectSelector, getPath } from \"./selectors.ts\";\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 event's `bodyKey` value must appear at least once as `key` in a\n * selected effect. The expected keys are re-derived from the bodies that\n * remain when shrinking removes events.\n */\nexport function atLeastOncePerMessage(\n name: string,\n events: readonly { readonly id: string; readonly body: JsonValue }[],\n effect: EffectSelector,\n key: string,\n bodyKey: string,\n): AtLeastOnce {\n const expected: JsonValue[] = [];\n for (const e of events) {\n const v = getPath(e.body, bodyKey);\n if (v === undefined)\n throw new Error(`event ${e.id} has no ${JSON.stringify(bodyKey)} in its body`);\n expected.push(v);\n }\n return { ...atLeastOnce(name, effect, key, expected), perMessage: { bodyKey } };\n}\n"],"mappings":";;AAUA,SAAgB,iBACd,MACA,QACA,KACkB;CAClB,OAAO;EAAE,MAAM;EAAoB;EAAM;EAAQ;CAAI;AACvD;AAEA,SAAgB,YACd,MACA,QACA,KACA,UACa;CACb,OAAO;EAAE,MAAM;EAAe;EAAM;EAAQ;EAAK;CAAS;AAC5D;;;;;;AAOA,SAAgB,sBACd,MACA,QACA,QACA,KACA,SACa;CACb,MAAM,WAAwB,CAAC;CAC/B,KAAK,MAAM,KAAK,QAAQ;EACtB,MAAM,IAAI,QAAQ,EAAE,MAAM,OAAO;EACjC,IAAI,MAAM,KAAA,GACR,MAAM,IAAI,MAAM,SAAS,EAAE,GAAG,UAAU,KAAK,UAAU,OAAO,EAAE,aAAa;EAC/E,SAAS,KAAK,CAAC;CACjB;CACA,OAAO;EAAE,GAAG,YAAY,MAAM,QAAQ,KAAK,QAAQ;EAAG,YAAY,EAAE,QAAQ;CAAE;AAChF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explore-Rwe1PPqX.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../spec/src/ir.ts","../../engine/src/explore.ts"],"mappings":";UAOiB;WACN;WACA;WACA;WACA;;;;;;;WAOA;aACE;aACA;aACA;;;UAIH;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;UAGM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;UAGF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;UAMK,oBAAoB;WAC1B;WACA,OAAO;WACP;;KAGC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;;;;;;;;;;;KC1DvB;WACG;;WACA;;WACA;;WACA;;WACA;WAA0B;;WAC1B;;WACA;;WAEA;;WAEA;WACA,iBAAiB;;WAEjB;WAAwB,kBAAkB;;;;WAE1C;WAAwB,SAAS;;WACjC;WAA0B;;UAExB;WACN;WACA,MAAM;;;UAIA;WACN;WACA;;;;;;;UAQM;WACN;WACA,QAAQ;WACR,QAAQ;WACR;aAAmB;aAA0B;;;;UAIvC;;WAEN;WACA,MAAM;;;UAIA;WACN;WACA,MAAM;WACN,OAAO;;;UAID;;WAEN;;WAEA;WACA;;WAEA;;;;;;;UAQM;;WAEN;WACA;;WAEA,kBAAkB;;WAElB,SAAS;WACT,OAAO;WACP,UAAU;;;;;WAKV;aAA6B;aAAwB;;;WAErD;;WAEA;;;UAIM;WACN;WACA,iBAAiB;WACjB,qBAAqB;;WAErB;;WAEA;;;UAIM;WACN;WACA;WACA;;;UAIM;WACN,oBAAoB;WACpB,iBAAiB;;UClGX;WACN;;WAEA;;;;;;;;WAQA;;;;;;;WAOA;;WAEA;;WAEA;;;;;;WAMA;;;;;;;;WAQA;aAAkC;;;;
|
|
1
|
+
{"version":3,"file":"explore-Rwe1PPqX.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../spec/src/ir.ts","../../engine/src/explore.ts"],"mappings":";UAOiB;WACN;WACA;WACA;WACA;;;;;;;WAOA;aACE;aACA;aACA;;;UAIH;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;UAGM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;UAGF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;UAMK,oBAAoB;WAC1B;WACA,OAAO;WACP;;KAGC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;;;;;;;;;;;KC1DvB;WACG;;WACA;;WACA;;WACA;;WACA;WAA0B;;WAC1B;;WACA;;WAEA;;WAEA;WACA,iBAAiB;;WAEjB;WAAwB,kBAAkB;;;;WAE1C;WAAwB,SAAS;;WACjC;WAA0B;;UAExB;WACN;WACA,MAAM;;;UAIA;WACN;WACA;;;;;;;UAQM;WACN;WACA,QAAQ;WACR,QAAQ;WACR;aAAmB;aAA0B;;;;UAIvC;;WAEN;WACA,MAAM;;;UAIA;WACN;WACA,MAAM;WACN,OAAO;;;UAID;;WAEN;;WAEA;WACA;;WAEA;;;;;;;UAQM;;WAEN;WACA;;WAEA,kBAAkB;;WAElB,SAAS;WACT,OAAO;WACP,UAAU;;;;;WAKV;aAA6B;aAAwB;;;WAErD;;WAEA;;;UAIM;WACN;WACA,iBAAiB;WACjB,qBAAqB;;WAErB;;WAEA;;;UAIM;WACN;WACA;WACA;;;UAIM;WACN,oBAAoB;WACpB,iBAAiB;;UClGX;WACN;;WAEA;;;;;;;;WAQA;;;;;;;WAOA;;WAEA;;WAEA;;;;;;WAMA;;;;;;;;WAQA;aAAkC;;;;iBAsKvB,OACpB,MAAM,cACN,UAAU,UACV,UAAU,WACT,QAAQ;iBAIW,QACpB,UAAU,cACV,UAAU,UACV,SAAS,iBACR,QAAQ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as explore, b as checkInvariants, o as replay, s as restrictSpec, t as observeCore, v as validateScenario, y as checkInvariant } from "./src-
|
|
2
|
-
import { a as renderText, b as describeVerdict, c as aggregate, d as testedRung, i as renderSpecs, o as renderTrace, p as checkedRung, s as emitRegressionTest, t as renderJson, u as specLadder } from "./src-
|
|
1
|
+
import { a as explore, b as checkInvariants, o as replay, s as restrictSpec, t as observeCore, v as validateScenario, y as checkInvariant } from "./src-BRjmbzMV.mjs";
|
|
2
|
+
import { a as renderText, b as describeVerdict, c as aggregate, d as testedRung, i as renderSpecs, o as renderTrace, p as checkedRung, s as emitRegressionTest, t as renderJson, u as specLadder } from "./src-Db2r3ZDr.mjs";
|
|
3
3
|
// packages/core/src/spec-verdict.ts
|
|
4
4
|
/** One line per spec verdict, for error messages; full rendering lives in `report`. */
|
|
5
5
|
function describeSpecVerdict(v) {
|
|
@@ -965,14 +965,24 @@ function realDeadline(ms) {
|
|
|
965
965
|
function realTick() {
|
|
966
966
|
return new Promise((resolve) => realSetTimeout(() => resolve(), 0));
|
|
967
967
|
}
|
|
968
|
-
const
|
|
968
|
+
const hostSetImmediate = globalThis.setImmediate;
|
|
969
|
+
const inWorkerd = globalThis.navigator?.userAgent === "Cloudflare-Workers" || typeof globalThis.WebSocketPair === "function";
|
|
969
970
|
/**
|
|
970
|
-
*
|
|
971
|
-
* one
|
|
972
|
-
*
|
|
971
|
+
* A turn of the real event loop without a timer's delay, where the host
|
|
972
|
+
* gives one cheaply: Node's `setImmediate` (microseconds), after which every
|
|
973
|
+
* pending microtask has run and I/O callbacks that were due have been
|
|
974
|
+
* delivered. Null in workerd, which has `setImmediate` too but runs it as a
|
|
975
|
+
* timer, about a millisecond like `setTimeout(0)`, and where nothing else
|
|
976
|
+
* reaches the event loop (streams, bodies, message ports, crypto and the
|
|
977
|
+
* cache all resolve without a turn of it), so a zero timer is the turn.
|
|
978
|
+
* Measured in the Cloudflare Vitest pool (workerd 1.2026-10, 2026-10-30),
|
|
979
|
+
* not documented: a workerd whose `setImmediate` became cheap would only
|
|
980
|
+
* run slower here, never wrong.
|
|
973
981
|
*/
|
|
974
|
-
|
|
975
|
-
|
|
982
|
+
const cheapEventLoopTurn = hostSetImmediate && !inWorkerd ? () => new Promise((resolve) => hostSetImmediate.call(globalThis, () => resolve())) : null;
|
|
983
|
+
/** One turn of the real event loop: the cheap one where the host has it, else a zero timer. */
|
|
984
|
+
function eventLoopTurn() {
|
|
985
|
+
return cheapEventLoopTurn ? cheapEventLoopTurn() : realTick();
|
|
976
986
|
}
|
|
977
987
|
/**
|
|
978
988
|
* Wait for a promise under the virtual clock: while it is pending, let real
|
|
@@ -1447,6 +1457,16 @@ var Frames = class {
|
|
|
1447
1457
|
* chooser when exploring exhaustively, else from a stream seeded by the
|
|
1448
1458
|
* schedule's seed. It also tracks whether turns told apart by their parked
|
|
1449
1459
|
* effects' targets may not commute, which partial-order reduction needs.
|
|
1460
|
+
*
|
|
1461
|
+
* Between turns the run waits for the code it released to come to rest
|
|
1462
|
+
* (`quiesce`): progress (a park, a delivery's end, real I/O completing)
|
|
1463
|
+
* wakes it, and before it decides every continuation that progress set off
|
|
1464
|
+
* has run, which takes one turn of the host's event loop: `setImmediate`
|
|
1465
|
+
* where that is cheap (Node), else the real zero timer the wait armed, which
|
|
1466
|
+
* also polls for the moves of hosted code, which cannot wake it, and gives
|
|
1467
|
+
* code waiting on something it cannot see its allowance. One such turn per
|
|
1468
|
+
* decision is the floor in workerd, where a zero timer is the only way to
|
|
1469
|
+
* the event loop and costs about a millisecond.
|
|
1450
1470
|
*/
|
|
1451
1471
|
var Turns = class {
|
|
1452
1472
|
options;
|
|
@@ -1467,8 +1487,14 @@ var Turns = class {
|
|
|
1467
1487
|
/** The target of the turn running since the last decision; null for an event's start or none. */
|
|
1468
1488
|
turnTarget = null;
|
|
1469
1489
|
commuteNot = false;
|
|
1470
|
-
/** Woken whenever an invocation parks, a delivery ends or I/O completes. */
|
|
1490
|
+
/** Woken whenever an invocation parks, a delivery ends or I/O completes (see `progressed`). */
|
|
1471
1491
|
progressWaiters = [];
|
|
1492
|
+
/** Times something moved, hosted code's moves included, and the count the last wait or step saw. */
|
|
1493
|
+
moves = 0;
|
|
1494
|
+
seenMoves = 0;
|
|
1495
|
+
/** Parks and delivery ends so far, and the count when the current step began. */
|
|
1496
|
+
rests = 0;
|
|
1497
|
+
restsAtStep = 0;
|
|
1472
1498
|
/** The order invocations started in, which orders the parked ones. */
|
|
1473
1499
|
startOrder = /* @__PURE__ */ new Map();
|
|
1474
1500
|
/** The picks among parked invocations, drawn apart from fault decisions. */
|
|
@@ -1502,8 +1528,22 @@ var Turns = class {
|
|
|
1502
1528
|
option,
|
|
1503
1529
|
...host ? { host } : {}
|
|
1504
1530
|
});
|
|
1531
|
+
this.rested();
|
|
1532
|
+
}
|
|
1533
|
+
/** See `Run.rested`. */
|
|
1534
|
+
rested() {
|
|
1535
|
+
this.rests++;
|
|
1505
1536
|
this.progressed();
|
|
1506
1537
|
}
|
|
1538
|
+
/**
|
|
1539
|
+
* A step begins: a turn is released, an event starts or a timer fires.
|
|
1540
|
+
* `quiesce` then waits for what the step set off to come to rest. Called
|
|
1541
|
+
* by `takeTurn` and, for timers, by the run.
|
|
1542
|
+
*/
|
|
1543
|
+
step() {
|
|
1544
|
+
this.restsAtStep = this.rests;
|
|
1545
|
+
this.seenMoves = this.moves;
|
|
1546
|
+
}
|
|
1507
1547
|
/** See `Run.turnsMayNotCommute`. */
|
|
1508
1548
|
get mayNotCommute() {
|
|
1509
1549
|
this.endSegment();
|
|
@@ -1526,6 +1566,7 @@ var Turns = class {
|
|
|
1526
1566
|
}
|
|
1527
1567
|
/** See `Run.progressed`. */
|
|
1528
1568
|
progressed() {
|
|
1569
|
+
this.moves++;
|
|
1529
1570
|
if (this.frames.hostingNow > 0) return;
|
|
1530
1571
|
const waiters = this.progressWaiters;
|
|
1531
1572
|
this.progressWaiters = [];
|
|
@@ -1534,10 +1575,40 @@ var Turns = class {
|
|
|
1534
1575
|
/** See `Run.quiesce`. */
|
|
1535
1576
|
async quiesce() {
|
|
1536
1577
|
for (;;) {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
if (this.
|
|
1578
|
+
const moved = await this.wait();
|
|
1579
|
+
if (this.frames.inFlight > 0) continue;
|
|
1580
|
+
if (this.rests !== this.restsAtStep) return;
|
|
1581
|
+
if (!moved) return;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Wait for a move (see `progressed`) or one real zero timer, whichever
|
|
1586
|
+
* comes first (no wait when something moved since the last one), then
|
|
1587
|
+
* let everything the move set off run before the caller looks: one turn
|
|
1588
|
+
* of the event loop, the cheap one where the host has it, else the timer
|
|
1589
|
+
* armed for the wait, after which the microtask queue is empty too.
|
|
1590
|
+
* Returns whether anything moved since the last wait.
|
|
1591
|
+
*/
|
|
1592
|
+
async wait() {
|
|
1593
|
+
const before = this.seenMoves;
|
|
1594
|
+
const racing = this.moves === before;
|
|
1595
|
+
const tick = racing || !cheapEventLoopTurn ? realDeadline(0) : void 0;
|
|
1596
|
+
if (racing && tick) {
|
|
1597
|
+
let wake = () => {};
|
|
1598
|
+
const woken = new Promise((resolve) => {
|
|
1599
|
+
wake = resolve;
|
|
1600
|
+
});
|
|
1601
|
+
this.progressWaiters.push(wake);
|
|
1602
|
+
await Promise.race([woken, tick.expired]);
|
|
1603
|
+
const i = this.progressWaiters.indexOf(wake);
|
|
1604
|
+
if (i >= 0) this.progressWaiters.splice(i, 1);
|
|
1540
1605
|
}
|
|
1606
|
+
if (cheapEventLoopTurn) {
|
|
1607
|
+
tick?.cancel();
|
|
1608
|
+
await cheapEventLoopTurn();
|
|
1609
|
+
} else await tick?.expired;
|
|
1610
|
+
this.seenMoves = this.moves;
|
|
1611
|
+
return this.moves !== before;
|
|
1541
1612
|
}
|
|
1542
1613
|
/** See `Run.takeTurn`. */
|
|
1543
1614
|
takeTurn(canStart) {
|
|
@@ -1546,6 +1617,7 @@ var Turns = class {
|
|
|
1546
1617
|
const options = this.parked.length + (canStart ? 1 : 0);
|
|
1547
1618
|
this.endSegment();
|
|
1548
1619
|
this.turnTarget = null;
|
|
1620
|
+
this.step();
|
|
1549
1621
|
if (options === 0) return "none";
|
|
1550
1622
|
let pick = 0;
|
|
1551
1623
|
if (options > 1) {
|
|
@@ -2076,16 +2148,24 @@ var Run = class {
|
|
|
2076
2148
|
invocation: () => cell.id
|
|
2077
2149
|
};
|
|
2078
2150
|
}
|
|
2079
|
-
/** Concurrent runs: something moved (
|
|
2151
|
+
/** Concurrent runs: something moved (I/O completed, an event was queued). */
|
|
2080
2152
|
progressed() {
|
|
2081
2153
|
this.turns.progressed();
|
|
2082
2154
|
}
|
|
2155
|
+
/** Concurrent runs: a delivery ended. */
|
|
2156
|
+
rested() {
|
|
2157
|
+
this.turns.rested();
|
|
2158
|
+
}
|
|
2083
2159
|
/**
|
|
2084
|
-
* Concurrent runs: wait until the
|
|
2085
|
-
*
|
|
2086
|
-
*
|
|
2087
|
-
*
|
|
2088
|
-
*
|
|
2160
|
+
* Concurrent runs: wait until what the last step set off (a turn
|
|
2161
|
+
* released, an event started, a timer fired) has parked, finished or
|
|
2162
|
+
* gone idle. Parking, a delivery ending and I/O completing wake the wait
|
|
2163
|
+
* at once, except while a Durable Object's code runs, which cannot wake
|
|
2164
|
+
* it (the wait's zero timer polls then); every continuation they set off
|
|
2165
|
+
* runs before it returns (one turn of the event loop), so code another
|
|
2166
|
+
* invocation's promise resumed reaches its own effect too. Code waiting
|
|
2167
|
+
* on anything else gets one such turn, the same allowance the sequential
|
|
2168
|
+
* path gives, before it counts as idle.
|
|
2089
2169
|
*/
|
|
2090
2170
|
quiesce() {
|
|
2091
2171
|
return this.turns.quiesce();
|
|
@@ -2102,19 +2182,21 @@ var Run = class {
|
|
|
2102
2182
|
/**
|
|
2103
2183
|
* Let virtual time pass until `at`: timers due by then fire first, in due
|
|
2104
2184
|
* order, as the invocations that set them, each followed by the work it
|
|
2105
|
-
* sets off. No-op when `at` is not ahead.
|
|
2185
|
+
* sets off. No-op when `at` is not ahead. Returns whether a timer fired.
|
|
2106
2186
|
*/
|
|
2107
2187
|
async advanceTo(at) {
|
|
2108
2188
|
const clock = this.patched?.clock;
|
|
2109
|
-
if (!clock) return;
|
|
2189
|
+
if (!clock) return false;
|
|
2190
|
+
let fired = false;
|
|
2110
2191
|
for (let due = clock.nextDue(); due !== void 0 && due <= at; due = clock.nextDue()) {
|
|
2111
|
-
this.
|
|
2112
|
-
|
|
2192
|
+
this.fireNextTimer(clock);
|
|
2193
|
+
fired = true;
|
|
2113
2194
|
do
|
|
2114
|
-
await
|
|
2195
|
+
await eventLoopTurn();
|
|
2115
2196
|
while (this.frames.inFlight > 0);
|
|
2116
2197
|
}
|
|
2117
2198
|
clock.advance(at - clock.now());
|
|
2199
|
+
return fired;
|
|
2118
2200
|
}
|
|
2119
2201
|
/** When the next virtual timer is due, or undefined when none is pending. */
|
|
2120
2202
|
nextTimerDue() {
|
|
@@ -2123,10 +2205,13 @@ var Run = class {
|
|
|
2123
2205
|
/** Concurrent runs: fire the next due timer as the invocation that set it. False when none is pending. */
|
|
2124
2206
|
fireTimer() {
|
|
2125
2207
|
const clock = this.patched?.clock;
|
|
2126
|
-
if (!clock) return false;
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2208
|
+
if (!clock || clock.nextOwner() === void 0) return false;
|
|
2209
|
+
return this.fireNextTimer(clock);
|
|
2210
|
+
}
|
|
2211
|
+
/** Fire the next due timer as the invocation that set it (a step of a concurrent run). */
|
|
2212
|
+
fireNextTimer(clock) {
|
|
2213
|
+
this.runAs(clock.nextOwner() ?? null);
|
|
2214
|
+
if (this.concurrent) this.turns.step();
|
|
2130
2215
|
return clock.fireNext();
|
|
2131
2216
|
}
|
|
2132
2217
|
/**
|
|
@@ -2298,14 +2383,15 @@ async function deliverConcurrently(spec, platform, run) {
|
|
|
2298
2383
|
};
|
|
2299
2384
|
d.started.promise.then((result) => {
|
|
2300
2385
|
d.outcome = { result };
|
|
2301
|
-
run.
|
|
2386
|
+
run.rested();
|
|
2302
2387
|
}, (error) => {
|
|
2303
2388
|
d.outcome = { error };
|
|
2304
|
-
run.
|
|
2389
|
+
run.rested();
|
|
2305
2390
|
});
|
|
2306
2391
|
active.push(d);
|
|
2307
|
-
} else if (turn === "none" && next >= 0 && !due && active.length < spec.bounds.maxConcurrentInvocations && (run.nextTimerDue() ?? Number.POSITIVE_INFINITY) > (pending[next]?.at ?? 0))
|
|
2308
|
-
|
|
2392
|
+
} else if (turn === "none" && next >= 0 && !due && active.length < spec.bounds.maxConcurrentInvocations && (run.nextTimerDue() ?? Number.POSITIVE_INFINITY) > (pending[next]?.at ?? 0)) {
|
|
2393
|
+
if (!await run.advanceTo(pending[next]?.at ?? 0)) continue;
|
|
2394
|
+
} else if (turn === "none" && !run.fireTimer()) {
|
|
2309
2395
|
const stuck = active.flatMap((d) => d.started.invocation() ?? []);
|
|
2310
2396
|
if (run.abandon(stuck) === 0) throw new Error(`the ${platform.name} platform's delivery made no progress and cannot be abandoned`);
|
|
2311
2397
|
}
|
|
@@ -2652,4 +2738,4 @@ function observeCore(namespace, functions) {
|
|
|
2652
2738
|
}
|
|
2653
2739
|
export { nextU32 as C, canonicalJson as E, nextInt as S, getPath as T, defaultBounds as _, explore as a, checkInvariants as b, CrashSignal as c, withoutNetwork as d, patchGlobals as f, toJson as g, patchProperty as h, proxiedSide as i, InjectedEffectError as l, settleOn as m, DifferentialStuck as n, replay as o, realTick as p, compareSides as r, restrictSpec as s, observeCore as t, installScriptedFetch as u, validateScenario as v, seedPrng as w, nextFloat as x, checkInvariant as y };
|
|
2654
2740
|
|
|
2655
|
-
//# sourceMappingURL=src-
|
|
2741
|
+
//# sourceMappingURL=src-BRjmbzMV.mjs.map
|