eutaxy 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +6 -6
  2. package/dist/aws.d.mts +2 -2
  3. package/dist/aws.mjs +2 -2
  4. package/dist/bin.mjs +1 -1
  5. package/dist/{cli-KACykdzJ.mjs → cli-dK6w25AU.mjs} +13 -9
  6. package/dist/{cli-KACykdzJ.mjs.map → cli-dK6w25AU.mjs.map} +1 -1
  7. package/dist/cli.mjs +1 -1
  8. package/dist/cloudflare.d.mts +14 -3
  9. package/dist/cloudflare.d.mts.map +1 -1
  10. package/dist/cloudflare.mjs +2 -2
  11. package/dist/{delivery-invariants-BfRnb9yR.mjs → delivery-invariants-BXCuv43L.mjs} +2 -2
  12. package/dist/{delivery-invariants-BfRnb9yR.mjs.map → delivery-invariants-BXCuv43L.mjs.map} +1 -1
  13. package/dist/{delivery-invariants-B8ZZnCZg.d.mts → delivery-invariants-D7DI7i8x.d.mts} +2 -2
  14. package/dist/{delivery-invariants-B8ZZnCZg.d.mts.map → delivery-invariants-D7DI7i8x.d.mts.map} +1 -1
  15. package/dist/{explore-DlwIUowm.d.mts → explore-Ci-xVeKU.d.mts} +2 -2
  16. package/dist/{explore-DlwIUowm.d.mts.map → explore-Ci-xVeKU.d.mts.map} +1 -1
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.mjs +2 -2
  19. package/dist/{platform-DPJTjpSr.d.mts → platform-D4hlJjm3.d.mts} +26 -1
  20. package/dist/{platform-DPJTjpSr.d.mts.map → platform-D4hlJjm3.d.mts.map} +1 -1
  21. package/dist/{src-dkn6Illb.mjs → src-BiX530QY.mjs} +179 -18
  22. package/dist/src-BiX530QY.mjs.map +1 -0
  23. package/dist/{src-DWRaG5aV.mjs → src-DVqL5Rk_.mjs} +2 -2
  24. package/dist/{src-DWRaG5aV.mjs.map → src-DVqL5Rk_.mjs.map} +1 -1
  25. package/dist/{workerd-9Tt0BV-3.mjs → workerd-b1sqOnVc.mjs} +3751 -3277
  26. package/dist/workerd-b1sqOnVc.mjs.map +1 -0
  27. package/package.json +1 -1
  28. package/dist/src-dkn6Illb.mjs.map +0 -1
  29. package/dist/workerd-9Tt0BV-3.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1 +1 @@
1
- export { t as main } from "./cli-KACykdzJ.mjs";
1
+ export { t as main } from "./cli-dK6w25AU.mjs";
@@ -1,6 +1,6 @@
1
- import { C as EffectSelector, S as Refines, _ as Implies, a as PlatformData, b as StateQuery, c as WorkerRef, f as Invariant, g as EveryRow, i as ExternalDecl, k as JsonValue, n as Platform, o as ScenarioSpec, r as Bounds, s as ScriptedResponse, u as AtLeastOnce, v as References, x as Unique, y as RowCondition } from "./platform-DPJTjpSr.mjs";
2
- import { n as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-B8ZZnCZg.mjs";
3
- import { c as ModuleSpecs, g as Violated, m as ScenarioVerdict, t as ExploreOptions } from "./explore-DlwIUowm.mjs";
1
+ import { C as EffectSelector, S as Refines, _ as Implies, a as PlatformData, b as StateQuery, c as WorkerRef, f as Invariant, g as EveryRow, i as ExternalDecl, k as JsonValue, n as Platform, o as ScenarioSpec, r as Bounds, s as ScriptedResponse, u as AtLeastOnce, v as References, x as Unique, y as RowCondition } from "./platform-D4hlJjm3.mjs";
2
+ import { n as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-D7DI7i8x.mjs";
3
+ import { c as ModuleSpecs, g as Violated, m as ScenarioVerdict, t as ExploreOptions } from "./explore-Ci-xVeKU.mjs";
4
4
  /**
5
5
  * What `cloudflareRegressionTest` needs to write the test: import paths of the scenario, the Worker and its
6
6
  * schema files, relative to the emitted file, and what the platform was given when the check ran.
@@ -38,6 +38,8 @@ interface CloudflareRegressionOptions {
38
38
  readonly path: string;
39
39
  readonly entrypoint?: string;
40
40
  readonly props?: Readonly<Record<string, unknown>>;
41
+ /** The callee is the scenario's own Worker, called back by a Worker it called. */
42
+ readonly self?: boolean;
41
43
  }>>;
42
44
  /**
43
45
  * The qualified names the callees' bindings had in the check's isolate: the
@@ -544,6 +546,14 @@ interface CalleeModule {
544
546
  readonly exports: Readonly<Record<string, unknown>>;
545
547
  readonly entrypoint?: string;
546
548
  readonly props?: Readonly<Record<string, JsonValue>>;
549
+ /**
550
+ * The module is the scenario's own Worker, reached back through a
551
+ * callee's binding (the Worker it called calls it in turn): it runs with
552
+ * the scenario's env as it is, under its own names, not with a view
553
+ * qualified by `name`, so what it reads and writes there is what the
554
+ * scenario's events read and write.
555
+ */
556
+ readonly self?: boolean;
547
557
  }
548
558
  /**
549
559
  * The callee's `env`: the scenario's env seen under the callee's own names,
@@ -687,6 +697,7 @@ interface CheckTransport {
687
697
  readonly name: string;
688
698
  readonly entrypoint?: string;
689
699
  readonly props?: Readonly<Record<string, unknown>>;
700
+ readonly self?: boolean;
690
701
  }>>;
691
702
  /** The aliases the platform ran with, for the regression test. */
