@voxgig/sdkgen-langpack 0.0.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 (300) hide show
  1. package/.sdk/model/target/dart.aon +63 -0
  2. package/.sdk/model/target/haskell.aon +72 -0
  3. package/.sdk/model/target/lean.aon +91 -0
  4. package/.sdk/src/cmp/dart/Config_dart.ts +248 -0
  5. package/.sdk/src/cmp/dart/EntityBase_dart.ts +34 -0
  6. package/.sdk/src/cmp/dart/EntityOperation_dart.ts +43 -0
  7. package/.sdk/src/cmp/dart/EntityTypes_dart.ts +207 -0
  8. package/.sdk/src/cmp/dart/Entity_dart.ts +87 -0
  9. package/.sdk/src/cmp/dart/Gitignore_dart.ts +34 -0
  10. package/.sdk/src/cmp/dart/MainEntity_dart.ts +33 -0
  11. package/.sdk/src/cmp/dart/Main_dart.ts +178 -0
  12. package/.sdk/src/cmp/dart/Package_dart.ts +82 -0
  13. package/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +177 -0
  14. package/.sdk/src/cmp/dart/ReadmeExamplesTest_dart.ts +238 -0
  15. package/.sdk/src/cmp/dart/ReadmeExplanation_dart.ts +53 -0
  16. package/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +152 -0
  17. package/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +59 -0
  18. package/.sdk/src/cmp/dart/ReadmeIntro_dart.ts +65 -0
  19. package/.sdk/src/cmp/dart/ReadmeModel_dart.ts +151 -0
  20. package/.sdk/src/cmp/dart/ReadmeOptions_dart.ts +63 -0
  21. package/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +225 -0
  22. package/.sdk/src/cmp/dart/ReadmeRef_dart.ts +397 -0
  23. package/.sdk/src/cmp/dart/ReadmeTopHowto_dart.ts +24 -0
  24. package/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +106 -0
  25. package/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +78 -0
  26. package/.sdk/src/cmp/dart/SdkError_dart.ts +42 -0
  27. package/.sdk/src/cmp/dart/TestDirect_dart.ts +516 -0
  28. package/.sdk/src/cmp/dart/TestEntity_dart.ts +628 -0
  29. package/.sdk/src/cmp/dart/Test_dart.ts +138 -0
  30. package/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +98 -0
  31. package/.sdk/src/cmp/dart/fragment/Config.fragment.dart +70 -0
  32. package/.sdk/src/cmp/dart/fragment/Direct.test.fragment.dart +25 -0
  33. package/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +29 -0
  34. package/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +28 -0
  35. package/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +302 -0
  36. package/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +98 -0
  37. package/.sdk/src/cmp/dart/fragment/EntityListOp.fragment.dart +90 -0
  38. package/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +102 -0
  39. package/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +108 -0
  40. package/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +102 -0
  41. package/.sdk/src/cmp/dart/fragment/Main.fragment.dart +339 -0
  42. package/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +26 -0
  43. package/.sdk/src/cmp/dart/tsconfig.json +15 -0
  44. package/.sdk/src/cmp/dart/utility_dart.ts +155 -0
  45. package/.sdk/src/cmp/haskell/Config_haskell.ts +98 -0
  46. package/.sdk/src/cmp/haskell/Entity_haskell.ts +13 -0
  47. package/.sdk/src/cmp/haskell/Gitignore_haskell.ts +27 -0
  48. package/.sdk/src/cmp/haskell/Main_haskell.ts +123 -0
  49. package/.sdk/src/cmp/haskell/Package_haskell.ts +60 -0
  50. package/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +186 -0
  51. package/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +135 -0
  52. package/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +48 -0
  53. package/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +168 -0
  54. package/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +51 -0
  55. package/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +67 -0
  56. package/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +162 -0
  57. package/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +74 -0
  58. package/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +241 -0
  59. package/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +408 -0
  60. package/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +31 -0
  61. package/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +104 -0
  62. package/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +80 -0
  63. package/.sdk/src/cmp/haskell/Test_haskell.ts +297 -0
  64. package/.sdk/src/cmp/haskell/tsconfig.json +15 -0
  65. package/.sdk/src/cmp/haskell/utility_haskell.ts +166 -0
  66. package/.sdk/src/cmp/lean/Config_lean.ts +93 -0
  67. package/.sdk/src/cmp/lean/Entity_lean.ts +9 -0
  68. package/.sdk/src/cmp/lean/Gitignore_lean.ts +18 -0
  69. package/.sdk/src/cmp/lean/Main_lean.ts +120 -0
  70. package/.sdk/src/cmp/lean/Package_lean.ts +93 -0
  71. package/.sdk/src/cmp/lean/ReadmeEntity_lean.ts +29 -0
  72. package/.sdk/src/cmp/lean/ReadmeExplanation_lean.ts +19 -0
  73. package/.sdk/src/cmp/lean/ReadmeHowto_lean.ts +25 -0
  74. package/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +39 -0
  75. package/.sdk/src/cmp/lean/ReadmeIntro_lean.ts +25 -0
  76. package/.sdk/src/cmp/lean/ReadmeModel_lean.ts +24 -0
  77. package/.sdk/src/cmp/lean/ReadmeOptions_lean.ts +22 -0
  78. package/.sdk/src/cmp/lean/ReadmeQuick_lean.ts +50 -0
  79. package/.sdk/src/cmp/lean/ReadmeRef_lean.ts +40 -0
  80. package/.sdk/src/cmp/lean/ReadmeTopHowto_lean.ts +16 -0
  81. package/.sdk/src/cmp/lean/ReadmeTopQuick_lean.ts +23 -0
  82. package/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +19 -0
  83. package/.sdk/src/cmp/lean/Test_lean.ts +261 -0
  84. package/.sdk/src/cmp/lean/utility_lean.ts +129 -0
  85. package/.sdk/tm/dart/LICENSE +22 -0
  86. package/.sdk/tm/dart/Makefile +50 -0
  87. package/.sdk/tm/dart/lib/Context.dart +150 -0
  88. package/.sdk/tm/dart/lib/Control.dart +15 -0
  89. package/.sdk/tm/dart/lib/Operation.dart +31 -0
  90. package/.sdk/tm/dart/lib/Point.dart +51 -0
  91. package/.sdk/tm/dart/lib/Response.dart +32 -0
  92. package/.sdk/tm/dart/lib/Result.dart +39 -0
  93. package/.sdk/tm/dart/lib/Spec.dart +49 -0
  94. package/.sdk/tm/dart/lib/feature/audit/AuditFeature.dart +103 -0
  95. package/.sdk/tm/dart/lib/feature/base/BaseFeature.dart +76 -0
  96. package/.sdk/tm/dart/lib/feature/cache/CacheFeature.dart +152 -0
  97. package/.sdk/tm/dart/lib/feature/clienttrack/ClienttrackFeature.dart +104 -0
  98. package/.sdk/tm/dart/lib/feature/cost/CostFeature.dart +446 -0
  99. package/.sdk/tm/dart/lib/feature/debug/DebugFeature.dart +153 -0
  100. package/.sdk/tm/dart/lib/feature/idempotency/IdempotencyFeature.dart +92 -0
  101. package/.sdk/tm/dart/lib/feature/log/LogFeature.dart +85 -0
  102. package/.sdk/tm/dart/lib/feature/metrics/MetricsFeature.dart +103 -0
  103. package/.sdk/tm/dart/lib/feature/netsim/NetsimFeature.dart +186 -0
  104. package/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +240 -0
  105. package/.sdk/tm/dart/lib/feature/proxy/ProxyFeature.dart +118 -0
  106. package/.sdk/tm/dart/lib/feature/ratelimit/RatelimitFeature.dart +103 -0
  107. package/.sdk/tm/dart/lib/feature/rbac/RbacFeature.dart +121 -0
  108. package/.sdk/tm/dart/lib/feature/retry/RetryFeature.dart +155 -0
  109. package/.sdk/tm/dart/lib/feature/secrets/SecretsFeature.dart +649 -0
  110. package/.sdk/tm/dart/lib/feature/secrets/plugin/capability.dart +105 -0
  111. package/.sdk/tm/dart/lib/feature/secrets/plugin/catalog.dart +46 -0
  112. package/.sdk/tm/dart/lib/feature/secrets/plugin/config.dart +297 -0
  113. package/.sdk/tm/dart/lib/feature/secrets/plugin/depend.dart +198 -0
  114. package/.sdk/tm/dart/lib/feature/secrets/plugin/env.dart +144 -0
  115. package/.sdk/tm/dart/lib/feature/secrets/plugin/export.dart +58 -0
  116. package/.sdk/tm/dart/lib/feature/secrets/plugin/graph.dart +160 -0
  117. package/.sdk/tm/dart/lib/feature/secrets/plugin/host.dart +1067 -0
  118. package/.sdk/tm/dart/lib/feature/secrets/plugin/order.dart +172 -0
  119. package/.sdk/tm/dart/lib/feature/secrets/plugin/plugin.dart +23 -0
  120. package/.sdk/tm/dart/lib/feature/secrets/plugin/point.dart +117 -0
  121. package/.sdk/tm/dart/lib/feature/secrets/plugin/ref.dart +105 -0
  122. package/.sdk/tm/dart/lib/feature/secrets/plugin/resolve.dart +58 -0
  123. package/.sdk/tm/dart/lib/feature/secrets/plugin/types.dart +201 -0
  124. package/.sdk/tm/dart/lib/feature/secrets/plugin/version.dart +116 -0
  125. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/aws.dart +285 -0
  126. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/azuresecrets.dart +178 -0
  127. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/boru.dart +145 -0
  128. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/crypto.dart +194 -0
  129. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/doppler.dart +101 -0
  130. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/gcpsecrets.dart +143 -0
  131. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/hashicorp.dart +190 -0
  132. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/httpjson.dart +363 -0
  133. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/infisical.dart +149 -0
  134. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/onepassword.dart +146 -0
  135. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/secretspec.dart +116 -0
  136. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/sigv4.dart +237 -0
  137. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/addr.dart +138 -0
  138. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/json.dart +276 -0
  139. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/provider.dart +31 -0
  140. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/providers.dart +243 -0
  141. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/sekreto.dart +730 -0
  142. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/spec.dart +200 -0
  143. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/support.dart +217 -0
  144. package/.sdk/tm/dart/lib/feature/streaming/StreamingFeature.dart +97 -0
  145. package/.sdk/tm/dart/lib/feature/telemetry/TelemetryFeature.dart +136 -0
  146. package/.sdk/tm/dart/lib/feature/test/TestFeature.dart +328 -0
  147. package/.sdk/tm/dart/lib/feature/timeout/TimeoutFeature.dart +104 -0
  148. package/.sdk/tm/dart/lib/utility/CleanUtility.dart +12 -0
  149. package/.sdk/tm/dart/lib/utility/DoneUtility.dart +18 -0
  150. package/.sdk/tm/dart/lib/utility/ErrUtility.dart +46 -0
  151. package/.sdk/tm/dart/lib/utility/FeatureAddUtility.dart +35 -0
  152. package/.sdk/tm/dart/lib/utility/FeatureHookUtility.dart +20 -0
  153. package/.sdk/tm/dart/lib/utility/FeatureInitUtility.dart +9 -0
  154. package/.sdk/tm/dart/lib/utility/FetcherUtility.dart +104 -0
  155. package/.sdk/tm/dart/lib/utility/GraphqlUtility.dart +162 -0
  156. package/.sdk/tm/dart/lib/utility/MakeContextUtility.dart +6 -0
  157. package/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +71 -0
  158. package/.sdk/tm/dart/lib/utility/MakeFetchDefUtility.dart +42 -0
  159. package/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +233 -0
  160. package/.sdk/tm/dart/lib/utility/MakePointUtility.dart +130 -0
  161. package/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +66 -0
  162. package/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +59 -0
  163. package/.sdk/tm/dart/lib/utility/MakeResultUtility.dart +49 -0
  164. package/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +77 -0
  165. package/.sdk/tm/dart/lib/utility/MakeUrlUtility.dart +51 -0
  166. package/.sdk/tm/dart/lib/utility/ParamUtility.dart +56 -0
  167. package/.sdk/tm/dart/lib/utility/PrepareAuthUtility.dart +46 -0
  168. package/.sdk/tm/dart/lib/utility/PrepareBodyUtility.dart +19 -0
  169. package/.sdk/tm/dart/lib/utility/PrepareHeadersUtility.dart +11 -0
  170. package/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +30 -0
  171. package/.sdk/tm/dart/lib/utility/PrepareParamsUtility.dart +23 -0
  172. package/.sdk/tm/dart/lib/utility/PreparePathUtility.dart +9 -0
  173. package/.sdk/tm/dart/lib/utility/PrepareQueryUtility.dart +18 -0
  174. package/.sdk/tm/dart/lib/utility/ResultBasicUtility.dart +29 -0
  175. package/.sdk/tm/dart/lib/utility/ResultBodyUtility.dart +15 -0
  176. package/.sdk/tm/dart/lib/utility/ResultHeadersUtility.dart +18 -0
  177. package/.sdk/tm/dart/lib/utility/StructUtility.dart +127 -0
  178. package/.sdk/tm/dart/lib/utility/TransformRequestUtility.dart +28 -0
  179. package/.sdk/tm/dart/lib/utility/TransformResponseUtility.dart +44 -0
  180. package/.sdk/tm/dart/lib/utility/Utility.dart +239 -0
  181. package/.sdk/tm/dart/lib/utility/voxgig_struct.dart +2462 -0
  182. package/.sdk/tm/dart/src/feature/README.md +3 -0
  183. package/.sdk/tm/dart/src/feature/audit/.gitkeep +0 -0
  184. package/.sdk/tm/dart/src/feature/base/.gitkeep +0 -0
  185. package/.sdk/tm/dart/src/feature/cache/.gitkeep +0 -0
  186. package/.sdk/tm/dart/src/feature/clienttrack/.gitkeep +0 -0
  187. package/.sdk/tm/dart/src/feature/cost/.gitkeep +0 -0
  188. package/.sdk/tm/dart/src/feature/debug/.gitkeep +0 -0
  189. package/.sdk/tm/dart/src/feature/idempotency/.gitkeep +0 -0
  190. package/.sdk/tm/dart/src/feature/log/.gitkeep +0 -0
  191. package/.sdk/tm/dart/src/feature/metrics/.gitkeep +0 -0
  192. package/.sdk/tm/dart/src/feature/netsim/.gitkeep +0 -0
  193. package/.sdk/tm/dart/src/feature/paging/.gitkeep +0 -0
  194. package/.sdk/tm/dart/src/feature/proxy/.gitkeep +0 -0
  195. package/.sdk/tm/dart/src/feature/ratelimit/.gitkeep +0 -0
  196. package/.sdk/tm/dart/src/feature/rbac/.gitkeep +0 -0
  197. package/.sdk/tm/dart/src/feature/retry/.gitkeep +0 -0
  198. package/.sdk/tm/dart/src/feature/secrets/.gitkeep +0 -0
  199. package/.sdk/tm/dart/src/feature/streaming/.gitkeep +0 -0
  200. package/.sdk/tm/dart/src/feature/telemetry/.gitkeep +0 -0
  201. package/.sdk/tm/dart/src/feature/test/.gitkeep +0 -0
  202. package/.sdk/tm/dart/src/feature/timeout/.gitkeep +0 -0
  203. package/.sdk/tm/dart/test/custom_test.dart +65 -0
  204. package/.sdk/tm/dart/test/exists_test.dart +12 -0
  205. package/.sdk/tm/dart/test/feature/harness.dart +347 -0
  206. package/.sdk/tm/dart/test/feature/secrets/secrets_test.dart +1107 -0
  207. package/.sdk/tm/dart/test/feature_test.dart +1193 -0
  208. package/.sdk/tm/dart/test/harness.dart +153 -0
  209. package/.sdk/tm/dart/test/netsim_test.dart +48 -0
  210. package/.sdk/tm/dart/test/omni.dart +520 -0
  211. package/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
  212. package/.sdk/tm/dart/test/pipeline_test.dart +608 -0
  213. package/.sdk/tm/dart/test/primary_test.dart +476 -0
  214. package/.sdk/tm/dart/test/sdk-test-control.json +19 -0
  215. package/.sdk/tm/dart/test/struct_test.dart +468 -0
  216. package/.sdk/tm/dart/test/utility.dart +198 -0
  217. package/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
  218. package/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
  219. package/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
  220. package/.sdk/tm/haskell/LICENSE +21 -0
  221. package/.sdk/tm/haskell/Makefile +22 -0
  222. package/.sdk/tm/haskell/VERSION +1 -0
  223. package/.sdk/tm/haskell/src/SdkFeatures.hs +1440 -0
  224. package/.sdk/tm/haskell/src/SdkHelpers.hs +337 -0
  225. package/.sdk/tm/haskell/src/SdkJson.hs +111 -0
  226. package/.sdk/tm/haskell/src/SdkRuntime.hs +1279 -0
  227. package/.sdk/tm/haskell/src/SdkTypes.hs +195 -0
  228. package/.sdk/tm/haskell/src/VoxgigStruct.hs +2299 -0
  229. package/.sdk/tm/haskell/src/Vregex.hs +237 -0
  230. package/.sdk/tm/haskell/src/feature/README.md +5 -0
  231. package/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
  232. package/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
  233. package/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
  234. package/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
  235. package/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
  236. package/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
  237. package/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
  238. package/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
  239. package/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
  240. package/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
  241. package/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
  242. package/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
  243. package/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
  244. package/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
  245. package/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
  246. package/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
  247. package/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
  248. package/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
  249. package/.sdk/tm/haskell/test/Harness.hs +281 -0
  250. package/.sdk/tm/haskell/test/OmniResolver.hs +252 -0
  251. package/.sdk/tm/haskell/test/Runner.hs +49 -0
  252. package/.sdk/tm/haskell/test/StructCorpus.hs +449 -0
  253. package/.sdk/tm/haskell/test/TCustomUtility.hs +38 -0
  254. package/.sdk/tm/haskell/test/TFeature.hs +794 -0
  255. package/.sdk/tm/haskell/test/TNetsim.hs +50 -0
  256. package/.sdk/tm/haskell/test/TPipeline.hs +334 -0
  257. package/.sdk/tm/haskell/test/TPrimaryCorpus.hs +263 -0
  258. package/.sdk/tm/haskell/test/TPrimaryUtility.hs +386 -0
  259. package/.sdk/tm/haskell/test/Testutil.hs +59 -0
  260. package/.sdk/tm/haskell/test/vendor/omni/Omni.hs +1147 -0
  261. package/.sdk/tm/lean/LICENSE +21 -0
  262. package/.sdk/tm/lean/Makefile +32 -0
  263. package/.sdk/tm/lean/VERSION +1 -0
  264. package/.sdk/tm/lean/src/SdkFeature.lean +171 -0
  265. package/.sdk/tm/lean/src/SdkFeatures.lean +787 -0
  266. package/.sdk/tm/lean/src/SdkJson.lean +134 -0
  267. package/.sdk/tm/lean/src/SdkRuntime.lean +374 -0
  268. package/.sdk/tm/lean/src/SdkUtility.lean +809 -0
  269. package/.sdk/tm/lean/src/VoxgigStruct.lean +2880 -0
  270. package/.sdk/tm/lean/src/Vregex.lean +412 -0
  271. package/.sdk/tm/lean/src/feature/README.md +5 -0
  272. package/.sdk/tm/lean/src/feature/audit/.gitkeep +0 -0
  273. package/.sdk/tm/lean/src/feature/base/.gitkeep +0 -0
  274. package/.sdk/tm/lean/src/feature/cache/.gitkeep +0 -0
  275. package/.sdk/tm/lean/src/feature/clienttrack/.gitkeep +0 -0
  276. package/.sdk/tm/lean/src/feature/cost/.gitkeep +0 -0
  277. package/.sdk/tm/lean/src/feature/debug/.gitkeep +0 -0
  278. package/.sdk/tm/lean/src/feature/idempotency/.gitkeep +0 -0
  279. package/.sdk/tm/lean/src/feature/log/.gitkeep +0 -0
  280. package/.sdk/tm/lean/src/feature/metrics/.gitkeep +0 -0
  281. package/.sdk/tm/lean/src/feature/netsim/.gitkeep +0 -0
  282. package/.sdk/tm/lean/src/feature/paging/.gitkeep +0 -0
  283. package/.sdk/tm/lean/src/feature/proxy/.gitkeep +0 -0
  284. package/.sdk/tm/lean/src/feature/ratelimit/.gitkeep +0 -0
  285. package/.sdk/tm/lean/src/feature/rbac/.gitkeep +0 -0
  286. package/.sdk/tm/lean/src/feature/retry/.gitkeep +0 -0
  287. package/.sdk/tm/lean/src/feature/streaming/.gitkeep +0 -0
  288. package/.sdk/tm/lean/src/feature/telemetry/.gitkeep +0 -0
  289. package/.sdk/tm/lean/src/feature/test/.gitkeep +0 -0
  290. package/.sdk/tm/lean/src/feature/timeout/.gitkeep +0 -0
  291. package/.sdk/tm/lean/test/OmniResolver.lean +358 -0
  292. package/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
  293. package/.sdk/tm/lean/test/StructCorpus.lean +368 -0
  294. package/.sdk/tm/lean/test/TFeature.lean +281 -0
  295. package/.sdk/tm/lean/test/TPrimaryUtility.lean +227 -0
  296. package/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
  297. package/LICENSE +21 -0
  298. package/README.md +104 -0
  299. package/package.json +78 -0
  300. package/sdkgen-package.json +22 -0
