@systemfsoftware/effect-spec-runtime 1.3.1 → 1.3.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @systemfsoftware/effect-spec-runtime
2
2
 
3
- # @systemfsoftware/effect-spec-runtime@1.3.1
3
+ # @systemfsoftware/effect-spec-runtime@1.3.3
4
4
 
5
- Requires Effect ^4.1.4.
5
+ Render JSON text through `Schema.fromJsonString` instead of calling `JSON.stringify` directly, so the package passes the `global-json` check. Output is unchanged for JSON-serialisable values.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Context, Effect, Layer, Scope, Tracer } from "effect";
1
+ import { Context, Effect, Layer, Scope as Scope$1, Tracer } from "effect";
2
2
  import { Expect, Vitest } from "@systemfsoftware/vitest";
3
3
  import { Asserted } from "@systemfsoftware/vitest/integration";
4
4
  import { TestOptions } from "vitest";
5
- import * as Scope$1 from "effect/Scope";
5
+ import * as Scope from "effect/Scope";
6
6
  declare namespace KernelCase_d_exports {
7
7
  export { LiveCase, announceLive, caseProgram, explore, exploreOnce, liveCase };
8
8
  }
@@ -20,8 +20,8 @@ interface LiveCase {
20
20
  * zero-preemption schedule), the scenario body runs after it.
21
21
  */
22
22
  declare const caseProgram: {
23
- <B, E, R, RIn extends Scope$1.Scope>(env: Layer.Layer<R, never, RIn>): (body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>) => Effect.Effect<B, E>;
24
- <B, E, R, RIn extends Scope$1.Scope>(body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>, env: Layer.Layer<R, never, RIn>): Effect.Effect<B, E>;
23
+ <B, E, R, RIn extends Scope.Scope>(env: Layer.Layer<R, never, RIn>): (body: Effect.Effect<B, E, R | RIn | Scope.Scope>) => Effect.Effect<B, E>;
24
+ <B, E, R, RIn extends Scope.Scope>(body: Effect.Effect<B, E, R | RIn | Scope.Scope>, env: Layer.Layer<R, never, RIn>): Effect.Effect<B, E>;
25
25
  };
26
26
  /** Announces a live case with its reason, which is how the run report lists it. */
27
27
  declare const announceLive: (reason: string) => Effect.Effect<void>;
@@ -31,8 +31,8 @@ declare const announceLive: (reason: string) => Effect.Effect<void>;
31
31
  * provides the case scope.
32
32
  */
33
33
  declare const liveCase: {
34
- <B, E, R, RIn extends Scope$1.Scope>(env: Layer.Layer<R, never, RIn>, reason: string): (body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>) => Effect.Effect<B, E, Scope$1.Scope>;
35
- <B, E, R, RIn extends Scope$1.Scope>(body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>, env: Layer.Layer<R, never, RIn>, reason: string): Effect.Effect<B, E, Scope$1.Scope>;
34
+ <B, E, R, RIn extends Scope.Scope>(env: Layer.Layer<R, never, RIn>, reason: string): (body: Effect.Effect<B, E, R | RIn | Scope.Scope>) => Effect.Effect<B, E, Scope.Scope>;
35
+ <B, E, R, RIn extends Scope.Scope>(body: Effect.Effect<B, E, R | RIn | Scope.Scope>, env: Layer.Layer<R, never, RIn>, reason: string): Effect.Effect<B, E, Scope.Scope>;
36
36
  };
37
37
  declare const explore: <A, E>(program: Effect.Effect<A, E>) => Promise<void>;
38
38
  /** An explored case's leak-check second run: its first run already took every seeded schedule. */
@@ -50,18 +50,16 @@ interface SpanRecorder {
50
50
  readonly spans: ReadonlyArray<Tracer.NativeSpan>;
51
51
  }
52
52
  declare const make: () => SpanRecorder;
