@moltzap/protocol 2026.503.3 → 2026.504.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/dist/brands.d.ts +11 -0
- package/dist/brands.d.ts.map +1 -0
- package/dist/brands.js +14 -0
- package/dist/brands.js.map +1 -0
- package/dist/helpers.d.ts +29 -26
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +34 -16
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/ajv.d.ts +5 -0
- package/dist/internal/ajv.d.ts.map +1 -0
- package/dist/internal/ajv.js +22 -0
- package/dist/internal/ajv.js.map +1 -0
- package/dist/notification.d.ts +14 -0
- package/dist/notification.d.ts.map +1 -0
- package/dist/notification.js +11 -0
- package/dist/notification.js.map +1 -0
- package/dist/rpc-errors.d.ts +30 -0
- package/dist/rpc-errors.d.ts.map +1 -0
- package/dist/rpc-errors.js +23 -0
- package/dist/rpc-errors.js.map +1 -0
- package/dist/rpc-groups.d.ts +120 -0
- package/dist/rpc-groups.d.ts.map +1 -0
- package/dist/rpc-groups.js +131 -0
- package/dist/rpc-groups.js.map +1 -0
- package/dist/rpc-registry.d.ts +1238 -278
- package/dist/rpc-registry.d.ts.map +1 -1
- package/dist/rpc-registry.js +11 -22
- package/dist/rpc-registry.js.map +1 -1
- package/dist/rpc.d.ts +26 -5
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +21 -11
- package/dist/rpc.js.map +1 -1
- package/dist/schema/apps.d.ts +13 -23
- package/dist/schema/apps.d.ts.map +1 -1
- package/dist/schema/apps.js +2 -12
- package/dist/schema/apps.js.map +1 -1
- package/dist/schema/contacts.d.ts +6 -2
- package/dist/schema/contacts.d.ts.map +1 -1
- package/dist/schema/conversations.d.ts +15 -5
- package/dist/schema/conversations.d.ts.map +1 -1
- package/dist/schema/delivery.d.ts +9 -3
- package/dist/schema/delivery.d.ts.map +1 -1
- package/dist/schema/errors.d.ts +0 -4
- package/dist/schema/errors.d.ts.map +1 -1
- package/dist/schema/errors.js +0 -4
- package/dist/schema/errors.js.map +1 -1
- package/dist/schema/frames.d.ts +48 -51
- package/dist/schema/frames.d.ts.map +1 -1
- package/dist/schema/frames.js +28 -50
- package/dist/schema/frames.js.map +1 -1
- package/dist/schema/identity.d.ts +17 -9
- package/dist/schema/identity.d.ts.map +1 -1
- package/dist/schema/index.d.ts +3 -4
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +3 -4
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/internal-frames.d.ts +10 -0
- package/dist/schema/internal-frames.d.ts.map +1 -0
- package/dist/schema/internal-frames.js +5 -0
- package/dist/schema/internal-frames.js.map +1 -0
- package/dist/schema/invites.d.ts +6 -2
- package/dist/schema/invites.d.ts.map +1 -1
- package/dist/schema/json-rpc.d.ts +27 -0
- package/dist/schema/json-rpc.d.ts.map +1 -0
- package/dist/schema/json-rpc.js +32 -0
- package/dist/schema/json-rpc.js.map +1 -0
- package/dist/schema/messages.d.ts +15 -5
- package/dist/schema/messages.d.ts.map +1 -1
- package/dist/schema/methods/apps.d.ts +138 -85
- package/dist/schema/methods/apps.d.ts.map +1 -1
- package/dist/schema/methods/apps.js +4 -45
- package/dist/schema/methods/apps.js.map +1 -1
- package/dist/schema/methods/auth.d.ts +62 -34
- package/dist/schema/methods/auth.d.ts.map +1 -1
- package/dist/schema/methods/contacts.d.ts +27 -9
- package/dist/schema/methods/contacts.d.ts.map +1 -1
- package/dist/schema/methods/conversations.d.ts +91 -18
- package/dist/schema/methods/conversations.d.ts.map +1 -1
- package/dist/schema/methods/conversations.js +2 -2
- package/dist/schema/methods/conversations.js.map +1 -1
- package/dist/schema/methods/messages.d.ts +39 -13
- package/dist/schema/methods/messages.d.ts.map +1 -1
- package/dist/schema/methods/presence.d.ts +6 -2
- package/dist/schema/methods/presence.d.ts.map +1 -1
- package/dist/schema/notifications.d.ts +791 -0
- package/dist/schema/notifications.d.ts.map +1 -0
- package/dist/schema/notifications.js +173 -0
- package/dist/schema/notifications.js.map +1 -0
- package/dist/schema/presence.d.ts +3 -1
- package/dist/schema/presence.d.ts.map +1 -1
- package/dist/schema/primitives.d.ts +21 -5
- package/dist/schema/primitives.d.ts.map +1 -1
- package/dist/schema/primitives.js +6 -0
- package/dist/schema/primitives.js.map +1 -1
- package/dist/test-fixtures/seed-data.d.ts +0 -1388
- package/dist/test-fixtures/seed-data.d.ts.map +1 -1
- package/dist/test-fixtures/seed-data.js +34 -990
- package/dist/test-fixtures/seed-data.js.map +1 -1
- package/dist/testing/agent-registration.d.ts +3 -1
- package/dist/testing/agent-registration.d.ts.map +1 -1
- package/dist/testing/agent-registration.js +6 -15
- package/dist/testing/agent-registration.js.map +1 -1
- package/dist/testing/arbitraries/frames.d.ts +2 -2
- package/dist/testing/arbitraries/frames.d.ts.map +1 -1
- package/dist/testing/arbitraries/frames.js +9 -7
- package/dist/testing/arbitraries/frames.js.map +1 -1
- package/dist/testing/arbitraries/from-typebox.d.ts.map +1 -1
- package/dist/testing/arbitraries/from-typebox.js +19 -10
- package/dist/testing/arbitraries/from-typebox.js.map +1 -1
- package/dist/testing/arbitraries/index.d.ts +1 -1
- package/dist/testing/arbitraries/index.d.ts.map +1 -1
- package/dist/testing/arbitraries/index.js +1 -1
- package/dist/testing/arbitraries/index.js.map +1 -1
- package/dist/testing/arbitraries/rpc.d.ts +3 -2
- package/dist/testing/arbitraries/rpc.d.ts.map +1 -1
- package/dist/testing/arbitraries/rpc.js +13 -3
- package/dist/testing/arbitraries/rpc.js.map +1 -1
- package/dist/testing/captures.d.ts.map +1 -1
- package/dist/testing/captures.js +4 -3
- package/dist/testing/captures.js.map +1 -1
- package/dist/testing/codec.d.ts +13 -11
- package/dist/testing/codec.d.ts.map +1 -1
- package/dist/testing/codec.js +43 -50
- package/dist/testing/codec.js.map +1 -1
- package/dist/testing/conformance/__divergence_proofs__/executable-proof-helpers.d.ts.map +1 -1
- package/dist/testing/conformance/__divergence_proofs__/executable-proof-helpers.js +15 -5
- package/dist/testing/conformance/__divergence_proofs__/executable-proof-helpers.js.map +1 -1
- package/dist/testing/conformance/_helpers.d.ts +12 -7
- package/dist/testing/conformance/_helpers.d.ts.map +1 -1
- package/dist/testing/conformance/_helpers.js +30 -7
- package/dist/testing/conformance/_helpers.js.map +1 -1
- package/dist/testing/conformance/adversity.d.ts.map +1 -1
- package/dist/testing/conformance/adversity.js +83 -90
- package/dist/testing/conformance/adversity.js.map +1 -1
- package/dist/testing/conformance/boundary.d.ts +1 -1
- package/dist/testing/conformance/boundary.d.ts.map +1 -1
- package/dist/testing/conformance/boundary.js +55 -50
- package/dist/testing/conformance/boundary.js.map +1 -1
- package/dist/testing/conformance/client/_fixtures.d.ts +7 -5
- package/dist/testing/conformance/client/_fixtures.d.ts.map +1 -1
- package/dist/testing/conformance/client/_fixtures.js +17 -8
- package/dist/testing/conformance/client/_fixtures.js.map +1 -1
- package/dist/testing/conformance/client/adversity.d.ts.map +1 -1
- package/dist/testing/conformance/client/adversity.js +28 -22
- package/dist/testing/conformance/client/adversity.js.map +1 -1
- package/dist/testing/conformance/client/boundary.d.ts +2 -2
- package/dist/testing/conformance/client/boundary.d.ts.map +1 -1
- package/dist/testing/conformance/client/boundary.js +19 -16
- package/dist/testing/conformance/client/boundary.js.map +1 -1
- package/dist/testing/conformance/client/delivery.d.ts +5 -5
- package/dist/testing/conformance/client/delivery.d.ts.map +1 -1
- package/dist/testing/conformance/client/delivery.js +77 -73
- package/dist/testing/conformance/client/delivery.js.map +1 -1
- package/dist/testing/conformance/client/index.d.ts +2 -2
- package/dist/testing/conformance/client/index.d.ts.map +1 -1
- package/dist/testing/conformance/client/index.js +1 -1
- package/dist/testing/conformance/client/index.js.map +1 -1
- package/dist/testing/conformance/client/rpc-semantics.d.ts.map +1 -1
- package/dist/testing/conformance/client/rpc-semantics.js +31 -37
- package/dist/testing/conformance/client/rpc-semantics.js.map +1 -1
- package/dist/testing/conformance/client/runner.d.ts +38 -32
- package/dist/testing/conformance/client/runner.d.ts.map +1 -1
- package/dist/testing/conformance/client/runner.js +36 -45
- package/dist/testing/conformance/client/runner.js.map +1 -1
- package/dist/testing/conformance/client/schema-conformance.d.ts +8 -8
- package/dist/testing/conformance/client/schema-conformance.d.ts.map +1 -1
- package/dist/testing/conformance/client/schema-conformance.js +37 -35
- package/dist/testing/conformance/client/schema-conformance.js.map +1 -1
- package/dist/testing/conformance/client/suite.d.ts.map +1 -1
- package/dist/testing/conformance/client/suite.js +4 -3
- package/dist/testing/conformance/client/suite.js.map +1 -1
- package/dist/testing/conformance/delivery.d.ts.map +1 -1
- package/dist/testing/conformance/delivery.js +127 -140
- package/dist/testing/conformance/delivery.js.map +1 -1
- package/dist/testing/conformance/dispatcher-concurrency.js +12 -12
- package/dist/testing/conformance/dispatcher-concurrency.js.map +1 -1
- package/dist/testing/conformance/env.d.ts +9 -0
- package/dist/testing/conformance/env.d.ts.map +1 -1
- package/dist/testing/conformance/env.js +16 -3
- package/dist/testing/conformance/env.js.map +1 -1
- package/dist/testing/conformance/presence.d.ts.map +1 -1
- package/dist/testing/conformance/presence.js +35 -24
- package/dist/testing/conformance/presence.js.map +1 -1
- package/dist/testing/conformance/registry.d.ts +1 -1
- package/dist/testing/conformance/registry.d.ts.map +1 -1
- package/dist/testing/conformance/registry.js +1 -1
- package/dist/testing/conformance/registry.js.map +1 -1
- package/dist/testing/conformance/rpc-semantics.d.ts +12 -12
- package/dist/testing/conformance/rpc-semantics.d.ts.map +1 -1
- package/dist/testing/conformance/rpc-semantics.js +131 -90
- package/dist/testing/conformance/rpc-semantics.js.map +1 -1
- package/dist/testing/conformance/runner.d.ts +2 -2
- package/dist/testing/conformance/runner.d.ts.map +1 -1
- package/dist/testing/conformance/runner.js +5 -10
- package/dist/testing/conformance/runner.js.map +1 -1
- package/dist/testing/conformance/schema-conformance.d.ts +3 -40
- package/dist/testing/conformance/schema-conformance.d.ts.map +1 -1
- package/dist/testing/conformance/schema-conformance.js +75 -235
- package/dist/testing/conformance/schema-conformance.js.map +1 -1
- package/dist/testing/conformance/suite.d.ts +1 -1
- package/dist/testing/conformance/suite.d.ts.map +1 -1
- package/dist/testing/conformance/suite.js +17 -18
- package/dist/testing/conformance/suite.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/models/dispatch.d.ts +5 -5
- package/dist/testing/models/dispatch.d.ts.map +1 -1
- package/dist/testing/models/dispatch.js +50 -59
- package/dist/testing/models/dispatch.js.map +1 -1
- package/dist/testing/models/state.d.ts +5 -5
- package/dist/testing/models/state.d.ts.map +1 -1
- package/dist/testing/models/state.js +14 -1
- package/dist/testing/models/state.js.map +1 -1
- package/dist/testing/test-client.d.ts +51 -40
- package/dist/testing/test-client.d.ts.map +1 -1
- package/dist/testing/test-client.js +154 -122
- package/dist/testing/test-client.js.map +1 -1
- package/dist/testing/test-server.d.ts +5 -5
- package/dist/testing/test-server.d.ts.map +1 -1
- package/dist/testing/test-server.js +11 -15
- package/dist/testing/test-server.js.map +1 -1
- package/dist/testing/toxics/client.d.ts.map +1 -1
- package/dist/testing/toxics/client.js +9 -3
- package/dist/testing/toxics/client.js.map +1 -1
- package/dist/testing/toxics/profile.d.ts.map +1 -1
- package/dist/testing/toxics/profile.js +4 -1
- package/dist/testing/toxics/profile.js.map +1 -1
- package/dist/types.d.ts +3 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validators.d.ts +366 -101
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +23 -30
- package/dist/validators.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/schema/events.d.ts +0 -213
- package/dist/schema/events.d.ts.map +0 -1
- package/dist/schema/events.js +0 -122
- package/dist/schema/events.js.map +0 -1
- package/dist/schema/methods/push.d.ts +0 -21
- package/dist/schema/methods/push.d.ts.map +0 -1
- package/dist/schema/methods/push.js +0 -28
- package/dist/schema/methods/push.js.map +0 -1
- package/dist/schema/surfaces.d.ts +0 -55
- package/dist/schema/surfaces.d.ts.map +0 -1
- package/dist/schema/surfaces.js +0 -55
- package/dist/schema/surfaces.js.map +0 -1
package/dist/testing/codec.js
CHANGED
|
@@ -9,8 +9,26 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Effect } from "effect";
|
|
11
11
|
import { Value } from "@sinclair/typebox/value";
|
|
12
|
-
import { RequestFrameSchema, ResponseFrameSchema,
|
|
12
|
+
import { RequestFrameSchema, ResponseFrameSchema, NotificationFrameSchema, } from "../schema/frames.js";
|
|
13
|
+
import { isJsonRpcStringId } from "../schema/json-rpc.js";
|
|
13
14
|
import { FrameSchemaError } from "./errors.js";
|
|
15
|
+
const BIT_FLIP_VARIANTS = 8;
|
|
16
|
+
const OVERSIZED_PADDING_BYTES = 65_536;
|
|
17
|
+
const LCG_MULTIPLIER = 1_664_525;
|
|
18
|
+
const LCG_INCREMENT = 1_013_904_223;
|
|
19
|
+
const LCG_MODULUS = 0x100000000;
|
|
20
|
+
export function isRequestFrame(frame) {
|
|
21
|
+
return "id" in frame && "method" in frame;
|
|
22
|
+
}
|
|
23
|
+
export function isResponseFrame(frame) {
|
|
24
|
+
return "id" in frame && ("result" in frame || "error" in frame);
|
|
25
|
+
}
|
|
26
|
+
export function isCorrelatedResponseFrame(frame) {
|
|
27
|
+
return isResponseFrame(frame) && isJsonRpcStringId(frame.id);
|
|
28
|
+
}
|
|
29
|
+
export function isNotificationFrame(frame) {
|
|
30
|
+
return !("id" in frame) && "method" in frame;
|
|
31
|
+
}
|
|
14
32
|
/** Serialize a typed frame to the wire bytes. */
|
|
15
33
|
export function encodeFrame(frame) {
|
|
16
34
|
return JSON.stringify(frame);
|
|
@@ -34,57 +52,29 @@ export function decodeFrame(raw, direction) {
|
|
|
34
52
|
reason: `json parse failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
35
53
|
}));
|
|
36
54
|
}
|
|
37
|
-
if (parsed === null ||
|
|
38
|
-
typeof parsed !== "object" ||
|
|
39
|
-
!("type" in parsed) ||
|
|
40
|
-
typeof parsed.type !== "string") {
|
|
55
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
41
56
|
return Effect.fail(new FrameSchemaError({
|
|
42
57
|
direction,
|
|
43
58
|
expected: "request",
|
|
44
59
|
raw,
|
|
45
|
-
reason: "frame
|
|
60
|
+
reason: "frame must be a JSON object",
|
|
46
61
|
}));
|
|
47
62
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
case "request":
|
|
51
|
-
if (Value.Check(RequestFrameSchema, parsed)) {
|
|
52
|
-
return Effect.succeed(parsed);
|
|
53
|
-
}
|
|
54
|
-
return Effect.fail(new FrameSchemaError({
|
|
55
|
-
direction,
|
|
56
|
-
expected: "request",
|
|
57
|
-
raw,
|
|
58
|
-
reason: firstValueError(RequestFrameSchema, parsed),
|
|
59
|
-
}));
|
|
60
|
-
case "response":
|
|
61
|
-
if (Value.Check(ResponseFrameSchema, parsed)) {
|
|
62
|
-
return Effect.succeed(parsed);
|
|
63
|
-
}
|
|
64
|
-
return Effect.fail(new FrameSchemaError({
|
|
65
|
-
direction,
|
|
66
|
-
expected: "response",
|
|
67
|
-
raw,
|
|
68
|
-
reason: firstValueError(ResponseFrameSchema, parsed),
|
|
69
|
-
}));
|
|
70
|
-
case "event":
|
|
71
|
-
if (Value.Check(EventFrameSchema, parsed)) {
|
|
72
|
-
return Effect.succeed(parsed);
|
|
73
|
-
}
|
|
74
|
-
return Effect.fail(new FrameSchemaError({
|
|
75
|
-
direction,
|
|
76
|
-
expected: "event",
|
|
77
|
-
raw,
|
|
78
|
-
reason: firstValueError(EventFrameSchema, parsed),
|
|
79
|
-
}));
|
|
80
|
-
default:
|
|
81
|
-
return Effect.fail(new FrameSchemaError({
|
|
82
|
-
direction,
|
|
83
|
-
expected: "request",
|
|
84
|
-
raw,
|
|
85
|
-
reason: `unknown frame type: ${type}`,
|
|
86
|
-
}));
|
|
63
|
+
if (Value.Check(ResponseFrameSchema, parsed)) {
|
|
64
|
+
return Effect.succeed(parsed);
|
|
87
65
|
}
|
|
66
|
+
if (Value.Check(RequestFrameSchema, parsed)) {
|
|
67
|
+
return Effect.succeed(parsed);
|
|
68
|
+
}
|
|
69
|
+
if (Value.Check(NotificationFrameSchema, parsed)) {
|
|
70
|
+
return Effect.succeed(parsed);
|
|
71
|
+
}
|
|
72
|
+
return Effect.fail(new FrameSchemaError({
|
|
73
|
+
direction,
|
|
74
|
+
expected: "request",
|
|
75
|
+
raw,
|
|
76
|
+
reason: firstValueError(RequestFrameSchema, parsed),
|
|
77
|
+
}));
|
|
88
78
|
});
|
|
89
79
|
}
|
|
90
80
|
function firstValueError(schema, value) {
|
|
@@ -110,7 +100,7 @@ export function malformFrame(base, kind, seed) {
|
|
|
110
100
|
const pos = Math.floor(rand() * rawJson.length);
|
|
111
101
|
const ch = rawJson.charCodeAt(pos);
|
|
112
102
|
// Flip one bit in the low byte (XOR with 1<<bit).
|
|
113
|
-
const bit = Math.floor(rand() *
|
|
103
|
+
const bit = Math.floor(rand() * BIT_FLIP_VARIANTS);
|
|
114
104
|
const flipped = String.fromCharCode(ch ^ (1 << bit));
|
|
115
105
|
return rawJson.slice(0, pos) + flipped + rawJson.slice(pos + 1);
|
|
116
106
|
}
|
|
@@ -125,7 +115,7 @@ export function malformFrame(base, kind, seed) {
|
|
|
125
115
|
// Uses `_padding` field at top level of the JSON object, which
|
|
126
116
|
// `additionalProperties: false` rejects — also triggers "extra-property"
|
|
127
117
|
// under different framing, but here the point is byte-size.
|
|
128
|
-
const padLen =
|
|
118
|
+
const padLen = OVERSIZED_PADDING_BYTES;
|
|
129
119
|
const pad = "X".repeat(padLen);
|
|
130
120
|
// Splice "_padding":"...", before the closing `}`.
|
|
131
121
|
const idx = rawJson.lastIndexOf("}");
|
|
@@ -151,10 +141,13 @@ export function malformFrame(base, kind, seed) {
|
|
|
151
141
|
}
|
|
152
142
|
default: {
|
|
153
143
|
const _exhaustive = kind;
|
|
154
|
-
|
|
144
|
+
return absurdMalformedFrameKind(_exhaustive);
|
|
155
145
|
}
|
|
156
146
|
}
|
|
157
147
|
}
|
|
148
|
+
function absurdMalformedFrameKind(kind) {
|
|
149
|
+
throw new Error(`malformFrame: unexpected kind ${String(kind)}`);
|
|
150
|
+
}
|
|
158
151
|
/**
|
|
159
152
|
* Deterministic LCG (Numerical Recipes constants). Given the same seed,
|
|
160
153
|
* yields the same sequence of floats in [0, 1). Good enough for reproducible
|
|
@@ -163,8 +156,8 @@ export function malformFrame(base, kind, seed) {
|
|
|
163
156
|
function lcg(seed) {
|
|
164
157
|
let s = seed >>> 0 || 1;
|
|
165
158
|
return () => {
|
|
166
|
-
s = (Math.imul(s,
|
|
167
|
-
return s /
|
|
159
|
+
s = (Math.imul(s, LCG_MULTIPLIER) + LCG_INCREMENT) >>> 0;
|
|
160
|
+
return s / LCG_MODULUS;
|
|
168
161
|
};
|
|
169
162
|
}
|
|
170
163
|
//# sourceMappingURL=codec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/testing/codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/testing/codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GAIxB,MAAM,qBAAqB,CAAC;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cAAc,IAAI,GAAG,CAAC;QACvD,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,WAAW,GAAU,IAAI,CAAC;YAChC,OAAO,wBAAwB,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAW;IAC3C,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,SAAS,GAAG,CAAC,IAAY;IACvB,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE;QACV,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,WAAW,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executable-proof-helpers.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/__divergence_proofs__/executable-proof-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAU,MAAM,QAAQ,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"executable-proof-helpers.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/__divergence_proofs__/executable-proof-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAU,MAAM,QAAQ,CAAC;AACtD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAYxB,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,kBAAkB,GAC3B,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAiBhC;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,GACnB,IAAI,CAWN;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,GACnB,IAAI,CAWN"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { Cause, Chunk, Effect, Option } from "effect";
|
|
2
|
-
import { PropertyAssertionFailure, PropertyInvariantViolation, } from "../registry.js";
|
|
2
|
+
import { PropertyAssertionFailure, PropertyInvariantViolation, PropertyUnavailable, } from "../registry.js";
|
|
3
|
+
class ProofExpectationError extends Error {
|
|
4
|
+
name = "ProofExpectationError";
|
|
5
|
+
}
|
|
6
|
+
function describeFailure(failure) {
|
|
7
|
+
if (failure instanceof PropertyUnavailable)
|
|
8
|
+
return failure.reason;
|
|
9
|
+
if (failure instanceof PropertyInvariantViolation)
|
|
10
|
+
return failure.reason;
|
|
11
|
+
return String(failure.cause);
|
|
12
|
+
}
|
|
3
13
|
export function runExpectingFailure(property) {
|
|
4
14
|
return Effect.gen(function* () {
|
|
5
15
|
const exit = yield* Effect.exit(property.run);
|
|
@@ -16,18 +26,18 @@ export function runExpectingFailure(property) {
|
|
|
16
26
|
}
|
|
17
27
|
export function expectInvariant(failure, propertyName) {
|
|
18
28
|
if (!(failure instanceof PropertyInvariantViolation)) {
|
|
19
|
-
throw new
|
|
29
|
+
throw new ProofExpectationError(`expected invariant failure, got ${failure._tag}: ${describeFailure(failure)}`);
|
|
20
30
|
}
|
|
21
31
|
if (failure.name !== propertyName) {
|
|
22
|
-
throw new
|
|
32
|
+
throw new ProofExpectationError(`expected ${propertyName}, got ${failure.name}`);
|
|
23
33
|
}
|
|
24
34
|
}
|
|
25
35
|
export function expectAssertionFailure(failure, propertyName) {
|
|
26
36
|
if (!(failure instanceof PropertyAssertionFailure)) {
|
|
27
|
-
throw new
|
|
37
|
+
throw new ProofExpectationError(`expected assertion failure, got ${failure._tag}: ${describeFailure(failure)}`);
|
|
28
38
|
}
|
|
29
39
|
if (failure.name !== propertyName) {
|
|
30
|
-
throw new
|
|
40
|
+
throw new ProofExpectationError(`expected ${propertyName}, got ${failure.name}`);
|
|
31
41
|
}
|
|
32
42
|
}
|
|
33
43
|
//# sourceMappingURL=executable-proof-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executable-proof-helpers.js","sourceRoot":"","sources":["../../../../src/testing/conformance/__divergence_proofs__/executable-proof-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EACL,wBAAwB,EACxB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"executable-proof-helpers.js","sourceRoot":"","sources":["../../../../src/testing/conformance/__divergence_proofs__/executable-proof-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,GAGpB,MAAM,gBAAgB,CAAC;AAExB,MAAM,qBAAsB,SAAQ,KAAK;IACrB,IAAI,GAAG,uBAAuB,CAAC;CAClD;AAED,SAAS,eAAe,CAAC,OAAwB;IAC/C,IAAI,OAAO,YAAY,mBAAmB;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAClE,IAAI,OAAO,YAAY,0BAA0B;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IACzE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,QAA4B;IAE5B,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC,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AI,KAAK,YAAY,EAAE,CAAC;QAClC,MAAM,IAAI,qBAAqB,CAC7B,YAAY,YAAY,SAAS,OAAO,CAAC,IAAI,EAAE,CAChD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
* property modules. Keep this file thin; promote utilities here only
|
|
4
4
|
* when they would otherwise be duplicated verbatim.
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { Effect, Either } from "effect";
|
|
7
|
+
import type { TSchema } from "@sinclair/typebox";
|
|
8
|
+
import type { RpcDefinition } from "../../rpc.js";
|
|
7
9
|
import type { TestClient } from "../test-client.js";
|
|
8
10
|
import type { FrameSchemaError, RpcResponseError, RpcTimeoutError, TransportClosedError, TransportIoError } from "../errors.js";
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
* untyped-cast path. Adding the verb to the registry is an accretive
|
|
14
|
-
* change outside this sub-issue's scope; this helper localizes the cast.
|
|
12
|
+
* Send an RPC whose descriptor is not in the typed `rpcMethods` registry
|
|
13
|
+
* (e.g., `apps/register`). Returns the result as `unknown`; the cast
|
|
14
|
+
* widens `client.sendRpc`'s `D extends AnyRpcDefinition` constraint.
|
|
15
15
|
*/
|
|
16
|
-
export declare function sendUntypedRpc(client: TestClient,
|
|
16
|
+
export declare function sendUntypedRpc(client: TestClient, definition: RpcDefinition<string, TSchema, TSchema>, params: unknown): Effect.Effect<unknown, RpcResponseError | RpcTimeoutError | TransportClosedError | TransportIoError | FrameSchemaError>;
|
|
17
|
+
export declare function requireRight<A, E, F>(value: Either.Either<A, E>, onLeft: (error: E) => F): Effect.Effect<A, F>;
|
|
18
|
+
export declare function leftOrNull<A, E>(value: Either.Either<A, E>): E | null;
|
|
19
|
+
export declare function eitherTag<A, E extends {
|
|
20
|
+
readonly _tag: string;
|
|
21
|
+
}>(value: Either.Either<A, E>): "Right" | E["_tag"];
|
|
17
22
|
//# sourceMappingURL=_helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_helpers.d.ts","sourceRoot":"","sources":["../../../src/testing/conformance/_helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"_helpers.d.ts","sourceRoot":"","sources":["../../../src/testing/conformance/_helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EACnD,MAAM,EAAE,OAAO,GACd,MAAM,CAAC,MAAM,CACd,OAAO,EACL,gBAAgB,GAChB,eAAe,GACf,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,CACnB,CAaA;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAClC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GACtB,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAKrB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAKrE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAC9D,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACzB,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,CAKrB"}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* untyped-cast path. Adding the verb to the registry is an accretive
|
|
6
|
-
* change outside this sub-issue's scope; this helper localizes the cast.
|
|
2
|
+
* Conformance-suite shared helpers — small utilities used by multiple
|
|
3
|
+
* property modules. Keep this file thin; promote utilities here only
|
|
4
|
+
* when they would otherwise be duplicated verbatim.
|
|
7
5
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { Effect, Either } from "effect";
|
|
7
|
+
/**
|
|
8
|
+
* Send an RPC whose descriptor is not in the typed `rpcMethods` registry
|
|
9
|
+
* (e.g., `apps/register`). Returns the result as `unknown`; the cast
|
|
10
|
+
* widens `client.sendRpc`'s `D extends AnyRpcDefinition` constraint.
|
|
11
|
+
*/
|
|
12
|
+
export function sendUntypedRpc(client, definition, params) {
|
|
13
|
+
const sendRpc = client.sendRpc;
|
|
14
|
+
return sendRpc(definition, params);
|
|
15
|
+
}
|
|
16
|
+
export function requireRight(value, onLeft) {
|
|
17
|
+
return Either.match(value, {
|
|
18
|
+
onLeft: (error) => Effect.fail(onLeft(error)),
|
|
19
|
+
onRight: (success) => Effect.succeed(success),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function leftOrNull(value) {
|
|
23
|
+
return Either.match(value, {
|
|
24
|
+
onLeft: (error) => error,
|
|
25
|
+
onRight: () => null,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function eitherTag(value) {
|
|
29
|
+
return Either.match(value, {
|
|
30
|
+
onLeft: (error) => error._tag,
|
|
31
|
+
onRight: () => "Right",
|
|
32
|
+
});
|
|
10
33
|
}
|
|
11
34
|
//# sourceMappingURL=_helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_helpers.js","sourceRoot":"","sources":["../../../src/testing/conformance/_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_helpers.js","sourceRoot":"","sources":["../../../src/testing/conformance/_helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAYxC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAkB,EAClB,UAAmD,EACnD,MAAe;IASf,MAAM,OAAO,GAAG,MAAM,CAAC,OAUtB,CAAC;IACF,OAAO,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,KAA0B,EAC1B,MAAuB;IAEvB,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;QACzB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAO,KAA0B;IACzD,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;QACzB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;QACxB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,KAA0B;IAE1B,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;QACzB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI;QAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO;KACvB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversity.d.ts","sourceRoot":"","sources":["../../../src/testing/conformance/adversity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adversity.d.ts","sourceRoot":"","sources":["../../../src/testing/conformance/adversity.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA+KzD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CA4D1E;AAED,4CAA4C;AAC5C,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CAcrE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CA4DtE;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CAmD1E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CAkEvE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CAyCzE"}
|
|
@@ -1,30 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
* Adversity — each toxic property asserts the specific invariant spec
|
|
3
|
-
* #181 §5 names for that toxic. Not a one-size-fits-all body: the
|
|
4
|
-
* toxics have different failure modes, and the spec's contract for each
|
|
5
|
-
* is different.
|
|
6
|
-
*
|
|
7
|
-
* Historical grouping note: spec #181 §5 calls this "Tier D". Code uses
|
|
8
|
-
* semantic names only. Backpressure is a tombstone (→ #186).
|
|
9
|
-
*
|
|
10
|
-
* | Toxic | Spec asks (paraphrased) |
|
|
11
|
-
* |-------------|------------------------------------------------------|
|
|
12
|
-
* | latency | delivery invariant still holds under added latency |
|
|
13
|
-
* | slicer | delivery holds + payload byte-identical through splits |
|
|
14
|
-
* | reset_peer | sender's RPCs surface typed TransportClosedError |
|
|
15
|
-
* | timeout | caller surfaces typed RpcTimeoutError within budget |
|
|
16
|
-
* | slow_close | scope release completes within a bounded window |
|
|
17
|
-
*
|
|
18
|
-
* Principle 3: every property body is `Effect<void, PropertyFailure>`
|
|
19
|
-
* — no bare throws, no `Effect.void` shortcuts.
|
|
20
|
-
*/
|
|
21
|
-
import { Clock, Effect } from "effect";
|
|
1
|
+
import { Clock, Effect, Either } from "effect";
|
|
22
2
|
import { defaultToxicProfile } from "../toxics/defaults.js";
|
|
23
3
|
import { makeTestClient } from "../test-client.js";
|
|
24
4
|
import { registerTestAgent } from "../agent-registration.js";
|
|
5
|
+
import { isNotificationFrame } from "../codec.js";
|
|
6
|
+
import { TransportClosedError } from "../errors.js";
|
|
25
7
|
import { PropertyDeferred, PropertyInvariantViolation, PropertyUnavailable, registerProperty, } from "./registry.js";
|
|
8
|
+
import { ConversationsCreate, ConversationsList, } from "../../schema/methods/conversations.js";
|
|
9
|
+
import { MessagesSend } from "../../schema/methods/messages.js";
|
|
10
|
+
import { ConversationId, conversationId } from "../../schema/primitives.js";
|
|
26
11
|
const CATEGORY = "adversity";
|
|
27
12
|
const DEFAULT_CAPTURE_CAPACITY = 128;
|
|
13
|
+
const ID_RADIX = 36;
|
|
14
|
+
const RANDOM_SUFFIX_START = 2;
|
|
15
|
+
const RANDOM_SUFFIX_END = 8;
|
|
16
|
+
const LATENCY_CLIENT_TIMEOUT_MS = 6_000;
|
|
17
|
+
const SLICER_CLIENT_TIMEOUT_MS = 8_000;
|
|
18
|
+
const RESET_CLIENT_TIMEOUT_MS = 4_000;
|
|
19
|
+
const RESET_POLL_ATTEMPTS = 10;
|
|
20
|
+
const RESET_CLOSE_BUDGET_MS = 3_500;
|
|
21
|
+
const TIMEOUT_CLIENT_TIMEOUT_MS = 1_500;
|
|
22
|
+
const TIMEOUT_EXPECTED_BUDGET_MS = 3_000;
|
|
23
|
+
const SLOW_CLOSE_CLIENT_TIMEOUT_MS = 2_000;
|
|
24
|
+
const SLOW_CLOSE_BUDGET_MS = 5_000;
|
|
25
|
+
const TIMEOUT_SURFACE_PROPERTY = "timeout-surface";
|
|
26
|
+
function violation(name, reason) {
|
|
27
|
+
return new PropertyInvariantViolation({ category: CATEGORY, name, reason });
|
|
28
|
+
}
|
|
29
|
+
function randomIdSuffix() {
|
|
30
|
+
return Math.random()
|
|
31
|
+
.toString(ID_RADIX)
|
|
32
|
+
.slice(RANDOM_SUFFIX_START, RANDOM_SUFFIX_END);
|
|
33
|
+
}
|
|
34
|
+
function proxyName(prefix, seed) {
|
|
35
|
+
return `${prefix}-${seed}-${randomIdSuffix()}`;
|
|
36
|
+
}
|
|
28
37
|
/** Acquire a TestClient that routes through the Toxiproxy proxy. */
|
|
29
38
|
function acquireProxiedClient(ctx, proxy, name, defaultTimeoutMs, unavailable) {
|
|
30
39
|
// Preserve the upstream path (e.g., `/ws`) when building the
|
|
@@ -97,24 +106,17 @@ export function registerLatencyResilience(ctx) {
|
|
|
97
106
|
ctx,
|
|
98
107
|
propertyName: "latency-resilience",
|
|
99
108
|
description: "fan-out delivery survives added latency + jitter",
|
|
100
|
-
proxyName:
|
|
109
|
+
proxyName: proxyName("lat", ctx.seed),
|
|
101
110
|
profile: defaultToxicProfile.latency,
|
|
102
111
|
body: ({ proxy, unavailable, attachToxic }) => Effect.gen(function* () {
|
|
103
|
-
const owner = yield* acquireProxiedClient(ctx, proxy, `lat-${ctx.seed}-o`,
|
|
104
|
-
const participant = yield* acquireProxiedClient(ctx, proxy, `lat-${ctx.seed}-p`,
|
|
105
|
-
const
|
|
106
|
-
if (conv.kind !== "ok") {
|
|
107
|
-
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
108
|
-
category: CATEGORY,
|
|
109
|
-
name: "latency-resilience",
|
|
110
|
-
reason: conv.reason,
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
112
|
+
const owner = yield* acquireProxiedClient(ctx, proxy, `lat-${ctx.seed}-o`, LATENCY_CLIENT_TIMEOUT_MS, unavailable);
|
|
113
|
+
const participant = yield* acquireProxiedClient(ctx, proxy, `lat-${ctx.seed}-p`, LATENCY_CLIENT_TIMEOUT_MS, unavailable);
|
|
114
|
+
const conversationId = yield* createOneOnOneConversation(owner, participant, "latency-resilience");
|
|
113
115
|
yield* Effect.scoped(Effect.gen(function* () {
|
|
114
116
|
yield* attachToxic;
|
|
115
117
|
yield* owner.client
|
|
116
|
-
.sendRpc(
|
|
117
|
-
conversationId
|
|
118
|
+
.sendRpc(MessagesSend, {
|
|
119
|
+
conversationId,
|
|
118
120
|
parts: [{ type: "text", text: "lat-ping" }],
|
|
119
121
|
})
|
|
120
122
|
.pipe(Effect.either);
|
|
@@ -123,9 +125,9 @@ export function registerLatencyResilience(ctx) {
|
|
|
123
125
|
}));
|
|
124
126
|
const snap = yield* participant.client.snapshot;
|
|
125
127
|
const delivered = snap.filter((s) => s.kind === "inbound" &&
|
|
126
|
-
s.frame
|
|
127
|
-
|
|
128
|
-
s.frame.
|
|
128
|
+
s.frame !== null &&
|
|
129
|
+
isNotificationFrame(s.frame) &&
|
|
130
|
+
s.frame.method.includes("message")).length;
|
|
129
131
|
if (delivered === 0) {
|
|
130
132
|
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
131
133
|
category: CATEGORY,
|
|
@@ -154,25 +156,18 @@ export function registerSlicerFraming(ctx) {
|
|
|
154
156
|
ctx,
|
|
155
157
|
propertyName: "slicer-framing",
|
|
156
158
|
description: "partial-frame slicing preserves payload byte-identity",
|
|
157
|
-
proxyName:
|
|
159
|
+
proxyName: proxyName("sli", ctx.seed),
|
|
158
160
|
profile: defaultToxicProfile.slicer,
|
|
159
161
|
body: ({ proxy, unavailable, attachToxic }) => Effect.gen(function* () {
|
|
160
|
-
const owner = yield* acquireProxiedClient(ctx, proxy, `sli-${ctx.seed}-o`,
|
|
161
|
-
const participant = yield* acquireProxiedClient(ctx, proxy, `sli-${ctx.seed}-p`,
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
165
|
-
category: CATEGORY,
|
|
166
|
-
name: "slicer-framing",
|
|
167
|
-
reason: conv.reason,
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
const token = `sli-token-${ctx.seed}-${Date.now().toString(36)}`;
|
|
162
|
+
const owner = yield* acquireProxiedClient(ctx, proxy, `sli-${ctx.seed}-o`, SLICER_CLIENT_TIMEOUT_MS, unavailable);
|
|
163
|
+
const participant = yield* acquireProxiedClient(ctx, proxy, `sli-${ctx.seed}-p`, SLICER_CLIENT_TIMEOUT_MS, unavailable);
|
|
164
|
+
const conversationId = yield* createOneOnOneConversation(owner, participant, "slicer-framing");
|
|
165
|
+
const token = `sli-token-${ctx.seed}-${Date.now().toString(ID_RADIX)}`;
|
|
171
166
|
yield* Effect.scoped(Effect.gen(function* () {
|
|
172
167
|
yield* attachToxic;
|
|
173
168
|
yield* owner.client
|
|
174
|
-
.sendRpc(
|
|
175
|
-
conversationId
|
|
169
|
+
.sendRpc(MessagesSend, {
|
|
170
|
+
conversationId,
|
|
176
171
|
parts: [{ type: "text", text: token }],
|
|
177
172
|
})
|
|
178
173
|
.pipe(Effect.either);
|
|
@@ -180,7 +175,8 @@ export function registerSlicerFraming(ctx) {
|
|
|
180
175
|
}));
|
|
181
176
|
const snap = yield* participant.client.snapshot;
|
|
182
177
|
const matched = snap.some((s) => s.kind === "inbound" &&
|
|
183
|
-
s.frame
|
|
178
|
+
s.frame !== null &&
|
|
179
|
+
isNotificationFrame(s.frame) &&
|
|
184
180
|
s.raw.includes(token));
|
|
185
181
|
if (!matched) {
|
|
186
182
|
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
@@ -205,27 +201,30 @@ export function registerResetPeerRecovery(ctx) {
|
|
|
205
201
|
ctx,
|
|
206
202
|
propertyName: "reset-peer-recovery",
|
|
207
203
|
description: "reset_peer surfaces TransportClosedError without hanging",
|
|
208
|
-
proxyName:
|
|
204
|
+
proxyName: proxyName("rst", ctx.seed),
|
|
209
205
|
profile: defaultToxicProfile.reset_peer,
|
|
210
206
|
body: ({ proxy, unavailable, attachToxic }) => Effect.gen(function* () {
|
|
211
207
|
const sender = yield* acquireProxiedClient(ctx, proxy, `rst-${ctx.seed}-s`,
|
|
212
208
|
// Deadline > reset_peer.timeoutMs (2000); bounded so a
|
|
213
209
|
// never-firing reset doesn't hang the suite.
|
|
214
|
-
|
|
210
|
+
RESET_CLIENT_TIMEOUT_MS, unavailable);
|
|
215
211
|
const observed = yield* Effect.scoped(Effect.gen(function* () {
|
|
216
212
|
yield* attachToxic;
|
|
217
213
|
const start = yield* Clock.currentTimeMillis;
|
|
218
|
-
for (let i = 0; i <
|
|
214
|
+
for (let i = 0; i < RESET_POLL_ATTEMPTS; i++) {
|
|
219
215
|
const outcome = yield* sender.client
|
|
220
|
-
.sendRpc(
|
|
216
|
+
.sendRpc(ConversationsList, {})
|
|
221
217
|
.pipe(Effect.either);
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
const transportClosed = Either.match(outcome, {
|
|
219
|
+
onLeft: (error) => error instanceof TransportClosedError,
|
|
220
|
+
onRight: () => false,
|
|
221
|
+
});
|
|
222
|
+
if (transportClosed) {
|
|
224
223
|
return true;
|
|
225
224
|
}
|
|
226
225
|
yield* Effect.sleep("300 millis");
|
|
227
226
|
const elapsed = (yield* Clock.currentTimeMillis) - start;
|
|
228
|
-
if (elapsed >
|
|
227
|
+
if (elapsed > RESET_CLOSE_BUDGET_MS)
|
|
229
228
|
return false;
|
|
230
229
|
}
|
|
231
230
|
return false;
|
|
@@ -247,47 +246,50 @@ export function registerResetPeerRecovery(ctx) {
|
|
|
247
246
|
export function registerTimeoutSurface(ctx) {
|
|
248
247
|
withToxicProxy({
|
|
249
248
|
ctx,
|
|
250
|
-
propertyName:
|
|
249
|
+
propertyName: TIMEOUT_SURFACE_PROPERTY,
|
|
251
250
|
description: "timeout toxic surfaces typed RpcTimeoutError within budget",
|
|
252
|
-
proxyName:
|
|
251
|
+
proxyName: proxyName("to", ctx.seed),
|
|
253
252
|
profile: defaultToxicProfile.timeout,
|
|
254
253
|
body: ({ proxy, unavailable, attachToxic }) => Effect.gen(function* () {
|
|
255
254
|
// Client timeout must be LESS than the toxic's forwarding
|
|
256
255
|
// timeout so the RPC hits the client-side deadline first.
|
|
257
256
|
// defaultToxicProfile.timeout.timeoutMs = 5000. Set client to
|
|
258
257
|
// 1500ms for a fast, clear timeout surface.
|
|
259
|
-
const proxied = yield* acquireProxiedClient(ctx, proxy, `to-${ctx.seed}-c`,
|
|
258
|
+
const proxied = yield* acquireProxiedClient(ctx, proxy, `to-${ctx.seed}-c`, TIMEOUT_CLIENT_TIMEOUT_MS, unavailable);
|
|
260
259
|
const { outcomeTag, elapsed } = yield* Effect.scoped(Effect.gen(function* () {
|
|
261
260
|
yield* attachToxic;
|
|
262
261
|
const start = yield* Clock.currentTimeMillis;
|
|
263
262
|
const outcome = yield* proxied.client
|
|
264
|
-
.sendRpc(
|
|
263
|
+
.sendRpc(ConversationsList, {})
|
|
265
264
|
.pipe(Effect.either);
|
|
266
265
|
const elapsed = (yield* Clock.currentTimeMillis) - start;
|
|
267
266
|
return {
|
|
268
|
-
outcomeTag:
|
|
267
|
+
outcomeTag: Either.match(outcome, {
|
|
268
|
+
onLeft: (error) => error._tag,
|
|
269
|
+
onRight: () => "success",
|
|
270
|
+
}),
|
|
269
271
|
elapsed,
|
|
270
272
|
};
|
|
271
273
|
}));
|
|
272
274
|
if (outcomeTag === "success") {
|
|
273
275
|
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
274
276
|
category: CATEGORY,
|
|
275
|
-
name:
|
|
277
|
+
name: TIMEOUT_SURFACE_PROPERTY,
|
|
276
278
|
reason: "RPC through timeout toxic unexpectedly succeeded",
|
|
277
279
|
}));
|
|
278
280
|
}
|
|
279
281
|
if (outcomeTag !== "TestingRpcTimeoutError") {
|
|
280
282
|
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
281
283
|
category: CATEGORY,
|
|
282
|
-
name:
|
|
284
|
+
name: TIMEOUT_SURFACE_PROPERTY,
|
|
283
285
|
reason: `expected RpcTimeoutError, got ${outcomeTag}`,
|
|
284
286
|
}));
|
|
285
287
|
}
|
|
286
|
-
if (elapsed >
|
|
288
|
+
if (elapsed > TIMEOUT_EXPECTED_BUDGET_MS) {
|
|
287
289
|
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
288
290
|
category: CATEGORY,
|
|
289
|
-
name:
|
|
290
|
-
reason: `timeout fired at ${elapsed}ms, expected
|
|
291
|
+
name: TIMEOUT_SURFACE_PROPERTY,
|
|
292
|
+
reason: `timeout fired at ${elapsed}ms, expected <${TIMEOUT_EXPECTED_BUDGET_MS}ms`,
|
|
291
293
|
}));
|
|
292
294
|
}
|
|
293
295
|
}),
|
|
@@ -303,7 +305,7 @@ export function registerSlowCloseCleanup(ctx) {
|
|
|
303
305
|
ctx,
|
|
304
306
|
propertyName: "slow-close-cleanup",
|
|
305
307
|
description: "slow_close toxic does not leak descriptors beyond 2s",
|
|
306
|
-
proxyName:
|
|
308
|
+
proxyName: proxyName("sc", ctx.seed),
|
|
307
309
|
profile: defaultToxicProfile.slow_close,
|
|
308
310
|
body: ({ proxy, unavailable, attachToxic }) => Effect.gen(function* () {
|
|
309
311
|
const start = yield* Clock.currentTimeMillis;
|
|
@@ -312,49 +314,40 @@ export function registerSlowCloseCleanup(ctx) {
|
|
|
312
314
|
// Effect.scoped unwinds, the client must release within the
|
|
313
315
|
// 2s budget even though the toxic delays its close-frame.
|
|
314
316
|
yield* Effect.scoped(Effect.gen(function* () {
|
|
315
|
-
const _client = yield* acquireProxiedClient(ctx, proxy, `sc-${ctx.seed}-c`,
|
|
317
|
+
const _client = yield* acquireProxiedClient(ctx, proxy, `sc-${ctx.seed}-c`, SLOW_CLOSE_CLIENT_TIMEOUT_MS, unavailable);
|
|
316
318
|
// A single RPC proves the socket is alive before close.
|
|
317
319
|
yield* _client.client
|
|
318
|
-
.sendRpc(
|
|
320
|
+
.sendRpc(ConversationsList, {})
|
|
319
321
|
.pipe(Effect.either);
|
|
320
322
|
}));
|
|
321
323
|
const elapsed = (yield* Clock.currentTimeMillis) - start;
|
|
322
|
-
if (elapsed >
|
|
324
|
+
if (elapsed > SLOW_CLOSE_BUDGET_MS) {
|
|
323
325
|
return yield* Effect.fail(new PropertyInvariantViolation({
|
|
324
326
|
category: CATEGORY,
|
|
325
327
|
name: "slow-close-cleanup",
|
|
326
|
-
reason: `scope release took ${elapsed}ms under slow_close (budget
|
|
328
|
+
reason: `scope release took ${elapsed}ms under slow_close (budget ${SLOW_CLOSE_BUDGET_MS}ms)`,
|
|
327
329
|
}));
|
|
328
330
|
}
|
|
329
331
|
}),
|
|
330
332
|
});
|
|
331
333
|
}
|
|
332
|
-
|
|
334
|
+
// ── helpers ──────────────────────────────────────────────────────────
|
|
335
|
+
function createOneOnOneConversation(owner, participant, propertyName) {
|
|
333
336
|
return Effect.gen(function* () {
|
|
334
337
|
const create = yield* owner.client
|
|
335
|
-
.sendRpc(
|
|
338
|
+
.sendRpc(ConversationsCreate, {
|
|
336
339
|
type: "group",
|
|
337
340
|
name: `adv-conv-${owner.agent.name}`,
|
|
338
341
|
participants: [
|
|
339
342
|
{ type: "agent", id: participant.agent.agentId },
|
|
340
343
|
],
|
|
341
344
|
})
|
|
342
|
-
.pipe(Effect.
|
|
343
|
-
|
|
344
|
-
return {
|
|
345
|
-
kind: "error",
|
|
346
|
-
reason: `conversations/create under toxic: ${create.left._tag}`,
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
const id = create.right.conversation
|
|
350
|
-
?.id;
|
|
345
|
+
.pipe(Effect.mapError((error) => violation(propertyName, `conversations/create under toxic: ${error._tag}`)));
|
|
346
|
+
const id = create.conversation?.id;
|
|
351
347
|
if (typeof id !== "string" || id.length === 0) {
|
|
352
|
-
return
|
|
353
|
-
kind: "error",
|
|
354
|
-
reason: "conversations/create returned no conversation.id",
|
|
355
|
-
};
|
|
348
|
+
return yield* Effect.fail(violation(propertyName, "conversations/create returned no conversation.id"));
|
|
356
349
|
}
|
|
357
|
-
return
|
|
350
|
+
return conversationId(id);
|
|
358
351
|
});
|
|
359
352
|
}
|
|
360
353
|
//# sourceMappingURL=adversity.js.map
|