692
703
  readonly aliases?: Readonly<Record<string, string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../../cli/src/regression.ts","../../cloudflare/src/r2.ts","../../cloudflare/src/scenario.ts","../../cloudflare/src/callees.ts","../../cloudflare/src/check.ts","../../cloudflare/src/d1.ts","../../cloudflare/src/durable-objects.ts","../../cloudflare/src/platform.ts","../../cloudflare/src/differential.ts","../../cli/src/workerd.ts"],"mappings":";;;;;;;UAOiB;;WAEN;;WAEA;;WAEA,aAAa,SAAS;;;;;WAKtB;;WAEA;;WAEA;;;;;WAKA;;WAEA;;;;;;WAMA,UAAU,SACjB;aAGa;aACA;aACA;aACA,QAAQ,SAAS;;;;;;WAQvB;;WAEA,UAAU,SAAS;WACnB;WACA;;WAEA;aACE;aACA;;;;wBA0BG,yBACd,SAAS,UACT,SAAS;;KCoJC;WAGG;WACA,iBAAiB,SAAS;WAC1B,eAAe,SAAS;;;UC5MtB;WACN;WACA,MAAM;;;UAIA,mBAAmB;WACz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WACnB;cACG;gBAA8B,yBAAyB;;;;;UAKpD;;WAEN;WACA,QAAQ;WACR,KAAK;WACL;;WAEA;;;wBAkcW,gBACpB,MAAM,cACN,SAAS,4BACR,QAAQ;;UCtgBM;WACN;;WAEA,sBAAsB;WACtB;aAAmB;aAAwB;;WAC3C;aAA2B;cAAwB;;;WAEnD;aAAmB;cAAwB;;;;WAG3C,UAAU,SACjB;aAGa;aACA;aACA,QAAQ,SAAS;;;WAKvB,UAAU,SAAS;WACnB;aAA+B;aAAyB;;;UAGlD;WACN;WACA;WACA;;;UAIM;WACN,OAAO;WACP,YAAY;;;KAIX,aAAa,SAAS,qBAAqB;;;;;UA8FtC;;WAEN,UAAU;;WAEV;;WAEA,gBAAgB;;WAEhB,UAAU,SAAS;;WAEnB,SAAS;;WAET,aAAa,SAAS,eAAe;;WAErC,SAAS,SAAS;;WAElB,UAAU,SAAS,eAAe;;WAElC,WAAW,SAAS;;WAEpB,UAAU,SAAS;WACnB;WACA;WACA;WACA;;;wBAIW,eAAe,OAAO,oBAAoB,QAAQ"}
