@moltzap/protocol 2026.408.0 → 2026.425.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/rpc-registry.d.ts +446 -0
  6. package/dist/rpc-registry.d.ts.map +1 -0
  7. package/dist/rpc-registry.js +67 -0
  8. package/dist/rpc-registry.js.map +1 -0
  9. package/dist/rpc.d.ts +42 -0
  10. package/dist/rpc.d.ts.map +1 -0
  11. package/dist/rpc.js +29 -0
  12. package/dist/rpc.js.map +1 -0
  13. package/dist/schema/apps.d.ts +86 -0
  14. package/dist/schema/apps.d.ts.map +1 -0
  15. package/dist/schema/apps.js +77 -0
  16. package/dist/schema/apps.js.map +1 -0
  17. package/dist/schema/contacts.d.ts +8 -18
  18. package/dist/schema/contacts.d.ts.map +1 -1
  19. package/dist/schema/contacts.js +9 -13
  20. package/dist/schema/contacts.js.map +1 -1
  21. package/dist/schema/conversations.d.ts +15 -8
  22. package/dist/schema/conversations.d.ts.map +1 -1
  23. package/dist/schema/conversations.js +18 -7
  24. package/dist/schema/conversations.js.map +1 -1
  25. package/dist/schema/delivery.d.ts +1 -4
  26. package/dist/schema/delivery.d.ts.map +1 -1
  27. package/dist/schema/delivery.js +2 -3
  28. package/dist/schema/delivery.js.map +1 -1
  29. package/dist/schema/errors.d.ts +13 -0
  30. package/dist/schema/errors.d.ts.map +1 -1
  31. package/dist/schema/errors.js +14 -0
  32. package/dist/schema/errors.js.map +1 -1
  33. package/dist/schema/events.d.ts +112 -93
  34. package/dist/schema/events.d.ts.map +1 -1
  35. package/dist/schema/events.js +84 -25
  36. package/dist/schema/events.js.map +1 -1
  37. package/dist/schema/identity.d.ts +19 -17
  38. package/dist/schema/identity.d.ts.map +1 -1
  39. package/dist/schema/identity.js +7 -14
  40. package/dist/schema/identity.js.map +1 -1
  41. package/dist/schema/index.d.ts +4 -2
  42. package/dist/schema/index.d.ts.map +1 -1
  43. package/dist/schema/index.js +4 -2
  44. package/dist/schema/index.js.map +1 -1
  45. package/dist/schema/messages.d.ts +3 -7
  46. package/dist/schema/messages.d.ts.map +1 -1
  47. package/dist/schema/messages.js +4 -6
  48. package/dist/schema/messages.js.map +1 -1
  49. package/dist/schema/methods/apps.d.ts +123 -0
  50. package/dist/schema/methods/apps.d.ts.map +1 -0
  51. package/dist/schema/methods/apps.js +93 -0
  52. package/dist/schema/methods/apps.js.map +1 -0
  53. package/dist/schema/methods/auth.d.ts +102 -90
  54. package/dist/schema/methods/auth.d.ts.map +1 -1
  55. package/dist/schema/methods/auth.js +86 -74
  56. package/dist/schema/methods/auth.js.map +1 -1
  57. package/dist/schema/methods/contacts.d.ts +39 -74
  58. package/dist/schema/methods/contacts.d.ts.map +1 -1
  59. package/dist/schema/methods/contacts.js +35 -29
  60. package/dist/schema/methods/contacts.js.map +1 -1
  61. package/dist/schema/methods/conversations.d.ts +48 -52
  62. package/dist/schema/methods/conversations.d.ts.map +1 -1
  63. package/dist/schema/methods/conversations.js +89 -38
  64. package/dist/schema/methods/conversations.js.map +1 -1
  65. package/dist/schema/methods/invites.d.ts +1 -3
  66. package/dist/schema/methods/invites.d.ts.map +1 -1
  67. package/dist/schema/methods/invites.js +8 -1
  68. package/dist/schema/methods/invites.js.map +1 -1
  69. package/dist/schema/methods/messages.d.ts +12 -44
  70. package/dist/schema/methods/messages.d.ts.map +1 -1
  71. package/dist/schema/methods/messages.js +22 -28
  72. package/dist/schema/methods/messages.js.map +1 -1
  73. package/dist/schema/methods/presence.d.ts +7 -22
  74. package/dist/schema/methods/presence.d.ts.map +1 -1
  75. package/dist/schema/methods/presence.js +12 -6
  76. package/dist/schema/methods/presence.js.map +1 -1
  77. package/dist/schema/methods/push.d.ts +8 -6
  78. package/dist/schema/methods/push.d.ts.map +1 -1
  79. package/dist/schema/methods/push.js +20 -7
  80. package/dist/schema/methods/push.js.map +1 -1
  81. package/dist/schema/methods/system.d.ts +4 -0
  82. package/dist/schema/methods/system.d.ts.map +1 -0
  83. package/dist/schema/methods/system.js +11 -0
  84. package/dist/schema/methods/system.js.map +1 -0
  85. package/dist/schema/presence.d.ts +1 -12
  86. package/dist/schema/presence.d.ts.map +1 -1
  87. package/dist/schema/presence.js +2 -7
  88. package/dist/schema/presence.js.map +1 -1
  89. package/dist/schema/surfaces.d.ts +31 -25
  90. package/dist/schema/surfaces.d.ts.map +1 -1
  91. package/dist/schema/surfaces.js +40 -21
  92. package/dist/schema/surfaces.js.map +1 -1
  93. package/dist/testing/agent-registration.d.ts +49 -0
  94. package/dist/testing/agent-registration.d.ts.map +1 -0
  95. package/dist/testing/agent-registration.js +77 -0
  96. package/dist/testing/agent-registration.js.map +1 -0
  97. package/dist/testing/arbitraries/frames.d.ts +24 -0
  98. package/dist/testing/arbitraries/frames.d.ts.map +1 -0
  99. package/dist/testing/arbitraries/frames.js +36 -0
  100. package/dist/testing/arbitraries/frames.js.map +1 -0
  101. package/dist/testing/arbitraries/from-typebox.d.ts +37 -0
  102. package/dist/testing/arbitraries/from-typebox.d.ts.map +1 -0
  103. package/dist/testing/arbitraries/from-typebox.js +131 -0
  104. package/dist/testing/arbitraries/from-typebox.js.map +1 -0
  105. package/dist/testing/arbitraries/index.d.ts +4 -0
  106. package/dist/testing/arbitraries/index.d.ts.map +1 -0
  107. package/dist/testing/arbitraries/index.js +4 -0
  108. package/dist/testing/arbitraries/index.js.map +1 -0
  109. package/dist/testing/arbitraries/rpc.d.ts +66 -0
  110. package/dist/testing/arbitraries/rpc.d.ts.map +1 -0
  111. package/dist/testing/arbitraries/rpc.js +98 -0
  112. package/dist/testing/arbitraries/rpc.js.map +1 -0
  113. package/dist/testing/canonicalize.d.ts +38 -0
  114. package/dist/testing/canonicalize.d.ts.map +1 -0
  115. package/dist/testing/canonicalize.js +55 -0
  116. package/dist/testing/canonicalize.js.map +1 -0
  117. package/dist/testing/captures.d.ts +61 -0
  118. package/dist/testing/captures.d.ts.map +1 -0
  119. package/dist/testing/captures.js +99 -0
  120. package/dist/testing/captures.js.map +1 -0
  121. package/dist/testing/codec.d.ts +44 -0
  122. package/dist/testing/codec.d.ts.map +1 -0
  123. package/dist/testing/codec.js +170 -0
  124. package/dist/testing/codec.js.map +1 -0
  125. package/dist/testing/conformance/__divergence_proofs__/executable-proof-helpers.d.ts +6 -0
  126. package/dist/testing/conformance/__divergence_proofs__/executable-proof-helpers.d.ts.map +1 -0
  127. package/dist/testing/conformance/__divergence_proofs__/executable-proof-helpers.js +33 -0
  128. package/dist/testing/conformance/__divergence_proofs__/executable-proof-helpers.js.map +1 -0
  129. package/dist/testing/conformance/adversity.d.ts +36 -0
  130. package/dist/testing/conformance/adversity.d.ts.map +1 -0
  131. package/dist/testing/conformance/adversity.js +360 -0
  132. package/dist/testing/conformance/adversity.js.map +1 -0
  133. package/dist/testing/conformance/boundary.d.ts +56 -0
  134. package/dist/testing/conformance/boundary.d.ts.map +1 -0
  135. package/dist/testing/conformance/boundary.js +129 -0
  136. package/dist/testing/conformance/boundary.js.map +1 -0
  137. package/dist/testing/conformance/client/_fixtures.d.ts +71 -0
  138. package/dist/testing/conformance/client/_fixtures.d.ts.map +1 -0
  139. package/dist/testing/conformance/client/_fixtures.js +102 -0
  140. package/dist/testing/conformance/client/_fixtures.js.map +1 -0
  141. package/dist/testing/conformance/client/adversity.d.ts +39 -0
  142. package/dist/testing/conformance/client/adversity.d.ts.map +1 -0
  143. package/dist/testing/conformance/client/adversity.js +162 -0
  144. package/dist/testing/conformance/client/adversity.js.map +1 -0
  145. package/dist/testing/conformance/client/boundary.d.ts +12 -0
  146. package/dist/testing/conformance/client/boundary.d.ts.map +1 -0
  147. package/dist/testing/conformance/client/boundary.js +68 -0
  148. package/dist/testing/conformance/client/boundary.js.map +1 -0
  149. package/dist/testing/conformance/client/delivery.d.ts +38 -0
  150. package/dist/testing/conformance/client/delivery.d.ts.map +1 -0
  151. package/dist/testing/conformance/client/delivery.js +202 -0
  152. package/dist/testing/conformance/client/delivery.js.map +1 -0
  153. package/dist/testing/conformance/client/index.d.ts +16 -0
  154. package/dist/testing/conformance/client/index.d.ts.map +1 -0
  155. package/dist/testing/conformance/client/index.js +16 -0
  156. package/dist/testing/conformance/client/index.js.map +1 -0
  157. package/dist/testing/conformance/client/rpc-semantics.d.ts +26 -0
  158. package/dist/testing/conformance/client/rpc-semantics.d.ts.map +1 -0
  159. package/dist/testing/conformance/client/rpc-semantics.js +145 -0
  160. package/dist/testing/conformance/client/rpc-semantics.js.map +1 -0
  161. package/dist/testing/conformance/client/runner.d.ts +258 -0
  162. package/dist/testing/conformance/client/runner.d.ts.map +1 -0
  163. package/dist/testing/conformance/client/runner.js +228 -0
  164. package/dist/testing/conformance/client/runner.js.map +1 -0
  165. package/dist/testing/conformance/client/schema-conformance.d.ts +25 -0
  166. package/dist/testing/conformance/client/schema-conformance.d.ts.map +1 -0
  167. package/dist/testing/conformance/client/schema-conformance.js +123 -0
  168. package/dist/testing/conformance/client/schema-conformance.js.map +1 -0
  169. package/dist/testing/conformance/client/suite.d.ts +90 -0
  170. package/dist/testing/conformance/client/suite.d.ts.map +1 -0
  171. package/dist/testing/conformance/client/suite.js +209 -0
  172. package/dist/testing/conformance/client/suite.js.map +1 -0
  173. package/dist/testing/conformance/coverage-policy.d.ts +8 -0
  174. package/dist/testing/conformance/coverage-policy.d.ts.map +1 -0
  175. package/dist/testing/conformance/coverage-policy.js +10 -0
  176. package/dist/testing/conformance/coverage-policy.js.map +1 -0
  177. package/dist/testing/conformance/delivery.d.ts +40 -0
  178. package/dist/testing/conformance/delivery.d.ts.map +1 -0
  179. package/dist/testing/conformance/delivery.js +231 -0
  180. package/dist/testing/conformance/delivery.js.map +1 -0
  181. package/dist/testing/conformance/env.d.ts +3 -0
  182. package/dist/testing/conformance/env.d.ts.map +1 -0
  183. package/dist/testing/conformance/env.js +14 -0
  184. package/dist/testing/conformance/env.js.map +1 -0
  185. package/dist/testing/conformance/index.d.ts +10 -0
  186. package/dist/testing/conformance/index.d.ts.map +1 -0
  187. package/dist/testing/conformance/index.js +10 -0
  188. package/dist/testing/conformance/index.js.map +1 -0
  189. package/dist/testing/conformance/registry.d.ts +93 -0
  190. package/dist/testing/conformance/registry.d.ts.map +1 -0
  191. package/dist/testing/conformance/registry.js +62 -0
  192. package/dist/testing/conformance/registry.js.map +1 -0
  193. package/dist/testing/conformance/rpc-semantics.d.ts +67 -0
  194. package/dist/testing/conformance/rpc-semantics.d.ts.map +1 -0
  195. package/dist/testing/conformance/rpc-semantics.js +394 -0
  196. package/dist/testing/conformance/rpc-semantics.js.map +1 -0
  197. package/dist/testing/conformance/runner.d.ts +78 -0
  198. package/dist/testing/conformance/runner.d.ts.map +1 -0
  199. package/dist/testing/conformance/runner.js +65 -0
  200. package/dist/testing/conformance/runner.js.map +1 -0
  201. package/dist/testing/conformance/schema-conformance.d.ts +30 -0
  202. package/dist/testing/conformance/schema-conformance.d.ts.map +1 -0
  203. package/dist/testing/conformance/schema-conformance.js +229 -0
  204. package/dist/testing/conformance/schema-conformance.js.map +1 -0
  205. package/dist/testing/conformance/suite.d.ts +92 -0
  206. package/dist/testing/conformance/suite.d.ts.map +1 -0
  207. package/dist/testing/conformance/suite.js +233 -0
  208. package/dist/testing/conformance/suite.js.map +1 -0
  209. package/dist/testing/errors.d.ts +78 -0
  210. package/dist/testing/errors.d.ts.map +1 -0
  211. package/dist/testing/errors.js +34 -0
  212. package/dist/testing/errors.js.map +1 -0
  213. package/dist/testing/index.d.ts +25 -0
  214. package/dist/testing/index.d.ts.map +1 -0
  215. package/dist/testing/index.js +37 -0
  216. package/dist/testing/index.js.map +1 -0
  217. package/dist/testing/models/dispatch.d.ts +61 -0
  218. package/dist/testing/models/dispatch.d.ts.map +1 -0
  219. package/dist/testing/models/dispatch.js +197 -0
  220. package/dist/testing/models/dispatch.js.map +1 -0
  221. package/dist/testing/models/index.d.ts +3 -0
  222. package/dist/testing/models/index.d.ts.map +1 -0
  223. package/dist/testing/models/index.js +3 -0
  224. package/dist/testing/models/index.js.map +1 -0
  225. package/dist/testing/models/state.d.ts +37 -0
  226. package/dist/testing/models/state.d.ts.map +1 -0
  227. package/dist/testing/models/state.js +14 -0
  228. package/dist/testing/models/state.js.map +1 -0
  229. package/dist/testing/test-client.d.ts +70 -0
  230. package/dist/testing/test-client.d.ts.map +1 -0
  231. package/dist/testing/test-client.js +266 -0
  232. package/dist/testing/test-client.js.map +1 -0
  233. package/dist/testing/test-server.d.ts +62 -0
  234. package/dist/testing/test-server.d.ts.map +1 -0
  235. package/dist/testing/test-server.js +134 -0
  236. package/dist/testing/test-server.js.map +1 -0
  237. package/dist/testing/toxics/client.d.ts +52 -0
  238. package/dist/testing/toxics/client.d.ts.map +1 -0
  239. package/dist/testing/toxics/client.js +120 -0
  240. package/dist/testing/toxics/client.js.map +1 -0
  241. package/dist/testing/toxics/defaults.d.ts +43 -0
  242. package/dist/testing/toxics/defaults.d.ts.map +1 -0
  243. package/dist/testing/toxics/defaults.js +9 -0
  244. package/dist/testing/toxics/defaults.js.map +1 -0
  245. package/dist/testing/toxics/index.d.ts +4 -0
  246. package/dist/testing/toxics/index.d.ts.map +1 -0
  247. package/dist/testing/toxics/index.js +4 -0
  248. package/dist/testing/toxics/index.js.map +1 -0
  249. package/dist/testing/toxics/profile.d.ts +69 -0
  250. package/dist/testing/toxics/profile.d.ts.map +1 -0
  251. package/dist/testing/toxics/profile.js +57 -0
  252. package/dist/testing/toxics/profile.js.map +1 -0
  253. package/dist/types.d.ts +7 -11
  254. package/dist/types.d.ts.map +1 -1
  255. package/dist/types.js +3 -0
  256. package/dist/types.js.map +1 -1
  257. package/dist/validators.d.ts +49 -177
  258. package/dist/validators.d.ts.map +1 -1
  259. package/dist/validators.js +77 -48
  260. package/dist/validators.js.map +1 -1
  261. package/dist/version.d.ts +1 -1
  262. package/dist/version.js +1 -1
  263. package/package.json +12 -34
  264. package/dist/optional/contact-events.d.ts +0 -3
  265. package/dist/optional/contact-events.d.ts.map +0 -1
  266. package/dist/optional/contact-events.js +0 -5
  267. package/dist/optional/contact-events.js.map +0 -1
  268. package/dist/optional/contact-methods.d.ts +0 -5
  269. package/dist/optional/contact-methods.d.ts.map +0 -1
  270. package/dist/optional/contact-methods.js +0 -5
  271. package/dist/optional/contact-methods.js.map +0 -1
  272. package/dist/phone-hash.d.ts +0 -10
  273. package/dist/phone-hash.d.ts.map +0 -1
  274. package/dist/phone-hash.js +0 -17
  275. package/dist/phone-hash.js.map +0 -1
  276. package/dist/schema/methods/phone-contacts.d.ts +0 -30
  277. package/dist/schema/methods/phone-contacts.d.ts.map +0 -1
  278. package/dist/schema/methods/phone-contacts.js +0 -10
  279. package/dist/schema/methods/phone-contacts.js.map +0 -1
  280. package/dist/test-client.d.ts +0 -34
  281. package/dist/test-client.d.ts.map +0 -1
  282. package/dist/test-client.js +0 -176
  283. package/dist/test-client.js.map +0 -1
  284. package/dist/test-fixtures/phone-hashes.d.ts +0 -18
  285. package/dist/test-fixtures/phone-hashes.d.ts.map +0 -1
  286. package/dist/test-fixtures/phone-hashes.js +0 -24
  287. package/dist/test-fixtures/phone-hashes.js.map +0 -1
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Schema conformance — properties that drive valid + malformed traffic
3
+ * through `TestClient` into the real server and assert the server's
4
+ * response shape conforms to the protocol schemas.
5
+ *
6
+ * Historical grouping note: spec #181 §5 calls this "Tier A". Code uses
7
+ * semantic names only.
8
+ *
9
+ * Principle 3: every property body is `Effect<void, PropertyFailure>`.
10
+ * Fast-check's Promise-based `fc.asyncProperty` is bridged via
11
+ * `assertProperty`; invariant/coverage failures raise
12
+ * `PropertyInvariantViolation`.
13
+ */
14
+ import * as fc from "fast-check";
15
+ import { Effect } from "effect";
16
+ import { Value } from "@sinclair/typebox/value";
17
+ import { allRpcMethods, arbitraryAnyCall, arbitraryCallFor, } from "../arbitraries/rpc.js";
18
+ import { arbitraryEventFrame, arbitraryMalformedFrame, } from "../arbitraries/frames.js";
19
+ import { decodeFrame, encodeFrame, malformFrame } from "../codec.js";
20
+ import { EventFrameSchema, ResponseFrameSchema, } from "../../schema/frames.js";
21
+ import { makeTestClient } from "../test-client.js";
22
+ import { registerTestAgent } from "../agent-registration.js";
23
+ import { assertProperty, PropertyInvariantViolation, registerProperty, } from "./registry.js";
24
+ const CATEGORY = "schema-conformance";
25
+ const DEFAULT_TIMEOUT_MS = 3000;
26
+ const DEFAULT_CAPTURE_CAPACITY = 64;
27
+ /**
28
+ * Valid request ⇒ valid-shape response. Drives fast-check RPC calls
29
+ * through a real TestClient against the real server and asserts every
30
+ * returned frame parses against `ResponseFrameSchema`.
31
+ */
32
+ export function registerRequestWellFormedness(ctx) {
33
+ registerProperty(ctx, CATEGORY, "request-well-formedness", "valid request ⇒ server reply parses against ResponseFrameSchema", assertProperty(CATEGORY, "request-well-formedness", () => fc.assert(
34
+ // #ignore-sloppy-code-next-line[async-keyword]: fast-check asyncProperty contract requires Promise-returning callback
35
+ fc.asyncProperty(arbitraryAnyCall(), async (call) => {
36
+ const observed = await Effect.runPromise(Effect.scoped(Effect.gen(function* () {
37
+ const agent = yield* registerTestAgent({
38
+ baseUrl: ctx.realServer.baseUrl,
39
+ name: "rw",
40
+ });
41
+ const client = yield* makeTestClient({
42
+ serverUrl: ctx.realServer.wsUrl,
43
+ agentKey: agent.apiKey,
44
+ agentId: agent.agentId,
45
+ defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
46
+ captureCapacity: DEFAULT_CAPTURE_CAPACITY,
47
+ });
48
+ // Mark the auto-connect boundary so we ignore frames
49
+ // that landed before the sampled call.
50
+ // Mark the auto-connect boundary so we ignore frames
51
+ // that landed before the sampled call.
52
+ const handshakeEnd = (yield* client.snapshot).length;
53
+ yield* client
54
+ .sendRpc(call.method, call.params)
55
+ .pipe(Effect.either);
56
+ return (yield* client.snapshot).slice(handshakeEnd);
57
+ })));
58
+ // Architect §4.3: validate every reply in the window.
59
+ // - outbound lookup → expectedId (confirms sampled call ran)
60
+ // - replies.length >= 1 (server didn't drop the whole window)
61
+ // - replies.every(Value.Check(ResponseFrameSchema, ...))
62
+ // (a stray duplicate/malformed response in the window fails)
63
+ // - replies.some(id === expectedId) (the sampled call got a
64
+ // reply, not just some other request)
65
+ const outbound = observed.find((s) => s.kind === "outbound" &&
66
+ s.frame?.type === "request" &&
67
+ s.frame.method === call.method);
68
+ if (outbound?.frame?.type !== "request")
69
+ return false;
70
+ const expectedId = outbound.frame.id;
71
+ const replies = observed.filter((s) => s.kind === "inbound" && s.frame?.type === "response");
72
+ if (replies.length < 1)
73
+ return false;
74
+ const allValid = replies.every((r) => r.frame?.type === "response" &&
75
+ Value.Check(ResponseFrameSchema, r.frame));
76
+ if (!allValid)
77
+ return false;
78
+ return replies.some((r) => r.frame?.type === "response" && r.frame.id === expectedId);
79
+ }), { seed: ctx.seed, numRuns: ctx.opts.numRuns ?? 3 })));
80
+ }
81
+ /**
82
+ * Valid event frame round-trips the codec cleanly.
83
+ *
84
+ * `@pure-codec` — does NOT drive a real server or real client. Spec A2's
85
+ * "accepted by a real client" assertion requires a TestServer + real
86
+ * client driver; that property lives in the consumer package (e.g.,
87
+ * `packages/client` or `moltzap-arena`) and is tracked under #186.
88
+ *
89
+ * Tightened per architect §4.4: predicate demands `Right` AND schema
90
+ * check of the specific event variant — the previous `Right || Left`
91
+ * shape was a tautology over the union.
92
+ */
93
+ export function registerEventWellFormedness(ctx) {
94
+ registerProperty(ctx, CATEGORY, "event-well-formedness", "valid event frame decodes cleanly and re-encodes to match", assertProperty(CATEGORY, "event-well-formedness", () => Promise.resolve(fc.assert(fc.property(arbitraryEventFrame(), (frame) => {
95
+ const raw = encodeFrame(frame);
96
+ const decoded = Effect.runSync(Effect.either(decodeFrame(raw, "inbound")));
97
+ if (decoded._tag !== "Right")
98
+ return false;
99
+ return (decoded.right.type === "event" &&
100
+ Value.Check(EventFrameSchema, decoded.right));
101
+ }), { seed: ctx.seed, numRuns: ctx.opts.numRuns ?? 20 }))));
102
+ }
103
+ /** parse(serialize(frame)) ≡ frame — pure codec round-trip. */
104
+ export function registerRoundTripIdentity(ctx) {
105
+ registerProperty(ctx, CATEGORY, "round-trip-identity", "parse(serialize(frame)) ≡ frame", assertProperty(CATEGORY, "round-trip-identity", () => Promise.resolve(fc.assert(fc.property(arbitraryMalformedFrame().map((m) => m.base), (frame) => {
106
+ const raw = encodeFrame(frame);
107
+ const re = Effect.runSync(Effect.either(decodeFrame(raw, "inbound")));
108
+ if (re._tag === "Left")
109
+ return true; // generator-side drift
110
+ const redone = encodeFrame(re.right);
111
+ return (JSON.stringify(JSON.parse(raw)) ===
112
+ JSON.stringify(JSON.parse(redone)));
113
+ }), { seed: ctx.seed, numRuns: ctx.opts.numRuns ?? 50 }))));
114
+ }
115
+ /**
116
+ * Malformed bytes on the wire → the server drops or returns a typed
117
+ * error, never crashes. Drives `sendMalformed` through a real WS and
118
+ * asserts the observable outcome.
119
+ */
120
+ export function registerMalformedFrameHandling(ctx) {
121
+ registerProperty(ctx, CATEGORY, "malformed-frame-handling", "malformed frames produce typed error or drop; server stays alive", assertProperty(CATEGORY, "malformed-frame-handling", () => fc.assert(
122
+ // #ignore-sloppy-code-next-line[async-keyword]: fast-check asyncProperty contract requires Promise-returning callback
123
+ fc.asyncProperty(arbitraryMalformedFrame(), async ({ kind, seed }) => {
124
+ const result = await Effect.runPromise(Effect.scoped(Effect.gen(function* () {
125
+ const agent = yield* registerTestAgent({
126
+ baseUrl: ctx.realServer.baseUrl,
127
+ name: "mf",
128
+ });
129
+ const client = yield* makeTestClient({
130
+ serverUrl: ctx.realServer.wsUrl,
131
+ agentKey: agent.apiKey,
132
+ agentId: agent.agentId,
133
+ defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
134
+ captureCapacity: DEFAULT_CAPTURE_CAPACITY,
135
+ malformedQuiescenceMs: 500,
136
+ });
137
+ const response = yield* client.sendMalformed({
138
+ baseMethod: "agents/list",
139
+ kind,
140
+ seed,
141
+ });
142
+ // Post-malformed the connection must still accept a
143
+ // normal RPC — proves the server didn't crash or
144
+ // poison its state.
145
+ const post = yield* client
146
+ .sendRpc("agents/list", {})
147
+ .pipe(Effect.either);
148
+ return { malformedReply: response, post };
149
+ })));
150
+ // Contract: either a typed error OR a clean drop (null). Both
151
+ // are acceptable per Tier A4.
152
+ const validReply = result.malformedReply === null ||
153
+ result.malformedReply._tag === "TestingRpcResponseError";
154
+ // Follow-up RPC must land with a typed success. "Right" or
155
+ // "Left" would be a tautology; "Left" would allow a timeout
156
+ // to count as server-alive, which is exactly what the
157
+ // property must reject. Require the post-malformed call to
158
+ // return cleanly.
159
+ const stillAlive = result.post._tag === "Right";
160
+ return validReply && stillAlive;
161
+ }), { seed: ctx.seed, numRuns: ctx.opts.numRuns ?? 3 })));
162
+ }
163
+ /**
164
+ * A representative sample of `RpcMethodName` reaches the real server.
165
+ * Full-set coverage is exercised by `schema-exhaustive-fuzz` in
166
+ * `boundary.ts`; this property asserts the wire path is alive for a
167
+ * small stratified sample — cheap to re-run, catches regressions that
168
+ * render every RPC unreachable.
169
+ */
170
+ const COVERAGE_SAMPLE = [
171
+ "auth/connect",
172
+ "agents/list",
173
+ "conversations/list",
174
+ "contacts/list",
175
+ ];
176
+ export function registerRpcMapCoverage(ctx) {
177
+ registerProperty(ctx, CATEGORY, "rpc-map-coverage", "a representative sample of RpcMethodName reaches a real-server response", Effect.gen(function* () {
178
+ void allRpcMethods; // kept for future expansion to full-set coverage
179
+ for (const method of COVERAGE_SAMPLE) {
180
+ const callArb = arbitraryCallFor(method);
181
+ const [sampled] = fc.sample(callArb, { numRuns: 1, seed: ctx.seed });
182
+ if (sampled === undefined) {
183
+ return yield* Effect.fail(new PropertyInvariantViolation({
184
+ category: CATEGORY,
185
+ name: "rpc-map-coverage",
186
+ reason: `failed to sample call for ${method}`,
187
+ }));
188
+ }
189
+ const reached = yield* Effect.scoped(Effect.gen(function* () {
190
+ const agent = yield* registerTestAgent({
191
+ baseUrl: ctx.realServer.baseUrl,
192
+ name: "cov",
193
+ });
194
+ const client = yield* makeTestClient({
195
+ serverUrl: ctx.realServer.wsUrl,
196
+ agentKey: agent.apiKey,
197
+ agentId: agent.agentId,
198
+ defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
199
+ captureCapacity: DEFAULT_CAPTURE_CAPACITY,
200
+ });
201
+ // Exclude handshake frames so "reached" can't be satisfied
202
+ // by the auto-connect reply — every method must produce its
203
+ // OWN response with a matching request id.
204
+ const handshakeEnd = (yield* client.snapshot).length;
205
+ yield* client
206
+ .sendRpc(sampled.method, sampled.params)
207
+ .pipe(Effect.either);
208
+ const snap = (yield* client.snapshot).slice(handshakeEnd);
209
+ const outbound = snap.find((s) => s.kind === "outbound" &&
210
+ s.frame?.type === "request" &&
211
+ s.frame.method === sampled.method);
212
+ if (outbound?.frame?.type !== "request")
213
+ return false;
214
+ const expectedId = outbound.frame.id;
215
+ return snap.some((s) => s.kind === "inbound" &&
216
+ s.frame?.type === "response" &&
217
+ s.frame.id === expectedId);
218
+ })).pipe(Effect.orElseSucceed(() => false));
219
+ if (!reached) {
220
+ return yield* Effect.fail(new PropertyInvariantViolation({
221
+ category: CATEGORY,
222
+ name: "rpc-map-coverage",
223
+ reason: `method ${method} produced no observable response`,
224
+ }));
225
+ }
226
+ }
227
+ }));
228
+ }
229
+ //# sourceMappingURL=schema-conformance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-conformance.js","sourceRoot":"","sources":["../../../src/testing/conformance/schema-conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,uBA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,IAAI,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAK,SAAS;oBAAE,OAAO,KAAK,CAAC;gBACtD,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC,IAAI,CACd,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,IAAI,KAAK,SAAS;oBACpB,CAAC,CAAC,KAAK,EAAE,IAAI,KAAK,UAAU;oBAC5B,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,UAAU,CAC5B,CAAC;YACJ,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,0BAA0B,CAAC;oBAC7B,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,kBAAkB;oBACxB,MAAM,EAAE,UAAU,MAAM,kCAAkC;iBAC3D,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Conformance suite — library-shaped entry point consumers call.
3
+ *
4
+ * `runConformanceSuite` is the single surface any real implementation
5
+ * (the core server, a third-party server, a packages/client-side
6
+ * TestServer harness, openclaw-channel, arena, …) invokes to exercise
7
+ * every property in this subpath.
8
+ *
9
+ * Dependency shape:
10
+ * - Protocol imports nothing from consumers (no `packages/server`, no
11
+ * `packages/client`, no test-runner globals).
12
+ * - Consumers import `@moltzap/protocol/testing` and pass their real
13
+ * server handle (and optionally a Toxiproxy URL + a webhook probe).
14
+ * That's the only cross-package coupling.
15
+ *
16
+ * Docker-compose spinup and vitest describe/it scaffolding are consumer
17
+ * concerns — the suite here is Effect-native and returns a typed
18
+ * `SuiteResult`. A consumer running under vitest asserts
19
+ * `result.failed.length === 0` and is done.
20
+ */
21
+ import { Effect } from "effect";
22
+ import { type ConformanceRunContext, type RealServerHandle } from "./runner.js";
23
+ import { type PropertyFailure } from "./registry.js";
24
+ import type { WebhookAdapterProbe } from "./boundary.js";
25
+ import type { RealServerAcquireError, ToxicControlError } from "../errors.js";
26
+ import { type AllowedCoverageGap } from "./coverage-policy.js";
27
+ /**
28
+ * Input shape — consumer names the concrete implementation under test and
29
+ * any optional capabilities they can provide (Toxiproxy, webhook probe).
30
+ */
31
+ export interface ConformanceSuiteOptions {
32
+ /** Factory for the implementation under test (server handle). */
33
+ readonly realServer: () => Promise<RealServerHandle>;
34
+ /**
35
+ * Toxiproxy control-plane URL. When `null`, the adversity category is
36
+ * skipped (registered properties return `PropertyUnavailable`).
37
+ */
38
+ readonly toxiproxyUrl?: string | null;
39
+ /**
40
+ * Webhook adapter probe. When provided, registers the graceful-shutdown
41
+ * boundary property. Consumers without a webhook surface omit it.
42
+ */
43
+ readonly webhookProbe?: WebhookAdapterProbe | null;
44
+ /** Replay seed. Defaults to `FC_SEED` env var or a timestamp. */
45
+ readonly replaySeed?: number;
46
+ /** Per-property fast-check `numRuns` override. Default: library default. */
47
+ readonly numRuns?: number;
48
+ /** Directory for per-property failure artifacts. Defaults to `./conformance-artifacts`. */
49
+ readonly artifactDir?: string;
50
+ }
51
+ export interface SuiteResult {
52
+ readonly seed: number;
53
+ readonly passed: ReadonlyArray<string>;
54
+ readonly deferred: ReadonlyArray<{
55
+ readonly name: string;
56
+ readonly reason: string;
57
+ }>;
58
+ readonly unavailable: ReadonlyArray<{
59
+ readonly name: string;
60
+ readonly reason: string;
61
+ }>;
62
+ readonly failed: ReadonlyArray<{
63
+ readonly name: string;
64
+ readonly failure: PropertyFailure | {
65
+ readonly _tag: "defect";
66
+ readonly message: string;
67
+ };
68
+ }>;
69
+ }
70
+ /**
71
+ * Register every property against `ctx`. Consumers that want a narrower
72
+ * run build a `ConformanceRunContext` directly and call only the modules
73
+ * they need; `runConformanceSuite` uses this helper to register the full
74
+ * set.
75
+ */
76
+ export declare function registerAllProperties(ctx: ConformanceRunContext, webhookProbe: WebhookAdapterProbe | null): void;
77
+ /**
78
+ * Run every registered property and collect a typed `SuiteResult`. Does
79
+ * not throw: failures land in `result.failed`; a vitest boundary asserts
80
+ * `result.failed.length === 0`.
81
+ */
82
+ export declare function runAllProperties(ctx: ConformanceRunContext, artifactDir: string, allowedCoverageGaps?: ReadonlyArray<AllowedCoverageGap>): Effect.Effect<SuiteResult>;
83
+ /**
84
+ * End-to-end library entry: acquire context, register all properties,
85
+ * run them, close scope. The returned `SuiteResult` is the single thing
86
+ * a consumer asserts on.
87
+ *
88
+ * The ambient `Scope` is internal — the outer scope closes when the
89
+ * Effect completes. Consumers don't need to pass a Scope.
90
+ */
91
+ export declare function runConformanceSuite(opts: ConformanceSuiteOptions): Effect.Effect<SuiteResult, ToxicControlError | RealServerAcquireError>;
92
+ //# sourceMappingURL=suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../../src/testing/conformance/suite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAgB,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAG5D,OAAO,EAEL,KAAK,qBAAqB,EAE1B,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACr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AAE,MAAM,EACnB,mBAAmB,GAAE,aAAa,CAAC,kBAAkB,CAAM,GAC1D,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CA0E5B;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,uBAAuB,GAC5B,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,iBAAiB,GAAG,sBAAsB,CAAC,CA4BxE"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Conformance suite — library-shaped entry point consumers call.
3
+ *
4
+ * `runConformanceSuite` is the single surface any real implementation
5
+ * (the core server, a third-party server, a packages/client-side
6
+ * TestServer harness, openclaw-channel, arena, …) invokes to exercise
7
+ * every property in this subpath.
8
+ *
9
+ * Dependency shape:
10
+ * - Protocol imports nothing from consumers (no `packages/server`, no
11
+ * `packages/client`, no test-runner globals).
12
+ * - Consumers import `@moltzap/protocol/testing` and pass their real
13
+ * server handle (and optionally a Toxiproxy URL + a webhook probe).
14
+ * That's the only cross-package coupling.
15
+ *
16
+ * Docker-compose spinup and vitest describe/it scaffolding are consumer
17
+ * concerns — the suite here is Effect-native and returns a typed
18
+ * `SuiteResult`. A consumer running under vitest asserts
19
+ * `result.failed.length === 0` and is done.
20
+ */
21
+ import { Cause, Chunk, Effect, Exit, Option } from "effect";
22
+ import { writeFileSync, mkdirSync, existsSync } from "node:fs";
23
+ import path from "node:path";
24
+ import { acquireRunContext, } from "./runner.js";
25
+ import { collectProperties, } from "./registry.js";
26
+ import * as schemaConformance from "./schema-conformance.js";
27
+ import * as rpcSemantics from "./rpc-semantics.js";
28
+ import * as delivery from "./delivery.js";
29
+ import * as adversity from "./adversity.js";
30
+ import * as boundary from "./boundary.js";
31
+ import { isAllowedCoverageGap, } from "./coverage-policy.js";
32
+ import { conformanceArtifactDirFromEnv } from "./env.js";
33
+ /**
34
+ * Register every property against `ctx`. Consumers that want a narrower
35
+ * run build a `ConformanceRunContext` directly and call only the modules
36
+ * they need; `runConformanceSuite` uses this helper to register the full
37
+ * set.
38
+ */
39
+ export function registerAllProperties(ctx, webhookProbe) {
40
+ schemaConformance.registerRequestWellFormedness(ctx);
41
+ schemaConformance.registerEventWellFormedness(ctx);
42
+ schemaConformance.registerRoundTripIdentity(ctx);
43
+ schemaConformance.registerMalformedFrameHandling(ctx);
44
+ schemaConformance.registerRpcMapCoverage(ctx);
45
+ rpcSemantics.registerModelEquivalence(ctx);
46
+ rpcSemantics.registerAuthorityPositive(ctx);
47
+ rpcSemantics.registerAuthorityNegative(ctx);
48
+ rpcSemantics.registerRequestIdUniqueness(ctx);
49
+ rpcSemantics.registerIdempotence(ctx);
50
+ delivery.registerFanOutCardinality(ctx);
51
+ delivery.registerStoreAndReplay(ctx);
52
+ delivery.registerPayloadOpacity(ctx);
53
+ delivery.registerTaskBoundaryIsolation(ctx);
54
+ adversity.registerLatencyResilience(ctx);
55
+ adversity.registerBackpressure(ctx); // tombstoned — #186
56
+ adversity.registerSlicerFraming(ctx);
57
+ adversity.registerResetPeerRecovery(ctx);
58
+ adversity.registerTimeoutSurface(ctx);
59
+ adversity.registerSlowCloseCleanup(ctx);
60
+ boundary.registerSchemaExhaustiveFuzz(ctx);
61
+ if (webhookProbe !== null) {
62
+ boundary.registerWebhookGracefulShutdown(ctx, webhookProbe);
63
+ }
64
+ }
65
+ /**
66
+ * Run every registered property and collect a typed `SuiteResult`. Does
67
+ * not throw: failures land in `result.failed`; a vitest boundary asserts
68
+ * `result.failed.length === 0`.
69
+ */
70
+ export function runAllProperties(ctx, artifactDir, allowedCoverageGaps = []) {
71
+ return Effect.gen(function* () {
72
+ if (!existsSync(artifactDir))
73
+ mkdirSync(artifactDir, { recursive: true });
74
+ const properties = collectProperties(ctx);
75
+ const passed = [];
76
+ const deferred = [];
77
+ const unavailable = [];
78
+ const failed = [];
79
+ for (const p of properties) {
80
+ const id = `${p.category}/${p.name}`;
81
+ const exit = yield* Effect.exit(p.run);
82
+ if (Exit.isSuccess(exit)) {
83
+ passed.push(id);
84
+ continue;
85
+ }
86
+ const failure = firstTypedFailure(exit);
87
+ if (failure === null) {
88
+ const msg = exit.cause.toString();
89
+ failed.push({ name: id, failure: { _tag: "defect", message: msg } });
90
+ writeArtifact(artifactDir, p, ctx.seed, { defect: msg });
91
+ continue;
92
+ }
93
+ switch (failure._tag) {
94
+ case "ConformancePropertyDeferred":
95
+ if (isAllowedCoverageGap(allowedCoverageGaps, "deferred", id, failure.followUp)) {
96
+ deferred.push({ name: id, reason: failure.followUp });
97
+ break;
98
+ }
99
+ failed.push({ name: id, failure });
100
+ writeArtifact(artifactDir, p, ctx.seed, failureArtifact(failure));
101
+ break;
102
+ case "ConformancePropertyUnavailable":
103
+ if (isAllowedCoverageGap(allowedCoverageGaps, "unavailable", id, failure.reason)) {
104
+ unavailable.push({ name: id, reason: failure.reason });
105
+ break;
106
+ }
107
+ failed.push({ name: id, failure });
108
+ writeArtifact(artifactDir, p, ctx.seed, failureArtifact(failure));
109
+ break;
110
+ case "ConformancePropertyAssertionFailure":
111
+ case "ConformancePropertyInvariantViolation":
112
+ failed.push({ name: id, failure });
113
+ writeArtifact(artifactDir, p, ctx.seed, failureArtifact(failure));
114
+ break;
115
+ default: {
116
+ const _exhaustive = failure;
117
+ failed.push({
118
+ name: id,
119
+ failure: {
120
+ _tag: "defect",
121
+ message: `unhandled failure tag: ${String(_exhaustive)}`,
122
+ },
123
+ });
124
+ }
125
+ }
126
+ }
127
+ return { seed: ctx.seed, passed, deferred, unavailable, failed };
128
+ });
129
+ }
130
+ /**
131
+ * End-to-end library entry: acquire context, register all properties,
132
+ * run them, close scope. The returned `SuiteResult` is the single thing
133
+ * a consumer asserts on.
134
+ *
135
+ * The ambient `Scope` is internal — the outer scope closes when the
136
+ * Effect completes. Consumers don't need to pass a Scope.
137
+ */
138
+ export function runConformanceSuite(opts) {
139
+ const toxiproxyUrl = opts.toxiproxyUrl ?? null;
140
+ const artifactDir = opts.artifactDir ??
141
+ conformanceArtifactDirFromEnv() ??
142
+ path.resolve(process.cwd(), "conformance-artifacts");
143
+ const categories = toxiproxyUrl === null ? ["A", "B", "C", "E"] : ["A", "B", "C", "D", "E"];
144
+ return Effect.scoped(Effect.gen(function* () {
145
+ const ctx = yield* acquireRunContext({
146
+ tiers: categories,
147
+ realServer: opts.realServer,
148
+ toxiproxyUrl: toxiproxyUrl ?? undefined,
149
+ manageToxiproxy: false, // consumer brings up Toxiproxy
150
+ replaySeed: opts.replaySeed,
151
+ numRuns: opts.numRuns,
152
+ artifactDir,
153
+ });
154
+ registerAllProperties(ctx, opts.webhookProbe ?? null);
155
+ return yield* runAllProperties(ctx, artifactDir, allowedServerCoverageGaps(toxiproxyUrl));
156
+ }));
157
+ }
158
+ function allowedServerCoverageGaps(toxiproxyUrl) {
159
+ const gaps = [
160
+ {
161
+ kind: "deferred",
162
+ id: "adversity/backpressure",
163
+ reasonIncludes: "issues/186",
164
+ },
165
+ {
166
+ kind: "unavailable",
167
+ id: "adversity/reset-peer-recovery",
168
+ reasonIncludes: "reset_peer toxic did not close",
169
+ },
170
+ ];
171
+ if (toxiproxyUrl === null) {
172
+ gaps.push({
173
+ kind: "unavailable",
174
+ id: "adversity/latency-resilience",
175
+ reasonIncludes: "Toxiproxy client not provisioned",
176
+ }, {
177
+ kind: "unavailable",
178
+ id: "adversity/slicer-framing",
179
+ reasonIncludes: "Toxiproxy client not provisioned",
180
+ }, {
181
+ kind: "unavailable",
182
+ id: "adversity/reset-peer-recovery",
183
+ reasonIncludes: "Toxiproxy client not provisioned",
184
+ }, {
185
+ kind: "unavailable",
186
+ id: "adversity/timeout-surface",
187
+ reasonIncludes: "Toxiproxy client not provisioned",
188
+ }, {
189
+ kind: "unavailable",
190
+ id: "adversity/slow-close-cleanup",
191
+ reasonIncludes: "Toxiproxy client not provisioned",
192
+ });
193
+ }
194
+ return gaps;
195
+ }
196
+ /**
197
+ * Extract the first typed `PropertyFailure` from an Exit. Uses Effect's
198
+ * `Cause.failures` so typed failures stay typed without bypassing the
199
+ * type system; defects land as `null` and the caller reports them
200
+ * under `_tag: "defect"`.
201
+ */
202
+ function firstTypedFailure(exit) {
203
+ if (Exit.isSuccess(exit))
204
+ return null;
205
+ const failures = Cause.failures(exit.cause);
206
+ const head = Chunk.head(failures);
207
+ return Option.getOrNull(head);
208
+ }
209
+ function failureArtifact(failure) {
210
+ switch (failure._tag) {
211
+ case "ConformancePropertyAssertionFailure":
212
+ return { tag: failure._tag, cause: String(failure.cause) };
213
+ case "ConformancePropertyInvariantViolation":
214
+ case "ConformancePropertyUnavailable":
215
+ return { tag: failure._tag, reason: failure.reason };
216
+ case "ConformancePropertyDeferred":
217
+ return { tag: failure._tag, followUp: failure.followUp };
218
+ default: {
219
+ const _exhaustive = failure;
220
+ return { tag: "unknown", value: String(_exhaustive) };
221
+ }
222
+ }
223
+ }
224
+ function writeArtifact(dir, property, seed, payload) {
225
+ const file = path.join(dir, `${property.category}-${property.name}.seed.json`);
226
+ writeFileSync(file, JSON.stringify({
227
+ category: property.category,
228
+ name: property.name,
229
+ seed,
230
+ ...payload,
231
+ }, null, 2));
232
+ }
233
+ //# sourceMappingURL=suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.js","sourceRoot":"","sources":["../../../src/testing/conformance/suite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,iBAAiB,GAIlB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,GAGlB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,QAA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