@systemfsoftware/trace-spec 0.4.0 → 0.5.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.
- package/CHANGELOG.md +27 -0
- package/dist/index.d.ts +50 -25
- package/dist/index.mjs +60 -24
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @systemfsoftware/trace-spec
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `Rel.Hold`, `Rel.Break` and `ObservationWindow.ObservationWindowSpec` are schema structs instead of classes, with unchanged encoded shapes: build them with `.make(...)` instead of `new`. The `VerdictTypeId` type is removed. `IncompleteObservationError.spanCount` must be a non-negative integer, and span `startMillis` and `durationMillis` must be finite and non-negative.
|
|
8
|
+
|
|
9
|
+
- `Contract.check(expect, input, options?)` takes the test's `expect` and ends in one check: a break fails it with the report as the message. `Contract.judge` returns the `{ verdict: 'Hold' | 'Break', report }` value, and `Contract.verdictCheck(contract, expect, judgment)` turns one into a check. `TraceDisparityError` is removed. `Suite` cases register as generator tests and judge each case once.
|
|
10
|
+
|
|
11
|
+
- The lawful test runner is now a peer dependency under its own name, `@systemfsoftware/vitest`, instead of the `@effect/vitest` alias that pointed at it. Install `@systemfsoftware/vitest` and import `it`, `layer`, `expect`, and the rest from `@systemfsoftware/vitest`. `@systemfsoftware/effect-gherkin-spec` re-exports `it` and `layer` from `@systemfsoftware/vitest`.
|
|
12
|
+
|
|
13
|
+
- A broken contract now fails the check with `BreakFailure`, whose message is the break report, pointing at the line that called the check.
|
|
14
|
+
|
|
15
|
+
- Cases now run on the simulation kernel — the zero-preemption schedule, then the profile's seeded schedules — instead of always on the live clock, and each case draws its own crypto-random salt, so two cases never share a trace id.
|
|
16
|
+
|
|
17
|
+
- `Suite.make({ it, layer })` → `Suite.make({ it })`.
|
|
18
|
+
- A case that must stay live declares a reason on any stage: `.live('...')`, or the new `Suite.live` combinator (`self.pipe(Suite.live(reason))`).
|
|
19
|
+
- `withLayer(shared)` rebuilds the shared layer freshly for every case rather than once per suite.
|
|
20
|
+
- `Stimulus.traceContext` draws its ids through Effect's `Random`, so a seeded run replays the same trace ids.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Update peer and runtime dependency on `effect` and companion packages to `4.0.0-rc.117`.
|
|
25
|
+
|
|
26
|
+
- Updated dependencies:
|
|
27
|
+
- @systemfsoftware/trace-taxonomy@0.0.2
|
|
28
|
+
- @systemfsoftware/vitest@0.2.0
|
|
29
|
+
|
|
3
30
|
## 0.4.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ import { Suite } from "@systemfsoftware/effect-spec-runtime";
|
|
|
9
9
|
import { Asserted, Check, Expect } from "@systemfsoftware/vitest";
|
|
10
10
|
import * as Scope from "effect/Scope";
|
|
11
11
|
import * as Arbitrary from "effect/unstable/arbitrary/Arbitrary";
|
|
12
|
+
//#region src/BreakFailure.schema.d.ts
|
|
13
|
+
declare const BreakFailure_base: Schema.Class<BreakFailure, Schema.TaggedStruct<"BreakFailure", {
|
|
14
|
+
readonly report: Schema.String;
|
|
15
|
+
}>, import("effect/Cause").YieldableError>;
|
|
16
|
+
declare class BreakFailure extends BreakFailure_base {
|
|
17
|
+
get message(): string;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
12
20
|
//#region src/ContractDecodeError.schema.d.ts
|
|
13
21
|
declare const ContractDecodeError_base: Schema.Class<ContractDecodeError, Schema.TaggedStruct<"ContractDecodeError", {
|
|
14
22
|
readonly declarationId: Schema.String;
|
|
@@ -17,22 +25,28 @@ declare const ContractDecodeError_base: Schema.Class<ContractDecodeError, Schema
|
|
|
17
25
|
readonly attribute: Schema.String;
|
|
18
26
|
readonly detail: Schema.String;
|
|
19
27
|
}>, import("effect/Cause").YieldableError>;
|
|
20
|
-
declare class ContractDecodeError extends ContractDecodeError_base {
|
|
28
|
+
declare class ContractDecodeError extends ContractDecodeError_base {
|
|
29
|
+
get message(): string;
|
|
30
|
+
}
|
|
21
31
|
//#endregion
|
|
22
32
|
//#region src/EmptyObservationError.schema.d.ts
|
|
23
33
|
declare const EmptyObservationError_base: Schema.Class<EmptyObservationError, Schema.TaggedStruct<"EmptyObservationError", {
|
|
24
34
|
readonly traceId: Schema.String;
|
|
25
35
|
readonly detail: Schema.String;
|
|
26
36
|
}>, import("effect/Cause").YieldableError>;
|
|
27
|
-
declare class EmptyObservationError extends EmptyObservationError_base {
|
|
37
|
+
declare class EmptyObservationError extends EmptyObservationError_base {
|
|
38
|
+
get message(): string;
|
|
39
|
+
}
|
|
28
40
|
//#endregion
|
|
29
41
|
//#region src/IncompleteObservationError.schema.d.ts
|
|
30
42
|
declare const IncompleteObservationError_base: Schema.Class<IncompleteObservationError, Schema.TaggedStruct<"IncompleteObservationError", {
|
|
31
43
|
readonly traceId: Schema.String;
|
|
32
|
-
readonly spanCount: Schema.
|
|
44
|
+
readonly spanCount: Schema.Int;
|
|
33
45
|
readonly detail: Schema.String;
|
|
34
46
|
}>, import("effect/Cause").YieldableError>;
|
|
35
|
-
declare class IncompleteObservationError extends IncompleteObservationError_base {
|
|
47
|
+
declare class IncompleteObservationError extends IncompleteObservationError_base {
|
|
48
|
+
get message(): string;
|
|
49
|
+
}
|
|
36
50
|
//#endregion
|
|
37
51
|
//#region src/TraceGraph.schema.d.ts
|
|
38
52
|
declare const Status: Schema.Literals<readonly ["ok", "unset", "error"]>;
|
|
@@ -145,7 +159,9 @@ declare const TransportObservationError_base: Schema.Class<TransportObservationE
|
|
|
145
159
|
readonly source: Schema.String;
|
|
146
160
|
readonly detail: Schema.String;
|
|
147
161
|
}>, import("effect/Cause").YieldableError>;
|
|
148
|
-
declare class TransportObservationError extends TransportObservationError_base {
|
|
162
|
+
declare class TransportObservationError extends TransportObservationError_base {
|
|
163
|
+
get message(): string;
|
|
164
|
+
}
|
|
149
165
|
declare namespace Observation_service_d_exports {
|
|
150
166
|
export { Collector, EmptyObservationError, IncompleteObservationError, Observation, ObservationFailure, TransportObservationError };
|
|
151
167
|
}
|
|
@@ -157,24 +173,25 @@ declare const Observation_base: Context.ServiceClass<Observation, "@systemfsoftw
|
|
|
157
173
|
declare class Observation extends Observation_base {}
|
|
158
174
|
//#endregion
|
|
159
175
|
//#region src/Verdict.schema.d.ts
|
|
160
|
-
declare const
|
|
161
|
-
type VerdictTypeId = typeof VerdictTypeId;
|
|
162
|
-
declare const Hold_base: Schema.Class<Hold, Schema.TaggedStruct<"Hold", {
|
|
176
|
+
declare const Hold: Schema.TaggedStruct<"Hold", {
|
|
163
177
|
readonly conjunct: Schema.String;
|
|
164
178
|
readonly inspected: Schema.$Array<Schema.String>;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
declare const Break_base: Schema.Class<Break, Schema.TaggedStruct<"Break", {
|
|
179
|
+
}>;
|
|
180
|
+
type Hold = typeof Hold.Type;
|
|
181
|
+
declare const Break: Schema.TaggedStruct<"Break", {
|
|
170
182
|
readonly conjunct: Schema.String;
|
|
171
183
|
readonly inspected: Schema.$Array<Schema.String>;
|
|
172
184
|
readonly detail: Schema.String;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
185
|
+
}>;
|
|
186
|
+
type Break = typeof Break.Type;
|
|
187
|
+
declare const Verdict: Schema.Union<readonly [Schema.TaggedStruct<"Hold", {
|
|
188
|
+
readonly conjunct: Schema.String;
|
|
189
|
+
readonly inspected: Schema.$Array<Schema.String>;
|
|
190
|
+
}>, Schema.TaggedStruct<"Break", {
|
|
191
|
+
readonly conjunct: Schema.String;
|
|
192
|
+
readonly inspected: Schema.$Array<Schema.String>;
|
|
193
|
+
readonly detail: Schema.String;
|
|
194
|
+
}>]>;
|
|
178
195
|
type Verdict = typeof Verdict.Type;
|
|
179
196
|
declare namespace Rel_d_exports {
|
|
180
197
|
export { Break, Hold, Relation, Verdict, absent, all, any, attrs, child, descendant, durationLessThan, errorType, event, exists, forall, fromTaxonomy, not, order, soft, status, unique };
|
|
@@ -263,7 +280,7 @@ declare const make$3: <Input, Output, E, R>(options: {
|
|
|
263
280
|
}) => Effect.Effect<Output, E, R>;
|
|
264
281
|
}) => Stimulus<Input, Output, E, R>;
|
|
265
282
|
declare namespace Contract_d_exports {
|
|
266
|
-
export { CheckOptions, Contract, ContractDecodeError, Declared$1 as Declared, EmptyObservationError, IncompleteObservationError, JudgeFailure, Judgment, Report, Services, Stimulated, TransportObservationError, TypeId$3 as TypeId, check, holds, judge, of, stimulate, verdictCheck };
|
|
283
|
+
export { BreakFailure, CheckOptions, Contract, ContractDecodeError, Declared$1 as Declared, EmptyObservationError, IncompleteObservationError, JudgeFailure, Judgment, Report, Services, Stimulated, TransportObservationError, TypeId$3 as TypeId, check, holds, judge, of, stimulate, verdictCheck };
|
|
267
284
|
}
|
|
268
285
|
declare const TypeId$3: unique symbol;
|
|
269
286
|
type TypeId$3 = typeof TypeId$3;
|
|
@@ -377,10 +394,10 @@ declare const source: (options: {
|
|
|
377
394
|
}) => TraceSource<HttpClient.HttpClient>;
|
|
378
395
|
//#endregion
|
|
379
396
|
//#region src/ObservationWindowSpec.schema.d.ts
|
|
380
|
-
declare const
|
|
397
|
+
declare const ObservationWindowSpec: Schema.Struct<{
|
|
381
398
|
readonly serviceName: Schema.NonEmptyString;
|
|
382
|
-
}
|
|
383
|
-
|
|
399
|
+
}>;
|
|
400
|
+
type ObservationWindowSpec = typeof ObservationWindowSpec.Type;
|
|
384
401
|
declare namespace observation_window_handle_d_exports {
|
|
385
402
|
export { ObservationWindow, TypeId$2 as TypeId, collect, context, isObservationWindow, make$2 as make, shutdown };
|
|
386
403
|
}
|
|
@@ -419,10 +436,16 @@ declare const TypeId$1: unique symbol;
|
|
|
419
436
|
type TypeId$1 = typeof TypeId$1;
|
|
420
437
|
declare const scoped: (spec: ObservationWindowSpec) => Effect.Effect<ObservationWindow, never, Scope.Scope>;
|
|
421
438
|
declare const layer: (spec: ObservationWindowSpec) => Layer.Layer<Observation | OtelTracer.OtelTracer>;
|
|
422
|
-
declare const ObservationWindows: Blueprint.Definition<typeof TypeId$1,
|
|
439
|
+
declare const ObservationWindows: Blueprint.Definition<typeof TypeId$1, {
|
|
440
|
+
readonly serviceName: string;
|
|
441
|
+
}, Blueprint.Derived<{
|
|
442
|
+
readonly serviceName: string;
|
|
443
|
+
}, {}, {
|
|
423
444
|
readonly scoped: typeof scoped;
|
|
424
445
|
readonly layer: typeof layer;
|
|
425
|
-
}>,
|
|
446
|
+
}>, {
|
|
447
|
+
readonly serviceName: string;
|
|
448
|
+
}>;
|
|
426
449
|
type ObservationWindowBlueprint = Blueprint.Of<typeof ObservationWindows>;
|
|
427
450
|
declare const make$1: (serviceName: string) => ObservationWindowBlueprint;
|
|
428
451
|
//#endregion
|
|
@@ -435,7 +458,9 @@ declare const StimulusFailure_base: Schema.Class<StimulusFailure, Schema.TaggedS
|
|
|
435
458
|
readonly stimulus: Schema.String;
|
|
436
459
|
readonly detail: Schema.String;
|
|
437
460
|
}>, import("effect/Cause").YieldableError>;
|
|
438
|
-
declare class StimulusFailure extends StimulusFailure_base {
|
|
461
|
+
declare class StimulusFailure extends StimulusFailure_base {
|
|
462
|
+
get message(): string;
|
|
463
|
+
}
|
|
439
464
|
declare namespace Suite_d_exports {
|
|
440
465
|
export { ArbitraryInput, CaseFailure, CaseRegistrar, CaseTools, Declared, Harness, LiveStage, Opened, Shared, StimulusFailure, TypeId, live, make, withLayer, withScenarioLayer };
|
|
441
466
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { callFrameOutside, withRaisingFrame } from "@systemfsoftware/vitest/failure";
|
|
2
3
|
import { Array as Array$1, Cause, Clock, Context, Duration, Effect, Encoding, Equal, FileSystem, Layer, Match, Option, Predicate, Random, Ref, Result, Schema, SchemaGetter, SchemaTransformation } from "effect";
|
|
3
4
|
import { dual } from "effect/Function";
|
|
4
5
|
import { Prototype } from "effect/Pipeable";
|
|
5
6
|
import "effect/PlatformError";
|
|
6
7
|
import "@systemfsoftware/trace-taxonomy";
|
|
8
|
+
import "effect/Array";
|
|
9
|
+
import "effect/Result";
|
|
7
10
|
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
8
11
|
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
9
12
|
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
|
|
@@ -13,6 +16,13 @@ import { Blueprint, Handle } from "@systemfsoftware/effect-cell-types";
|
|
|
13
16
|
import { SpanStatusCode } from "@opentelemetry/api";
|
|
14
17
|
import { AlwaysOnSampler, BasicTracerProvider } from "@opentelemetry/sdk-trace-base";
|
|
15
18
|
import { Suite, TaskRef } from "@systemfsoftware/effect-spec-runtime";
|
|
19
|
+
//#region src/BreakFailure.schema.ts
|
|
20
|
+
var BreakFailure = class extends Schema.TaggedError()("BreakFailure", { report: Schema.String }) {
|
|
21
|
+
get message() {
|
|
22
|
+
return this.report;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
16
26
|
//#region src/ContractDecodeError.schema.ts
|
|
17
27
|
var ContractDecodeError = class extends Schema.TaggedError()("ContractDecodeError", {
|
|
18
28
|
declarationId: Schema.String,
|
|
@@ -20,29 +30,32 @@ var ContractDecodeError = class extends Schema.TaggedError()("ContractDecodeErro
|
|
|
20
30
|
spanId: Schema.String,
|
|
21
31
|
attribute: Schema.String,
|
|
22
32
|
detail: Schema.String
|
|
23
|
-
}) {
|
|
33
|
+
}) {
|
|
34
|
+
get message() {
|
|
35
|
+
return `Span "${this.spanName}" (${this.spanId}) does not satisfy contract "${this.declarationId}": ${this.detail}`;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
24
38
|
//#endregion
|
|
25
39
|
//#region src/EmptyObservationError.schema.ts
|
|
26
40
|
var EmptyObservationError = class extends Schema.TaggedError()("EmptyObservationError", {
|
|
27
41
|
traceId: Schema.String,
|
|
28
42
|
detail: Schema.String
|
|
29
|
-
}) {
|
|
43
|
+
}) {
|
|
44
|
+
get message() {
|
|
45
|
+
return `Trace "${this.traceId}" recorded no spans: ${this.detail}`;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
30
48
|
//#endregion
|
|
31
49
|
//#region src/Verdict.schema.ts
|
|
32
|
-
const
|
|
33
|
-
var Hold = class extends Schema.TaggedClass()("Hold", {
|
|
50
|
+
const Hold = Schema.TaggedStruct("Hold", {
|
|
34
51
|
conjunct: Schema.String,
|
|
35
52
|
inspected: Schema.Array(Schema.String)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
var Break = class extends Schema.TaggedClass()("Break", {
|
|
53
|
+
});
|
|
54
|
+
const Break = Schema.TaggedStruct("Break", {
|
|
40
55
|
conjunct: Schema.String,
|
|
41
56
|
inspected: Schema.Array(Schema.String),
|
|
42
57
|
detail: Schema.String
|
|
43
|
-
})
|
|
44
|
-
[VerdictTypeId] = VerdictTypeId;
|
|
45
|
-
};
|
|
58
|
+
});
|
|
46
59
|
const Verdict = Schema.Union([Hold, Break]);
|
|
47
60
|
//#endregion
|
|
48
61
|
//#region src/FailureDump.ts
|
|
@@ -116,6 +129,7 @@ const SpanLink = Schema.Struct({
|
|
|
116
129
|
traceId: Schema.String,
|
|
117
130
|
spanId: Schema.String
|
|
118
131
|
});
|
|
132
|
+
const SpanMillis = Schema.Finite.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0)));
|
|
119
133
|
const SpanRecord = Schema.Struct({
|
|
120
134
|
traceId: Schema.String,
|
|
121
135
|
spanId: Schema.String,
|
|
@@ -123,8 +137,8 @@ const SpanRecord = Schema.Struct({
|
|
|
123
137
|
name: Schema.String,
|
|
124
138
|
status: Status,
|
|
125
139
|
errorType: Schema.NullOr(Schema.String),
|
|
126
|
-
startMillis:
|
|
127
|
-
durationMillis:
|
|
140
|
+
startMillis: SpanMillis,
|
|
141
|
+
durationMillis: SpanMillis,
|
|
128
142
|
attributes: Attributes,
|
|
129
143
|
events: Schema.Array(SpanEvent),
|
|
130
144
|
links: Schema.Array(SpanLink)
|
|
@@ -135,8 +149,8 @@ const GraphNode = Schema.Struct({
|
|
|
135
149
|
name: Schema.String,
|
|
136
150
|
status: Status,
|
|
137
151
|
errorType: Schema.NullOr(Schema.String),
|
|
138
|
-
startMillis:
|
|
139
|
-
durationMillis:
|
|
152
|
+
startMillis: SpanMillis,
|
|
153
|
+
durationMillis: SpanMillis,
|
|
140
154
|
attrs: Attributes,
|
|
141
155
|
events: Schema.Array(SpanEvent),
|
|
142
156
|
links: Schema.Array(SpanLink)
|
|
@@ -226,18 +240,27 @@ const decodeImpl = (traceId, spans, taxonomy) => {
|
|
|
226
240
|
const decode = dual(3, decodeImpl);
|
|
227
241
|
//#endregion
|
|
228
242
|
//#region src/IncompleteObservationError.schema.ts
|
|
243
|
+
const SpanCount = Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0, { message: "a span count is a non-negative integer" })));
|
|
229
244
|
var IncompleteObservationError = class extends Schema.TaggedError()("IncompleteObservationError", {
|
|
230
245
|
traceId: Schema.String,
|
|
231
|
-
spanCount:
|
|
246
|
+
spanCount: SpanCount,
|
|
232
247
|
detail: Schema.String
|
|
233
|
-
}) {
|
|
248
|
+
}) {
|
|
249
|
+
get message() {
|
|
250
|
+
return `Trace "${this.traceId}" is incomplete after ${this.spanCount} spans: ${this.detail}`;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
234
253
|
//#endregion
|
|
235
254
|
//#region src/TransportObservationError.schema.ts
|
|
236
255
|
var TransportObservationError = class extends Schema.TaggedError()("TransportObservationError", {
|
|
237
256
|
traceId: Schema.String,
|
|
238
257
|
source: Schema.String,
|
|
239
258
|
detail: Schema.String
|
|
240
|
-
}) {
|
|
259
|
+
}) {
|
|
260
|
+
get message() {
|
|
261
|
+
return `The trace store at "${this.source}" could not serve trace "${this.traceId}": ${this.detail}`;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
241
264
|
//#endregion
|
|
242
265
|
//#region src/Observation.service.ts
|
|
243
266
|
var Observation_service_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -250,6 +273,7 @@ var Observation = class extends Context.Service()("@systemfsoftware/trace-spec/O
|
|
|
250
273
|
//#endregion
|
|
251
274
|
//#region src/Contract.ts
|
|
252
275
|
var Contract_exports = /* @__PURE__ */ __exportAll({
|
|
276
|
+
BreakFailure: () => BreakFailure,
|
|
253
277
|
ContractDecodeError: () => ContractDecodeError,
|
|
254
278
|
EmptyObservationError: () => EmptyObservationError,
|
|
255
279
|
IncompleteObservationError: () => IncompleteObservationError,
|
|
@@ -262,6 +286,8 @@ var Contract_exports = /* @__PURE__ */ __exportAll({
|
|
|
262
286
|
stimulate: () => stimulate,
|
|
263
287
|
verdictCheck: () => verdictCheck
|
|
264
288
|
});
|
|
289
|
+
const OWN_FRAMES = /\/trace-spec\/(?:src|dist)\//u;
|
|
290
|
+
const callFrame = () => callFrameOutside(OWN_FRAMES);
|
|
265
291
|
const TypeId$3 = Symbol.for("@systemfsoftware/trace-spec/Contract");
|
|
266
292
|
const stimulatedOf = (taxonomy, stimulus) => ({
|
|
267
293
|
[TypeId$3]: TypeId$3,
|
|
@@ -318,6 +344,7 @@ const held = {
|
|
|
318
344
|
verdict: "Hold",
|
|
319
345
|
report: ""
|
|
320
346
|
};
|
|
347
|
+
const failureOfReport = (report) => new BreakFailure({ report: report.report });
|
|
321
348
|
const reportOf = (relationId, judgment) => Match.value(judgment.verdict).pipe(Match.tag("Hold", () => held), Match.tag("Break", (breach) => ({
|
|
322
349
|
verdict: "Break",
|
|
323
350
|
report: [
|
|
@@ -327,16 +354,20 @@ const reportOf = (relationId, judgment) => Match.value(judgment.verdict).pipe(Ma
|
|
|
327
354
|
`dump ${judgment.dumpPath ?? "(not written)"}`
|
|
328
355
|
].join("\n")
|
|
329
356
|
})), Match.exhaustive);
|
|
330
|
-
const
|
|
357
|
+
const verdictCheckWith = (self, expect, judgment, frame) => {
|
|
331
358
|
const report = reportOf(self.relation.id, judgment);
|
|
332
|
-
return expect(report, report.report).toEqual(held);
|
|
359
|
+
return report.verdict === "Break" ? Effect.die(withRaisingFrame(failureOfReport(report), frame)) : expect(report, report.report).toEqual(held);
|
|
333
360
|
};
|
|
361
|
+
const verdictCheckImpl = (self, expect, judgment) => verdictCheckWith(self, expect, judgment, callFrame());
|
|
334
362
|
/**
|
|
335
363
|
* The one check a judgement makes: it passes only when the relation held, and its message is the report, so a
|
|
336
364
|
* break names the conjunct that broke, the spans it inspected and where the evidence was written.
|
|
337
365
|
*/
|
|
338
366
|
const verdictCheck = dual(3, verdictCheckImpl);
|
|
339
|
-
const checkDual = (self, expect, input, options) =>
|
|
367
|
+
const checkDual = (self, expect, input, options) => {
|
|
368
|
+
const frame = callFrame();
|
|
369
|
+
return Effect.flatMap(judgeDual(self, input, options), (judgment) => verdictCheckWith(self, expect, judgment, frame));
|
|
370
|
+
};
|
|
340
371
|
/**
|
|
341
372
|
* The test edge over `judge`: the judgement and its one check. A break fails the check with the report;
|
|
342
373
|
* behaviour failures and infrastructure refusals stay on the error channel.
|
|
@@ -659,7 +690,7 @@ const collect = dual(2, (self, traceId) => Effect.suspend(() => {
|
|
|
659
690
|
const context = (self) => Context.make(Observation, { collect: (traceId) => collect(self, traceId) }).pipe(Context.add(OtelTracer.OtelTracerProvider, ObservationWindow.slot(self).provider));
|
|
660
691
|
//#endregion
|
|
661
692
|
//#region src/ObservationWindowSpec.schema.ts
|
|
662
|
-
|
|
693
|
+
const ObservationWindowSpec = Schema.Struct({ serviceName: Schema.NonEmptyString });
|
|
663
694
|
//#endregion
|
|
664
695
|
//#region src/observation-window.blueprint.ts
|
|
665
696
|
var observation_window_blueprint_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -680,7 +711,7 @@ const ObservationWindows = Blueprint.make()(TypeId$1).steps({
|
|
|
680
711
|
layer: layer$1
|
|
681
712
|
}
|
|
682
713
|
});
|
|
683
|
-
const make$2 = (serviceName) => ObservationWindows.of(
|
|
714
|
+
const make$2 = (serviceName) => ObservationWindows.of(ObservationWindowSpec.make({ serviceName }));
|
|
684
715
|
//#endregion
|
|
685
716
|
//#region src/Rel.ts
|
|
686
717
|
var Rel_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1162,10 +1193,15 @@ const predicateImpl = (title, contract, scenario, shared) => {
|
|
|
1162
1193
|
const predicate = dual(4, predicateImpl);
|
|
1163
1194
|
//#endregion
|
|
1164
1195
|
//#region src/StimulusFailure.schema.ts
|
|
1196
|
+
const firstLine = (text) => text.split("\n")[0] ?? "";
|
|
1165
1197
|
var StimulusFailure = class extends Schema.TaggedError()("StimulusFailure", {
|
|
1166
1198
|
stimulus: Schema.String,
|
|
1167
1199
|
detail: Schema.String
|
|
1168
|
-
}) {
|
|
1200
|
+
}) {
|
|
1201
|
+
get message() {
|
|
1202
|
+
return `The stimulus "${this.stimulus}" failed: ${firstLine(this.detail)}`;
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1169
1205
|
//#endregion
|
|
1170
1206
|
//#region src/Suite.ts
|
|
1171
1207
|
var Suite_exports = /* @__PURE__ */ __exportAll({
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/trace-spec",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
|
|
9
|
-
"directory": "packages/trace-spec"
|
|
9
|
+
"directory": "packages/trace/trace-spec"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/trace-spec#readme",
|
|
11
|
+
"homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/trace/trace-spec#readme",
|
|
12
12
|
"bugs": "https://github.com/systemfsoftware/systemfsoftware/issues",
|
|
13
13
|
"description": "Trace contracts as executable specs — own a trace id, observe the finished trace through an in-memory exporter, and relate the decoded span graph to a declared taxonomy.",
|
|
14
14
|
"keywords": [
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"@opentelemetry/resources": "^2",
|
|
39
39
|
"@opentelemetry/sdk-trace-base": "^2",
|
|
40
40
|
"@opentelemetry/semantic-conventions": "^1.33",
|
|
41
|
-
"@systemfsoftware/effect-cell-types": "^10.
|
|
42
|
-
"@systemfsoftware/effect-spec-runtime": "^0.3.
|
|
43
|
-
"@systemfsoftware/trace-taxonomy": "^0.0.
|
|
41
|
+
"@systemfsoftware/effect-cell-types": "^10.3.0",
|
|
42
|
+
"@systemfsoftware/effect-spec-runtime": "^0.3.1",
|
|
43
|
+
"@systemfsoftware/trace-taxonomy": "^0.0.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@effect/platform-node": "4.0.0-rc.117",
|
|
47
47
|
"@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
|
|
48
|
-
"@systemfsoftware/conformance-spec": "^0.
|
|
49
|
-
"@systemfsoftware/effect-gherkin-spec": "^
|
|
50
|
-
"@systemfsoftware/oxlint-config-recommended": "^3.
|
|
48
|
+
"@systemfsoftware/conformance-spec": "^0.2.0",
|
|
49
|
+
"@systemfsoftware/effect-gherkin-spec": "^6.0.0",
|
|
50
|
+
"@systemfsoftware/oxlint-config-recommended": "^3.2.0",
|
|
51
51
|
"@systemfsoftware/tsconfig": "^2.0.1",
|
|
52
52
|
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
53
|
-
"@systemfsoftware/vitest": "^0.
|
|
53
|
+
"@systemfsoftware/vitest": "^0.2.0",
|
|
54
54
|
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
55
55
|
"@types/node": "^26",
|
|
56
56
|
"effect": "4.0.0-rc.117",
|
|
@@ -61,11 +61,12 @@
|
|
|
61
61
|
"vitest": "^5"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@systemfsoftware/vitest": "^0.
|
|
64
|
+
"@systemfsoftware/vitest": "^0.2.0",
|
|
65
65
|
"effect": "4.0.0-rc.117",
|
|
66
66
|
"vitest": "^5"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
|
+
"access": "public",
|
|
69
70
|
"provenance": true
|
|
70
71
|
},
|
|
71
72
|
"scripts": {
|