53
- //#endregion
54
- //#region src/Register.d.ts
55
53
  type RegisterMode = 'run' | 'skip' | 'only';
56
54
  type DescribeMode = 'describe' | 'skip' | 'only';
57
55
  declare namespace Suite_d_exports {
58
- export { Bindings, CaseLive, Config$1 as Config, DescribeMode, LiveCase, Options, RegisterFn, RegisterMode, Scenario, Shared, open, openCase, openShared, openSharedCase };
56
+ export { Bindings, CaseLive, Config, DescribeMode, LiveCase, Options, RegisterFn, RegisterMode, Scenario, Shared, open, openCase, openShared, openSharedCase };
59
57
  }
60
58
  type Options = Pick<TestOptions, 'tags'> & Partial<TestOptions>;
61
59
  interface Bindings {
62
60
  readonly it: Vitest.Methods;
63
61
  }
64
- interface Config$1 {
62
+ interface Config {
65
63
  readonly name: string;
66
64
  readonly describe: DescribeMode;
67
65
  readonly options: Options | undefined;
@@ -75,7 +73,7 @@ interface Shared<R> {
75
73
  * steps check through the test's callback rather than an import. `R` is what the case's layer
76
74
  * provides; every marked step needs the runner's scope and check service beside it.
77
75
  */
78
- type Scenario<B, E, R> = (expect: Expect) => Effect.Effect<B, E, R | Scope.Scope | Asserted>;
76
+ type Scenario<B, E, R> = (expect: Expect) => Effect.Effect<B, E, R | Scope$1.Scope | Asserted>;
79
77
  /**
80
78
  * A case's own live declaration. A live case's first run may hang on an act that happens once, such
81
79
  * as a person approving in a browser; `rerun` is then the scenario the second run on fresh services
@@ -88,20 +86,20 @@ interface RegisterFn<B, E, R> {
88
86
  (name: string, scenario: Scenario<B, E, R>, mode: RegisterMode, live?: CaseLive<B, E, R>): void;
89
87
  }
90
88
  declare const open: {
91
- <B, E, C>(config: Config$1, use: (register: RegisterFn<B, E, Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
92
- <B, E, C>(bindings: Bindings, config: Config$1, use: (register: RegisterFn<B, E, Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
89
+ <B, E, C>(config: Config, use: (register: RegisterFn<B, E, Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
90
+ <B, E, C>(bindings: Bindings, config: Config, use: (register: RegisterFn<B, E, Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
93
91
  };
94
92
  declare const openShared: {
95
- <B, E, RShared, C>(config: Config$1, shared: Shared<RShared>, use: (register: RegisterFn<B, E, RShared | Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
96
- <B, E, RShared, C>(bindings: Bindings, config: Config$1, shared: Shared<RShared>, use: (register: RegisterFn<B, E, RShared | Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
93
+ <B, E, RShared, C>(config: Config, shared: Shared<RShared>, use: (register: RegisterFn<B, E, RShared | Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
94
+ <B, E, RShared, C>(bindings: Bindings, config: Config, shared: Shared<RShared>, use: (register: RegisterFn<B, E, RShared | Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
97
95
  };
98
96
  declare const openCase: {
99
- <B, E, RFresh, RFreshReq extends Scope.Scope, C>(config: Config$1, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RFresh | RFreshReq | Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
100
- <B, E, RFresh, RFreshReq extends Scope.Scope, C>(bindings: Bindings, config: Config$1, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RFresh | RFreshReq | Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
97
+ <B, E, RFresh, RFreshReq extends Scope$1.Scope, C>(config: Config, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RFresh | RFreshReq | Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
98
+ <B, E, RFresh, RFreshReq extends Scope$1.Scope, C>(bindings: Bindings, config: Config, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RFresh | RFreshReq | Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
101
99
  };
102
100
  declare const openSharedCase: {
103
- <B, E, RShared, RFresh, RFreshReq extends RShared, C>(config: Config$1, shared: Shared<RShared>, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RShared | RFresh | Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
104
- <B, E, RShared, RFresh, RFreshReq extends RShared, C>(bindings: Bindings, config: Config$1, shared: Shared<RShared>, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RShared | RFresh | Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
101
+ <B, E, RShared, RFresh, RFreshReq extends RShared, C>(config: Config, shared: Shared<RShared>, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RShared | RFresh | Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
102
+ <B, E, RShared, RFresh, RFreshReq extends RShared, C>(bindings: Bindings, config: Config, shared: Shared<RShared>, caseLayer: Layer.Layer<RFresh, never, RFreshReq>, use: (register: RegisterFn<B, E, RShared | RFresh | Scope$1.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): void;
105
103
  };
106
104
  declare namespace TaskRef_service_d_exports {
107
105
  export { RawVitestTaskRef, VitestTaskContext, VitestTaskRef, provideTaskRef };
@@ -122,5 +120,4 @@ declare const provideTaskRef: {
122
120
  <Ctx>(ctx: Ctx): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
123
121
  <A, E, R, Ctx>(effect: Effect.Effect<A, E, R>, ctx: Ctx): Effect.Effect<A, E, R>;
124
122
  };
125
- //#endregion
126
123
  export { KernelCase_d_exports as KernelCase, SpanRecorder_d_exports as SpanRecorder, Suite_d_exports as Suite, TaskRef_service_d_exports as TaskRef };
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.mjs";
2
2
  import { Kernel } from "@systemfsoftware/effect-sim-kernel";
3
3
  import { createSpanRecorder, providedWorkspaceRoot, replayOfText, testIdentityOf, throwFailureRecord } from "@systemfsoftware/vitest/failure";
4
- import { Cause, Config, Context, Effect, Exit, Layer, Match, Option, Schema, Scope, Tracer } from "effect";
4
+ import { Cause, Config, Context, Effect, Exit, Layer, Match, Option, Result, Schema, Scope, Tracer } from "effect";
5
5
  import { dual } from "effect/Function";
6
6
  import { VitestTestContext, vitestTestContextKey } from "@systemfsoftware/vitest";
7
7
  import { captureRunBinding } from "@systemfsoftware/vitest/integration";
8
8
  import { afterAll, describe } from "vitest";
9
- //#region src/KernelFailure.schema.ts
9
+ // src/KernelFailure.schema.ts
10
10
  /**
11
11
  * The kernel's own failure — a deadlock, an escape, a wait it cannot observe, or a runaway run — as a failure
12
12
  * value carrying the message the record's headline shows (R1, R2). It is a value, not a formatted string, so the
@@ -17,8 +17,7 @@ var KernelFailure = class extends Schema.TaggedError()("KernelFailure", { detail
17
17
  return this.detail;
18
18
  }
19
19
  };
20
- //#endregion
21
- //#region src/TaskRef.service.ts
20
+ // src/TaskRef.service.ts
22
21
  var TaskRef_service_exports = /* @__PURE__ */ __exportAll({
23
22
  RawVitestTaskRef: () => RawVitestTaskRef,
24
23
  VitestTaskRef: () => VitestTaskRef,
@@ -36,8 +35,7 @@ const readTaskContext = (ctx) => Option.getOrNull(Option.liftPredicate(ctx, isPl
36
35
  const readRawTaskContext = (ctx) => Option.getOrNull(Option.liftPredicate(ctx, isTaskContext));
37
36
  const provideTaskRefImpl = (effect, ctx) => effect.pipe(Effect.provideService(VitestTaskRef, readTaskContext(ctx)), Effect.provideService(RawVitestTaskRef, readRawTaskContext(ctx)));
38
37
  const provideTaskRef = dual(2, provideTaskRefImpl);
39
- //#endregion
40
- //#region src/KernelCase.ts
38
+ // src/KernelCase.ts
41
39
  var KernelCase_exports = /* @__PURE__ */ __exportAll({
42
40
  announceLive: () => announceLive,
43
41
  caseProgram: () => caseProgram,
@@ -45,6 +43,10 @@ var KernelCase_exports = /* @__PURE__ */ __exportAll({
45
43
  exploreOnce: () => exploreOnce,
46
44
  liveCase: () => liveCase
47
45
  });
46
+ const jsonTextOf = (value) => Result.match(Schema.encodeUnknownResult(Schema.fromJsonString(Schema.Unknown))(value), {
47
+ onFailure: () => String(value),
48
+ onSuccess: (text) => text
49
+ });
48
50
  /**
49
51
  * One run's program: the case's layers build under the zero-preemption
50
52
  * schedule, exploration is marked, and the scenario body runs under the
@@ -101,7 +103,7 @@ const describeSuspended = (fiber) => {
101
103
  if (first === void 0) return `fiber ${fiber.id}`;
102
104
  return `fiber ${fiber.id} at ${first}`;
103
105
  };
104
- const describeKernelFailure = (failure) => Match.value(failure).pipe(Match.when({ _tag: "Escape" }, (escape) => `escaped the controlled schedule through the ${escape.timer} timer at ${escape.site}`), Match.when({ _tag: "Blocked" }, (blocked) => `waited on a resource the kernel cannot observe: ${blocked.resources.join(", ")}`), Match.when({ _tag: "Deadlock" }, (deadlock) => `deadlocked with ${deadlock.suspended.length} suspended fibers: ${deadlock.suspended.map(describeSuspended).join("; ")}`), Match.when({ _tag: "Runaway" }, (runaway) => `ran past ${runaway.steps} steps with ${runaway.pending} fibers pending`), Match.when({ _tag: "ReplayTraceDiverged" }, (diverged) => `the replayed trace diverged at step ${diverged.atStep}: expected ${JSON.stringify(diverged.expected)}, got ${JSON.stringify(diverged.actual)}`), Match.exhaustive);
106
+ const describeKernelFailure = (failure) => Match.value(failure).pipe(Match.when({ _tag: "Escape" }, (escape) => `escaped the controlled schedule through the ${escape.timer} timer at ${escape.site}`), Match.when({ _tag: "Blocked" }, (blocked) => `waited on a resource the kernel cannot observe: ${blocked.resources.join(", ")}`), Match.when({ _tag: "Deadlock" }, (deadlock) => `deadlocked with ${deadlock.suspended.length} suspended fibers: ${deadlock.suspended.map(describeSuspended).join("; ")}`), Match.when({ _tag: "Runaway" }, (runaway) => `ran past ${runaway.steps} steps with ${runaway.pending} fibers pending`), Match.when({ _tag: "ReplayTraceDiverged" }, (diverged) => `the replayed trace diverged at step ${diverged.atStep}: expected ${jsonTextOf(diverged.expected)}, got ${jsonTextOf(diverged.actual)}`), Match.exhaustive);
105
107
  /** One run with its own recorder: the record is rendered from exactly the spans this run opened (KTD2). */
106
108
  const recorded = (program) => {
107
109
  const recorder = createSpanRecorder();
@@ -192,8 +194,7 @@ const exploreOnce = (program) => readReplayValue().then((value) => {
192
194
  if (value === void 0) return baselineRun(program).then(() => {});
193
195
  return replayOrBaseline(program, replayOfText(value));
194
196
  });
195
- //#endregion
196
- //#region src/SpanRecorder.ts
197
+ // src/SpanRecorder.ts
197
198
  var SpanRecorder_exports = /* @__PURE__ */ __exportAll({ make: () => make });
198
199
  const make = () => {
199
200
  const spans = [];
@@ -206,8 +207,7 @@ const make = () => {
206
207
  spans
207
208
  };
208
209
  };
209
- //#endregion
210
- //#region src/Register.ts
210
+ // src/Register.ts
211
211
  const selectDescribe = (mode) => ({
212
212
  skip: describe.skip,
213
213
  only: describe.only,
@@ -273,8 +273,7 @@ const exploredOnceProgram = (program) => exploredWith(exploreOnce, program);
273
273
  */
274
274
  const selectCaseRunnerImpl = (methodsIt, mode, live) => pickLane(caseLanes(methodsIt, live), mode);
275
275
  const selectCaseRunner = dual(3, selectCaseRunnerImpl);
276
- //#endregion
277
- //#region src/Suite.ts
276
+ // src/Suite.ts
278
277
  var Suite_exports = /* @__PURE__ */ __exportAll({
279
278
  open: () => open,
280
279
  openCase: () => openCase,
@@ -366,5 +365,4 @@ const openSharedCaseImpl = (bindings, config, shared, caseLayer, use) => {
366
365
  });
367
366
  };
368
367
  const openSharedCase = dual(5, openSharedCaseImpl);
369
- //#endregion
370
368
  export { KernelCase_exports as KernelCase, SpanRecorder_exports as SpanRecorder, Suite_exports as Suite, TaskRef_service_exports as TaskRef };
@@ -0,0 +1,12 @@
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, flags) => {
4
+ let target = Object.setPrototypeOf({}, null);
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return flags & 2 ? target : Object.preventExtensions(target);
11
+ };
12
+ export { __exportAll as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/effect-spec-runtime",
3
3
  "license": "Apache-2.0",
4
- "version": "1.3.1",
4
+ "version": "1.3.3",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -32,27 +32,27 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@systemfsoftware/effect-sim-kernel": "^2.0.6"
35
+ "@systemfsoftware/effect-sim-kernel": "^2.1.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@microsoft/api-extractor": "^7.59.4",
38
+ "@microsoft/api-extractor": "^7.60.1",
39
39
  "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
40
- "@systemfsoftware/oxlint-config-recommended": "^8.0.3",
40
+ "@systemfsoftware/oxlint-config-recommended": "^9.0.0",
41
41
  "@systemfsoftware/tsconfig": "^2.1.0",
42
- "@systemfsoftware/tsdown-config": "^0.1.2",
43
- "@systemfsoftware/vitest": "^4.1.3",
44
- "@systemfsoftware/vitest-config": "^0.1.3",
45
- "@types/node": "^26.6.5",
42
+ "@systemfsoftware/tsdown-config": "^0.1.3",
43
+ "@systemfsoftware/vitest": "^4.2.1",
44
+ "@systemfsoftware/vitest-config": "^0.1.4",
45
+ "@types/node": "^26.6.6",
46
46
  "effect": "^4.1.4",
47
47
  "fast-check": "^4.10.2",
48
48
  "oxlint": "~1.93.0",
49
- "rimraf": "^6.1.3",
50
- "tsdown": "^0.23.0",
49
+ "rimraf": "^6.1.4",
50
+ "tsdown": "^0.23.7",
51
51
  "tstyche": "^7.2.5",
52
52
  "vitest": "^5.1.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@systemfsoftware/vitest": "^4.1.3",
55
+ "@systemfsoftware/vitest": "^4.2.1",
56
56
  "effect": "^4.1.4",
57
57
  "vitest": "^5.1.0"
58
58
  },
@@ -66,7 +66,7 @@
66
66
  "typecheck": "tsc -b",
67
67
  "test": "vitest run",
68
68
  "test:types": "TSTYCHE_TYPESCRIPT_MODULE=tstyche-typescript tstyche",
69
- "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}",
69
+ "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; effect-tsgo oxlint . --format=${f:-default}",
70
70
  "attw": "attw --pack .",
71
71
  "api:check": "api-extractor-quiet run",
72
72
  "api:update": "api-extractor run --local"
@@ -1,13 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
- return target;
11
- };
12
- //#endregion
13
- export { __exportAll as t };