1
+ {"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../../cli/src/regression.ts","../../cloudflare/src/r2.ts","../../cloudflare/src/scenario.ts","../../cloudflare/src/callees.ts","../../cloudflare/src/check.ts","../../cloudflare/src/d1.ts","../../cloudflare/src/durable-objects.ts","../../cloudflare/src/platform.ts","../../cloudflare/src/differential.ts","../../cli/src/workerd.ts"],"mappings":";;;;;;;UAOiB;;WAEN;;WAEA;;WAEA,aAAa,SAAS;;;;;WAKtB;;WAEA;;WAEA;;;;;WAKA;;WAEA;;;;;;WAMA,UAAU,SACjB;aAGa;aACA;aACA;aACA,QAAQ,SAAS;;aAEjB;;;;;;WAQN;;WAEA,UAAU,SAAS;WACnB;WACA;;WAEA;aACE;aACA;;;;wBA0BG,yBACd,SAAS,UACT,SAAS;;KCoJC;WAGG;WACA,iBAAiB,SAAS;WAC1B,eAAe,SAAS;;;UC9MtB;WACN;WACA,MAAM;;;U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WAEA,SAAS;;UAGH;WACN,mBAAmB;WACnB;cACG;gBAA8B,yBAAyB;;;;;UAKpD;;WAEN;WACA,QAAQ;WACR,KAAK;WACL;;WAEA;;;wBAkcW,gBACpB,MAAM,cACN,SAAS,4BACR,QAAQ;;UCvgBM;WACN;;WAEA,sBAAsB;WACtB;aAAmB;aAAwB;;WAC3C;aAA2B;cAAwB;;;WAEnD;aAAmB;cAAwB;;;;WAG3C,UAAU,SACjB;aAGa;aACA;aACA,QAAQ,SAAS;aACjB;;;WAKN,UAAU,SAAS;WACnB;aAA+B;aAAyB;;;UAGlD;WACN;WACA;WACA;;;UAIM;WACN,OAAO;WACP,YAAY;;;KAIX,aAAa,SAAS,qBAAqB;;;;;UA8FtC;;WAEN,UAAU;;WAEV;;WAEA,gBAAgB;;WAEhB,UAAU,SAAS;;WAEnB,SAAS;;WAET,aAAa,SAAS,eAAe;;WAErC,SAAS,SAAS;;WAElB,UAAU,SAAS,eAAe;;WAElC,WAAW,SAAS;;WAEpB,UAAU,SAAS;WACnB;WACA;WACA;WACA;;;wBAIW,eAAe,OAAO,oBAAoB,QAAQ"}
@@ -1,3 +1,3 @@
1
- import { r as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-BfRnb9yR.mjs";
2
- import { A as r2Bucket, B as webSocketReceived, C as external, D as implies, E as httpResponse, F as rpc, G as cloudflareRegressionTest, H as workflow, I as rpcResponse, L as service, M as r2Rows, N as references, O as queue, P as refines, R as serviceCall, S as everyRow, T as http, U as workflowRows, V as websocket, W as workflowStep, _ as d1Write, a as createCloudflarePlatform, b as durableObjectRows, c as expectHolds, d as callee, f as cron, g as d1Schema, h as d1Rows, i as runDifferential, j as r2Op, k as queueAck, l as calleeEnv, m as d1Read, o as snapshotD1, p as d1Param, s as check, t as checkInWorkerd, u as atLeastOncePerMessage, v as defineScenario, w as fetchCall, x as durableObjectTable, y as durableObject, z as unique } from "./workerd-9Tt0BV-3.mjs";
1
+ import { r as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-BXCuv43L.mjs";
2
+ import { A as r2Op, B as websocket, C as fetchCall, D as queue, E as implies, F as rpcResponse, G as cloudflareRegressionTest, H as workflowRows, I as service, L as serviceCall, M as references, N as refines, O as queueAck, P as rpc, R as unique, S as external, T as httpResponse, U as workflowStep, V as workflow, W as snapshotD1, _ as defineScenario, a as createCloudflarePlatform, b as durableObjectTable, c as calleeEnv, d as cron, f as d1Param, g as d1Write, h as d1Schema, i as runDifferential, j as r2Rows, k as r2Bucket, l as atLeastOncePerMessage, m as d1Rows, o as check, p as d1Read, s as expectHolds, t as checkInWorkerd, u as callee, v as durableObject, w as http, x as everyRow, y as durableObjectRows, z as webSocketReceived } from "./workerd-b1sqOnVc.mjs";
3
3
  export { atLeastOnce, atLeastOncePerMessage, atMostOncePerKey, callee, calleeEnv, check, checkInWorkerd, cloudflareRegressionTest, createCloudflarePlatform, cron, d1Param, d1Read, d1Rows, d1Schema, d1Write, defineScenario, durableObject, durableObjectRows, durableObjectTable, everyRow, expectHolds, external, fetchCall, http, httpResponse, implies, queue, queueAck, r2Bucket, r2Op, r2Rows, references, refines, rpc, rpcResponse, runDifferential, service, serviceCall, snapshotD1, unique, webSocketReceived, websocket, workflow, workflowRows, workflowStep };
@@ -1,4 +1,4 @@
1
- import { F as getPath } from "./src-dkn6Illb.mjs";
1
+ import { F as getPath } from "./src-BiX530QY.mjs";
2
2
  // packages/core/src/delivery-invariants.ts
3
3
  /**
4
4
  * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing
@@ -41,4 +41,4 @@ function atLeastOncePerMessage(name, events, effect, key, bodyKey) {
41
41
  }
42
42
  export { atLeastOncePerMessage as n, atMostOncePerKey as r, atLeastOnce as t };
43
43
 
44
- //# sourceMappingURL=delivery-invariants-BfRnb9yR.mjs.map
44
+ //# sourceMappingURL=delivery-invariants-BXCuv43L.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-invariants-BfRnb9yR.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\n/**\n * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing\n * happened twice for one key, a payment recorded twice, a message sent twice.\n */\nexport function atMostOncePerKey(\n name: string,\n effect: EffectSelector,\n key: string,\n): AtMostOncePerKey {\n return { kind: \"atMostOncePerKey\", name, effect, key };\n}\n\n/** Every value in `expected` appears at least once as `key` in a selected effect: nothing was lost. */\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":";;;;;;AAcA,SAAgB,iBACd,MACA,QACA,KACkB;CAClB,OAAO;EAAE,MAAM;EAAoB;EAAM;EAAQ;CAAI;AACvD;;AAGA,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
+ {"version":3,"file":"delivery-invariants-BXCuv43L.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\n/**\n * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing\n * happened twice for one key, a payment recorded twice, a message sent twice.\n */\nexport function atMostOncePerKey(\n name: string,\n effect: EffectSelector,\n key: string,\n): AtMostOncePerKey {\n return { kind: \"atMostOncePerKey\", name, effect, key };\n}\n\n/** Every value in `expected` appears at least once as `key` in a selected effect: nothing was lost. */\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":";;;;;;AAcA,SAAgB,iBACd,MACA,QACA,KACkB;CAClB,OAAO;EAAE,MAAM;EAAoB;EAAM;EAAQ;CAAI;AACvD;;AAGA,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,4 +1,4 @@
1
- import { C as EffectSelector, d as AtMostOncePerKey, k as JsonValue, u as AtLeastOnce } from "./platform-DPJTjpSr.mjs";
1
+ import { C as EffectSelector, d as AtMostOncePerKey, k as JsonValue, u as AtLeastOnce } from "./platform-D4hlJjm3.mjs";
2
2
  /**
3
3
  * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing
4
4
  * happened twice for one key, a payment recorded twice, a message sent twice.
@@ -7,4 +7,4 @@ declare function atMostOncePerKey(name: string, effect: EffectSelector, key: str
7
7
  /** Every value in `expected` appears at least once as `key` in a selected effect: nothing was lost. */
8
8
  declare function atLeastOnce(name: string, effect: EffectSelector, key: string, expected: readonly JsonValue[]): AtLeastOnce;
9
9
  export { atMostOncePerKey as n, atLeastOnce as t };
10
- //# sourceMappingURL=delivery-invariants-B8ZZnCZg.d.mts.map
10
+ //# sourceMappingURL=delivery-invariants-D7DI7i8x.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-invariants-B8ZZnCZg.d.mts","names":[],"sources":["../../core/src/delivery-invariants.ts"],"mappings":";;;;;iBAcgB,iBACd,cACA,QAAQ,gBACR,cACC;;iBAKa,YACd,cACA,QAAQ,gBACR,aACA,mBAAmB,cAClB"}
1
+ {"version":3,"file":"delivery-invariants-D7DI7i8x.d.mts","names":[],"sources":["../../core/src/delivery-invariants.ts"],"mappings":";;;;;iBAcgB,iBACd,cACA,QAAQ,gBACR,cACC;;iBAKa,YACd,cACA,QAAQ,gBACR,aACA,mBAAmB,cAClB"}
@@ -1,4 +1,4 @@
1
- import { O as Schedule, n as Platform, o as ScenarioSpec, p as Violation, r as Bounds, w as EffectLog } from "./platform-DPJTjpSr.mjs";
1
+ import { O as Schedule, n as Platform, o as ScenarioSpec, p as Violation, r as Bounds, w as EffectLog } from "./platform-D4hlJjm3.mjs";
2
2
  /** How far exploration got: runs, effect points, faults injected and time taken, and coverage when exhaustive. */
3
3
  interface BoundsReached {
4
4
  readonly runs: number;
@@ -241,4 +241,4 @@ declare function replay(spec: ScenarioSpec, platform: Platform, schedule: Schedu
241
241
  */
242
242
  declare function explore(scenario: ScenarioSpec, platform: Platform, options: ExploreOptions): Promise<ScenarioVerdict>;
243
243
  export { describeVerdict as _, Binder as a, ModuleSpecs as c, SpecType as d, Bounded as f, Violated as g, Unsupported as h, Arrow as i, Property as l, ScenarioVerdict as m, explore as n, FunctionSpec as o, BoundsReached as p, replay as r, Hint as s, ExploreOptions as t, SpecError as u };
244
- //# sourceMappingURL=explore-DlwIUowm.d.mts.map
244
+ //# sourceMappingURL=explore-Ci-xVeKU.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"explore-DlwIUowm.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../spec/src/ir.ts","../../engine/src/explore.ts"],"mappings":";;UAQiB;WACN;WACA;WACA;WACA;;;;;;;WAOA;aACE;aACA;aACA;;;UAIH;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;;UAIM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;;UAIF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;;UAOK,oBAAoB;WAC1B;WACA,OAAO;WACP;;;KAIC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;;;;;;;;;;;KC/DvB;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;;;UC3FX;WACN;;WAEA;;;;;;;;WAQA;;;;;;;WAOA;;WAEA;;WAEA;;;;;;WAMA;;;;;;;;WAQA;aAAkC;;;;iBAuPvB,OACpB,MAAM,cACN,UAAU,UACV,UAAU,WACT,QAAQ;;;;;;iBASW,QACpB,UAAU,cACV,UAAU,UACV,SAAS,iBACR,QAAQ"}
1
+ {"version":3,"file":"explore-Ci-xVeKU.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../spec/src/ir.ts","../../engine/src/explore.ts"],"mappings":";;UAQiB;WACN;WACA;WACA;WACA;;;;;;;WAOA;aACE;aACA;aACA;;;UAIH;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;;UAIM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;;UAIF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;;UAOK,oBAAoB;WAC1B;WACA,OAAO;WACP;;;KAIC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;;;;;;;;;;;KC/DvB;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;;;UC3FX;WACN;;WAEA;;;;;;;;WAQA;;;;;;;WAOA;;WAEA;;WAEA;;;;;;WAMA;;;;;;;;WAQA;aAAkC;;;;iBAqQvB,OACpB,MAAM,cACN,UAAU,UACV,UAAU,WACT,QAAQ;;;;;;iBASW,QACpB,UAAU,cACV,UAAU,UACV,SAAS,iBACR,QAAQ"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as EffectSelector, D as FaultKind, E as FaultDecision, O as Schedule, S as Refines, T as EffectRecord, _ as Implies, b as StateQuery, d as AtMostOncePerKey, f as Invariant, g as EveryRow, h as checkInvariants, l as validateScenario, m as checkInvariant, n as Platform, o as ScenarioSpec, p as Violation, r as Bounds, t as EventRef, u as AtLeastOnce, w as EffectLog, x as Unique, y as RowCondition } from "./platform-DPJTjpSr.mjs";
2
- import { _ as describeVerdict, a as Binder, c as ModuleSpecs, d as SpecType, f as Bounded, g as Violated, h as Unsupported, i as Arrow, l as Property, m as ScenarioVerdict, n as explore, o as FunctionSpec, p as BoundsReached, r as replay, s as Hint, t as ExploreOptions, u as SpecError } from "./explore-DlwIUowm.mjs";
1
+ import { C as EffectSelector, D as FaultKind, E as FaultDecision, O as Schedule, S as Refines, T as EffectRecord, _ as Implies, b as StateQuery, d as AtMostOncePerKey, f as Invariant, g as EveryRow, h as checkInvariants, l as validateScenario, m as checkInvariant, n as Platform, o as ScenarioSpec, p as Violation, r as Bounds, t as EventRef, u as AtLeastOnce, w as EffectLog, x as Unique, y as RowCondition } from "./platform-D4hlJjm3.mjs";
2
+ import { _ as describeVerdict, a as Binder, c as ModuleSpecs, d as SpecType, f as Bounded, g as Violated, h as Unsupported, i as Arrow, l as Property, m as ScenarioVerdict, n as explore, o as FunctionSpec, p as BoundsReached, r as replay, s as Hint, t as ExploreOptions, u as SpecError } from "./explore-Ci-xVeKU.mjs";
3
3
  import { n as Forall, t as Fn } from "./combinators-BecOKcmi.mjs";
4
4
  /**
5
5
  * Spec verdicts: what is known about one property of one pure function.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { D as checkInvariants, E as checkInvariant, T as validateScenario, a as explore, o as replay, s as restrictSpec, t as observeCore } from "./src-dkn6Illb.mjs";
2
- import { a as renderText, f as checkedRung, i as renderSpecs, l as specLadder, o as renderTrace, s as emitRegressionTest, t as renderJson, u as testedRung, y as describeVerdict } from "./src-DWRaG5aV.mjs";
1
+ import { D as checkInvariants, E as checkInvariant, T as validateScenario, a as explore, o as replay, s as restrictSpec, t as observeCore } from "./src-BiX530QY.mjs";
2
+ import { a as renderText, f as checkedRung, i as renderSpecs, l as specLadder, o as renderTrace, s as emitRegressionTest, t as renderJson, u as testedRung, y as describeVerdict } from "./src-DVqL5Rk_.mjs";
3
3
  import { t as aggregate } from "./provers-DS44OeEm.mjs";
4
4
  // packages/core/src/spec-verdict.ts
5
5
  /** One line per spec verdict, for error messages; full rendering lives in `report`. */
@@ -384,6 +384,22 @@ interface RunHooks {
384
384
  * invocations only one runs at a time, so this is always the caller.
385
385
  */
386
386
  running(): string;
387
+ /**
388
+ * Whether the invocation has set a virtual timer that has not fired or
389
+ * been cleared: work it left running, for a platform that must know
390
+ * before it treats the invocation's work as done.
391
+ */
392
+ timersPending(invocation: string): boolean;
393
+ /**
394
+ * Run `code` as `host`'s own while a call is still on its way into the
395
+ * host: what an object's constructor does before the method the call
396
+ * names can run (work behind its input gate). The code is the host's,
397
+ * its timers virtual and the host's to be woken by, and the effects it
398
+ * makes the entering call's; it is not the call itself, which starts
399
+ * with `hostedCode`. While it runs, the entering call counts as code
400
+ * that may be awaiting a timer of its own.
401
+ */
402
+ hostEntering<T>(host: string, code: () => T): T;
387
403
  /**
388
404
  * Run `code` as `host`'s own (see `EffectOptions.host`), where the runtime
389
405
  * does not carry async context into it: an object's method about to be
@@ -468,10 +484,19 @@ interface Platform {
468
484
  deliver(event: EventRef, hooks: RunHooks, spec: ScenarioSpec): Promise<DeliveryResult>;
469
485
  /** The same scenario driven only by the events with these ids (for shrinking and regression tests). */
470
486
  restrictEvents(spec: ScenarioSpec, keepIds: readonly string[]): ScenarioSpec;
487
+ /**
488
+ * Events of the platform's own that the end of the run calls for. Asked
489
+ * each time every event has been delivered and nothing is left to move;
490
+ * what it answers is delivered like any other event, and it is asked
491
+ * again until it answers none. (A stateful resource a crash reset and
492
+ * nothing entered since is woken here, inside the run, so the end-of-run
493
+ * snapshot reads it as its next event would find it.)
494
+ */
495
+ closingEvents?(spec: ScenarioSpec): readonly EventRef[];
471
496
  /** Called once all events are delivered; the place to record end-of-run state snapshots. */
472
497
  finish?(spec: ScenarioSpec, hooks: RunHooks): Promise<void>;
473
498
  /** Called when a run ends for any reason, after `finish` or after a failure: undo any per-run patching. */
474
499
  cleanup?(spec: ScenarioSpec): Promise<void>;
475
500
  }
476
501
  export { EffectSelector as C, FaultKind as D, FaultDecision as E, Schedule as O, Refines as S, EffectRecord as T, Implies as _, PlatformData as a, StateQuery as b, WorkerRef as c, AtMostOncePerKey as d, Invariant as f, EveryRow as g, checkInvariants as h, ExternalDecl as i, JsonValue as k, validateScenario as l, checkInvariant as m, Platform as n, ScenarioSpec as o, Violation as p, Bounds as r, ScriptedResponse as s, EventRef as t, AtLeastOnce as u, References as v, EffectLog as w, Unique as x, RowCondition as y };
477
- //# sourceMappingURL=platform-DPJTjpSr.d.mts.map
502
+ //# sourceMappingURL=platform-D4hlJjm3.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-DPJTjpSr.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/faults.ts","../../core/src/effect-log.ts","../../core/src/selectors.ts","../../core/src/refines.ts","../../core/src/state.ts","../../core/src/invariants.ts","../../core/src/scenario.ts","../../core/src/platform.ts"],"mappings":";;;;;KAMY,wDAKC;YACG,cAAc;;;;;;;KCAlB;;UAoBK;;WAEN;;WAEA;WACA,OAAO;;WAEP;WACA;;;UAIM;;WAEN;WACA,iBAAiB;;;;;;;WAOjB;;;KC3CC;;UAGK;;WAEN;WACA,MAAM;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;WACN,kBAAkB;;;UCxBZ;WACN;WACA;WACA,OAAO;;WAEP;cAAoB,eAAe;;;WAEnC;cAAsB;;;;;;;;;;;;;;UCYhB;WACN;WACA;;WAEA;WACA,QAAQ;WACR;aAA8B;aAAyB;;WACvD;aACE,MAAM;aACN,OAAO;;aAEP;;;;KC5BD;WACG;WAAyB;WAA2B,OAAO;;WAC3D;WAAyB;WAA0C;;WACnE;WAAyB;WAAmB,gBAAgB;;WAC5D;WAAyB;;;UAGvB;;WAEN;WACA;WACA,iBAAiB;;;UAIX;WACN;WACA;WACA,OAAO;WACP,gBAAgB;;;;;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AAY,GAAG,cAAc;;EAEzD,UAAU;;;;;;;EAOV,QAAQ,OAAO;;EAEf,SAAS,oBAAoB,gBAAgB,SAAS;;;;;;;;;;EAUtD,OAAO,GAAG,SAAS,QAAQ,IAAI,qBAAqB,QAAQ;;;;;;;;;;;;;;;;EAgB5D,QAAQ,GAAG,oBAAoB,YAAY,GAAG,qBAAqB,QAAQ;;;UAI5D,QAAQ;;WAEd,OAAO;;WAEP,MAAM;;UAGA;WACN;;WAEA,oBAAoB;;;;;;;UAQd;WACN;;WAEA;;;;;;;WAOA;;EAET,MAAM,MAAM,eAAe;;EAE3B,cAAc,MAAM,wBAAwB;;EAE5C,QAAQ,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe,QAAQ;;EAEvE,eAAe,MAAM,cAAc,6BAA6B;;EAEhE,QAAQ,MAAM,cAAc,OAAO,WAAW;;EAE9C,SAAS,MAAM,eAAe"}
1
+ {"version":3,"file":"platform-D4hlJjm3.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/faults.ts","../../core/src/effect-log.ts","../../core/src/selectors.ts","../../core/src/refines.ts","../../core/src/state.ts","../../core/src/invariants.ts","../../core/src/scenario.ts","../../core/src/platform.ts"],"mappings":";;;;;KAMY,wDAKC;YACG,cAAc;;;;;;;KCAlB;;UAoBK;;WAEN;;WAEA;WACA,OAAO;;WAEP;WACA;;;UAIM;;WAEN;WACA,iBAAiB;;;;;;;WAOjB;;;KC3CC;;UAGK;;WAEN;WACA,MAAM;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;WACN,kBAAkB;;;UCxBZ;WACN;WACA;WACA,OAAO;;WAEP;cAAoB,eAAe;;;WAEnC;cAAsB;;;;;;;;;;;;;;UCYhB;WACN;WACA;;WAEA;WACA,QAAQ;WACR;aAA8B;aAAyB;;WACvD;aACE,MAAM;aACN,OAAO;;aAEP;;;;KC5BD;WACG;WAAyB;WAA2B,OAAO;;WAC3D;WAAyB;WAA0C;;WACnE;WAAyB;WAAm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O,aAAa,eAAe,GAAG,YAAY,OAAO,MAAM,YAAY;;EAEzF,YAAY;;;;;;EAMZ;;;;;;EAMA,cAAc;;;;;;;;;;EAUd,aAAa,GAAG,cAAc,YAAY,IAAI;;;;;;;;;;EAU9C,WAAW,GAAG,cAAc,YAAY,GAAG,cAAc;;EAEzD,UAAU;;;;;;;EAOV,QAAQ,OAAO;;EAEf,SAAS,oBAAoB,gBAAgB,SAAS;;;;;;;;;;EAUtD,OAAO,GAAG,SAAS,QAAQ,IAAI,qBAAqB,QAAQ;;;;;;;;;;;;;;;;EAgB5D,QAAQ,GAAG,oBAAoB,YAAY,GAAG,qBAAqB,QAAQ;;;UAI5D,QAAQ;;WAEd,OAAO;;WAEP,MAAM;;UAGA;WACN;;WAEA,oBAAoB;;;;;;;UAQd;WACN;;WAEA;;;;;;;WAOA;;EAET,MAAM,MAAM,eAAe;;EAE3B,cAAc,MAAM,wBAAwB;;EAE5C,QAAQ,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe,QAAQ;;EAEvE,eAAe,MAAM,cAAc,6BAA6B;;;;;;;;;EAShE,eAAe,MAAM,wBAAwB;;EAE7C,QAAQ,MAAM,cAAc,OAAO,WAAW;;EAE9C,SAAS,MAAM,eAAe"}
@@ -1499,6 +1499,8 @@ var Frame = class {
1499
1499
  claimed = false;
1500
1500
  /** The host's code this effect is the call of has started running (`Run.hostedCode`); until then the call is in transit. */
1501
1501
  entered = false;
1502
+ /** Code the host runs on the call's way in (`Run.hostEntering`: its constructor's) is running now, this many times over. */
1503
+ entering = 0;
1502
1504
  /** The host's code this effect is the call of has returned (`Frames.answered`): its answer is in transit. */
1503
1505
  answered = false;
1504
1506
  /**
@@ -1522,9 +1524,15 @@ var Frame = class {
1522
1524
  this.onAbandon = options.onAbandon;
1523
1525
  this.mayPark = options.mayPark ?? (() => true);
1524
1526
  }
1525
- /** Its hosted code is only waiting on effects of its own that are parked (however deep). */
1527
+ /**
1528
+ * Its hosted code is only waiting on effects of its own that are parked
1529
+ * (however deep). A call into a host (an object) waits only once its code
1530
+ * is running there: one whose constructor left an effect parked and whose
1531
+ * method has not started is still on its way in, and taking it for
1532
+ * waiting would let another call enter the host's code ahead of it.
1533
+ */
1526
1534
  isWaiting() {
1527
- return this.children > 0 && this.waitingChildren === this.children;
1535
+ return (this.host === void 0 || this.entered || this.entering > 0) && this.children > 0 && this.waitingChildren === this.children;
1528
1536
  }
1529
1537
  /**
1530
1538
  * Whether it counts as real I/O pending: unless its hosted code is only
@@ -1587,6 +1595,15 @@ var Frames = class {
1587
1595
  * gate delivers calls in the order they arrived, which is the order their
1588
1596
  * effects entered. Without one of that op, the oldest unclaimed of any.
1589
1597
  */
1598
+ /**
1599
+ * The effect of `host`'s being performed whose call is on its way in: the
1600
+ * oldest the host's code has not started, else the newest of its effects.
1601
+ * Not claimed: the call's own code claims it when it starts.
1602
+ */
1603
+ enteringHost(host) {
1604
+ const live = this.byHost.get(host) ?? [];
1605
+ return live.find((f) => !f.claimed) ?? live.at(-1);
1606
+ }
1590
1607
  claimHost(host, op) {
1591
1608
  const live = this.byHost.get(host) ?? [];
1592
1609
  const frame = (op === void 0 ? void 0 : live.find((f) => !f.claimed && f.op === op)) ?? live.find((f) => !f.claimed);
@@ -1611,7 +1628,7 @@ var Frames = class {
1611
1628
  for (const frame of this.stack) {
1612
1629
  if (frame.isWaiting()) continue;
1613
1630
  counted++;
1614
- if (frame.host === void 0 || !frame.entered || frame.answered || frame.performing > 0 || frame.children > 0) return null;
1631
+ if (frame.host === void 0 || !(frame.entered || frame.entering > 0) || frame.answered || frame.performing > 0 || frame.children > 0) return null;
1615
1632
  hosts.add(frame.host);
1616
1633
  }
1617
1634
  return counted > 0 && counted === this.inFlight ? hosts : null;
@@ -1624,17 +1641,21 @@ var Frames = class {
1624
1641
  * resumed in the context of an effect that has ended, as an object's code
1625
1642
  * may run in the context it was built in) or absent (workerd carries none
1626
1643
  * into an object's code): trust only a live frame of the same invocation
1627
- * (the innermost); else, for code in a stale context or hosted code
1628
- * (`hosted`: an object's, entered by the platform), the invocation's own
1629
- * hosting effect. Code in no context at all that is not hosted is
1644
+ * (the innermost); else, for hosted code (`hosted`: an object's, entered
1645
+ * by the platform), the call that code is (`call`, when the platform
1646
+ * knows it: an invocation may have calls into several objects in flight
1647
+ * at once, and the one that started last is not the one every object's
1648
+ * code is inside); else, for hosted code or code in a stale context, the
1649
+ * invocation's own innermost hosting effect. Code in no context at all that is not hosted is
1630
1650
  * outside every effect: a second strand of the invocation (a step
1631
1651
  * attempt the engine gave up on, see `Run.attempt`) running while a call
1632
1652
  * of the first strand is in flight.
1633
1653
  */
1634
- enclosing(invocation, hosted = true) {
1654
+ enclosing(invocation, hosted = true, call) {
1635
1655
  if (!effectScope) return this.stack.at(-1);
1636
1656
  const store = effectScope.getStore();
1637
1657
  if (store?.active && store.invocation === invocation) return store;
1658
+ if (call?.active && call.invocation === invocation) return call;
1638
1659
  return hosted || store !== void 0 ? this.hosting.get(invocation)?.at(-1) : void 0;
1639
1660
  }
1640
1661
  /**
@@ -1769,6 +1790,18 @@ var Turns = class {
1769
1790
  started(id) {
1770
1791
  this.startOrder.set(id, this.startOrder.size);
1771
1792
  }
1793
+ /**
1794
+ * Whether a turn is parked that belongs to one of these hosts: an effect
1795
+ * made by code a call into the host hosts, or by the host's work after an
1796
+ * answer (its continuation, `<host>/after`).
1797
+ */
1798
+ parkedFor(hosts) {
1799
+ return this.parked.some((p) => {
1800
+ if (p.host?.host !== void 0 && hosts.has(p.host.host)) return true;
1801
+ const continuation = /^(.*)\/after(?:#\d+)?$/.exec(p.inv.id);
1802
+ return continuation !== null && hosts.has(continuation[1]);
1803
+ });
1804
+ }
1772
1805
  /** Park an invocation at an effect until `takeTurn` releases it with `go`. */
1773
1806
  park(inv, target, go, host, attempt) {
1774
1807
  const option = {
@@ -2076,7 +2109,13 @@ var Run = class {
2076
2109
  * those effects from then on; see `ownerOf`.
2077
2110
  */
2078
2111
  adopted = /* @__PURE__ */ new WeakMap();
2079
- /** Per host, its poller (concurrent runs; see `pollHost`). */
2112
+ /** Per hosted invocation, the object (host) whose code it was hosted from, directly or through another: see `hosted`. */
2113
+ hostedWithin = /* @__PURE__ */ new Map();
2114
+ /**
2115
+ * Per host, its poller (concurrent runs; see `pollHost`): the waits its
2116
+ * ticks wake, and the turns released to the host's code since its last
2117
+ * tick (`releasedTo`).
2118
+ */
2080
2119
  hostPollers = /* @__PURE__ */ new Map();
2081
2120
  /** Concurrent runs: settles waiting on invocations, released with a `CrashSignal` once theirs crashed; see `settle`. */
2082
2121
  crashWatch = [];
@@ -2093,7 +2132,7 @@ var Run = class {
2093
2132
  options;
2094
2133
  constructor(options) {
2095
2134
  this.options = options;
2096
- this.turns = new Turns(options.chooser, this.frames, (id) => this.runAs(id), () => this.patched?.reads, () => this.firedPending(), () => this.hasAfterWork(), () => this.timersAllowed() !== null);
2135
+ this.turns = new Turns(options.chooser, this.frames, (id) => this.runAs(id), () => this.patched?.reads, () => this.firedPending() + this.releasedUnseen(), () => this.hasAfterWork(), () => this.timersAllowed() !== null || this.idleBehindParked());
2097
2136
  this.concurrent = options.bounds.maxConcurrentInvocations > 1;
2098
2137
  }
2099
2138
  get log() {
@@ -2225,12 +2264,43 @@ var Run = class {
2225
2264
  if (host !== void 0) return this.continuationOf(host).id;
2226
2265
  return deliveryScope?.getStore()?.id ?? this.current;
2227
2266
  }
2267
+ hostEntering(host, code) {
2268
+ if (hostScope?.getStore()?.host === host) return code();
2269
+ if (this.concurrent) this.pollHost(host);
2270
+ const frame = this.frames.enteringHost(host);
2271
+ const run = () => this.patched ? this.patched.handlerCode(code) : code();
2272
+ if (!frame) return hostScope ? hostScope.run({
2273
+ host,
2274
+ frame
2275
+ }, run) : run();
2276
+ this.frames.adjust(frame, () => {
2277
+ frame.entering++;
2278
+ });
2279
+ const left = () => this.frames.adjust(frame, () => {
2280
+ frame.entering--;
2281
+ });
2282
+ let result;
2283
+ try {
2284
+ result = hostScope ? hostScope.run({
2285
+ host,
2286
+ frame
2287
+ }, run) : run();
2288
+ } catch (err) {
2289
+ left();
2290
+ throw err;
2291
+ }
2292
+ if (isThenable(result)) Promise.resolve(result).then(left, left);
2293
+ else left();
2294
+ return result;
2295
+ }
2228
2296
  hostedCode(host, code, op) {
2229
2297
  if (hostScope?.getStore()?.host === host) return code();
2230
2298
  if (this.concurrent) this.pollHost(host);
2231
2299
  const current = this.frames.current();
2232
2300
  const frame = current?.host === host && current.active ? current : this.frames.claimHost(host, op);
2233
- if (frame) frame.entered = true;
2301
+ if (frame) this.frames.adjust(frame, () => {
2302
+ frame.entered = true;
2303
+ });
2234
2304
  const run = () => this.patched ? this.patched.handlerCode(code) : code();
2235
2305
  const result = hostScope ? hostScope.run({
2236
2306
  host,
@@ -2254,17 +2324,43 @@ var Run = class {
2254
2324
  */
2255
2325
  pollHost(host) {
2256
2326
  if (this.hostPollers.has(host)) return;
2257
- const poller = { waiters: [] };
2327
+ const poller = {
2328
+ waiters: [],
2329
+ unseen: 0
2330
+ };
2258
2331
  this.hostPollers.set(host, poller);
2259
2332
  const tick = () => {
2260
2333
  const waiters = poller.waiters;
2261
2334
  poller.waiters = [];
2335
+ const released = poller.unseen;
2262
2336
  for (const wake of waiters) wake();
2337
+ if (released > 0) Promise.resolve().then(() => {
2338
+ poller.unseen -= released;
2339
+ });
2263
2340
  if (poller.waiters.length > 0 || this.hostMayMove(host)) realSetTimeout(tick, 0);
2264
2341
  else this.hostPollers.delete(host);
2265
2342
  };
2266
2343
  realSetTimeout(tick, 0);
2267
2344
  }
2345
+ /**
2346
+ * A turn was released to code that waits for it by polling from inside
2347
+ * `host` (an object's effect during a call, or in its work after an
2348
+ * answer). Until the host's poller ticks, the effect is neither parked
2349
+ * nor in flight, and the scheduler must not take the run for at rest: it
2350
+ * would decide with that code's next effect missing from its options on
2351
+ * a slow tick and present on a fast one. Counted against the poller, so
2352
+ * a host that was reset, whose poller is gone, is not waited for.
2353
+ */
2354
+ releasedTo(host) {
2355
+ const poller = host === void 0 ? void 0 : this.hostPollers.get(host);
2356
+ if (poller) poller.unseen++;
2357
+ }
2358
+ /** Turns released to hosts' code and not yet seen by it (see `releasedTo`): work on its way. */
2359
+ releasedUnseen() {
2360
+ let n = 0;
2361
+ for (const poller of this.hostPollers.values()) n += poller.unseen;
2362
+ return n;
2363
+ }
2268
2364
  hostMayMove(host) {
2269
2365
  const cont = this.continuations.get(host);
2270
2366
  return cont !== void 0 && !cont.isCrashed() && this.afterWork.has(cont) || this.frames.liveHost(host) !== void 0;
@@ -2592,9 +2688,12 @@ var Run = class {
2592
2688
  }
2593
2689
  async effect(point, perform, summarize, options = {}) {
2594
2690
  const ctx = hostScope?.getStore();
2691
+ /** A host's code inside a call of its: that call. */
2692
+ let call;
2595
2693
  if (ctx !== void 0) {
2596
2694
  const { host } = ctx;
2597
2695
  const live = ctx.frame ? ctx.frame.active ? ctx.frame : void 0 : this.frames.liveHost(host);
2696
+ call = live;
2598
2697
  if (live) {
2599
2698
  if (live.invocation !== point.invocation) return this.effect({
2600
2699
  ...point,
@@ -2612,6 +2711,7 @@ var Run = class {
2612
2711
  let released = false;
2613
2712
  this.turns.park(cont, own.target, () => {
2614
2713
  released = true;
2714
+ this.releasedTo(host);
2615
2715
  });
2616
2716
  while (!released && !cont.isCrashed()) await this.hostTick(host);
2617
2717
  if (!released) return hang();
@@ -2620,18 +2720,33 @@ var Run = class {
2620
2720
  }
2621
2721
  }
2622
2722
  const inv = this.invocation(point.invocation);
2623
- const enclosing = this.frames.enclosing(point.invocation, hostScope?.getStore() !== void 0);
2723
+ const enclosing = this.frames.enclosing(point.invocation, ctx !== void 0, call);
2624
2724
  if (this.ownerOf(inv, enclosing).isCrashed()) return hang();
2625
2725
  const nested = enclosing !== void 0;
2626
2726
  if (this.concurrent && !nested) {
2627
2727
  const host = this.hosts.get(point.invocation);
2628
- if (host?.active) return this.hostedTurn(point, perform, summarize, options, inv, void 0, host, (park) => new Promise((go) => park(() => go(true))));
2728
+ if (host?.active) {
2729
+ const within = this.hostedWithin.get(point.invocation);
2730
+ if (within !== void 0) this.pollHost(within);
2731
+ return this.hostedTurn(point, perform, summarize, options, inv, void 0, host, within === void 0 ? (park) => new Promise((go) => park(() => go(true))) : async (park, crashed) => {
2732
+ let released = false;
2733
+ park(() => {
2734
+ released = true;
2735
+ this.releasedTo(within);
2736
+ });
2737
+ while (!released && !crashed()) await this.hostTick(within);
2738
+ return released;
2739
+ });
2740
+ }
2629
2741
  await new Promise((go) => this.turns.park(inv, point.target, go, void 0, this.attemptNow()));
2630
2742
  if (inv.isCrashed()) return hang();
2631
2743
  } else if (this.concurrent && enclosing?.hosts && enclosing.mayPark()) return this.hostedTurn(point, perform, summarize, options, inv, enclosing, enclosing, async (park, crashed) => {
2632
2744
  let released = false;
2633
- park(() => released = true);
2634
2745
  const host = enclosing.host;
2746
+ park(() => {
2747
+ released = true;
2748
+ this.releasedTo(host);
2749
+ });
2635
2750
  while (!released && !crashed()) await (host === void 0 ? realTick() : this.hostTick(host));
2636
2751
  return released;
2637
2752
  });
@@ -2887,16 +3002,19 @@ var Run = class {
2887
3002
  const frame = this.frames.current();
2888
3003
  if (!frame) throw new Error(`invocation ${id} can only be hosted inside an effect being performed`);
2889
3004
  if (!deliveryScope) throw new Error("hosting an invocation needs AsyncLocalStorage (node:async_hooks)");
3005
+ const within = hostScope?.getStore()?.host ?? this.hostedWithin.get(frame.invocation);
2890
3006
  const run = async () => {
2891
3007
  const inv = this.track(id);
2892
3008
  if (this.concurrent) this.turns.started(id);
2893
3009
  this.hosts.set(id, frame);
3010
+ if (within !== void 0) this.hostedWithin.set(id, within);
2894
3011
  this.childWaits(frame);
2895
3012
  try {
2896
3013
  return await work(inv);
2897
3014
  } finally {
2898
3015
  this.childLeaves(frame, true);
2899
3016
  this.hosts.delete(id);
3017
+ this.hostedWithin.delete(id);
2900
3018
  }
2901
3019
  };
2902
3020
  const asHandler = () => this.patched ? this.patched.handlerCode(run) : run();
@@ -3063,6 +3181,40 @@ var Run = class {
3063
3181
  }
3064
3182
  return abandoned;
3065
3183
  }
3184
+ timersPending(invocation) {
3185
+ return this.patched?.clock.nextDueOwned((owner) => owner === invocation, false) !== void 0;
3186
+ }
3187
+ /**
3188
+ * Whether everything in flight is idle code of hosts (see
3189
+ * `Frames.idleHosts`) one of which has an effect parked: a call that
3190
+ * awaits what another call of the same object started (a load the object
3191
+ * dedupes) is waiting on that call's effect, though it parked none of its
3192
+ * own. The run is at rest then, for the scheduler to give that effect its
3193
+ * turn; taken for busy, the call would wait for a turn nothing could give.
3194
+ */
3195
+ idleBehindParked() {
3196
+ const hosts = this.frames.idleHosts();
3197
+ return hosts !== null && this.turns.parkedFor(hosts);
3198
+ }
3199
+ /** Whether the invocation of this id has crashed; one never started has not. */
3200
+ hasCrashed(id) {
3201
+ return id !== null && (this.invocations.get(id)?.isCrashed() ?? false);
3202
+ }
3203
+ /**
3204
+ * Concurrent runs: wait in real time until one of these deliveries ends,
3205
+ * within the scenario's budget. False when there is none to wait for or
3206
+ * none ended in time.
3207
+ */
3208
+ async ended(deliveries) {
3209
+ if (deliveries.length === 0) return false;
3210
+ const deadline = realDeadline(this.options.bounds.budgetMs);
3211
+ const over = () => "ended";
3212
+ try {
3213
+ return await Promise.race([...deliveries.map((d) => d.then(over, over)), deadline.expired]) === "ended";
3214
+ } finally {
3215
+ deadline.cancel();
3216
+ }
3217
+ }
3066
3218
  /** A call of a pure core function, recorded as a decision of the invocation running now (see `observeCore`). */
3067
3219
  decision(fn, payload) {
3068
3220
  this.append({
@@ -3465,7 +3617,9 @@ function explorationAssumption(options) {
3465
3617
  /** Deliver events one at a time, each to completion; time passes until a delayed one is due. */
3466
3618
  async function deliverInOrder(spec, platform, run) {
3467
3619
  const pending = [...platform.initialEvents(spec)];
3468
- while (pending.length > 0) {
3620
+ for (;;) {
3621
+ if (pending.length === 0) pending.push(...platform.closingEvents?.(spec) ?? []);
3622
+ if (pending.length === 0) return;
3469
3623
  const [event] = pending.splice(earliestEvent(pending), 1);
3470
3624
  if (event.at !== void 0) await run.advanceTo(event.at);
3471
3625
  const result = await platform.deliver(event, run, spec);
@@ -3494,7 +3648,11 @@ async function deliverConcurrently(spec, platform, run) {
3494
3648
  active = active.filter((d) => !d.outcome);
3495
3649
  pending.push(...run.takeQueued());
3496
3650
  if (pending.length > queuedBefore) run.queuedEvents();
3497
- if (active.length === 0 && pending.length === 0 && !run.hasAfterWork()) return;
3651
+ if (active.length === 0 && pending.length === 0 && !run.hasAfterWork()) {
3652
+ pending.push(...platform.closingEvents?.(spec) ?? []);
3653
+ if (pending.length === 0) return;
3654
+ run.queuedEvents();
3655
+ }
3498
3656
  const next = pending.length > 0 ? earliestEvent(pending) : -1;
3499
3657
  const eventAt = pending[next]?.at ?? 0;
3500
3658
  const due = next >= 0 && eventAt <= run.now();
@@ -3521,7 +3679,10 @@ async function deliverConcurrently(spec, platform, run) {
3521
3679
  if (!await run.advanceTo(eventAt)) continue;
3522
3680
  } else if (turn === "none" && !(active.length > 0 || !run.hasAfterWork() ? run.fireTimer() : run.fireAfterWorkTimer()) && run.settleAfterWork() === 0) {
3523
3681
  const stuck = active.flatMap((d) => d.started.invocation() ?? []);
3524
- if (run.abandon(stuck) === 0) throw new Error(`the ${platform.name} platform's delivery made no progress and cannot be abandoned`);
3682
+ if (run.abandon(stuck) === 0) {
3683
+ const ending = active.filter((d) => run.hasCrashed(d.started.invocation()));
3684
+ if (!await run.ended(ending.map((d) => d.started.promise))) throw new Error(`the ${platform.name} platform's delivery made no progress and cannot be abandoned`);
3685
+ }
3525
3686
  }
3526
3687
  await run.quiesce();
3527
3688
  }
@@ -3911,4 +4072,4 @@ function observeCore(namespace, functions) {
3911
4072
  }
3912
4073
  export { writeFaults as A, toJson as C, checkInvariants as D, checkInvariant as E, getPath as F, invocationOf as I, redelivery as L, nextInt as M, nextU32 as N, decisionFaults as O, seedPrng as P, canonicalJson as R, patchProperty as S, validateScenario as T, replyOf as _, explore as a, realTick as b, decide as c, runInvocation as d, CrashSignal as f, parseBody as g, isRedirect as h, rawRun as i, nextFloat as j, readFaults as k, hostInvocation as l, findResponse as m, compareSides as n, replay as o, InjectedEffectError as p, proxiedSide as r, restrictSpec as s, observeCore as t, note as u, toResponse as v, defaultBounds as w, virtualEpoch as x, withoutNetwork as y };
3913
4074
 
3914
- //# sourceMappingURL=src-dkn6Illb.mjs.map
4075
+ //# sourceMappingURL=src-BiX530QY.mjs.map