lawspec 0.30.0 → 0.31.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 (443) hide show
  1. package/CHANGELOG.md +405 -1
  2. package/README.md +19 -7
  3. package/api.mjs +1 -0
  4. package/beam-doctor.mjs +2 -2
  5. package/bin/lawspec.mjs +104 -96
  6. package/build.json +498 -406
  7. package/component-packages.mjs +339 -0
  8. package/component.d.ts +46 -0
  9. package/component.mjs +208 -0
  10. package/core.wasm +2 -2
  11. package/core_jsffi.js +5 -5
  12. package/examples/native-payments/clojure/lawspec.edn +48 -0
  13. package/examples/native-payments/clojure/src/domain/payments.clj +1 -1
  14. package/examples/native-payments/clojure/test/domain/payment_generators.clj +1 -1
  15. package/examples/native-payments/csharp/lawspec.edn +48 -0
  16. package/examples/native-payments/elixir/lawspec.edn +123 -0
  17. package/examples/native-payments/erlang/lawspec.edn +128 -0
  18. package/examples/native-payments/fsharp/lawspec.edn +123 -0
  19. package/examples/native-payments/gleam/lawspec.edn +123 -0
  20. package/examples/native-payments/go/lawspec.edn +123 -0
  21. package/examples/native-payments/groovy/lawspec.edn +123 -0
  22. package/examples/native-payments/haskell/lawspec.edn +123 -0
  23. package/examples/native-payments/java/lawspec.edn +123 -0
  24. package/examples/native-payments/javascript/lawspec.edn +123 -0
  25. package/examples/native-payments/kotlin/lawspec.edn +123 -0
  26. package/examples/native-payments/prolog/lawspec.edn +48 -0
  27. package/examples/native-payments/python/lawspec.edn +123 -0
  28. package/examples/native-payments/rust/lawspec.edn +124 -0
  29. package/examples/native-payments/scala/lawspec.edn +123 -0
  30. package/examples/native-payments/swift/lawspec.edn +123 -0
  31. package/examples/native-payments/typescript/lawspec.edn +123 -0
  32. package/examples/packages/orders/lawspec.edn +25 -0
  33. package/examples/packages/shop-domain/lawspec.edn +13 -0
  34. package/examples/packages/shop-tax-1/lawspec.edn +9 -0
  35. package/examples/packages/shop-tax-2/lawspec.edn +9 -0
  36. package/examples/specs/handler_bindings.lawspec +2 -2
  37. package/files.mjs +2 -1
  38. package/go.mod +4 -0
  39. package/index.d.ts +135 -2
  40. package/input-files.mjs +47 -0
  41. package/launcher.mjs +33 -13
  42. package/learn/adapters.mjs +226 -0
  43. package/learn/app.mjs +1279 -0
  44. package/learn/assert.mjs +33 -0
  45. package/learn/assets.mjs +15 -0
  46. package/learn/browser-runtime.mjs +58 -0
  47. package/learn/bundle.mjs +118 -0
  48. package/learn/compile-worker.mjs +106 -0
  49. package/learn/compiler.mjs +230 -0
  50. package/learn/coverage.json +8187 -0
  51. package/learn/curriculum.json +2952 -0
  52. package/learn/fantomas-worker.mjs +25 -0
  53. package/learn/format-worker.mjs +148 -0
  54. package/learn/fsharp.mjs +83 -0
  55. package/learn/harness-host.mjs +22 -0
  56. package/learn/index.html +326 -0
  57. package/learn/lawspec-core.mjs +223 -0
  58. package/learn/lawspec-language.mjs +69 -0
  59. package/learn/node-test.mjs +11 -0
  60. package/learn/presentation.mjs +73 -0
  61. package/learn/runner.mjs +72 -0
  62. package/learn/sandbox-frame.html +34 -0
  63. package/learn/sandbox.mjs +91 -0
  64. package/learn/store.mjs +141 -0
  65. package/learn/story.mjs +42 -0
  66. package/learn/style-options.json +16 -0
  67. package/learn/style.css +1023 -0
  68. package/learn/theme.js +77 -0
  69. package/learn/typescript.mjs +53 -0
  70. package/learn/vendor/@fontsource-atkinson-hyperlegible-LICENSE.txt +93 -0
  71. package/learn/vendor/@fontsource-atkinson-hyperlegible-mono-LICENSE.txt +93 -0
  72. package/learn/vendor/@fontsource-overpass-LICENSE.txt +93 -0
  73. package/learn/vendor/assemblies.json +1 -0
  74. package/learn/vendor/editor-worker.js +30 -0
  75. package/learn/vendor/editor.css +1 -0
  76. package/learn/vendor/editor.mjs +931 -0
  77. package/learn/vendor/esbuild-wasm-LICENSE.txt +21 -0
  78. package/learn/vendor/esbuild.mjs +2683 -0
  79. package/learn/vendor/esbuild.wasm +0 -0
  80. package/learn/vendor/fable-library/Array.js +1347 -0
  81. package/learn/vendor/fable-library/Async.js +134 -0
  82. package/learn/vendor/fable-library/AsyncBuilder.js +183 -0
  83. package/learn/vendor/fable-library/BigInt.js +306 -0
  84. package/learn/vendor/fable-library/BitConverter.js +138 -0
  85. package/learn/vendor/fable-library/Boolean.js +22 -0
  86. package/learn/vendor/fable-library/CHANGELOG.md +242 -0
  87. package/learn/vendor/fable-library/Char.js +202 -0
  88. package/learn/vendor/fable-library/Choice.js +184 -0
  89. package/learn/vendor/fable-library/CollectionUtil.js +182 -0
  90. package/learn/vendor/fable-library/ConditionalWeakTable.js +21 -0
  91. package/learn/vendor/fable-library/Date.js +841 -0
  92. package/learn/vendor/fable-library/DateOffset.js +261 -0
  93. package/learn/vendor/fable-library/DateOnly.js +124 -0
  94. package/learn/vendor/fable-library/Decimal.js +238 -0
  95. package/learn/vendor/fable-library/Double.js +47 -0
  96. package/learn/vendor/fable-library/Encoding.js +185 -0
  97. package/learn/vendor/fable-library/Event.js +93 -0
  98. package/learn/vendor/fable-library/FSharp.Collections.js +45 -0
  99. package/learn/vendor/fable-library/FSharp.Core.CompilerServices.js +27 -0
  100. package/learn/vendor/fable-library/FSharp.Core.js +156 -0
  101. package/learn/vendor/fable-library/Global.js +29 -0
  102. package/learn/vendor/fable-library/Guid.js +161 -0
  103. package/learn/vendor/fable-library/Int32.js +135 -0
  104. package/learn/vendor/fable-library/List.js +1323 -0
  105. package/learn/vendor/fable-library/Long.js +47 -0
  106. package/learn/vendor/fable-library/MailboxProcessor.js +94 -0
  107. package/learn/vendor/fable-library/Map.js +1396 -0
  108. package/learn/vendor/fable-library/MapUtil.js +130 -0
  109. package/learn/vendor/fable-library/MutableMap.js +339 -0
  110. package/learn/vendor/fable-library/MutableSet.js +233 -0
  111. package/learn/vendor/fable-library/Native.js +14 -0
  112. package/learn/vendor/fable-library/Numeric.js +75 -0
  113. package/learn/vendor/fable-library/Observable.js +113 -0
  114. package/learn/vendor/fable-library/Option.js +104 -0
  115. package/learn/vendor/fable-library/README.md +3 -0
  116. package/learn/vendor/fable-library/Random.js +172 -0
  117. package/learn/vendor/fable-library/Range.js +45 -0
  118. package/learn/vendor/fable-library/Reflection.js +479 -0
  119. package/learn/vendor/fable-library/RegExp.js +141 -0
  120. package/learn/vendor/fable-library/Result.js +165 -0
  121. package/learn/vendor/fable-library/Seq.js +1417 -0
  122. package/learn/vendor/fable-library/Seq2.js +111 -0
  123. package/learn/vendor/fable-library/Set.js +1816 -0
  124. package/learn/vendor/fable-library/String.js +674 -0
  125. package/learn/vendor/fable-library/System.Collections.Generic.js +333 -0
  126. package/learn/vendor/fable-library/System.Text.js +200 -0
  127. package/learn/vendor/fable-library/System.js +289 -0
  128. package/learn/vendor/fable-library/TimeOnly.js +122 -0
  129. package/learn/vendor/fable-library/TimeSpan.js +180 -0
  130. package/learn/vendor/fable-library/Timer.js +67 -0
  131. package/learn/vendor/fable-library/Types.js +198 -0
  132. package/learn/vendor/fable-library/Unicode.13.0.0.js +4 -0
  133. package/learn/vendor/fable-library/Uri.js +165 -0
  134. package/learn/vendor/fable-library/Util.js +796 -0
  135. package/learn/vendor/fable-library/big.d.ts +338 -0
  136. package/learn/vendor/fable-library/lib/big.js +825 -0
  137. package/learn/vendor/fable-library/package.json +24 -0
  138. package/learn/vendor/fable-library/quotation.js +618 -0
  139. package/learn/vendor/fable.js +430 -0
  140. package/learn/vendor/fantomas/FSharp.Core.uawo19tl4c.wasm +0 -0
  141. package/learn/vendor/fantomas/Fantomas.Core.stnanlnpyw.wasm +0 -0
  142. package/learn/vendor/fantomas/Fantomas.FCS.lqohfu5o9y.wasm +0 -0
  143. package/learn/vendor/fantomas/LawSpec.Learn.Formatter.5arcua4vy0.wasm +0 -0
  144. package/learn/vendor/fantomas/LawSpec.Learn.Formatter.u1ne3a6xd2.wasm +0 -0
  145. package/learn/vendor/fantomas/Microsoft.CSharp.mp8lhr6rez.wasm +0 -0
  146. package/learn/vendor/fantomas/Microsoft.VisualBasic.0e5fchkecn.wasm +0 -0
  147. package/learn/vendor/fantomas/Microsoft.VisualBasic.Core.17wn27qal2.wasm +0 -0
  148. package/learn/vendor/fantomas/Microsoft.Win32.Primitives.9d566sle9e.wasm +0 -0
  149. package/learn/vendor/fantomas/Microsoft.Win32.Registry.52dy96yk8i.wasm +0 -0
  150. package/learn/vendor/fantomas/System.AppContext.jwujeh069z.wasm +0 -0
  151. package/learn/vendor/fantomas/System.Buffers.y0isk1x97h.wasm +0 -0
  152. package/learn/vendor/fantomas/System.Collections.Concurrent.x5koi7bzem.wasm +0 -0
  153. package/learn/vendor/fantomas/System.Collections.Immutable.diwg7advch.wasm +0 -0
  154. package/learn/vendor/fantomas/System.Collections.NonGeneric.4089xs440e.wasm +0 -0
  155. package/learn/vendor/fantomas/System.Collections.Specialized.hj81u7zblb.wasm +0 -0
  156. package/learn/vendor/fantomas/System.Collections.nvrdeoknr1.wasm +0 -0
  157. package/learn/vendor/fantomas/System.ComponentModel.Annotations.yatcnfjeuk.wasm +0 -0
  158. package/learn/vendor/fantomas/System.ComponentModel.DataAnnotations.led9l5awu3.wasm +0 -0
  159. package/learn/vendor/fantomas/System.ComponentModel.EventBasedAsync.hpvp6cf4de.wasm +0 -0
  160. package/learn/vendor/fantomas/System.ComponentModel.Primitives.v7cajwpaqo.wasm +0 -0
  161. package/learn/vendor/fantomas/System.ComponentModel.TypeConverter.xk1hnyt762.wasm +0 -0
  162. package/learn/vendor/fantomas/System.ComponentModel.rrnda1lucx.wasm +0 -0
  163. package/learn/vendor/fantomas/System.Configuration.bn9vghjcq8.wasm +0 -0
  164. package/learn/vendor/fantomas/System.Console.09ajpiafhz.wasm +0 -0
  165. package/learn/vendor/fantomas/System.Core.wc649o5mw9.wasm +0 -0
  166. package/learn/vendor/fantomas/System.Data.Common.s4cowzd9a9.wasm +0 -0
  167. package/learn/vendor/fantomas/System.Data.DataSetExtensions.5fm360ikxl.wasm +0 -0
  168. package/learn/vendor/fantomas/System.Data.fsu4j4t4jw.wasm +0 -0
  169. package/learn/vendor/fantomas/System.Diagnostics.Contracts.p74re5oxzn.wasm +0 -0
  170. package/learn/vendor/fantomas/System.Diagnostics.Debug.622sixg49n.wasm +0 -0
  171. package/learn/vendor/fantomas/System.Diagnostics.DiagnosticSource.2j35bc2g2b.wasm +0 -0
  172. package/learn/vendor/fantomas/System.Diagnostics.FileVersionInfo.7n0wdvltaa.wasm +0 -0
  173. package/learn/vendor/fantomas/System.Diagnostics.Process.8iffh49mew.wasm +0 -0
  174. package/learn/vendor/fantomas/System.Diagnostics.StackTrace.1yz88vico8.wasm +0 -0
  175. package/learn/vendor/fantomas/System.Diagnostics.TextWriterTraceListener.ua8iuh2vhj.wasm +0 -0
  176. package/learn/vendor/fantomas/System.Diagnostics.Tools.roy5445ugj.wasm +0 -0
  177. package/learn/vendor/fantomas/System.Diagnostics.TraceSource.6qx1ldzz7g.wasm +0 -0
  178. package/learn/vendor/fantomas/System.Diagnostics.Tracing.b4799zpaas.wasm +0 -0
  179. package/learn/vendor/fantomas/System.Drawing.8gcjjqj0pu.wasm +0 -0
  180. package/learn/vendor/fantomas/System.Drawing.Primitives.y2uveru2yk.wasm +0 -0
  181. package/learn/vendor/fantomas/System.Dynamic.Runtime.023zrvzh9x.wasm +0 -0
  182. package/learn/vendor/fantomas/System.Formats.Asn1.znpklkbgqv.wasm +0 -0
  183. package/learn/vendor/fantomas/System.Formats.Tar.5yybjepfi2.wasm +0 -0
  184. package/learn/vendor/fantomas/System.Globalization.Calendars.10g6hyjy3k.wasm +0 -0
  185. package/learn/vendor/fantomas/System.Globalization.Extensions.hrinfrismg.wasm +0 -0
  186. package/learn/vendor/fantomas/System.Globalization.uvs4rah8fk.wasm +0 -0
  187. package/learn/vendor/fantomas/System.IO.4j645gw40d.wasm +0 -0
  188. package/learn/vendor/fantomas/System.IO.Compression.2z7vdt6tfb.wasm +0 -0
  189. package/learn/vendor/fantomas/System.IO.Compression.Brotli.fv80xs79j3.wasm +0 -0
  190. package/learn/vendor/fantomas/System.IO.Compression.FileSystem.88jdddz3sw.wasm +0 -0
  191. package/learn/vendor/fantomas/System.IO.Compression.ZipFile.jkn9avr4vo.wasm +0 -0
  192. package/learn/vendor/fantomas/System.IO.FileSystem.AccessControl.yme0uhbu37.wasm +0 -0
  193. package/learn/vendor/fantomas/System.IO.FileSystem.DriveInfo.qas7wf73rs.wasm +0 -0
  194. package/learn/vendor/fantomas/System.IO.FileSystem.Primitives.d1jmhkzu0e.wasm +0 -0
  195. package/learn/vendor/fantomas/System.IO.FileSystem.Watcher.z570derp0d.wasm +0 -0
  196. package/learn/vendor/fantomas/System.IO.FileSystem.o6jtz51fup.wasm +0 -0
  197. package/learn/vendor/fantomas/System.IO.IsolatedStorage.hqyeyb5ipe.wasm +0 -0
  198. package/learn/vendor/fantomas/System.IO.MemoryMappedFiles.zhamjnusxd.wasm +0 -0
  199. package/learn/vendor/fantomas/System.IO.Pipelines.wrmw5vws31.wasm +0 -0
  200. package/learn/vendor/fantomas/System.IO.Pipes.AccessControl.qcancj8gj2.wasm +0 -0
  201. package/learn/vendor/fantomas/System.IO.Pipes.zhcyguvwkr.wasm +0 -0
  202. package/learn/vendor/fantomas/System.IO.UnmanagedMemoryStream.o8cpjnlard.wasm +0 -0
  203. package/learn/vendor/fantomas/System.Linq.AsyncEnumerable.hyc0b7okjw.wasm +0 -0
  204. package/learn/vendor/fantomas/System.Linq.Expressions.ldibvm0efj.wasm +0 -0
  205. package/learn/vendor/fantomas/System.Linq.Parallel.2buevezvch.wasm +0 -0
  206. package/learn/vendor/fantomas/System.Linq.Queryable.cvq43g1awj.wasm +0 -0
  207. package/learn/vendor/fantomas/System.Linq.lz6mvi0hm2.wasm +0 -0
  208. package/learn/vendor/fantomas/System.Memory.3jekerw0ga.wasm +0 -0
  209. package/learn/vendor/fantomas/System.Net.Http.Json.8k237kkwec.wasm +0 -0
  210. package/learn/vendor/fantomas/System.Net.Http.cityx2bvcl.wasm +0 -0
  211. package/learn/vendor/fantomas/System.Net.HttpListener.s1jreclykx.wasm +0 -0
  212. package/learn/vendor/fantomas/System.Net.Mail.cmlj4c0gto.wasm +0 -0
  213. package/learn/vendor/fantomas/System.Net.NameResolution.q3gf18q13l.wasm +0 -0
  214. package/learn/vendor/fantomas/System.Net.NetworkInformation.xaz5tjw7d0.wasm +0 -0
  215. package/learn/vendor/fantomas/System.Net.Ping.a40atim1h0.wasm +0 -0
  216. package/learn/vendor/fantomas/System.Net.Primitives.i88i20r8sr.wasm +0 -0
  217. package/learn/vendor/fantomas/System.Net.Quic.hx06eo5xkj.wasm +0 -0
  218. package/learn/vendor/fantomas/System.Net.Requests.hkjxlfe5f5.wasm +0 -0
  219. package/learn/vendor/fantomas/System.Net.Security.ch34yya69o.wasm +0 -0
  220. package/learn/vendor/fantomas/System.Net.ServerSentEvents.0u7o0jk3p1.wasm +0 -0
  221. package/learn/vendor/fantomas/System.Net.ServicePoint.xbhxnytx4l.wasm +0 -0
  222. package/learn/vendor/fantomas/System.Net.Sockets.hzgzlvkc9l.wasm +0 -0
  223. package/learn/vendor/fantomas/System.Net.WebClient.84i8nwzbgu.wasm +0 -0
  224. package/learn/vendor/fantomas/System.Net.WebHeaderCollection.326nl7s9g3.wasm +0 -0
  225. package/learn/vendor/fantomas/System.Net.WebProxy.oq3mgkkqef.wasm +0 -0
  226. package/learn/vendor/fantomas/System.Net.WebSockets.2cx1v74vg8.wasm +0 -0
  227. package/learn/vendor/fantomas/System.Net.WebSockets.Client.rafzkktw8j.wasm +0 -0
  228. package/learn/vendor/fantomas/System.Net.w1hpj3bo6r.wasm +0 -0
  229. package/learn/vendor/fantomas/System.Numerics.Vectors.oyv7biw9ux.wasm +0 -0
  230. package/learn/vendor/fantomas/System.Numerics.lyu36wqn19.wasm +0 -0
  231. package/learn/vendor/fantomas/System.ObjectModel.kxu80demuu.wasm +0 -0
  232. package/learn/vendor/fantomas/System.Private.CoreLib.1vy46s12u6.wasm +0 -0
  233. package/learn/vendor/fantomas/System.Private.DataContractSerialization.ao8k9iu77a.wasm +0 -0
  234. package/learn/vendor/fantomas/System.Private.Uri.itn0n2zjd0.wasm +0 -0
  235. package/learn/vendor/fantomas/System.Private.Xml.19nzpxrx8w.wasm +0 -0
  236. package/learn/vendor/fantomas/System.Private.Xml.Linq.tw5eq1hjvo.wasm +0 -0
  237. package/learn/vendor/fantomas/System.Reflection.DispatchProxy.7lajnj8s8c.wasm +0 -0
  238. package/learn/vendor/fantomas/System.Reflection.Emit.7liz9zln06.wasm +0 -0
  239. package/learn/vendor/fantomas/System.Reflection.Emit.ILGeneration.1ut3qgacw8.wasm +0 -0
  240. package/learn/vendor/fantomas/System.Reflection.Emit.Lightweight.d0gvllb1jj.wasm +0 -0
  241. package/learn/vendor/fantomas/System.Reflection.Extensions.zr5bhwfczd.wasm +0 -0
  242. package/learn/vendor/fantomas/System.Reflection.Metadata.ff6np6mz2j.wasm +0 -0
  243. package/learn/vendor/fantomas/System.Reflection.Primitives.igpmvwv78c.wasm +0 -0
  244. package/learn/vendor/fantomas/System.Reflection.TypeExtensions.qouojzlnp9.wasm +0 -0
  245. package/learn/vendor/fantomas/System.Reflection.mk3jyxvh13.wasm +0 -0
  246. package/learn/vendor/fantomas/System.Resources.Reader.41ppfyz2vc.wasm +0 -0
  247. package/learn/vendor/fantomas/System.Resources.ResourceManager.sfwvfmw1ea.wasm +0 -0
  248. package/learn/vendor/fantomas/System.Resources.Writer.3uvs9tp38z.wasm +0 -0
  249. package/learn/vendor/fantomas/System.Runtime.CompilerServices.Unsafe.puz1xm53oc.wasm +0 -0
  250. package/learn/vendor/fantomas/System.Runtime.CompilerServices.VisualC.9qdau315py.wasm +0 -0
  251. package/learn/vendor/fantomas/System.Runtime.Extensions.i7gntui96b.wasm +0 -0
  252. package/learn/vendor/fantomas/System.Runtime.Handles.00oxj4o6ov.wasm +0 -0
  253. package/learn/vendor/fantomas/System.Runtime.InteropServices.JavaScript.9kq1vofond.wasm +0 -0
  254. package/learn/vendor/fantomas/System.Runtime.InteropServices.RuntimeInformation.my7qeqbhfh.wasm +0 -0
  255. package/learn/vendor/fantomas/System.Runtime.InteropServices.vqp80tnwc7.wasm +0 -0
  256. package/learn/vendor/fantomas/System.Runtime.Intrinsics.u0samjybfo.wasm +0 -0
  257. package/learn/vendor/fantomas/System.Runtime.Loader.n6zxw1b98a.wasm +0 -0
  258. package/learn/vendor/fantomas/System.Runtime.Numerics.o40sjhz59x.wasm +0 -0
  259. package/learn/vendor/fantomas/System.Runtime.Serialization.Formatters.1esvva4te3.wasm +0 -0
  260. package/learn/vendor/fantomas/System.Runtime.Serialization.Json.4n7u09advh.wasm +0 -0
  261. package/learn/vendor/fantomas/System.Runtime.Serialization.Primitives.xs2bo91wvk.wasm +0 -0
  262. package/learn/vendor/fantomas/System.Runtime.Serialization.Xml.ny21jmziti.wasm +0 -0
  263. package/learn/vendor/fantomas/System.Runtime.Serialization.qcxaur5wqs.wasm +0 -0
  264. package/learn/vendor/fantomas/System.Runtime.odq454d6j9.wasm +0 -0
  265. package/learn/vendor/fantomas/System.Security.AccessControl.8yfnzmqzaq.wasm +0 -0
  266. package/learn/vendor/fantomas/System.Security.Claims.8ogy0860de.wasm +0 -0
  267. package/learn/vendor/fantomas/System.Security.Cryptography.Algorithms.8zijp1svfw.wasm +0 -0
  268. package/learn/vendor/fantomas/System.Security.Cryptography.Cng.yxagtt77no.wasm +0 -0
  269. package/learn/vendor/fantomas/System.Security.Cryptography.Csp.uhfbvvau84.wasm +0 -0
  270. package/learn/vendor/fantomas/System.Security.Cryptography.Encoding.2ywrusvy8q.wasm +0 -0
  271. package/learn/vendor/fantomas/System.Security.Cryptography.OpenSsl.oa268u7i92.wasm +0 -0
  272. package/learn/vendor/fantomas/System.Security.Cryptography.Primitives.5uhvqe8puk.wasm +0 -0
  273. package/learn/vendor/fantomas/System.Security.Cryptography.X509Certificates.6i7pxilopt.wasm +0 -0
  274. package/learn/vendor/fantomas/System.Security.Cryptography.d0quqk1iyr.wasm +0 -0
  275. package/learn/vendor/fantomas/System.Security.Principal.Windows.gpqua4rz29.wasm +0 -0
  276. package/learn/vendor/fantomas/System.Security.Principal.i20kfklf3g.wasm +0 -0
  277. package/learn/vendor/fantomas/System.Security.SecureString.x2y8tzci3c.wasm +0 -0
  278. package/learn/vendor/fantomas/System.Security.e83vvh6sl2.wasm +0 -0
  279. package/learn/vendor/fantomas/System.ServiceModel.Web.poglliv2no.wasm +0 -0
  280. package/learn/vendor/fantomas/System.ServiceProcess.yro5uj2opo.wasm +0 -0
  281. package/learn/vendor/fantomas/System.Text.Encoding.CodePages.2wchx40i7z.wasm +0 -0
  282. package/learn/vendor/fantomas/System.Text.Encoding.Extensions.8utaw61kn5.wasm +0 -0
  283. package/learn/vendor/fantomas/System.Text.Encoding.cxdyfepnpj.wasm +0 -0
  284. package/learn/vendor/fantomas/System.Text.Encodings.Web.37ehbi7cye.wasm +0 -0
  285. package/learn/vendor/fantomas/System.Text.Json.ixiaa8hd3h.wasm +0 -0
  286. package/learn/vendor/fantomas/System.Text.RegularExpressions.2fhfmkk6vf.wasm +0 -0
  287. package/learn/vendor/fantomas/System.Threading.6pry74a050.wasm +0 -0
  288. package/learn/vendor/fantomas/System.Threading.AccessControl.76zfdfy8go.wasm +0 -0
  289. package/learn/vendor/fantomas/System.Threading.Channels.gpxnr01lmp.wasm +0 -0
  290. package/learn/vendor/fantomas/System.Threading.Overlapped.aqpl8tzdyc.wasm +0 -0
  291. package/learn/vendor/fantomas/System.Threading.Tasks.Dataflow.ytwttt7fzh.wasm +0 -0
  292. package/learn/vendor/fantomas/System.Threading.Tasks.Extensions.0deavcb00v.wasm +0 -0
  293. package/learn/vendor/fantomas/System.Threading.Tasks.Parallel.tjwtxugso0.wasm +0 -0
  294. package/learn/vendor/fantomas/System.Threading.Tasks.fu4qd5h3qy.wasm +0 -0
  295. package/learn/vendor/fantomas/System.Threading.Thread.klaua2by9m.wasm +0 -0
  296. package/learn/vendor/fantomas/System.Threading.ThreadPool.mkzm212njz.wasm +0 -0
  297. package/learn/vendor/fantomas/System.Threading.Timer.yp49llu5h2.wasm +0 -0
  298. package/learn/vendor/fantomas/System.Transactions.Local.vz6cgeh4w7.wasm +0 -0
  299. package/learn/vendor/fantomas/System.Transactions.ipwm3rsy66.wasm +0 -0
  300. package/learn/vendor/fantomas/System.ValueTuple.7ol6ljuhx8.wasm +0 -0
  301. package/learn/vendor/fantomas/System.Web.HttpUtility.itlvncjd96.wasm +0 -0
  302. package/learn/vendor/fantomas/System.Web.np8uzzakvl.wasm +0 -0
  303. package/learn/vendor/fantomas/System.Windows.18nzio44t3.wasm +0 -0
  304. package/learn/vendor/fantomas/System.Xml.45jprtg1pa.wasm +0 -0
  305. package/learn/vendor/fantomas/System.Xml.Linq.v9v8udncm1.wasm +0 -0
  306. package/learn/vendor/fantomas/System.Xml.ReaderWriter.a9mr08uzci.wasm +0 -0
  307. package/learn/vendor/fantomas/System.Xml.Serialization.03juoguwgc.wasm +0 -0
  308. package/learn/vendor/fantomas/System.Xml.XDocument.c9dhjnzqjb.wasm +0 -0
  309. package/learn/vendor/fantomas/System.Xml.XPath.XDocument.138b12i1pm.wasm +0 -0
  310. package/learn/vendor/fantomas/System.Xml.XPath.pvxm9341ce.wasm +0 -0
  311. package/learn/vendor/fantomas/System.Xml.XmlDocument.450wsyxvl0.wasm +0 -0
  312. package/learn/vendor/fantomas/System.Xml.XmlSerializer.y3t2n0tce7.wasm +0 -0
  313. package/learn/vendor/fantomas/System.gjriafnqmz.wasm +0 -0
  314. package/learn/vendor/fantomas/WindowsBase.8zsce9qxfb.wasm +0 -0
  315. package/learn/vendor/fantomas/cs/FSharp.Core.resources.9ehmavdel7.wasm +0 -0
  316. package/learn/vendor/fantomas/de/FSharp.Core.resources.2ofmxloa01.wasm +0 -0
  317. package/learn/vendor/fantomas/dotnet.js +1233 -0
  318. package/learn/vendor/fantomas/dotnet.native.b6l13xorvf.js +16 -0
  319. package/learn/vendor/fantomas/dotnet.native.rw4kynp763.wasm +0 -0
  320. package/learn/vendor/fantomas/dotnet.runtime.v06hirbjsv.js +4 -0
  321. package/learn/vendor/fantomas/es/FSharp.Core.resources.hkr5ggb4tr.wasm +0 -0
  322. package/learn/vendor/fantomas/fr/FSharp.Core.resources.43soen28ow.wasm +0 -0
  323. package/learn/vendor/fantomas/icudt_CJK.tjcz0u77k5.dat +0 -0
  324. package/learn/vendor/fantomas/icudt_EFIGS.tptq2av103.dat +0 -0
  325. package/learn/vendor/fantomas/icudt_no_CJK.lfu7j35m59.dat +0 -0
  326. package/learn/vendor/fantomas/it/FSharp.Core.resources.m60n5ls7oq.wasm +0 -0
  327. package/learn/vendor/fantomas/ja/FSharp.Core.resources.o6oof69v14.wasm +0 -0
  328. package/learn/vendor/fantomas/ko/FSharp.Core.resources.q6l4snlu9o.wasm +0 -0
  329. package/learn/vendor/fantomas/mscorlib.8ptuc08eli.wasm +0 -0
  330. package/learn/vendor/fantomas/netstandard.eymp85mooh.wasm +0 -0
  331. package/learn/vendor/fantomas/pl/FSharp.Core.resources.8bni0w6j8b.wasm +0 -0
  332. package/learn/vendor/fantomas/pt-BR/FSharp.Core.resources.k849vqm41u.wasm +0 -0
  333. package/learn/vendor/fantomas/ru/FSharp.Core.resources.jz9rhhtsla.wasm +0 -0
  334. package/learn/vendor/fantomas/tr/FSharp.Core.resources.wn6vbvjm1u.wasm +0 -0
  335. package/learn/vendor/fantomas/zh-Hans/FSharp.Core.resources.z7zzbso094.wasm +0 -0
  336. package/learn/vendor/fantomas/zh-Hant/FSharp.Core.resources.iammfsi7ls.wasm +0 -0
  337. package/learn/vendor/fast-check-LICENSE.txt +21 -0
  338. package/learn/vendor/fast-check.mjs +37 -0
  339. package/learn/vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
  340. package/learn/vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
  341. package/learn/vendor/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2 +0 -0
  342. package/learn/vendor/fonts/overpass-latin-600-normal.woff2 +0 -0
  343. package/learn/vendor/fonts/overpass-latin-700-normal.woff2 +0 -0
  344. package/learn/vendor/formatter-licenses/DotNet-LICENSE.txt +23 -0
  345. package/learn/vendor/formatter-licenses/DotNet-THIRD-PARTY-NOTICES.txt +1418 -0
  346. package/learn/vendor/formatter-licenses/FSharp-LICENSE.txt +23 -0
  347. package/learn/vendor/formatter-licenses/Fantomas-LICENSE.txt +202 -0
  348. package/learn/vendor/formatter-licenses/README.md +12 -0
  349. package/learn/vendor/manifest.json +1358 -0
  350. package/learn/vendor/metadata/Browser.Blob.dll +0 -0
  351. package/learn/vendor/metadata/Browser.Dom.dll +0 -0
  352. package/learn/vendor/metadata/Browser.Event.dll +0 -0
  353. package/learn/vendor/metadata/Browser.Gamepad.dll +0 -0
  354. package/learn/vendor/metadata/Browser.WebGL.dll +0 -0
  355. package/learn/vendor/metadata/Browser.WebStorage.dll +0 -0
  356. package/learn/vendor/metadata/FSharp.Core.dll +0 -0
  357. package/learn/vendor/metadata/Fable.Core.dll +0 -0
  358. package/learn/vendor/metadata/Fable.Repl.Lib.dll +0 -0
  359. package/learn/vendor/metadata/System.Collections.Concurrent.dll +0 -0
  360. package/learn/vendor/metadata/System.Collections.dll +0 -0
  361. package/learn/vendor/metadata/System.ComponentModel.Primitives.dll +0 -0
  362. package/learn/vendor/metadata/System.ComponentModel.TypeConverter.dll +0 -0
  363. package/learn/vendor/metadata/System.ComponentModel.dll +0 -0
  364. package/learn/vendor/metadata/System.Console.dll +0 -0
  365. package/learn/vendor/metadata/System.Core.dll +0 -0
  366. package/learn/vendor/metadata/System.Diagnostics.Debug.dll +0 -0
  367. package/learn/vendor/metadata/System.Diagnostics.Tools.dll +0 -0
  368. package/learn/vendor/metadata/System.Diagnostics.Tracing.dll +0 -0
  369. package/learn/vendor/metadata/System.Globalization.dll +0 -0
  370. package/learn/vendor/metadata/System.IO.dll +0 -0
  371. package/learn/vendor/metadata/System.Net.Requests.dll +0 -0
  372. package/learn/vendor/metadata/System.Net.WebClient.dll +0 -0
  373. package/learn/vendor/metadata/System.Numerics.dll +0 -0
  374. package/learn/vendor/metadata/System.Reflection.Extensions.dll +0 -0
  375. package/learn/vendor/metadata/System.Reflection.Metadata.dll +0 -0
  376. package/learn/vendor/metadata/System.Reflection.Primitives.dll +0 -0
  377. package/learn/vendor/metadata/System.Reflection.TypeExtensions.dll +0 -0
  378. package/learn/vendor/metadata/System.Reflection.dll +0 -0
  379. package/learn/vendor/metadata/System.Runtime.Extensions.dll +0 -0
  380. package/learn/vendor/metadata/System.Runtime.InteropServices.dll +0 -0
  381. package/learn/vendor/metadata/System.Runtime.Numerics.dll +0 -0
  382. package/learn/vendor/metadata/System.Runtime.dll +0 -0
  383. package/learn/vendor/metadata/System.Text.Encoding.Extensions.dll +0 -0
  384. package/learn/vendor/metadata/System.Text.Encoding.dll +0 -0
  385. package/learn/vendor/metadata/System.Text.RegularExpressions.dll +0 -0
  386. package/learn/vendor/metadata/System.Threading.Tasks.dll +0 -0
  387. package/learn/vendor/metadata/System.Threading.Thread.dll +0 -0
  388. package/learn/vendor/metadata/System.Threading.dll +0 -0
  389. package/learn/vendor/metadata/System.ValueTuple.dll +0 -0
  390. package/learn/vendor/metadata/System.dll +0 -0
  391. package/learn/vendor/metadata/mscorlib.dll +0 -0
  392. package/learn/vendor/metadata/netstandard.dll +0 -0
  393. package/learn/vendor/monaco-editor-LICENSE.txt +21 -0
  394. package/learn/vendor/prettier/babel.mjs +16 -0
  395. package/learn/vendor/prettier/brace-style.mjs +376 -0
  396. package/learn/vendor/prettier/estree.mjs +44 -0
  397. package/learn/vendor/prettier/standalone.mjs +29 -0
  398. package/learn/vendor/prettier/typescript.mjs +22 -0
  399. package/learn/vendor/prettier-LICENSE.txt +7 -0
  400. package/learn/vendor/prettier-plugin-brace-style-LICENSE.txt +21 -0
  401. package/learn/vendor/typescript-LICENSE.txt +55 -0
  402. package/learn/vendor/typescript-libs.json +1 -0
  403. package/learn/vendor/typescript.mjs +451 -0
  404. package/learn/vendor/zod-LICENSE.txt +21 -0
  405. package/learn/web-format.mjs +8 -0
  406. package/learn.mjs +126 -0
  407. package/lsp.mjs +10 -5
  408. package/native-evidence.mjs +50 -15
  409. package/native-examples.mjs +8 -7
  410. package/native-host.mjs +71 -0
  411. package/package.json +10 -4
  412. package/proof.d.ts +8 -2
  413. package/proof.mjs +183 -31
  414. package/scala-build-state.mjs +59 -0
  415. package/templates.mjs +242 -2
  416. package/test-command.mjs +192 -60
  417. package/builtin-data-names.mjs +0 -73
  418. package/examples/native-payments/clojure/lawspec.json +0 -62
  419. package/examples/native-payments/csharp/lawspec.json +0 -62
  420. package/examples/native-payments/elixir/lawspec.json +0 -160
  421. package/examples/native-payments/erlang/lawspec.json +0 -159
  422. package/examples/native-payments/fsharp/lawspec.json +0 -178
  423. package/examples/native-payments/gleam/lawspec.json +0 -160
  424. package/examples/native-payments/go/lawspec.json +0 -147
  425. package/examples/native-payments/groovy/lawspec.json +0 -176
  426. package/examples/native-payments/haskell/lawspec.json +0 -160
  427. package/examples/native-payments/java/lawspec.json +0 -176
  428. package/examples/native-payments/javascript/lawspec.json +0 -160
  429. package/examples/native-payments/kotlin/lawspec.json +0 -176
  430. package/examples/native-payments/prolog/lawspec.json +0 -20
  431. package/examples/native-payments/python/lawspec.json +0 -160
  432. package/examples/native-payments/rust/lawspec.json +0 -178
  433. package/examples/native-payments/scala/lawspec.json +0 -176
  434. package/examples/native-payments/swift/lawspec.json +0 -165
  435. package/examples/native-payments/typescript/lawspec.json +0 -160
  436. package/examples/packages/orders/lawspec.json +0 -27
  437. package/examples/packages/shop-domain/lawspec-package.json +0 -7
  438. package/examples/packages/shop-tax-1/lawspec-package.json +0 -5
  439. package/examples/packages/shop-tax-2/lawspec-package.json +0 -5
  440. package/explain.mjs +0 -114
  441. package/expression-presentation.mjs +0 -333
  442. package/positional-fields.mjs +0 -13
  443. package/typed-presentation.mjs +0 -165