@@ -0,0 +1,794 @@
1
+ -- Feature behaviour tests. Each feature is driven through the mini operation
2
+ -- pipeline (Harness) against a mock transport, with injected clocks / idgen /
3
+ -- keygen so timing and id features are deterministic. Feature tracking is
4
+ -- inspected on client._<name> (trackGet); where a feature exposes no track
5
+ -- field the sent request (recordingServer) or the op result is asserted.
6
+ -- Mirrors the rust donor tests/feature_test.rs at the same depth.
7
+
8
+ {-# LANGUAGE ScopedTypeVariables #-}
9
+
10
+ module TFeature (tests) where
11
+
12
+ import Control.Monad (forM_)
13
+ import Data.IORef
14
+ import System.Environment (lookupEnv, setEnv, unsetEnv)
15
+
16
+ import VoxgigStruct (Value (..), emptyMap, emptyList, isNoval)
17
+ import SdkTypes
18
+ import SdkHelpers
19
+ import Harness
20
+ import Testutil
21
+
22
+ -- number field of a tracking bucket (absent -> -999)
23
+ bnum :: Value -> String -> IO Double
24
+ bnum m k = do v <- getp m k; pure (case v of VNum n -> n; _ -> -999)
25
+
26
+ -- length of a list-valued bucket field (absent -> 0)
27
+ blen :: Value -> String -> IO Int
28
+ blen m k = do v <- getp m k; case v of VList r -> length <$> readIORef r; _ -> pure 0
29
+
30
+ -- header on the op's final spec (features stamp spec.headers during PreRequest)
31
+ specHeader :: OpResult -> String -> IO Value
32
+ specHeader r name = do
33
+ sp <- readIORef (cSpec (orCtx r))
34
+ case sp of { VMap _ -> do { h <- getp sp "headers"; headerCI h name }; _ -> pure VNoval }
35
+
36
+ -- recorded (call n) fetchdef / header / url off a recordingServer
37
+ recAt :: IORef [Value] -> Int -> IO Value
38
+ recAt calls i = do cs <- readIORef calls; pure (if i >= 0 && i < length cs then cs !! i else VNoval)
39
+
40
+ recFetchdef :: IORef [Value] -> Int -> IO Value
41
+ recFetchdef calls i = do r <- recAt calls i; getp r "fetchdef"
42
+
43
+ recHeader :: IORef [Value] -> Int -> String -> IO Value
44
+ recHeader calls i name = do fd <- recFetchdef calls i; h <- getp fd "headers"; headerCI h name
45
+
46
+ recUrl :: IORef [Value] -> Int -> IO String
47
+ recUrl calls i = do r <- recAt calls i; getStrD r "url" ""
48
+
49
+ -- resmap status (feature failure surfaces status onto the result map)
50
+ resStatus :: OpResult -> IO Int
51
+ resStatus r = do st <- getp (orResult r) "status"; pure (toInt st)
52
+
53
+ resHeader :: OpResult -> String -> IO Value
54
+ resHeader r name = do h <- getp (orResult r) "headers"; case h of { VMap _ -> headerCI h name; _ -> pure VNoval }
55
+
56
+ startsWith :: String -> String -> Bool
57
+ startsWith pfx s = take (length pfx) s == pfx
58
+
59
+ endsW :: String -> String -> Bool
60
+ endsW suf s = length s >= length suf && drop (length s - length suf) s == suf
61
+
62
+ vfnStr :: (String -> String) -> Value
63
+ vfnStr f = VFunc (\_ v _ _ -> pure (VStr (f (vstring v))))
64
+
65
+ listVals :: Value -> IO [Value]
66
+ listVals v = case v of VList r -> readIORef r; _ -> pure []
67
+
68
+ tests :: Counters -> IO ()
69
+ tests c = do
70
+
71
+ ---------------------------------------------------------------- netsim
72
+ runTest c "feature.netsim_fixed_latency_then_delegate" $ do
73
+ clk <- makeClock
74
+ ex <- emptyMap; ctrl <- jo [("explain", ex)]
75
+ nopts <- jo [("latency", VNum 250), ("sleep", clockSleepFn clk)]
76
+ h <- makeClientH [("netsim", nopts)] Nothing []
77
+ res <- runOpH h (defaultOpArgs { oaCtrl = ctrl })
78
+ t <- clockNow clk
79
+ bucket <- trackGet (hClient h) "netsim"
80
+ calls <- bnum bucket "calls"
81
+ pure (orOk res && t == 250 && calls == 1)
82
+
83
+ runTest c "feature.netsim_ranged_latency_in_min_max" $ do
84
+ clk <- makeClock
85
+ latm <- jo [("min", VNum 100), ("max", VNum 300)]
86
+ nopts <- jo [("latency", latm), ("seed", VNum 7), ("sleep", clockSleepFn clk)]
87
+ h <- makeClientH [("netsim", nopts)] Nothing []
88
+ _ <- runOpH h defaultOpArgs
89
+ t <- clockNow clk
90
+ pure (t >= 100 && t < 300)
91
+
92
+ runTest c "feature.netsim_equal_min_max_latency_exact" $ do
93
+ clk <- makeClock
94
+ latm <- jo [("min", VNum 50), ("max", VNum 50)]
95
+ nopts <- jo [("latency", latm), ("sleep", clockSleepFn clk)]
96
+ h <- makeClientH [("netsim", nopts)] Nothing []
97
+ _ <- runOpH h defaultOpArgs
98
+ t <- clockNow clk
99
+ pure (t == 50)
100
+
101
+ runTest c "feature.netsim_fail_times_returns_retryable_status" $ do
102
+ nopts <- jo [("failTimes", VNum 2), ("failStatus", VNum 503)]
103
+ h <- makeClientH [("netsim", nopts)] Nothing []
104
+ r1 <- runOpH h defaultOpArgs; s1 <- resStatus r1
105
+ r2 <- runOpH h defaultOpArgs; s2 <- resStatus r2
106
+ r3 <- runOpH h defaultOpArgs
107
+ pure (s1 == 503 && s2 == 503 && orOk r3)
108
+
109
+ runTest c "feature.netsim_fail_every_fails_every_nth" $ do
110
+ nopts <- jo [("failEvery", VNum 2)]
111
+ h <- makeClientH [("netsim", nopts)] Nothing []
112
+ r1 <- runOpH h defaultOpArgs
113
+ r2 <- runOpH h defaultOpArgs
114
+ r3 <- runOpH h defaultOpArgs
115
+ pure (orOk r1 && not (orOk r2) && orOk r3)
116
+
117
+ runTest c "feature.netsim_fail_rate_with_seed_deterministic" $ do
118
+ nopts <- jo [("failRate", VNum 1), ("seed", VNum 5)]
119
+ h <- makeClientH [("netsim", nopts)] Nothing []
120
+ res <- runOpH h defaultOpArgs
121
+ pure (not (orOk res))
122
+
123
+ runTest c "feature.netsim_error_times_connection_error" $ do
124
+ nopts <- jo [("errorTimes", VNum 1)]
125
+ h <- makeClientH [("netsim", nopts)] Nothing []
126
+ res <- runOpH h defaultOpArgs
127
+ ecode <- case orErr res of Just e -> errCode e; Nothing -> pure ""
128
+ pure (not (orOk res) && ecode == "netsim_conn")
129
+
130
+ runTest c "feature.netsim_offline_fails_every_call" $ do
131
+ nopts <- jo [("offline", VBool True)]
132
+ h <- makeClientH [("netsim", nopts)] Nothing []
133
+ res <- runOpH h defaultOpArgs
134
+ ecode <- case orErr res of Just e -> errCode e; Nothing -> pure ""
135
+ pure (not (orOk res) && ecode == "netsim_offline")
136
+
137
+ runTest c "feature.netsim_rate_limit_times_429_retry_after" $ do
138
+ nopts <- jo [("rateLimitTimes", VNum 1), ("retryAfter", VNum 3)]
139
+ h <- makeClientH [("netsim", nopts)] Nothing []
140
+ res <- runOpH h defaultOpArgs
141
+ st <- resStatus res
142
+ ra <- resHeader res "retry-after"
143
+ pure (st == 429 && vstring ra == "3")
144
+
145
+ runTest c "feature.netsim_inactive_does_not_wrap" $ do
146
+ nopts <- jo [("active", VBool False), ("offline", VBool True)]
147
+ h <- makeClientH [("netsim", nopts)] Nothing []
148
+ res <- runOpH h defaultOpArgs
149
+ bucket <- trackGet (hClient h) "netsim"
150
+ pure (orOk res && isNoval bucket)
151
+
152
+ ---------------------------------------------------------------- retry
153
+ runTest c "feature.retry_retries_transient_then_succeeds" $ do
154
+ clk <- makeClock
155
+ nopts <- jo [("failTimes", VNum 2), ("failStatus", VNum 503)]
156
+ ropts <- jo [("retries", VNum 3), ("minDelay", VNum 10), ("jitter", VBool False), ("sleep", clockSleepFn clk)]
157
+ h <- makeClientH [("netsim", nopts), ("retry", ropts)] Nothing []
158
+ res <- runOpH h defaultOpArgs
159
+ bucket <- trackGet (hClient h) "retry"
160
+ attempts <- bnum bucket "attempts"
161
+ pure (orOk res && attempts == 2)
162
+
163
+ runTest c "feature.retry_gives_up_after_budget" $ do
164
+ clk <- makeClock
165
+ nopts <- jo [("failTimes", VNum 9), ("failStatus", VNum 500)]
166
+ ropts <- jo [("retries", VNum 2), ("minDelay", VNum 1), ("jitter", VBool False), ("sleep", clockSleepFn clk)]
167
+ h <- makeClientH [("netsim", nopts), ("retry", ropts)] Nothing []
168
+ res <- runOpH h defaultOpArgs
169
+ st <- resStatus res
170
+ pure (st == 500)
171
+
172
+ runTest c "feature.retry_does_not_retry_non_retryable_status" $ do
173
+ let reply _ _ = do r <- makeResponse 404 VNoval []; pure (r, Nothing)
174
+ (srv, calls) <- recordingServer (Just reply)
175
+ ropts <- jo [("retries", VNum 3), ("minDelay", VNum 0)]
176
+ h <- makeClientH [("retry", ropts)] (Just srv) []
177
+ _ <- runOpH h defaultOpArgs
178
+ cs <- readIORef calls
179
+ pure (length cs == 1)
180
+
181
+ runTest c "feature.retry_retries_transport_error_then_returns_it" $ do
182
+ clk <- makeClock
183
+ n <- newIORef (0 :: Int)
184
+ let srv _ _ _ = do modifyIORef n (+ 1); e <- mkErr "boom" "boom"; pure (VNoval, Just e)
185
+ ropts <- jo [("retries", VNum 2), ("minDelay", VNum 1), ("jitter", VBool False), ("sleep", clockSleepFn clk)]
186
+ h <- makeClientH [("retry", ropts)] (Just srv) []
187
+ res <- runOpH h defaultOpArgs
188
+ cnt <- readIORef n
189
+ pure (not (orOk res) && cnt == 3)
190
+
191
+ runTest c "feature.retry_retries_nil_transport_result" $ do
192
+ n <- newIORef (0 :: Int)
193
+ let srv _ _ _ = do
194
+ modifyIORef n (+ 1); c0 <- readIORef n
195
+ if c0 < 2 then pure (VNoval, Nothing)
196
+ else do d <- jo [("ok", VBool True)]; r <- makeResponse 200 d []; pure (r, Nothing)
197
+ ropts <- jo [("retries", VNum 3), ("minDelay", VNum 0)]
198
+ h <- makeClientH [("retry", ropts)] (Just srv) []
199
+ res <- runOpH h defaultOpArgs
200
+ cnt <- readIORef n
201
+ pure (orOk res && cnt == 2)
202
+
203
+ runTest c "feature.retry_honours_server_retry_after" $ do
204
+ clk <- makeClock
205
+ nopts <- jo [("rateLimitTimes", VNum 1), ("retryAfter", VNum 2)]
206
+ ropts <- jo [("retries", VNum 2), ("minDelay", VNum 10), ("maxDelay", VNum 60000), ("jitter", VBool False), ("sleep", clockSleepFn clk)]
207
+ h <- makeClientH [("netsim", nopts), ("retry", ropts)] Nothing []
208
+ res <- runOpH h defaultOpArgs
209
+ t <- clockNow clk
210
+ pure (orOk res && t == 2000)
211
+
212
+ runTest c "feature.retry_inactive_does_not_wrap" $ do
213
+ let reply _ _ = do r <- makeResponse 503 VNoval []; pure (r, Nothing)
214
+ (srv, calls) <- recordingServer (Just reply)
215
+ ropts <- jo [("active", VBool False)]
216
+ h <- makeClientH [("retry", ropts)] (Just srv) []
217
+ _ <- runOpH h defaultOpArgs
218
+ cs <- readIORef calls
219
+ pure (length cs == 1)
220
+
221
+ ---------------------------------------------------------------- timeout
222
+ runTest c "feature.timeout_slow_request_times_out" $ do
223
+ clk <- makeClock
224
+ let srv _ _ _ = do clockAdvance clk 100; d <- jo [("ok", VBool True)]; r <- makeResponse 200 d []; pure (r, Nothing)
225
+ topts <- jo [("ms", VNum 10), ("now", clockNowFn clk)]
226
+ h <- makeClientH [("timeout", topts)] (Just srv) []
227
+ res <- runOpH h defaultOpArgs
228
+ ecode <- case orErr res of Just e -> errCode e; Nothing -> pure ""
229
+ bucket <- trackGet (hClient h) "timeout"
230
+ count <- bnum bucket "count"
231
+ pure (not (orOk res) && ecode == "timeout" && count == 1)
232
+
233
+ runTest c "feature.timeout_fast_request_passes" $ do
234
+ clk <- makeClock
235
+ topts <- jo [("ms", VNum 1000), ("now", clockNowFn clk)]
236
+ h <- makeClientH [("timeout", topts)] Nothing []
237
+ res <- runOpH h defaultOpArgs
238
+ pure (orOk res)
239
+
240
+ runTest c "feature.timeout_ms_zero_disables" $ do
241
+ clk <- makeClock
242
+ let srv _ _ _ = do clockAdvance clk 100; d <- jo [("ok", VBool True)]; r <- makeResponse 200 d []; pure (r, Nothing)
243
+ topts <- jo [("ms", VNum 0), ("now", clockNowFn clk)]
244
+ h <- makeClientH [("timeout", topts)] (Just srv) []
245
+ res <- runOpH h defaultOpArgs
246
+ pure (orOk res)
247
+
248
+ runTest c "feature.timeout_inactive_does_not_wrap" $ do
249
+ topts <- jo [("active", VBool False)]
250
+ h <- makeClientH [("timeout", topts)] Nothing []
251
+ res <- runOpH h defaultOpArgs
252
+ pure (orOk res)
253
+
254
+ ---------------------------------------------------------------- ratelimit
255
+ runTest c "feature.ratelimit_throttles_once_burst_spent" $ do
256
+ clk <- makeClock
257
+ ropts <- jo [("rate", VNum 1), ("burst", VNum 2), ("now", clockNowFn clk), ("sleep", clockSleepFn clk)]
258
+ h <- makeClientH [("ratelimit", ropts)] Nothing []
259
+ _ <- runOpH h defaultOpArgs
260
+ _ <- runOpH h defaultOpArgs
261
+ _ <- runOpH h defaultOpArgs
262
+ bucket <- trackGet (hClient h) "ratelimit"
263
+ throttled <- bnum bucket "throttled"
264
+ t <- clockNow clk
265
+ pure (throttled == 1 && t > 0)
266
+
267
+ runTest c "feature.ratelimit_burst_defaults_to_rate_and_refills" $ do
268
+ clk <- makeClock
269
+ ropts <- jo [("rate", VNum 2), ("now", clockNowFn clk), ("sleep", clockSleepFn clk)]
270
+ h <- makeClientH [("ratelimit", ropts)] Nothing []
271
+ _ <- runOpH h defaultOpArgs
272
+ _ <- runOpH h defaultOpArgs
273
+ clockAdvance clk 1000
274
+ _ <- runOpH h defaultOpArgs
275
+ bucket <- trackGet (hClient h) "ratelimit"
276
+ throttled <- bnum bucket "throttled"
277
+ pure (isNoval bucket || throttled == 0)
278
+
279
+ runTest c "feature.ratelimit_inactive_does_not_wrap" $ do
280
+ ropts <- jo [("active", VBool False)]
281
+ h <- makeClientH [("ratelimit", ropts)] Nothing []
282
+ res <- runOpH h defaultOpArgs
283
+ bucket <- trackGet (hClient h) "ratelimit"
284
+ pure (orOk res && isNoval bucket)
285
+
286
+ ---------------------------------------------------------------- cache
287
+ runTest c "feature.cache_serves_repeated_read_from_cache" $ do
288
+ (srv, calls) <- recordingServer Nothing
289
+ copts <- jo [("ttl", VNum 10000)]
290
+ h <- makeClientH [("cache", copts)] (Just srv) []
291
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/w/1" })
292
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/w/1" })
293
+ bucket <- trackGet (hClient h) "cache"
294
+ hit <- bnum bucket "hit"
295
+ cs <- readIORef calls
296
+ pure (length cs == 1 && hit == 1)
297
+
298
+ runTest c "feature.cache_does_not_cache_non_get" $ do
299
+ (srv, calls) <- recordingServer Nothing
300
+ h <- makeClientH [("cache", VNoval)] (Just srv) []
301
+ _ <- runOpH h (defaultOpArgs { oaOp = "create", oaMethod = Just "POST", oaPath = Just "/w" })
302
+ _ <- runOpH h (defaultOpArgs { oaOp = "create", oaMethod = Just "POST", oaPath = Just "/w" })
303
+ cs <- readIORef calls
304
+ pure (length cs == 2)
305
+
306
+ runTest c "feature.cache_does_not_cache_non_2xx" $ do
307
+ let reply _ _ = do r <- makeResponse 500 VNoval []; pure (r, Nothing)
308
+ (srv, calls) <- recordingServer (Just reply)
309
+ h <- makeClientH [("cache", VNoval)] (Just srv) []
310
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/w" })
311
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/w" })
312
+ cs <- readIORef calls
313
+ bucket <- trackGet (hClient h) "cache"
314
+ bypass <- bnum bucket "bypass"
315
+ pure (length cs == 2 && bypass == 2)
316
+
317
+ runTest c "feature.cache_refetches_after_ttl" $ do
318
+ clk <- makeClock
319
+ (srv, calls) <- recordingServer Nothing
320
+ copts <- jo [("ttl", VNum 1000), ("now", clockNowFn clk)]
321
+ h <- makeClientH [("cache", copts)] (Just srv) []
322
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/w" })
323
+ clockAdvance clk 1500
324
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/w" })
325
+ cs <- readIORef calls
326
+ pure (length cs == 2)
327
+
328
+ runTest c "feature.cache_evicts_oldest_past_max" $ do
329
+ (srv, calls) <- recordingServer Nothing
330
+ copts <- jo [("ttl", VNum 10000), ("max", VNum 1)]
331
+ h <- makeClientH [("cache", copts)] (Just srv) []
332
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/a" })
333
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/b" })
334
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/a" })
335
+ cs <- readIORef calls
336
+ pure (length cs == 3)
337
+
338
+ runTest c "feature.cache_inactive_does_not_wrap" $ do
339
+ (srv, calls) <- recordingServer Nothing
340
+ copts <- jo [("active", VBool False)]
341
+ h <- makeClientH [("cache", copts)] (Just srv) []
342
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/x" })
343
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/x" })
344
+ cs <- readIORef calls
345
+ pure (length cs == 2)
346
+
347
+ ---------------------------------------------------------------- idempotency
348
+ runTest c "feature.idempotency_adds_key_to_mutating_ops" $ do
349
+ h <- makeClientH [("idempotency", VNoval)] Nothing []
350
+ res <- runOpH h (defaultOpArgs { oaOp = "create", oaMethod = Just "POST" })
351
+ k <- specHeader res "Idempotency-Key"
352
+ bucket <- trackGet (hClient h) "idempotency"
353
+ issued <- bnum bucket "issued"
354
+ pure (not (isNoval k) && issued == 1)
355
+
356
+ runTest c "feature.idempotency_adds_key_by_http_method" $ do
357
+ h <- makeClientH [("idempotency", VNoval)] Nothing []
358
+ res <- runOpH h (defaultOpArgs { oaOp = "act", oaMethod = Just "PUT" })
359
+ k <- specHeader res "Idempotency-Key"
360
+ pure (not (isNoval k))
361
+
362
+ runTest c "feature.idempotency_leaves_reads_untouched" $ do
363
+ h <- makeClientH [("idempotency", VNoval)] Nothing []
364
+ res <- runOpH h defaultOpArgs
365
+ k <- specHeader res "Idempotency-Key"
366
+ pure (isNoval k)
367
+
368
+ runTest c "feature.idempotency_preserves_caller_key_custom_header" $ do
369
+ iopts <- jo [("header", VStr "X-Idem")]
370
+ h <- makeClientH [("idempotency", iopts)] Nothing [("X-Idem", VStr "caller-1")]
371
+ res <- runOpH h (defaultOpArgs { oaOp = "create", oaMethod = Just "POST" })
372
+ k <- specHeader res "X-Idem"
373
+ pure (vstring k == "caller-1")
374
+
375
+ runTest c "feature.idempotency_injected_keygen" $ do
376
+ iopts <- jo [("keygen", vfunc0 (pure (VStr "K1")))]
377
+ h <- makeClientH [("idempotency", iopts)] Nothing []
378
+ res <- runOpH h (defaultOpArgs { oaOp = "create", oaMethod = Just "POST" })
379
+ k <- specHeader res "Idempotency-Key"
380
+ bucket <- trackGet (hClient h) "idempotency"
381
+ issued <- bnum bucket "issued"; lastK <- getp bucket "last"
382
+ pure (vstring k == "K1" && issued == 1 && vstring lastK == "K1")
383
+
384
+ runTest c "feature.idempotency_inactive_is_noop" $ do
385
+ iopts <- jo [("active", VBool False)]
386
+ h <- makeClientH [("idempotency", iopts)] Nothing []
387
+ res <- runOpH h (defaultOpArgs { oaOp = "create", oaMethod = Just "POST" })
388
+ k <- specHeader res "Idempotency-Key"
389
+ pure (isNoval k)
390
+
391
+ ---------------------------------------------------------------- rbac
392
+ runTest c "feature.rbac_denies_before_any_call" $ do
393
+ rules <- jo [("widget.remove", VStr "admin")]
394
+ perms <- emptyList
395
+ ropts <- jo [("rules", rules), ("permissions", perms)]
396
+ (srv, calls) <- recordingServer Nothing
397
+ h <- makeClientH [("rbac", ropts)] (Just srv) []
398
+ res <- runOpH h (defaultOpArgs { oaOp = "remove", oaMethod = Just "DELETE" })
399
+ ecode <- case orErr res of Just e -> errCode e; Nothing -> pure ""
400
+ cs <- readIORef calls
401
+ bucket <- trackGet (hClient h) "rbac"
402
+ denied <- bnum bucket "denied"
403
+ pure (not (orOk res) && ecode == "rbac_denied" && length cs == 0 && denied == 1)
404
+
405
+ runTest c "feature.rbac_allows_held_permission" $ do
406
+ rules <- jo [("widget.remove", VStr "admin")]
407
+ perms <- ja [VStr "admin"]
408
+ ropts <- jo [("rules", rules), ("permissions", perms)]
409
+ h <- makeClientH [("rbac", ropts)] Nothing []
410
+ res <- runOpH h (defaultOpArgs { oaOp = "remove", oaMethod = Just "DELETE" })
411
+ bucket <- trackGet (hClient h) "rbac"
412
+ allowed <- bnum bucket "allowed"
413
+ pure (orOk res && allowed == 1)
414
+
415
+ runTest c "feature.rbac_op_rule_and_wildcard_grant" $ do
416
+ rules <- jo [("load", VStr "read")]
417
+ perms <- ja [VStr "*"]
418
+ ropts <- jo [("rules", rules), ("permissions", perms)]
419
+ h <- makeClientH [("rbac", ropts)] Nothing []
420
+ res <- runOpH h defaultOpArgs
421
+ pure (orOk res)
422
+
423
+ runTest c "feature.rbac_default_allow_and_deny_true" $ do
424
+ permsA <- emptyList
425
+ aopts <- jo [("permissions", permsA)]
426
+ ha <- makeClientH [("rbac", aopts)] Nothing []
427
+ ra <- runOpH ha defaultOpArgs
428
+ permsD <- emptyList
429
+ dopts <- jo [("deny", VBool True), ("permissions", permsD)]
430
+ hd <- makeClientH [("rbac", dopts)] Nothing []
431
+ rd <- runOpH hd defaultOpArgs
432
+ ecode <- case orErr rd of Just e -> errCode e; Nothing -> pure ""
433
+ pure (orOk ra && not (orOk rd) && ecode == "rbac_denied")
434
+
435
+ runTest c "feature.rbac_inactive_is_noop" $ do
436
+ ropts <- jo [("active", VBool False), ("deny", VBool True)]
437
+ h <- makeClientH [("rbac", ropts)] Nothing []
438
+ res <- runOpH h defaultOpArgs
439
+ pure (orOk res)
440
+
441
+ ---------------------------------------------------------------- metrics
442
+ runTest c "feature.metrics_counts_ok_and_err_per_op" $ do
443
+ nopts <- jo [("failTimes", VNum 1), ("failStatus", VNum 500)]
444
+ h <- makeClientH [("netsim", nopts), ("metrics", VNoval)] Nothing []
445
+ _ <- runOpH h defaultOpArgs
446
+ _ <- runOpH h defaultOpArgs
447
+ _ <- runOpH h (defaultOpArgs { oaOp = "list" })
448
+ bucket <- trackGet (hClient h) "metrics"
449
+ total <- getp bucket "total"
450
+ count <- bnum total "count"; okN <- bnum total "ok"; errN <- bnum total "err"
451
+ ops <- getp bucket "ops"; wl <- getp ops "widget.load"; wlCount <- bnum wl "count"
452
+ pure (count == 3 && okN == 2 && errN == 1 && wlCount == 2)
453
+
454
+ runTest c "feature.metrics_injected_clock" $ do
455
+ clk <- makeClock
456
+ mopts <- jo [("now", clockNowFn clk)]
457
+ h <- makeClientH [("metrics", mopts)] Nothing []
458
+ _ <- runOpH h defaultOpArgs
459
+ bucket <- trackGet (hClient h) "metrics"
460
+ total <- getp bucket "total"
461
+ count <- bnum total "count"; totalMs <- bnum total "totalMs"
462
+ pure (count == 1 && totalMs == 0)
463
+
464
+ runTest c "feature.metrics_inactive_records_nothing" $ do
465
+ mopts <- jo [("active", VBool False)]
466
+ h <- makeClientH [("metrics", mopts)] Nothing []
467
+ _ <- runOpH h defaultOpArgs
468
+ bucket <- trackGet (hClient h) "metrics"
469
+ total <- getp bucket "total"; count <- bnum total "count"
470
+ pure (count == 0)
471
+
472
+ ---------------------------------------------------------------- telemetry
473
+ runTest c "feature.telemetry_opens_spans_and_propagates_headers" $ do
474
+ exported <- newIORef ([] :: [Value])
475
+ let exp0 = VFunc (\_ v _ _ -> do modifyIORef exported (++ [v]); pure VNoval)
476
+ topts <- jo [("exporter", exp0)]
477
+ h <- makeClientH [("telemetry", topts)] Nothing []
478
+ res <- runOpH h defaultOpArgs
479
+ tid <- specHeader res "X-Trace-Id"
480
+ tp <- specHeader res "traceparent"
481
+ bucket <- trackGet (hClient h) "telemetry"
482
+ spans <- getp bucket "spans"; sps <- listVals spans
483
+ span0 <- case sps of (s : _) -> pure s; [] -> pure VNoval
484
+ spanTid <- getp span0 "traceId"
485
+ exps <- readIORef exported
486
+ let tps = vstring tp
487
+ pure (length sps == 1 && length exps == 1 && vstring tid == vstring spanTid
488
+ && startsWith "00-" tps && endsW "-01" tps)
489
+
490
+ runTest c "feature.telemetry_records_failed_span" $ do
491
+ nopts <- jo [("failTimes", VNum 1), ("failStatus", VNum 500)]
492
+ h <- makeClientH [("netsim", nopts), ("telemetry", VNoval)] Nothing []
493
+ _ <- runOpH h defaultOpArgs
494
+ bucket <- trackGet (hClient h) "telemetry"
495
+ spans <- getp bucket "spans"; sps <- listVals spans
496
+ span0 <- case sps of (s : _) -> pure s; [] -> pure VNoval
497
+ okV <- getp span0 "ok"
498
+ pure (length sps == 1 && not (isTrueV okV))
499
+
500
+ runTest c "feature.telemetry_injected_idgen_and_clock" $ do
501
+ clk <- makeClock
502
+ topts <- jo [("idgen", vfnStr (++ "-X")), ("now", clockNowFn clk)]
503
+ h <- makeClientH [("telemetry", topts)] Nothing []
504
+ _ <- runOpH h defaultOpArgs
505
+ bucket <- trackGet (hClient h) "telemetry"
506
+ spans <- getp bucket "spans"; sps <- listVals spans
507
+ span0 <- case sps of (s : _) -> pure s; [] -> pure VNoval
508
+ tid <- getp span0 "traceId"; dur <- bnum span0 "durationMs"
509
+ pure (vstring tid == "trace-X" && dur == 0)
510
+
511
+ runTest c "feature.telemetry_inactive_records_nothing" $ do
512
+ topts <- jo [("active", VBool False)]
513
+ h <- makeClientH [("telemetry", topts)] Nothing []
514
+ _ <- runOpH h defaultOpArgs
515
+ bucket <- trackGet (hClient h) "telemetry"
516
+ spans <- getp bucket "spans"; sps <- listVals spans
517
+ pure (length sps == 0)
518
+
519
+ ---------------------------------------------------------------- debug
520
+ runTest c "feature.debug_redacts_and_honours_onentry_max" $ do
521
+ seen <- newIORef ([] :: [Value])
522
+ let onE = VFunc (\_ v _ _ -> do modifyIORef seen (++ [v]); pure VNoval)
523
+ dopts <- jo [("max", VNum 1), ("onEntry", onE)]
524
+ h <- makeClientH [("debug", dopts)] Nothing []
525
+ _ <- runOpH h (defaultOpArgs { oaHeaders = [("authorization", VStr "Bearer secret")] })
526
+ _ <- runOpH h (defaultOpArgs { oaOp = "list" })
527
+ bucket <- trackGet (hClient h) "debug"
528
+ entries <- getp bucket "entries"; es <- listVals entries
529
+ ss <- readIORef seen
530
+ e0 <- case ss of (s : _) -> pure s; [] -> pure VNoval
531
+ hdrs <- getp e0 "headers"; auth <- getp hdrs "authorization"
532
+ pure (length es == 1 && length ss == 2 && vstring auth == "<redacted>")
533
+
534
+ runTest c "feature.debug_captures_failures" $ do
535
+ nopts <- jo [("failTimes", VNum 1), ("failStatus", VNum 500)]
536
+ h <- makeClientH [("netsim", nopts), ("debug", VNoval)] Nothing []
537
+ _ <- runOpH h defaultOpArgs
538
+ bucket <- trackGet (hClient h) "debug"
539
+ entries <- getp bucket "entries"; es <- listVals entries
540
+ e0 <- case es of (s : _) -> pure s; [] -> pure VNoval
541
+ okV <- getp e0 "ok"
542
+ pure (length es == 1 && not (isTrueV okV))
543
+
544
+ runTest c "feature.debug_injected_clock_and_custom_redact" $ do
545
+ clk <- makeClock
546
+ rl <- ja [VStr "x-secret"]
547
+ dopts <- jo [("now", clockNowFn clk), ("redact", rl)]
548
+ h <- makeClientH [("debug", dopts)] Nothing []
549
+ _ <- runOpH h (defaultOpArgs { oaHeaders = [("x-secret", VStr "hide"), ("x-ok", VStr "show")] })
550
+ bucket <- trackGet (hClient h) "debug"
551
+ entries <- getp bucket "entries"; es <- listVals entries
552
+ e0 <- case es of (s : _) -> pure s; [] -> pure VNoval
553
+ hdrs <- getp e0 "headers"; sec <- getp hdrs "x-secret"; okh <- getp hdrs "x-ok"
554
+ pure (vstring sec == "<redacted>" && vstring okh == "show")
555
+
556
+ runTest c "feature.debug_inactive_records_nothing" $ do
557
+ dopts <- jo [("active", VBool False)]
558
+ h <- makeClientH [("debug", dopts)] Nothing []
559
+ _ <- runOpH h defaultOpArgs
560
+ bucket <- trackGet (hClient h) "debug"
561
+ entries <- getp bucket "entries"; es <- listVals entries
562
+ pure (length es == 0)
563
+
564
+ ---------------------------------------------------------------- audit
565
+ runTest c "feature.audit_one_record_per_op_sink_actor" $ do
566
+ sunk <- newIORef ([] :: [Value])
567
+ let sink = VFunc (\_ v _ _ -> do modifyIORef sunk (++ [v]); pure VNoval)
568
+ nopts <- jo [("failTimes", VNum 1), ("failStatus", VNum 500)]
569
+ aopts <- jo [("actor", VStr "svc"), ("max", VNum 5), ("sink", sink)]
570
+ h <- makeClientH [("netsim", nopts), ("audit", aopts)] Nothing []
571
+ _ <- runOpH h (defaultOpArgs { oaOp = "remove", oaMethod = Just "DELETE" })
572
+ perCall <- jo [("actor", VStr "per-call")]
573
+ _ <- runOpH h (defaultOpArgs { oaCtrl = perCall })
574
+ bucket <- trackGet (hClient h) "audit"
575
+ recs <- getp bucket "records"; rs <- listVals recs
576
+ r0 <- case rs of (x : _) -> pure x; [] -> pure VNoval
577
+ r1 <- case rs of (_ : x : _) -> pure x; _ -> pure VNoval
578
+ outcome0 <- getp r0 "outcome"; actor0 <- getp r0 "actor"; actor1 <- getp r1 "actor"
579
+ ss <- readIORef sunk
580
+ pure (length rs == 2 && vstring outcome0 == "error" && vstring actor0 == "svc"
581
+ && vstring actor1 == "per-call" && length ss == 2)
582
+
583
+ runTest c "feature.audit_default_actor_anonymous" $ do
584
+ h <- makeClientH [("audit", VNoval)] Nothing []
585
+ _ <- runOpH h defaultOpArgs
586
+ bucket <- trackGet (hClient h) "audit"
587
+ recs <- getp bucket "records"; rs <- listVals recs
588
+ r0 <- case rs of (x : _) -> pure x; [] -> pure VNoval
589
+ actor <- getp r0 "actor"
590
+ pure (vstring actor == "anonymous")
591
+
592
+ runTest c "feature.audit_injected_clock" $ do
593
+ aopts <- jo [("now", vfunc0 (pure (VNum 42)))]
594
+ h <- makeClientH [("audit", aopts)] Nothing []
595
+ _ <- runOpH h defaultOpArgs
596
+ bucket <- trackGet (hClient h) "audit"
597
+ recs <- getp bucket "records"; rs <- listVals recs
598
+ r0 <- case rs of (x : _) -> pure x; [] -> pure VNoval
599
+ ts <- bnum r0 "ts"
600
+ pure (ts == 42)
601
+
602
+ runTest c "feature.audit_inactive_records_nothing" $ do
603
+ aopts <- jo [("active", VBool False)]
604
+ h <- makeClientH [("audit", aopts)] Nothing []
605
+ _ <- runOpH h defaultOpArgs
606
+ bucket <- trackGet (hClient h) "audit"
607
+ recs <- getp bucket "records"; rs <- listVals recs
608
+ pure (length rs == 0)
609
+
610
+ ---------------------------------------------------------------- clienttrack
611
+ runTest c "feature.clienttrack_stable_id_unique_request_ids_ua" $ do
612
+ (srv, calls) <- recordingServer Nothing
613
+ copts <- jo [("clientName", VStr "Acme"), ("clientVersion", VStr "2.0.0")]
614
+ h <- makeClientH [("clienttrack", copts)] (Just srv) []
615
+ _ <- runOpH h defaultOpArgs
616
+ _ <- runOpH h defaultOpArgs
617
+ ua0 <- recHeader calls 0 "User-Agent"
618
+ cid0 <- recHeader calls 0 "X-Client-Id"; cid1 <- recHeader calls 1 "X-Client-Id"
619
+ rid0 <- recHeader calls 0 "X-Request-Id"; rid1 <- recHeader calls 1 "X-Request-Id"
620
+ bucket <- trackGet (hClient h) "clienttrack"
621
+ reqs <- bnum bucket "requests"
622
+ pure (vstring ua0 == "Acme/2.0.0" && vstring cid0 == vstring cid1
623
+ && vstring rid0 /= vstring rid1 && reqs == 2)
624
+
625
+ runTest c "feature.clienttrack_does_not_clobber_caller_ua" $ do
626
+ (srv, calls) <- recordingServer Nothing
627
+ h <- makeClientH [("clienttrack", VNoval)] (Just srv) []
628
+ _ <- runOpH h (defaultOpArgs { oaHeaders = [("User-Agent", VStr "mine")] })
629
+ ua <- recHeader calls 0 "User-Agent"
630
+ pure (vstring ua == "mine")
631
+
632
+ runTest c "feature.clienttrack_injected_idgen_fixed_session" $ do
633
+ (srv, calls) <- recordingServer Nothing
634
+ copts <- jo [("sessionId", VStr "S1"), ("idgen", vfnStr (++ "-1"))]
635
+ h <- makeClientH [("clienttrack", copts)] (Just srv) []
636
+ _ <- runOpH h defaultOpArgs
637
+ cid <- recHeader calls 0 "X-Client-Id"
638
+ rid <- recHeader calls 0 "X-Request-Id"
639
+ pure (vstring cid == "S1" && vstring rid == "request-1")
640
+
641
+ runTest c "feature.clienttrack_inactive_stamps_nothing" $ do
642
+ (srv, calls) <- recordingServer Nothing
643
+ copts <- jo [("active", VBool False)]
644
+ h <- makeClientH [("clienttrack", copts)] (Just srv) []
645
+ _ <- runOpH h defaultOpArgs
646
+ cid <- recHeader calls 0 "X-Client-Id"
647
+ pure (isNoval cid)
648
+
649
+ ---------------------------------------------------------------- paging
650
+ runTest c "feature.paging_stamps_page_limit_and_reads_headers" $ do
651
+ let reply _ _ = do
652
+ d <- do a <- ja [VNum 1, VNum 2]; jo [("items", a)]
653
+ makeResponse 200 d [("x-next-page", VStr "2"), ("x-total-count", VStr "5"), ("link", VStr "</w?page=2>; rel=\"next\"")]
654
+ >>= \r -> pure (r, Nothing)
655
+ (srv, calls) <- recordingServer (Just reply)
656
+ popts <- jo [("limit", VNum 2)]
657
+ h <- makeClientH [("paging", popts)] (Just srv) []
658
+ res <- runOpH h (defaultOpArgs { oaOp = "list", oaPath = Just "/w" })
659
+ u0 <- recUrl calls 0
660
+ paging <- getp (orResult res) "paging"
661
+ np <- bnum paging "nextPage"; tc <- bnum paging "totalCount"; nx <- getp paging "next"
662
+ pure (substrContains u0 "page=1" && substrContains u0 "limit=2"
663
+ && np == 2 && tc == 5 && vstring nx == "/w?page=2")
664
+
665
+ runTest c "feature.paging_body_cursor_and_explicit_cursor" $ do
666
+ let reply _ _ = do
667
+ d <- jo [("nextCursor", VStr "abc"), ("hasMore", VBool True)]
668
+ makeResponse 200 d [] >>= \r -> pure (r, Nothing)
669
+ (srv, calls) <- recordingServer (Just reply)
670
+ pg <- jo [("cursor", VStr "xyz")]
671
+ ctrl <- jo [("paging", pg)]
672
+ h <- makeClientH [("paging", VNoval)] (Just srv) []
673
+ res <- runOpH h (defaultOpArgs { oaOp = "list", oaPath = Just "/w", oaCtrl = ctrl })
674
+ u0 <- recUrl calls 0
675
+ paging <- getp (orResult res) "paging"
676
+ cur <- getp paging "cursor"; hm <- getp paging "hasMore"
677
+ pure (substrContains u0 "cursor=xyz" && vstring cur == "abc" && isTrueV hm)
678
+
679
+ runTest c "feature.paging_non_list_not_paged" $ do
680
+ (srv, calls) <- recordingServer Nothing
681
+ h <- makeClientH [("paging", VNoval)] (Just srv) []
682
+ _ <- runOpH h (defaultOpArgs { oaPath = Just "/w/1" })
683
+ u0 <- recUrl calls 0
684
+ pure (not (substrContains u0 "page="))
685
+
686
+ runTest c "feature.paging_inactive_stamps_nothing" $ do
687
+ (srv, calls) <- recordingServer Nothing
688
+ popts <- jo [("active", VBool False)]
689
+ h <- makeClientH [("paging", popts)] (Just srv) []
690
+ _ <- runOpH h (defaultOpArgs { oaOp = "list", oaPath = Just "/w" })
691
+ u0 <- recUrl calls 0
692
+ pure (not (substrContains u0 "page="))
693
+
694
+ ---------------------------------------------------------------- streaming
695
+ runTest c "feature.streaming_streams_list_items" $ do
696
+ clk <- makeClock
697
+ let reply _ _ = do d <- ja [VStr "a", VStr "b", VStr "c"]; makeResponse 200 d [] >>= \r -> pure (r, Nothing)
698
+ (srv, _) <- recordingServer (Just reply)
699
+ sopts <- jo [("chunkDelay", VNum 5), ("sleep", clockSleepFn clk)]
700
+ h <- makeClientH [("streaming", sopts)] (Just srv) []
701
+ res <- runOpH h (defaultOpArgs { oaOp = "list", oaPath = Just "/w" })
702
+ streaming <- getp (orResult res) "streaming"
703
+ stream <- getp (orResult res) "stream"
704
+ seen <- callVfn stream VNoval
705
+ its <- listVals seen
706
+ t <- clockNow clk
707
+ pure (isTrueV streaming && map vstring its == ["a", "b", "c"] && t == 15)
708
+
709
+ runTest c "feature.streaming_batches_with_chunksize" $ do
710
+ let reply _ _ = do d <- ja [VNum 1, VNum 2, VNum 3, VNum 4, VNum 5]; makeResponse 200 d [] >>= \r -> pure (r, Nothing)
711
+ (srv, _) <- recordingServer (Just reply)
712
+ sopts <- jo [("chunkSize", VNum 2)]
713
+ h <- makeClientH [("streaming", sopts)] (Just srv) []
714
+ res <- runOpH h (defaultOpArgs { oaOp = "list", oaPath = Just "/w" })
715
+ stream <- getp (orResult res) "stream"
716
+ batches <- callVfn stream VNoval
717
+ bs <- listVals batches
718
+ lens <- mapM (\b -> length <$> listVals b) bs
719
+ flat <- concat <$> mapM listVals bs
720
+ pure (lens == [2, 2, 1] && map vstring flat == ["1", "2", "3", "4", "5"])
721
+
722
+ runTest c "feature.streaming_non_list_not_streamed" $ do
723
+ h <- makeClientH [("streaming", VNoval)] Nothing []
724
+ res <- runOpH h defaultOpArgs
725
+ streaming <- getp (orResult res) "streaming"
726
+ stream <- getp (orResult res) "stream"
727
+ pure (not (isTrueV streaming) && isNoval stream)
728
+
729
+ runTest c "feature.streaming_inactive_is_noop" $ do
730
+ let reply _ _ = do d <- ja [VStr "a"]; makeResponse 200 d [] >>= \r -> pure (r, Nothing)
731
+ (srv, _) <- recordingServer (Just reply)
732
+ sopts <- jo [("active", VBool False)]
733
+ h <- makeClientH [("streaming", sopts)] (Just srv) []
734
+ res <- runOpH h (defaultOpArgs { oaOp = "list", oaPath = Just "/w" })
735
+ streaming <- getp (orResult res) "streaming"
736
+ bucket <- trackGet (hClient h) "streaming"
737
+ opened <- bnum bucket "opened"
738
+ pure (not (isTrueV streaming) && (isNoval bucket || opened == 0))
739
+
740
+ ---------------------------------------------------------------- proxy
741
+ runTest c "feature.proxy_routes_through_proxy" $ do
742
+ (srv, calls) <- recordingServer Nothing
743
+ popts <- jo [("url", VStr "http://proxy:8080")]
744
+ h <- makeClientH [("proxy", popts)] (Just srv) []
745
+ _ <- runOpH h defaultOpArgs
746
+ fd <- recFetchdef calls 0; px <- getp fd "proxy"
747
+ bucket <- trackGet (hClient h) "proxy"; routed <- bnum bucket "routed"
748
+ pure (vstring px == "http://proxy:8080" && routed == 1)
749
+
750
+ runTest c "feature.proxy_bypasses_noproxy_hosts" $ do
751
+ (srv, calls) <- recordingServer Nothing
752
+ np <- ja [VStr "api.test"]
753
+ popts <- jo [("url", VStr "http://proxy:8080"), ("noProxy", np)]
754
+ h <- makeClientH [("proxy", popts)] (Just srv) []
755
+ _ <- runOpH h defaultOpArgs
756
+ fd <- recFetchdef calls 0; px <- getp fd "proxy"
757
+ pure (isNoval px)
758
+
759
+ runTest c "feature.proxy_fromenv_reads_https_proxy" $ do
760
+ prev <- lookupEnv "HTTPS_PROXY"
761
+ setEnv "HTTPS_PROXY" "http://env-proxy:8080"
762
+ (srv, calls) <- recordingServer Nothing
763
+ popts <- jo [("fromEnv", VBool True)]
764
+ h <- makeClientH [("proxy", popts)] (Just srv) []
765
+ _ <- runOpH h defaultOpArgs
766
+ case prev of Just v -> setEnv "HTTPS_PROXY" v; Nothing -> unsetEnv "HTTPS_PROXY"
767
+ fd <- recFetchdef calls 0; px <- getp fd "proxy"
768
+ pure (vstring px == "http://env-proxy:8080")
769
+
770
+ runTest c "feature.proxy_no_url_is_noop" $ do
771
+ (srv, calls) <- recordingServer Nothing
772
+ h <- makeClientH [("proxy", VNoval)] (Just srv) []
773
+ _ <- runOpH h defaultOpArgs
774
+ fd <- recFetchdef calls 0; px <- getp fd "proxy"
775
+ pure (isNoval px)
776
+
777
+ runTest c "feature.proxy_inactive_does_not_wrap" $ do
778
+ (srv, calls) <- recordingServer Nothing
779
+ popts <- jo [("active", VBool False), ("url", VStr "http://proxy:8080")]
780
+ h <- makeClientH [("proxy", popts)] (Just srv) []
781
+ _ <- runOpH h defaultOpArgs
782
+ fd <- recFetchdef calls 0; px <- getp fd "proxy"
783
+ pure (isNoval px)
784
+
785
+ ---------------------------------------------------------------- composition
786
+ runTest c "feature.composition_cache_hit_skips_simulated_failure" $ do
787
+ nopts <- jo [("failEvery", VNum 2)]
788
+ copts <- jo [("ttl", VNum 10000)]
789
+ h <- makeClientH [("netsim", nopts), ("cache", copts)] Nothing []
790
+ r1 <- runOpH h (defaultOpArgs { oaPath = Just "/w" })
791
+ r2 <- runOpH h (defaultOpArgs { oaPath = Just "/w" })
792
+ bucket <- trackGet (hClient h) "netsim"
793
+ calls <- bnum bucket "calls"
794
+ pure (orOk r1 && orOk r2 && calls == 1)