package/CHANGELOG.md CHANGED
@@ -6,6 +6,408 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.31.1] - 2026-10-29
10
+
11
+ ### Added
12
+
13
+ - `lawspec learn` serves the packaged F#-first learning track without a project
14
+ manifest. Six executable lessons pair worked examples with practice in F#,
15
+ TypeScript or JavaScript, covering examples, property selection, generators,
16
+ shrinking, replay and kept regression cases. The same artifact replaces the
17
+ previous coffee-order tutorial on GoForge. Teaching review remains open;
18
+ later lessons, capstones and the complete API collection remain deferred.
19
+ - The browser workspace includes independent Laws, Solution and Harness tabs,
20
+ local formatting and execution, progressive hints, complete solutions,
21
+ autosaved drafts and progress backup/restore. F# executes through Fable and
22
+ the JavaScript harness with fast-check, separately from native .NET/FsCheck.
23
+ Samples, mandatory definition checks, missing results and execution failures
24
+ retain their own meanings; saved progress is not proof.
25
+ - A portable LawSpec tutor skill shares the generated course and executable
26
+ projects with the browser app.
27
+ ### Fixed
28
+
29
+ - Quantified-claim formatting uses parsed header, body and closing boundaries,
30
+ keeping short arithmetic bodies together and long binders intact. Formatting
31
+ before a learning run saves and executes the same complete project snapshot.
32
+ - The local Learn server serves JavaScript modules with the correct MIME type,
33
+ including the compiler's JavaScript glue, and packages all required browser
34
+ compiler, editor, formatter, runtime and font assets for local execution.
35
+
36
+ ## [0.31.0] - 2026-10-26
37
+
38
+ ### Fixed
39
+
40
+ - The installed npm package declares its own Go module boundary, so a host
41
+ application's `go test ./...` does not collect the bundled example adapters
42
+ before those examples have been generated.
43
+ - Rust groups block-like operands where its statement grammar requires it,
44
+ including comparisons between record fields lowered to `match` expressions.
45
+ - Persistent layout caches preserve shared document graphs when loading them,
46
+ avoiding the memory expansion caused by decoding each use as a separate
47
+ tree. Existing compiler cache entries are recomputed; generated code and
48
+ semantic identities are unchanged.
49
+
50
+ ### Changed
51
+
52
+ - Complete and bounded scoped searches share one typed candidate body and enumerate
53
+ their domain at runtime. Their ordered, three-outcome execution preserves
54
+ short-circuiting and incomplete results. Finite quantifier and witness proof
55
+ lowering likewise keeps candidate data and one scoped predicate instead of
56
+ copying the predicate per candidate. Source comments retain the original
57
+ checked proposition, independently of its execution plan.
58
+ - All 18 executable targets use compact finite test plans: ordered shared
59
+ prefixes, value lists and inclusive integer ranges, with one shared check
60
+ body per law. Cases retain stable indices, fresh attempt values, selection
61
+ and failure context. Native runners register cases individually where their
62
+ APIs support it; Rust uses runtime row loops with indexed failure reports.
63
+ In the handler-bindings suite, the JavaScript test file shrinks from 1,096,011
64
+ lines to 2,355 and Python from 1,127,192 to 2,535, preserving all 8,012 cases
65
+ and rejecting both adapter mutations. Haskell shrinks from 92,352 to 2,235
66
+ lines and Rust from 42,006 to 1,905. Generated test size is checked against
67
+ source-relative byte and line limits, including compact layouts.
68
+ - Prolog registers individual PLUnit cases from the Python host's collected
69
+ case metadata. Exact selection executes only the selected provider case;
70
+ unknown, duplicate and incomplete results cannot supply completed evidence.
71
+ Ordered Swift tests report individual starts and completions under a fresh
72
+ run identity, checked against the native Swift Testing aggregate result.
73
+ - **Content identity.** Every type, declaration, handler, ability and law
74
+ has a semantic hash of its checked structure and a presentation hash of its
75
+ names, docs and spans ([Content identity](docs/explanation/content-identity.md)).
76
+ Binders are positions, references are hashes, and mutually recursive groups
77
+ are hashed together. Identity is structural: equivalent calculations can
78
+ still have different hashes. Presentation-bearing plans and emitted chunks
79
+ retain both hashes; pure execution and proof results can survive renames,
80
+ line moves and doc edits when their other inputs remain unchanged.
81
+ - `lawspec test` keys results on semantic identity, compiler build, target,
82
+ toolchain, adapters and execution settings, rather than generated file
83
+ bytes. Native interfaces and recorded comparisons also retain the public
84
+ names they can observe. A constructor rename that changes portable ordering
85
+ changes semantic identity. Changed presentation is validated before execution
86
+ reuse; mandatory definition validation remains independent of optional proofs.
87
+ - **Breaking in 0.31: proof tasks.** `programFingerprint` is replaced by a
88
+ per-law `lawFingerprint` over semantic dependencies, encoding, machine width
89
+ and proof settings. Receipts from public 0.30.0 and earlier must be recomputed.
90
+ The lawspec-smtlib-v1 byte freeze is replaced by semantic invariance checks;
91
+ this does not add a new proof backend or a kernel-checked certificate.
92
+ - **Breaking in 0.31: remote content hashes** are `blake3-semantic-1:` then
93
+ the semantic hash, replacing `sha3-256:`. A 0.31 node cannot exchange remote
94
+ definition identities with a 0.30 or earlier node. There is no pre-1.0
95
+ identity migration.
96
+ - Acceptance records exact generated-byte hits separately from semantic
97
+ execution hits. Reuse still requires matching compiler, toolchain, adapters,
98
+ mutants and execution context; changed presentation is formatted and
99
+ compiled/parsed before an earlier execution result is reused.
100
+ - BLAKE3 follows goforge's blake3sum design: unboxed words, an unrolled
101
+ compression function and a batch `hashMany`. It is 9.2 times faster on
102
+ 20,000 48-byte inputs (97.5 ms to 10.6 ms) and 22 times faster on 4 MiB
103
+ (432 ms to 19 ms), and agrees with the official vectors and blake3sum.
104
+
105
+ - **Breaking: generated Python names.** Generated Python is written to be
106
+ read. Locals keep their source names, checked definitions are named after
107
+ the definition (`_definitions.fee_model`, `lawspec_typed.settings`, with
108
+ `_2` only on a clash) and typed helpers after their type (`to_settings`).
109
+ Tests are named after the law and the example
110
+ (`test_normalizers_agree__spaces_become_hyphens_punctuation_is_preserved`),
111
+ and boundaries are numbered from 1. Anonymous records have a name from
112
+ where they are used (`DeclinedDetails`) instead of `Record<digest>`.
113
+ Adapters and native code that use the old names must be renamed.
114
+ - Generated Python writes text and bytes as Python literals, names the
115
+ machine width (`MACHINE_BITS`) and the integers' draw limit once per
116
+ module, imports only what it uses, and makes a case's `symbols` only when
117
+ the case uses them. Each law's comment gives its name, source line, what it
118
+ says and the statement its tests check, with source names and real
119
+ characters; each test, definition and helper links to its source line.
120
+ Assertion messages name the law and example and point at the expectation's
121
+ line instead of repeating its text.
122
+ - Generated Python is laid out as `ruff format` (0.17.2, default settings)
123
+ lays it out, at 88 columns rather than PEP 8's 79, and the Python runtimes
124
+ are formatted the same way. Acceptance runs `ruff format --check` on every
125
+ generated Python project (the formatted step).
126
+ - **Breaking: generated JavaScript and TypeScript names.** Locals keep their
127
+ source names; checked definitions are named after the definition
128
+ (`_definitions.feeModel` instead of `_definitions.evaluate0`), typed
129
+ functions after the definition (`modelPeek` instead of
130
+ `Def_modelPeek_a0205a6d`), typed classes after their type (`Pair` instead
131
+ of `T_Pair`) and typed helpers after their kind and type
132
+ (`fromPairInt64Int64` instead of `from_<digest>`). Anonymous records have a
133
+ name from where they are used, and a data name that is still taken gets
134
+ `_2`. Adapters and native code that use the old names must be renamed.
135
+ - Generated JavaScript and TypeScript are laid out as Prettier (3.9.10,
136
+ default settings) lays them out, and the web runtimes and default handlers
137
+ are formatted the same way. LawSpec prints the code itself, from a syntax
138
+ tree, with a port of Prettier's printer; acceptance runs
139
+ `prettier --check` on every generated JavaScript and TypeScript project.
140
+ Text is written as string literals (never split mid-word), small integers
141
+ and booleans as literals, `MACHINE_BITS` is named once per module, modules
142
+ import only what they use, and each test, definition and class links to
143
+ its source line. Each law's comment gives its name, source line, what it
144
+ says and the statement its tests check. The assertion helpers, the seed
145
+ option and the data generators' scalar table are the runtime's
146
+ (`ls.check`, `ls.checkData`, `ls.seeded`, `primitiveGenerators`), so a
147
+ test module holds only its laws.
148
+
149
+ - **Breaking: artifact and Prolog names.** HCL variables are named after their
150
+ declarations (`settings`, and `type_settings` for a type-only variable)
151
+ instead of `value_<identity>_<digest>`; schema `$defs`, ANTLR rules and
152
+ manifest keys are named after their types (`settings`, `listText`,
153
+ `boxUint8`) instead of `t_<digest>`, in spec order; ANTLR entry rules are
154
+ `<type>Document`; manifest `types` are written as LawSpec writes them.
155
+ Prolog modules are named after their unit (`example_payments`,
156
+ `example_payments_model`) instead of `lawspec_<digest>`, PLUnit units after
157
+ their test file, and the bridge's Python functions after their definitions.
158
+ Adapters that name the old modules must be renamed.
159
+ - Artifacts are laid out to be read: YAML in block style (yamllint's
160
+ defaults), JSON indented as `json.dumps(indent=2)` writes it, HCL as
161
+ `tofu fmt` writes it with one validation block and message per restriction,
162
+ ANTLR rules in the grammars-v4 layout, and a generated-file header on the
163
+ Makefile. Prolog is printed as SWI-Prolog's `portray_clause/2` prints it, and
164
+ the Prolog runtime is reformatted the same way; the Prolog project's Python
165
+ host files and runtimes follow `ruff format`. Each entry, variable, rule and
166
+ predicate links to its source line. The artifact validator and Prolog
167
+ acceptance check these layouts (yamllint 1.37.1, OpenTofu 1.13.1, SWI-Prolog
168
+ 10.0.2, ruff 0.17.2).
169
+ - **Breaking: generated Go names.** Generated Go is written to be read and
170
+ held to `gofmt`. Tests are named after the law and the example
171
+ (`TestNormalizersAgree_SpacesBecomeHyphensPunctuationIsPreserved`,
172
+ `_Boundary1` from 1, `_Property`), locals keep their source names, a
173
+ checked definition's evaluator is `lawSpecEvaluateFeeModel` and its typed
174
+ function `lsfFeeModel` (no digest suffix), typed helpers are named after
175
+ their type (`lsfToValueSettings`), and anonymous records are named from
176
+ where they are used (`PushDetails`) instead of `Record<digest>`; data names
177
+ that still meet take `_2`. Native code that uses the old names must be
178
+ renamed.
179
+ - Generated Go writes text as Go string literals and characters as rune
180
+ literals, links each test and law to its source line, names a failing
181
+ assertion's law and example and its expectation's line, shows text as text
182
+ in failures, and leaves out unused `symbols`, `_ = x` markers and wrapper
183
+ helpers. Every generated Go file, runtime copies included, starts with
184
+ `// Code generated by LawSpec. DO NOT EDIT.`. Acceptance runs the `gofmt`
185
+ of a pinned Go release (1.26.5, `test/locks/go/gofmt.txt`) in check mode on
186
+ every generated Go project, and the Go runtimes are formatted with it.
187
+ - **Breaking: generated F# and C# names.** Generated .NET code is written to
188
+ be read. Parameters, inputs and binders keep their source names, typed
189
+ definitions are named after the definition (`LawSpec.TypedProgram.settings`,
190
+ `Settings` in C#, with `_2` only on a clash), and each example's test is
191
+ named after its law and example
192
+ (`lawNormalizersAgree_spacesBecomeHyphensPunctuationIsPreserved`).
193
+ Anonymous records have a name from where they are used (`DeclinedDetails`)
194
+ instead of `Record<digest>`. Adapters and native code that use the old
195
+ names must be renamed.
196
+ - Generated F# and C# write text as string literals, link each test, law and
197
+ typed definition to its source line, and drop helpers that only forward
198
+ (a law's scoped case when it has no handlers, resources or policies).
199
+ Remote serving and evaluation, a typed operation's Result, a codec built
200
+ by an expression and a model's callbacks are runtime functions the
201
+ generated code calls (`Remote.serveDefinitions`, `Typed.tryResult`,
202
+ `Codec.toNative`, `Model.call1`).
203
+ - Generated F# is laid out as Fantomas (8.1.0, default settings) lays it
204
+ out, and the .NET runtime is formatted the same way; generated C# is what
205
+ `dotnet format` leaves unchanged. Acceptance runs `fantomas --check` and,
206
+ for C#, `dotnet format whitespace --verify-no-changes` on every generated
207
+ .NET project.
208
+ - **Breaking: generated Erlang, Elixir and Gleam names.** BEAM output is
209
+ written to be read. `lawspec_definitions` functions are named after their
210
+ definitions (`fee_model`, not `evaluate_3`), `lawspec_abilities` functions
211
+ after their abilities and handlers (`gateway_production`, not
212
+ `ability_0_production`), and `lawspec_typed` functions and conversions
213
+ after their definitions and types (`settings`, `from_dynamic_settings`),
214
+ with `_2` only on a clash; a specialised copy is named from its definition
215
+ and argument types. Binders keep their source names as Erlang variables.
216
+ Each law's cases are functions named after the law and the case
217
+ (`law_normalizers_agree__spaces_become_hyphens_punctuation_is_preserved`),
218
+ boundaries are numbered from 1, ExUnit tests are named for their cases,
219
+ and Gleeunit tests for the law and the case instead of `__case_N`.
220
+ Anonymous records have a name from where they are used (a payload of
221
+ `Declined` is the tag `declined_details`, the struct
222
+ `LawSpec.Data.DeclinedDetails` and the Gleam type `DeclinedDetails`)
223
+ instead of `Record<digest>`. Adapters and native code that use the old
224
+ names must be renamed.
225
+ - Generated BEAM code writes text as binaries (`<<"café"/utf8>>`) and
226
+ scalars through their runtime constructors instead of code-unit maps,
227
+ integer arithmetic and comparison as Erlang's operators and other
228
+ operations as named runtime functions (`lawspec_beam_scalar:add/4`), and
229
+ a let as `bind(Value, fun(X) -> ... end)`. A law's identity is a macro
230
+ written once, each law has the shared comment block, and every case,
231
+ definition and typed function links to its source line; test modules
232
+ name their specification in their header. ExUnit test modules name only
233
+ their laws (`law/4` in the new `LawSpec.Beam.ExUnitCases` test runtime).
234
+ - Generated Erlang is laid out as `erlfmt` 1.8.0 lays it out, Elixir as
235
+ `mix format` (Elixir 1.20.4) and Gleam as `gleam format` 1.19.0, each with
236
+ its default settings, and the BEAM runtimes are formatted the same way.
237
+ Acceptance runs each in check mode on every generated BEAM project (the
238
+ formatted step), pinned in `test/locks/beam-formatters.txt`.
239
+ - **Breaking: generated Haskell names.** Generated Haskell is written to be
240
+ read. Binders keep their source names, checked definitions are named after
241
+ the definition (`Definitions.feeModel`, `Typed.feeModel`, with `_2` only on
242
+ a clash), spec handlers after the handler (`fakeGatewayHandler`), typed
243
+ conversions after their type (`toPayment`, `fromNativeListInt32`), and
244
+ model and remote definitions take their arguments through `LS.uncurried`.
245
+ Tests are named after the law and the example
246
+ (`lawNormalizersAgree_spacesBecomeHyphensPunctuationIsPreserved`), and
247
+ boundaries are numbered from 1 (`_boundary1`). Anonymous records have a
248
+ name from where they are used (`PushDetails`) instead of `Record<digest>`.
249
+ Adapters and native code that use the old names must be renamed.
250
+ - Generated Haskell is printed by precedence, with no parentheses around
251
+ atoms, and laid out as `ormolu` (0.9.0.0) lays it out; the Haskell runtimes
252
+ and default handlers are formatted the same way. Acceptance runs
253
+ `ormolu --mode check` on every generated Haskell project (the formatted
254
+ step), remembering files it has passed by their content. Text is a Haskell
255
+ string literal (`LS.textScalar "café"`), never one code point per line.
256
+ - Generated Haskell tests hold only their laws: the assertion, the seeded
257
+ Hedgehog check (`LawSpecTesting.holds`), checked values
258
+ (`Schema.checked`, `Schema.literal`, `Schema.built`, `Schema.same`) and
259
+ adapter calls (`Codec.call1` to `call8`, `perform1` to `perform8`) are in
260
+ the runtime. A test module names its machine width, schema, scalar codecs
261
+ and the integers' draw limit once, imports only what it uses, and each
262
+ law's comment, test, definition and handler links to its source line.
263
+ - **Breaking: generated Swift names.** Generated Swift is written to be
264
+ read. A law's inputs, a definition's arguments and every binder keep their
265
+ source names; typed definitions are named after the definition
266
+ (`LawSpec.TypedProgram.settings`, a specialised copy `countListInt32`,
267
+ with `_2` only on a clash) instead of carrying a digest; specialised and
268
+ compiler-made entries lose their digests too. Tests are named after the law
269
+ and the example (`lawNormalizersAgree_spacesBecomeHyphensPunctuationIsPreserved`,
270
+ with readable `@Test` display names), and a law's statement is a helper
271
+ named after the law. Anonymous records have a name from where they are used
272
+ (`DeclinedDetails`), and acronyms in lowerCamelCase names are lowercased
273
+ whole (the case `usd`, not `uSD`). Adapters and native code that use the
274
+ old names must be renamed.
275
+ - Generated Swift writes text as Swift string literals, a long machine or
276
+ scenario spec as a multiline literal, and the crypto vectors as one
277
+ multiline literal. Each law's comment gives its name, source line, what it
278
+ says and the statement its tests check; each test, definition, data type,
279
+ typed function and spec handler links to its source line, and assertion
280
+ messages name the law and example and point at the expectation's line.
281
+ Files start with `Generated by LawSpec from <spec>. Do not edit.` and a
282
+ blank line, then sorted imports. Dead values (`_ = Value.bool(true)`) and
283
+ a law's case that only forwards to its statement are gone.
284
+ - Generated Swift is laid out as `swift-format` (6.3.0, from the Swift
285
+ toolchain, default configuration) lays it out: two-space indentation, 100
286
+ columns, one item a line when a call, array or signature does not fit,
287
+ trailing closures and grouped integer literals. The Swift runtime and the
288
+ `Package.swift` scaffold are formatted the same way. Acceptance formats a
289
+ copy of every generated Swift project with `swift format` and fails on any
290
+ difference (the formatted step).
291
+
292
+ - **Breaking: generated Rust names and tests.** Each Rust law is a module
293
+ named after it. Examples remain native `#[test]` functions, such as
294
+ `law_normalizers_agree::spaces_become_hyphens_punctuation_is_preserved`.
295
+ Boundary and exhaustive tests walk a compact cover at runtime, with stable
296
+ row indices and values in failures; generated cases use the `property` test.
297
+ `lawspec test` selects a law's tests by its module. Inputs and binders keep
298
+ their source names; checked definitions, typed functions and operation
299
+ bridges are named after what
300
+ they implement in snake case (`fee_model`, `count_list_int32`,
301
+ `perform_store_text_save`) instead of `evaluate_<n>` and digest suffixes;
302
+ anonymous records are named from where they are used (`DeclinedDetails`);
303
+ a handler from the context is typed by its binding. Adapters and native
304
+ code that use the old names must be renamed. Actors' handler methods are
305
+ snake case too (`withdraw_all`, `tell_withdraw_all`). The tests of one
306
+ generated file run one at a time (`ls::with_stack`), as a law's cases
307
+ share what they acquire; tests the harness orders run on `ls::on_stack`.
308
+ - Generated Rust writes text as Rust string literals, never split, links each
309
+ law, test, adapter call and definition to its source line, and gives each
310
+ law a comment with its name, what it says and the statement its tests
311
+ check. A failing expectation names its law, its example and its line, and
312
+ the runtime says how the values differ (`ls::expect_equal`, `ls::called`).
313
+ Seed and failure-database settings, handler locking, remote definitions,
314
+ served actor messages (`ls::net::message`), resource brackets
315
+ (`ls::bracket`) and session listening move into the runtimes. Generated Rust carries no
316
+ blanket `allow` attributes and builds without warnings.
317
+ - Generated Rust is laid out as `rustfmt` (1.97.1, edition 2024, default
318
+ settings) lays it out, by a Rust layout module that follows rustfmt's
319
+ rules for calls, chains, match arms and lets, and the Rust runtimes are
320
+ formatted the same way. Acceptance runs `rustfmt --check` on every
321
+ generated Rust project.
322
+
323
+ - **Breaking: generated JVM names.** Java, Kotlin, Scala and Groovy keep
324
+ the specification's names: locals keep their source names in camel case,
325
+ checked definitions and typed helpers are named after the definition
326
+ instead of `evaluateN`, tests after the law and the example
327
+ (`normalizersAgree_spacesBecomeHyphensPunctuationIs`), and anonymous
328
+ records after where they are used (`PushDetails`) instead of
329
+ `Record<digest>`. Adapters and native code that use the old names must be
330
+ renamed.
331
+ - Generated Java uses Allman braces with Google Java Style's other rules;
332
+ Kotlin is laid out as ktfmt 0.64 (kotlinlang style) lays it out; Scala as
333
+ scalafmt 3.11.5 (default configuration) accepts it; Groovy specifications
334
+ use Allman braces and pass CodeNarc; Clojure is laid out as cljfmt lays it
335
+ out. Acceptance checks each with its formatter (the formatted step):
336
+ Checkstyle 14.3.0, ktfmt, scalafmt, CodeNarc 4.0.0 and cljfmt 0.16.6.
337
+ - JVM tests write text as the language's string literals, name the machine
338
+ width and schema once per file, and point each assertion at its source
339
+ line; each law's comment gives its name, source line and statement. The
340
+ Kotlin and Scala tests' scalar generators and checks moved into the
341
+ runtime (`LawSpecScalars`, `LawSpecTesting`), so a test file holds only its
342
+ laws. Groovy's Spock specifications are generated from the plan instead of
343
+ rewritten from the Java tests, and Clojure's tests show the law's
344
+ statement.
345
+ - JVM property draws are flat: each sub-draw of a harness strategy is a
346
+ named function defined before its use (`gridCandidate`, `rowsOption1`),
347
+ drawn through `LawSpecDraws.oneOf`, `frequency` and `suchThat` (Kotlin,
348
+ Scala) or named suppliers (Java), instead of one nested closure per step.
349
+ Lets leave constructor arguments, match scrutinees and (in Java) strict
350
+ argument lists, and Java builds a value with its fields last
351
+ (`SCHEMA.construct(type, tag, bits, symbols, fields...)`), so nested
352
+ values indent once per level.
353
+ - A Scala unit whose tests would exceed 20,000 lines gets a file per law
354
+ (`<Unit><Law>Law.scala`) beside its `<Unit>LawSpecTest` object, and a long
355
+ chain of one boolean operator is `LawSpecScala.anyOf`/`allOf`, which
356
+ scalafmt can lay out.
357
+ - Acceptance's formatted step reads `acceptance/<suite>/<target>/unformatted.txt`:
358
+ a generated file it lists (path, then the reason) is not checked, and the
359
+ step reports it. Keywords' Java stub uses it: its `_class` adapter, the
360
+ documented escape of a Java keyword, is not a name Checkstyle's Google
361
+ rules accept.
362
+
363
+ - Swift codecs, Java actor/mailbox/session layout, Groovy stubs and the
364
+ Clojure bridge consume structured documents and interface metadata instead
365
+ of re-reading generated source. Definition source links use source names,
366
+ and labelled-law display names no longer carry an internal quote marker.
367
+ - Scala calls constructors with no non-`Unit` arguments directly from Scala,
368
+ avoiding the unnecessary Java-to-provider-Scala edge in the asynchronous
369
+ binding fixture. Constructors with values retain the Java bridge where raw
370
+ generic casts are needed. Scala build failures capture commands, Bloop
371
+ configuration and class inventories before cleanup; this is not a general
372
+ Bloop race fix.
373
+ - Replace project and package JSON manifests with `lawspec.edn`. The component
374
+ and published contract identities are explicit; obsolete JSON is rejected.
375
+ - Native runtimes, editor discovery, examples and test tooling use the same
376
+ manifest. Optional verification still leaves definition validation mandatory.
377
+
378
+ ### Added
379
+
380
+ - Shared foundations for readable output on every target: a naming service,
381
+ per-target string escaping tables, source links from Core origins, record
382
+ display names, and per-target layout profiles (brace style, indent, width,
383
+ trailing commas, blank lines, import order), with display widths and
384
+ printability from pinned Unicode 17.0.0 tables.
385
+ - `LawSpec.Code.Doc.flatReserve`: columns a flat layout keeps free without
386
+ printing anything, as swift-format keeps one for the trailing comma an
387
+ array gains when it breaks.
388
+ - **Breaking:** `lawspec explain` has three views: `--view eng` (plain
389
+ English, the default), `--view math` (mathematical notation) and `--view dev`
390
+ (LawSpec notation with types, examples and native conformance). The values
391
+ `developer`, `business`, `formal` and `evidence` are removed. Each one is an
392
+ error that names its replacement: `dev`, `eng`, `math`, or
393
+ `lawspec evidence <unit>::<law>`.
394
+ - `lawspec explain --json` prints the chosen view as records with `view`,
395
+ `law`, `name` and ordered `sections` of `lines`. The text output is derived
396
+ from them. Records no longer copy the typed assertion, inputs, examples or
397
+ evidence; `check --json` and `lawspec evidence --json` report those.
398
+ - The compiler words explanations. The new `explain` method is in the API,
399
+ with `ExplainRequest`, `ExplainResult` and `Explanation` types. The CLI calls
400
+ it, so CLI and API give the same text, and the native and WASM compilers
401
+ agree byte for byte.
402
+ - The dev view brackets terms only where LawSpec's precedence needs them, for
403
+ example `a > 0 and b implies f a = X`.
404
+ - Local, Git-tag/revision and SHA-256 HTTPS archive contract dependencies,
405
+ `lawspec.lock.edn`, fetch/update and locked/offline execution.
406
+ - Deterministic contract archives and the checked `lawspec/component` SDK and
407
+ `lawspec describe --json` descriptor for CALM consumers.
408
+ - Completed evidence can identify a component independently of its contracts,
409
+ retaining architecture, implementation and selected contract content digests.
410
+
9
411
  ## [0.30.0] - 2026-10-23
10
412
 
11
413
  ### Added
@@ -1973,7 +2375,9 @@ A maintenance release. The language, generated code and API are unchanged from
1973
2375
  machine-sized bindings reject an architecture mismatch. Rust adapters take
1974
2376
  owned values.
1975
2377
 
1976
- [Unreleased]: https://github.com/brain-fuel/lawspec/compare/v0.30.0...HEAD
2378
+ [Unreleased]: https://github.com/brain-fuel/lawspec/compare/v0.31.1...HEAD
2379
+ [0.31.1]: https://github.com/brain-fuel/lawspec/compare/v0.31.0...v0.31.1
2380
+ [0.31.0]: https://github.com/brain-fuel/lawspec/compare/v0.30.0...v0.31.0
1977
2381
  [0.30.0]: https://github.com/brain-fuel/lawspec/compare/v0.29.2...v0.30.0
1978
2382
  [0.29.2]: https://github.com/brain-fuel/lawspec/compare/v0.29.1...v0.29.2
1979
2383
  [0.29.1]: https://github.com/brain-fuel/lawspec/compare/v0.29.0...v0.29.1
package/README.md CHANGED
@@ -9,10 +9,7 @@ Haskell, Kotlin, Rust, C#, F#, Swift, Erlang, Elixir, Gleam, Clojure, Groovy and
9
9
  Scala. The compiler is written in Haskell and distributed on npm as prebuilt
10
10
  WebAssembly, with a Node CLI and a typed JavaScript API.
11
11
 
12
- The canonical authoring examples below target 0.25.0, the minor in preparation
13
- on `main`.
14
- Install the development checkout as shown below. For released 0.24.0, use the
15
- [0.24.0 documentation](https://github.com/brain-fuel/lawspec/tree/v0.24.0).
12
+ The npm package includes the compiler and learning track; no Haskell installation is needed.
16
13
 
17
14
  ## Features
18
15
 
@@ -54,7 +51,7 @@ npx lawspec doctor
54
51
 
55
52
  New projects start with `verification.layers: []`: intrinsic definition checks
56
53
  run, and no law verification is selected. Set `verification.layers` to
57
- `["property", "examples"]` in `lawspec.json`, then run `npx lawspec generate`.
54
+ `[:property :examples]` in `lawspec.edn`, then run `npx lawspec generate`.
58
55
  Implement `src/example/codec.mjs`, then run `npm test`:
59
56
 
60
57
  ```javascript
@@ -91,12 +88,18 @@ end law
91
88
  end unit
92
89
  ```
93
90
 
94
- `lawspec explain` shows the final property:
91
+ `lawspec explain` says what the law checks, in plain English:
95
92
 
96
93
  ```text
97
- for all (x :: Int32) . atoi (itoa (x)) = x
94
+ Law: round trip
95
+ applying {itoa} and then {atoi} recovers the original integer
96
+ For every x (an Int32):
97
+ The atoi for the itoa for this x must be this x.
98
98
  ```
99
99
 
100
+ `--view dev` shows the expanded property `atoi (itoa x) = x` with its
101
+ examples. `--view math` uses mathematical notation.
102
+
100
103
  The generated tests check the example, signed 32-bit boundary cases and
101
104
  randomized inputs against your `itoa` and `atoi`, on whichever targets you
102
105
  configure.
@@ -136,3 +139,12 @@ Syntax highlighting is available as a [VS Code extension](editors/vscode/README.
136
139
  ## License
137
140
 
138
141
  MIT. See [LICENSE](LICENSE).
142
+
143
+ ## Learn LawSpec
144
+
145
+ ```sh
146
+ npm install --global lawspec@0.31.1
147
+ lawspec learn
148
+ ```
149
+
150
+ Open the printed loopback URL, or use [Learn on GoForge](https://goforge.dev/lawspec/learn/). Six lessons pair worked examples with practice in F#, TypeScript or JavaScript. The course is a teaching preview; later lessons, capstones and the complete API collection remain deferred. See [Learn LawSpec](docs/how-to/learn.md).
package/api.mjs CHANGED
@@ -7,6 +7,7 @@ export async function createCompiler() {
7
7
  format: (input) => call({schemaVersion: 5, ...input, method: 'format'}),
8
8
  check: (input) => call({schemaVersion: 5, ...input, method: 'check'}),
9
9
  expand: (input) => call({schemaVersion: 5, ...input, method: 'expand'}),
10
+ explain: (input) => call({schemaVersion: 5, ...input, method: 'explain'}),
10
11
  proofTasks: (input) =>
11
12
  call({schemaVersion: 5, ...input, method: 'proofTasks'}),
12
13
  planGeneration: (input) =>
package/beam-doctor.mjs CHANGED
@@ -5,8 +5,8 @@ import path from "node:path";
5
5
 
6
6
  // These are the same sources the compiler emits, including the NIF loader.
7
7
  const runtime = {
8
- "formatter": "# Observe ExUnit's real skip events; excluded tests are not reported as run.\n# ref:REQ-harness-units ref:DEC-native-property-frameworks\ndefmodule LawSpec.Beam.ExUnitFormatter do\n @moduledoc false\n use GenServer\n\n def init(_options), do: {:ok, :lawspec_beam_report.open()}\n\n def handle_cast({:test_finished, %{state: {:skipped, _}, tags: %{lawspec_skip: {law, reason}}}}, state) do\n :lawspec_beam_harness.skip(law, reason)\n {:noreply, state}\n end\n\n def handle_cast({:test_finished, %{state: {:excluded, _}}}, state), do: {:noreply, state}\n def handle_cast({:test_finished, %{state: {:skipped, _}}}, state), do: {:noreply, state}\n def handle_cast({:test_finished, test}, state) do\n :lawspec_beam_report.event(state, %{\n event: \"test\", name: Atom.to_string(test.name), classname: inspect(test.module),\n identity: Map.get(test.tags, :lawspec_identity, \"\"),\n status: if(test.state == nil, do: \"passed\", else: \"failed\"),\n time: (test.time || 0) / 1_000_000,\n failure: if(test.state == nil, do: \"\", else: inspect(test.state, limit: :infinity, printable_limit: :infinity))\n })\n {:noreply, state}\n end\n\n def handle_cast({:suite_finished, _}, state) do\n :lawspec_beam_report.finish(state)\n {:noreply, state}\n end\n\n def handle_cast(_event, state), do: {:noreply, state}\nend\n",
9
- "native": "%% @doc The seed and vector bridge to the same OpenSSL ABI as OTP crypto.\n%% Build with escript lawspec_crypto_build.escript; ship the resulting priv/.\n%% ref:DEC-typed-core-boundary\n-module(lawspec_beam_crypto_native).\n-on_load(init/0).\n-export([expand/2, encapsulate_test/2, sign_context/5, verify_context/5]).\n\ninit() ->\n [{<<\"OpenSSL\">>, Version, _}] = crypto:info_lib(),\n BeamDir = filename:dirname(code:which(?MODULE)),\n %% Application layouts (Rebar, Mix, Gleam and releases) put ebin beside\n %% priv. The second path supports a standalone erlc output directory.\n Candidates = [filename:join([filename:dirname(BeamDir), \"priv\", \"lawspec_crypto_native\"]),\n filename:join([BeamDir, \"priv\", \"lawspec_crypto_native\"])],\n case [Path || Path <- Candidates, filelib:is_regular(Path ++ extension())] of\n [Library | _] -> erlang:load_nif(Library, Version bsr 28);\n [] -> {error, {load_failed,\n \"LawSpec crypto bridge is missing; run escript lawspec_crypto_build.escript before compiling and ship priv/ with the application\"}}\n end.\n\nextension() -> case os:type() of {win32, _} -> \".dll\"; _ -> \".so\" end.\n\nexpand(_, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\nencapsulate_test(_, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\nsign_context(_, _, _, _, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\nverify_context(_, _, _, _, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\n",
8
+ "formatter": "# Observe ExUnit's real skip events; excluded tests are not reported as run.\n# ref:REQ-harness-units ref:DEC-native-property-frameworks\ndefmodule LawSpec.Beam.ExUnitFormatter do\n @moduledoc false\n use GenServer\n\n def init(_options), do: {:ok, :lawspec_beam_report.open()}\n\n def handle_cast(\n {:test_finished, %{state: {:skipped, _}, tags: %{lawspec_skip: {law, reason}}}},\n state\n ) do\n :lawspec_beam_harness.skip(law, reason)\n {:noreply, state}\n end\n\n def handle_cast({:test_finished, %{state: {:excluded, _}}}, state), do: {:noreply, state}\n def handle_cast({:test_finished, %{state: {:skipped, _}}}, state), do: {:noreply, state}\n\n def handle_cast({:test_finished, test}, state) do\n :lawspec_beam_report.event(state, %{\n event: \"test\",\n name: Atom.to_string(test.name),\n classname: inspect(test.module),\n identity: Map.get(test.tags, :lawspec_identity, \"\"),\n status: if(test.state == nil, do: \"passed\", else: \"failed\"),\n time: (test.time || 0) / 1_000_000,\n failure:\n if(test.state == nil,\n do: \"\",\n else: inspect(test.state, limit: :infinity, printable_limit: :infinity)\n )\n })\n\n {:noreply, state}\n end\n\n def handle_cast({:suite_finished, _}, state) do\n :lawspec_beam_report.finish(state)\n {:noreply, state}\n end\n\n def handle_cast(_event, state), do: {:noreply, state}\nend\n",
9
+ "native": "%% @doc The seed and vector bridge to the same OpenSSL ABI as OTP crypto.\n%% Build with escript lawspec_crypto_build.escript; ship the resulting priv/.\n%% ref:DEC-typed-core-boundary\n-module(lawspec_beam_crypto_native).\n-on_load(init/0).\n-export([expand/2, encapsulate_test/2, sign_context/5, verify_context/5]).\n\ninit() ->\n [{<<\"OpenSSL\">>, Version, _}] = crypto:info_lib(),\n BeamDir = filename:dirname(code:which(?MODULE)),\n %% Application layouts (Rebar, Mix, Gleam and releases) put ebin beside\n %% priv. The second path supports a standalone erlc output directory.\n Candidates = [\n filename:join([filename:dirname(BeamDir), \"priv\", \"lawspec_crypto_native\"]),\n filename:join([BeamDir, \"priv\", \"lawspec_crypto_native\"])\n ],\n case [Path || Path <- Candidates, filelib:is_regular(Path ++ extension())] of\n [Library | _] ->\n erlang:load_nif(Library, Version bsr 28);\n [] ->\n {error,\n {load_failed,\n \"LawSpec crypto bridge is missing; run escript lawspec_crypto_build.escript before compiling and ship priv/ with the application\"}}\n end.\n\nextension() ->\n case os:type() of\n {win32, _} -> \".dll\";\n _ -> \".so\"\n end.\n\nexpand(_, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\nencapsulate_test(_, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\nsign_context(_, _, _, _, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\nverify_context(_, _, _, _, _) -> erlang:nif_error(lawspec_crypto_native_not_loaded).\n",
10
10
  "c": "/* OpenSSL operations not exposed by OTP 29's crypto API: compact key seeds,\n * signature contexts and deterministic known-answer tests. Ordinary random\n * encapsulation, signing, verification and AEAD use OTP directly.\n * ref:DEC-typed-core-boundary\n */\n#include <erl_nif.h>\n#include <openssl/crypto.h>\n#include <openssl/evp.h>\n#include <openssl/err.h>\n#include <openssl/params.h>\n#include <openssl/core_names.h>\n#include <string.h>\n\n#if OPENSSL_VERSION_NUMBER < 0x30500000L\n#error \"LawSpec crypto requires OpenSSL 3.5 or newer\"\n#endif\n#if !defined(LAWSPEC_OPENSSL_MAJOR) || OPENSSL_VERSION_MAJOR != LAWSPEC_OPENSSL_MAJOR\n#error \"Build LawSpec crypto with the same OpenSSL major version as Erlang/OTP\"\n#endif\n\ntypedef struct {\n const char *tag, *name;\n size_t seed, public_key, private_key, signature;\n} Algorithm;\n\nstatic const Algorithm algorithms[] = {\n {\"mlkem768\", \"ML-KEM-768\", 64, 1184, 2400, 0},\n {\"mldsa65\", \"ML-DSA-65\", 32, 1952, 4032, 3309},\n {\"slh_dsa_shake_128f\", \"SLH-DSA-SHAKE-128f\", 48, 32, 64, 17088}\n};\n\nstatic const Algorithm *algorithm(ErlNifEnv *env, ERL_NIF_TERM term) {\n char tag[32];\n size_t i;\n if (!enif_get_atom(env, term, tag, sizeof(tag), ERL_NIF_LATIN1)) return NULL;\n for (i = 0; i < sizeof(algorithms) / sizeof(algorithms[0]); ++i)\n if (!strcmp(tag, algorithms[i].tag)) return &algorithms[i];\n return NULL;\n}\n\n/* No key material or provider error strings enter diagnostics. OpenSSL's\n * per-thread error queue must not leak between jobs on a dirty scheduler. */\nstatic ERL_NIF_TERM failure(ErlNifEnv *env, const char *operation) {\n ERR_clear_error();\n return enif_raise_exception(env, enif_make_tuple2(env,\n enif_make_atom(env, \"lawspec_crypto_failure\"), enif_make_atom(env, operation)));\n}\n\nstatic EVP_PKEY *import_key(const Algorithm *alg, const char *parameter,\n const ErlNifBinary *bytes, int selection) {\n EVP_PKEY *key = NULL;\n EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_name(NULL, alg->name, NULL);\n OSSL_PARAM params[] = {\n OSSL_PARAM_construct_octet_string(parameter, bytes->data, bytes->size),\n OSSL_PARAM_construct_end()\n };\n if (!ctx || EVP_PKEY_fromdata_init(ctx) <= 0\n || EVP_PKEY_fromdata(ctx, &key, selection, params) <= 0) {\n EVP_PKEY_free(key);\n key = NULL;\n }\n EVP_PKEY_CTX_free(ctx);\n return key;\n}\n\nstatic ERL_NIF_TERM expand(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {\n const Algorithm *alg;\n ErlNifBinary seed, pub = {0}, priv = {0};\n EVP_PKEY_CTX *ctx = NULL;\n EVP_PKEY *key = NULL;\n size_t written;\n int pub_allocated = 0, priv_allocated = 0, ok = 0;\n ERL_NIF_TERM result;\n if (argc != 2 || !(alg = algorithm(env, argv[0]))\n || !enif_inspect_binary(env, argv[1], &seed) || seed.size != alg->seed)\n return enif_make_badarg(env);\n ERR_clear_error();\n if (alg == &algorithms[2]) {\n /* SLH's seed parameter is used only for the NIST key-generation tests. */\n OSSL_PARAM params[] = {\n OSSL_PARAM_construct_octet_string(\"seed\", seed.data, seed.size),\n OSSL_PARAM_construct_end()\n };\n ctx = EVP_PKEY_CTX_new_from_name(NULL, alg->name, NULL);\n if (!ctx || EVP_PKEY_keygen_init(ctx) <= 0\n || EVP_PKEY_CTX_set_params(ctx, params) <= 0\n || EVP_PKEY_generate(ctx, &key) <= 0) goto done;\n } else {\n key = import_key(alg, \"seed\", &seed, EVP_PKEY_KEYPAIR);\n if (!key) goto done;\n }\n if (!(pub_allocated = enif_alloc_binary(alg->public_key, &pub))\n || !(priv_allocated = enif_alloc_binary(alg->private_key, &priv))) goto done;\n if (!EVP_PKEY_get_octet_string_param(key, OSSL_PKEY_PARAM_PUB_KEY,\n pub.data, pub.size, &written) || written != pub.size\n || !EVP_PKEY_get_octet_string_param(key, OSSL_PKEY_PARAM_PRIV_KEY,\n priv.data, priv.size, &written) || written != priv.size) goto done;\n ok = 1;\ndone:\n EVP_PKEY_free(key);\n EVP_PKEY_CTX_free(ctx);\n if (ok) {\n result = enif_make_tuple2(env, enif_make_binary(env, &pub), enif_make_binary(env, &priv));\n ERR_clear_error();\n return result;\n }\n if (pub_allocated) enif_release_binary(&pub);\n if (priv_allocated) { OPENSSL_cleanse(priv.data, priv.size); enif_release_binary(&priv); }\n return failure(env, \"expand_seed\");\n}\n\n/* FIPS 203 deterministic encapsulation for known-answer tests only. */\nstatic ERL_NIF_TERM encapsulate_test(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {\n ErlNifBinary pub, randomness, ciphertext = {0}, secret = {0};\n EVP_PKEY *key = NULL;\n EVP_PKEY_CTX *ctx = NULL;\n size_t ciphertext_size = 1088, secret_size = 32;\n int ciphertext_allocated = 0, secret_allocated = 0, ok = 0;\n ERL_NIF_TERM result;\n if (argc != 2 || !enif_inspect_binary(env, argv[0], &pub) || pub.size != 1184\n || !enif_inspect_binary(env, argv[1], &randomness) || randomness.size != 32)\n return enif_make_badarg(env);\n ERR_clear_error();\n OSSL_PARAM params[] = {\n OSSL_PARAM_construct_octet_string(OSSL_KEM_PARAM_IKME, randomness.data, randomness.size),\n OSSL_PARAM_construct_end()\n };\n key = import_key(&algorithms[0], OSSL_PKEY_PARAM_PUB_KEY, &pub, EVP_PKEY_PUBLIC_KEY);\n if (!key || !(ctx = EVP_PKEY_CTX_new_from_pkey(NULL, key, NULL))\n || EVP_PKEY_encapsulate_init(ctx, params) <= 0) goto done;\n if (!(ciphertext_allocated = enif_alloc_binary(ciphertext_size, &ciphertext))\n || !(secret_allocated = enif_alloc_binary(secret_size, &secret))) goto done;\n if (EVP_PKEY_encapsulate(ctx, ciphertext.data, &ciphertext_size, secret.data, &secret_size) <= 0\n || ciphertext_size != ciphertext.size || secret_size != secret.size) goto done;\n ok = 1;\ndone:\n EVP_PKEY_CTX_free(ctx);\n EVP_PKEY_free(key);\n if (ok) {\n result = enif_make_tuple2(env, enif_make_binary(env, &ciphertext), enif_make_binary(env, &secret));\n ERR_clear_error();\n return result;\n }\n if (ciphertext_allocated) enif_release_binary(&ciphertext);\n if (secret_allocated) { OPENSSL_cleanse(secret.data, secret.size); enif_release_binary(&secret); }\n return failure(env, \"encapsulate_test\");\n}\n\nstatic ERL_NIF_TERM sign_context(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {\n const Algorithm *alg;\n ErlNifBinary secret, message, context, signature = {0};\n EVP_PKEY *key = NULL;\n EVP_PKEY_CTX *ctx = NULL;\n EVP_SIGNATURE *scheme = NULL;\n int deterministic, allocated = 0, ok = 0;\n size_t length;\n ERL_NIF_TERM result;\n if (argc != 5 || !(alg = algorithm(env, argv[0])) || !alg->signature\n || !enif_inspect_binary(env, argv[1], &secret)\n || secret.size != (alg == &algorithms[1] ? alg->seed : alg->private_key)\n || !enif_inspect_binary(env, argv[2], &message)\n || !enif_inspect_binary(env, argv[3], &context) || context.size > 255)\n return enif_make_badarg(env);\n if (enif_is_identical(argv[4], enif_make_atom(env, \"true\"))) deterministic = 1;\n else if (enif_is_identical(argv[4], enif_make_atom(env, \"false\"))) deterministic = 0;\n else return enif_make_badarg(env);\n ERR_clear_error();\n OSSL_PARAM params[] = {\n OSSL_PARAM_construct_octet_string(OSSL_SIGNATURE_PARAM_CONTEXT_STRING, context.data, context.size),\n OSSL_PARAM_construct_int(OSSL_SIGNATURE_PARAM_DETERMINISTIC, &deterministic),\n OSSL_PARAM_construct_end()\n };\n key = import_key(alg, alg == &algorithms[1] ? \"seed\" : OSSL_PKEY_PARAM_PRIV_KEY,\n &secret, EVP_PKEY_KEYPAIR);\n if (!key || !(ctx = EVP_PKEY_CTX_new_from_pkey(NULL, key, NULL))\n || !(scheme = EVP_SIGNATURE_fetch(NULL, alg->name, NULL))\n || EVP_PKEY_sign_message_init(ctx, scheme, params) <= 0) goto done;\n length = alg->signature;\n if (!(allocated = enif_alloc_binary(length, &signature))) goto done;\n if (EVP_PKEY_sign(ctx, signature.data, &length, message.data, message.size) <= 0\n || length != signature.size) goto done;\n ok = 1;\ndone:\n EVP_SIGNATURE_free(scheme);\n EVP_PKEY_CTX_free(ctx);\n EVP_PKEY_free(key);\n if (ok) {\n result = enif_make_binary(env, &signature);\n ERR_clear_error();\n return result;\n }\n if (allocated) enif_release_binary(&signature);\n return failure(env, \"sign_context\");\n}\n\nstatic ERL_NIF_TERM verify_context(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {\n const Algorithm *alg;\n ErlNifBinary pub, message, signature, context;\n EVP_PKEY *key = NULL;\n EVP_PKEY_CTX *ctx = NULL;\n EVP_SIGNATURE *scheme = NULL;\n int verified = -1;\n if (argc != 5 || !(alg = algorithm(env, argv[0])) || !alg->signature\n || !enif_inspect_binary(env, argv[1], &pub)\n || !enif_inspect_binary(env, argv[2], &message)\n || !enif_inspect_binary(env, argv[3], &signature)\n || !enif_inspect_binary(env, argv[4], &context)) return enif_make_badarg(env);\n if (pub.size != alg->public_key || signature.size != alg->signature || context.size > 255)\n return enif_make_atom(env, \"false\");\n ERR_clear_error();\n OSSL_PARAM params[] = {\n OSSL_PARAM_construct_octet_string(OSSL_SIGNATURE_PARAM_CONTEXT_STRING, context.data, context.size),\n OSSL_PARAM_construct_end()\n };\n key = import_key(alg, OSSL_PKEY_PARAM_PUB_KEY, &pub, EVP_PKEY_PUBLIC_KEY);\n if (!key || !(ctx = EVP_PKEY_CTX_new_from_pkey(NULL, key, NULL))\n || !(scheme = EVP_SIGNATURE_fetch(NULL, alg->name, NULL))\n || EVP_PKEY_verify_message_init(ctx, scheme, params) <= 0) goto done;\n verified = EVP_PKEY_verify(ctx, signature.data, signature.size, message.data, message.size);\ndone:\n EVP_SIGNATURE_free(scheme);\n EVP_PKEY_CTX_free(ctx);\n EVP_PKEY_free(key);\n if (verified < 0) return failure(env, \"verify_context\");\n ERR_clear_error();\n return enif_make_atom(env, verified == 1 ? \"true\" : \"false\");\n}\n\nstatic int load(ErlNifEnv *env, void **private_data, ERL_NIF_TERM info) {\n unsigned int expected;\n (void)private_data;\n return !enif_get_uint(env, info, &expected) || expected != OPENSSL_VERSION_MAJOR\n || OPENSSL_version_major() != expected || OpenSSL_version_num() < 0x30500000L;\n}\n\n/* Cover restores the original Erlang module after instrumentation. The\n * bridge holds no private state or resource types across calls, so each\n * module instance can use the same library after the ordinary ABI check. */\nstatic int upgrade(ErlNifEnv *env, void **private_data, void **old_private_data, ERL_NIF_TERM info) {\n (void)old_private_data;\n return load(env, private_data, info);\n}\n\nstatic ErlNifFunc functions[] = {\n {\"expand\", 2, expand, ERL_NIF_DIRTY_JOB_CPU_BOUND},\n {\"encapsulate_test\", 2, encapsulate_test, ERL_NIF_DIRTY_JOB_CPU_BOUND},\n {\"sign_context\", 5, sign_context, ERL_NIF_DIRTY_JOB_CPU_BOUND},\n {\"verify_context\", 5, verify_context, ERL_NIF_DIRTY_JOB_CPU_BOUND}\n};\nERL_NIF_INIT(lawspec_beam_crypto_native, functions, load, NULL, upgrade, NULL)\n",
11
11
  "build": "#!/usr/bin/env escript\n%%! -noshell\n%% Build once before Rebar/Mix/Gleam compilation; no compiler runs at application\n%% startup. CC names one executable. LAWSPEC_OPENSSL_PREFIX selects a development\n%% installation matching OTP's OpenSSL major version (3.5+).\n%% ref:DEC-typed-core-boundary\n-mode(compile).\n\nmain(Arguments) ->\n try\n Project = case Arguments of\n [] -> filename:dirname(filename:absname(escript:script_name()));\n [Directory] -> filename:absname(Directory);\n _ -> fail(\"usage: escript lawspec_crypto_build.escript [project-directory]\")\n end,\n build(Project)\n catch\n throw:{build_error, Message} -> io:format(standard_error, \"LawSpec crypto: ~ts~n\", [Message]), halt(1);\n error:Reason -> io:format(standard_error, \"LawSpec crypto build failed: ~tp~n\", [Reason]), halt(1)\n end.\n\nbuild(Project) ->\n case list_to_integer(erlang:system_info(otp_release)) >= 29 of\n true -> ok;\n false -> fail(\"Erlang/OTP 29 or newer is required\")\n end,\n [{<<\"OpenSSL\">>, Version, Description}] = crypto:info_lib(),\n Major = Version bsr 28,\n MissingAlgorithms = lists:append([Expected -- crypto:supports(Kind) || {Kind, Expected} <-\n [{kems, [mlkem768]}, {public_keys, [mldsa65, slh_dsa_shake_128f]},\n {hashs, [sha3_256, shake256]}, {ciphers, [aes_256_gcm]}]]),\n case MissingAlgorithms of\n [] -> ok;\n Missing -> fail(io_lib:format(\"OTP crypto lacks ~tp; install OTP with OpenSSL 3.5+\", [Missing]))\n end,\n Compiler = executable(env(\"CC\", \"cc\")),\n {Include, Library, ProviderVersion} = openssl(Major),\n OtpInclude = filename:join([code:root_dir(), \"usr\", \"include\"]),\n Source = filename:join([Project, \"priv\", \"lawspec_crypto_native.c\"]),\n Output = filename:join([Project, \"priv\", \"lawspec_crypto_native.so\"]),\n Stamp = Output ++ \".build\",\n SourceBytes = read(Source),\n Args = [\"-std=c11\", \"-O2\", \"-Wall\", \"-Wextra\", \"-Werror\", \"-fPIC\", \"-shared\"] ++\n platform_flags() ++ [\"-DLAWSPEC_OPENSSL_MAJOR=\" ++ integer_to_list(Major),\n \"-I\" ++ OtpInclude, \"-I\" ++ Include, Source, \"-L\" ++ Library,\n \"-Xlinker\", \"-rpath\", \"-Xlinker\", Library, \"-lcrypto\"],\n Fingerprint = crypto:hash(sha3_256, term_to_binary({SourceBytes,\n read(escript:script_name()), read(filename:join(Include, \"openssl/opensslv.h\")),\n read(filename:join(OtpInclude, \"erl_nif.h\")),\n erlang:system_info(system_architecture), erlang:system_info(nif_version),\n Version, Description, ProviderVersion, Compiler, Args})),\n case current(Stamp, Output, Fingerprint) of\n true -> ok;\n false ->\n %% A failed or concurrent build cannot replace a working library.\n Temporary = Output ++ \".\" ++ os:getpid() ++ \".tmp\",\n try\n checked(Compiler, Args ++ [\"-o\", Temporary]),\n ok = file:rename(Temporary, Output),\n ok = file:write_file(Stamp, term_to_binary({Fingerprint, crypto:hash(sha3_256, read(Output))})),\n io:format(\"Built LawSpec crypto bridge (~ts).~n\", [Description])\n after\n file:delete(Temporary)\n end\n end.\n\nplatform_flags() ->\n case os:type() of\n {unix, darwin} -> [\"-undefined\", \"dynamic_lookup\"];\n {unix, _} -> [];\n _ -> fail(\"the crypto bridge build requires a Unix C toolchain; use WSL on Windows\")\n end.\n\nopenssl(Major) ->\n case os:getenv(\"LAWSPEC_OPENSSL_PREFIX\") of\n false -> discover_openssl(Major);\n Prefix -> prefix(Prefix, \"explicit prefix\")\n end.\n\ndiscover_openssl(Major) ->\n case os:find_executable(\"pkg-config\") of\n false -> homebrew_openssl(Major);\n Pkg ->\n case run(Pkg, [\"--modversion\", \"libcrypto\"]) of\n {0, Text} ->\n Version = string:trim(binary_to_list(Text)),\n case string:prefix(Version, integer_to_list(Major) ++ \".\") of\n nomatch -> homebrew_openssl(Major);\n _ -> {query(Pkg, [\"--variable=includedir\", \"libcrypto\"]),\n query(Pkg, [\"--variable=libdir\", \"libcrypto\"]), Version}\n end;\n _ -> homebrew_openssl(Major)\n end\n end.\n\nhomebrew_openssl(Major) ->\n case os:find_executable(\"brew\") of\n false -> missing_openssl(Major);\n Brew ->\n case run(Brew, [\"--prefix\", \"openssl@\" ++ integer_to_list(Major)]) of\n {0, Text} -> prefix(string:trim(binary_to_list(Text)), \"Homebrew\");\n _ -> missing_openssl(Major)\n end\n end.\n\nprefix(Prefix, Origin) ->\n Absolute = filename:absname(Prefix),\n Include = filename:join(Absolute, \"include\"),\n case filelib:is_regular(filename:join(Include, \"openssl/evp.h\")) of\n true ->\n Libraries = [filename:join(Absolute, Subdir) || Subdir <- [\"lib\", \"lib64\"],\n lists:any(fun(Name) -> filelib:is_regular(filename:join([Absolute, Subdir, Name])) end,\n [\"libcrypto.so\", \"libcrypto.dylib\"])],\n case Libraries of\n [Library | _] -> {Include, Library, Origin};\n [] -> fail(\"OpenSSL shared library missing under \" ++ Absolute)\n end;\n false -> fail(\"OpenSSL headers missing under \" ++ Absolute)\n end.\n\nmissing_openssl(Major) -> fail(io_lib:format(\n \"install pkg-config and OpenSSL ~B development headers/libraries (3.5+), or set LAWSPEC_OPENSSL_PREFIX to that installation\", [Major])).\n\ncurrent(Stamp, Output, Fingerprint) ->\n case {file:read_file(Stamp), file:read_file(Output)} of\n {{ok, StampBytes}, {ok, OutputBytes}} ->\n try binary_to_term(StampBytes, [safe]) =:= {Fingerprint, crypto:hash(sha3_256, OutputBytes)}\n catch error:badarg -> false end;\n _ -> false\n end.\n\nenv(Key, Default) -> case os:getenv(Key) of false -> Default; Value -> Value end.\nexecutable(Name) -> case os:find_executable(Name) of\n false -> fail(\"executable not found: \" ++ Name ++ \" (CC must name one compiler executable)\");\n Path -> Path\nend.\n\nread(Path) -> case file:read_file(Path) of\n {ok, Bytes} -> Bytes;\n {error, Reason} -> fail(io_lib:format(\"cannot read ~ts: ~tp\", [Path, Reason]))\nend.\n\nquery(Command, Args) -> string:trim(binary_to_list(checked(Command, Args))).\nchecked(Command, Args) -> case run(Command, Args) of\n {0, Output} -> Output;\n {Status, Output} -> fail(io_lib:format(\"~ts exited ~B:~n~ts\", [Command, Status, Output]))\nend.\n\n%% Argument arrays, never a shell: project and installation paths may contain\n%% spaces, quotes, dollar signs or other shell metacharacters.\nrun(Command, Args) ->\n Port = open_port({spawn_executable, Command}, [binary, exit_status, use_stdio, stderr_to_stdout, {args, Args}]),\n collect(Port, []).\n\ncollect(Port, Parts) ->\n receive\n {Port, {data, Bytes}} -> collect(Port, [Bytes | Parts]);\n {Port, {exit_status, Status}} -> {Status, iolist_to_binary(lists:reverse(Parts))}\n end.\n\nfail(Message) -> throw({build_error, lists:flatten(Message)}).\n"
12
12
  };