@voxgig/sdkgen 4.50.0 → 4.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ReadmeExplanation.js +5 -2
  3. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  4. package/dist/cmp/ReadmeFeatures.js +20 -6
  5. package/dist/cmp/ReadmeFeatures.js.map +1 -1
  6. package/dist/helpers/optspec.js +2 -2
  7. package/dist/helpers/optspec.js.map +1 -1
  8. package/dist/tsconfig.tsbuildinfo +1 -1
  9. package/model/sdkgen.aontu +1 -1
  10. package/package.json +1 -1
  11. package/project/.sdk/model/feature/audit.aontu +1 -1
  12. package/project/.sdk/model/feature/cache.aontu +7 -5
  13. package/project/.sdk/model/feature/clienttrack.aontu +1 -1
  14. package/project/.sdk/model/feature/cost.aontu +1 -1
  15. package/project/.sdk/model/feature/debug.aontu +1 -1
  16. package/project/.sdk/model/feature/idempotency.aontu +1 -1
  17. package/project/.sdk/model/feature/log.aontu +1 -1
  18. package/project/.sdk/model/feature/metrics.aontu +3 -1
  19. package/project/.sdk/model/feature/netsim.aontu +1 -1
  20. package/project/.sdk/model/feature/paging.aontu +4 -1
  21. package/project/.sdk/model/feature/proxy.aontu +1 -1
  22. package/project/.sdk/model/feature/ratelimit.aontu +3 -3
  23. package/project/.sdk/model/feature/rbac.aontu +1 -1
  24. package/project/.sdk/model/feature/retry.aontu +1 -1
  25. package/project/.sdk/model/feature/secrets.aontu +1 -1
  26. package/project/.sdk/model/feature/streaming.aontu +1 -1
  27. package/project/.sdk/model/feature/telemetry.aontu +2 -2
  28. package/project/.sdk/model/feature/test.aontu +1 -1
  29. package/project/.sdk/model/feature/timeout.aontu +1 -1
  30. package/project/.sdk/model/feature/validate.aontu +1 -1
  31. package/project/.sdk/model/target/lua.aontu +6 -0
  32. package/project/.sdk/src/cmp/c/Config_c.ts +3 -134
  33. package/project/.sdk/src/cmp/c/TestClean_c.ts +26 -11
  34. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +17 -10
  35. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +10 -5
  36. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
  37. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +15 -1
  38. package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +9 -0
  39. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +30 -2
  40. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +31 -12
  41. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +13 -4
  42. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +51 -15
  43. package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +17 -0
  44. package/project/.sdk/src/cmp/go/TestClean_go.ts +39 -3
  45. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -2
  46. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +42 -14
  47. package/project/.sdk/src/cmp/java/TestClean_java.ts +17 -4
  48. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
  49. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
  50. package/project/.sdk/src/cmp/js/TestClean_js.ts +13 -5
  51. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +26 -2
  52. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +8 -0
  53. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +8 -0
  54. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +8 -0
  55. package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +8 -0
  56. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +8 -0
  57. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +8 -0
  58. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +12 -5
  59. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +31 -4
  60. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
  61. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +14 -4
  62. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +42 -5
  63. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +44 -10
  64. package/project/.sdk/src/cmp/lua/utility_lua.ts +2 -1
  65. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +20 -5
  66. package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
  67. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +13 -4
  68. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +21 -0
  69. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +31 -12
  70. package/project/.sdk/src/cmp/php/TestClean_php.ts +10 -3
  71. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +33 -4
  72. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
  73. package/project/.sdk/src/cmp/py/TestClean_py.ts +10 -3
  74. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +25 -2
  75. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +26 -12
  76. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +11 -4
  77. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +23 -2
  78. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +27 -11
  79. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +24 -17
  80. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
  81. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +45 -11
  82. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +14 -0
  83. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +31 -21
  84. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +9 -0
  85. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +24 -10
  86. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +13 -8
  87. package/project/.sdk/src/cmp/ts/TestClean_ts.ts +13 -5
  88. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +26 -2
  89. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +8 -0
  90. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +8 -0
  91. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +8 -0
  92. package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +8 -0
  93. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +8 -0
  94. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +8 -0
  95. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -5
  96. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +23 -11
  97. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +17 -10
  98. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +41 -6
  99. package/project/.sdk/tm/c/core/context.c +1 -0
  100. package/project/.sdk/tm/c/core/sdk.h +7 -4
  101. package/project/.sdk/tm/c/feature/cache.c +243 -13
  102. package/project/.sdk/tm/c/feature/metrics.c +7 -0
  103. package/project/.sdk/tm/c/feature/paging.c +231 -2
  104. package/project/.sdk/tm/c/feature/ratelimit.c +5 -9
  105. package/project/.sdk/tm/c/feature/retry.c +51 -4
  106. package/project/.sdk/tm/c/feature/secrets.c +27 -38
  107. package/project/.sdk/tm/c/feature/streaming.c +2 -1
  108. package/project/.sdk/tm/c/feature/telemetry.c +19 -18
  109. package/project/.sdk/tm/c/feature/test.c +78 -54
  110. package/project/.sdk/tm/c/tests/feature_test.c +288 -0
  111. package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
  112. package/project/.sdk/tm/c/utility/clean.c +26 -33
  113. package/project/.sdk/tm/c/utility/make_options.c +89 -17
  114. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +14 -11
  115. package/project/.sdk/tm/clojure/src/sdk/client.clj +3 -1
  116. package/project/.sdk/tm/clojure/src/sdk/core.clj +50 -22
  117. package/project/.sdk/tm/clojure/src/sdk/features.clj +279 -80
  118. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +103 -1
  119. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +1 -0
  120. package/project/.sdk/tm/cpp/Makefile +5 -0
  121. package/project/.sdk/tm/cpp/core/types.hpp +148 -72
  122. package/project/.sdk/tm/cpp/feature/audit.hpp +12 -8
  123. package/project/.sdk/tm/cpp/feature/cache.hpp +188 -9
  124. package/project/.sdk/tm/cpp/feature/metrics.hpp +19 -0
  125. package/project/.sdk/tm/cpp/feature/paging.hpp +160 -2
  126. package/project/.sdk/tm/cpp/feature/ratelimit.hpp +18 -14
  127. package/project/.sdk/tm/cpp/feature/retry.hpp +46 -5
  128. package/project/.sdk/tm/cpp/feature/secrets.hpp +12 -0
  129. package/project/.sdk/tm/cpp/feature/streaming.hpp +2 -1
  130. package/project/.sdk/tm/cpp/feature/telemetry.hpp +17 -10
  131. package/project/.sdk/tm/cpp/feature/test.hpp +63 -53
  132. package/project/.sdk/tm/cpp/test/feature_test.cpp +236 -0
  133. package/project/.sdk/tm/cpp/utility/pipeline.hpp +44 -12
  134. package/project/.sdk/tm/csharp/core/Context.cs +4 -0
  135. package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
  136. package/project/.sdk/tm/csharp/feature/CacheFeature.cs +126 -12
  137. package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
  138. package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
  139. package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +26 -19
  140. package/project/.sdk/tm/csharp/feature/RetryFeature.cs +41 -7
  141. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +9 -27
  142. package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +2 -1
  143. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +11 -9
  144. package/project/.sdk/tm/csharp/feature/TestFeature.cs +55 -67
  145. package/project/.sdk/tm/csharp/test/FeatureTest.cs +238 -0
  146. package/project/.sdk/tm/csharp/utility/Clean.cs +5 -10
  147. package/project/.sdk/tm/csharp/utility/Fetcher.cs +7 -1
  148. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +94 -24
  149. package/project/.sdk/tm/elixir/lib/projectname/context.ex +2 -0
  150. package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +146 -30
  151. package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
  152. package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
  153. package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +6 -12
  154. package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +33 -9
  155. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +10 -56
  156. package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +2 -1
  157. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +7 -7
  158. package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +52 -48
  159. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +77 -47
  160. package/project/.sdk/tm/elixir/test/feature_test.exs +198 -0
  161. package/project/.sdk/tm/go/core/context.go +6 -0
  162. package/project/.sdk/tm/go/feature/audit_feature.go +1 -3
  163. package/project/.sdk/tm/go/feature/base_feature.go +11 -0
  164. package/project/.sdk/tm/go/feature/cache_feature.go +131 -4
  165. package/project/.sdk/tm/go/feature/metrics_feature.go +14 -0
  166. package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
  167. package/project/.sdk/tm/go/feature/ratelimit_feature.go +19 -17
  168. package/project/.sdk/tm/go/feature/retry_feature.go +81 -9
  169. package/project/.sdk/tm/go/feature/secrets_feature.go +17 -71
  170. package/project/.sdk/tm/go/feature/streaming_feature.go +2 -1
  171. package/project/.sdk/tm/go/feature/telemetry_feature.go +18 -11
  172. package/project/.sdk/tm/go/feature/test_feature.go +65 -55
  173. package/project/.sdk/tm/go/test/feature_corpus_test.go +357 -28
  174. package/project/.sdk/tm/go/test/feature_test.go +93 -0
  175. package/project/.sdk/tm/go/utility/clean.go +5 -7
  176. package/project/.sdk/tm/go/utility/fetcher.go +11 -0
  177. package/project/.sdk/tm/go/utility/make_options.go +116 -13
  178. package/project/.sdk/tm/java/core/Context.java +9 -0
  179. package/project/.sdk/tm/java/core/SdkClient.java +43 -14
  180. package/project/.sdk/tm/java/feature/AuditFeature.java +5 -1
  181. package/project/.sdk/tm/java/feature/CacheFeature.java +123 -17
  182. package/project/.sdk/tm/java/feature/MetricsFeature.java +31 -0
  183. package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
  184. package/project/.sdk/tm/java/feature/RatelimitFeature.java +15 -13
  185. package/project/.sdk/tm/java/feature/RetryFeature.java +33 -6
  186. package/project/.sdk/tm/java/feature/SecretsFeature.java +9 -92
  187. package/project/.sdk/tm/java/feature/StreamingFeature.java +2 -1
  188. package/project/.sdk/tm/java/feature/TelemetryFeature.java +17 -9
  189. package/project/.sdk/tm/java/feature/TestFeature.java +50 -63
  190. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +309 -17
  191. package/project/.sdk/tm/java/test/FeatureTest.java +60 -0
  192. package/project/.sdk/tm/java/utility/Clean.java +6 -10
  193. package/project/.sdk/tm/java/utility/Fetcher.java +5 -1
  194. package/project/.sdk/tm/java/utility/MakeOptions.java +131 -15
  195. package/project/.sdk/tm/js/src/Context.js +4 -0
  196. package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +118 -11
  197. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +3 -2
  198. package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +9 -4
  199. package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +103 -5
  200. package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +5 -9
  201. package/project/.sdk/tm/js/src/feature/rbac/RbacFeature.js +4 -4
  202. package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +25 -3
  203. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +16 -6
  204. package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +2 -1
  205. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +11 -6
  206. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +38 -1
  207. package/project/.sdk/tm/js/src/feature/validate/ValidateFeature.js +2 -1
  208. package/project/.sdk/tm/js/src/utility/CleanUtility.js +1 -1
  209. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +61 -12
  210. package/project/.sdk/tm/js/test/feature/Corpus.test.js +191 -23
  211. package/project/.sdk/tm/js/test/feature/harness.js +3 -3
  212. package/project/.sdk/tm/js/test/feature.test.js +14 -1
  213. package/project/.sdk/tm/js/test/pipeline.test.js +1 -1
  214. package/project/.sdk/tm/kotlin/core/Context.kt +3 -0
  215. package/project/.sdk/tm/kotlin/core/SdkClient.kt +23 -10
  216. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +5 -1
  217. package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +102 -7
  218. package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +22 -0
  219. package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
  220. package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +16 -13
  221. package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +36 -14
  222. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +10 -20
  223. package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +4 -0
  224. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +12 -10
  225. package/project/.sdk/tm/kotlin/feature/TestFeature.kt +45 -48
  226. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +173 -0
  227. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +5 -5
  228. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +4 -0
  229. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +86 -15
  230. package/project/.sdk/tm/lua/core/context.lua +6 -0
  231. package/project/.sdk/tm/lua/feature/cache_feature.lua +212 -15
  232. package/project/.sdk/tm/lua/feature/debug_feature.lua +2 -3
  233. package/project/.sdk/tm/lua/feature/metrics_feature.lua +5 -0
  234. package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
  235. package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +5 -9
  236. package/project/.sdk/tm/lua/feature/retry_feature.lua +43 -5
  237. package/project/.sdk/tm/lua/feature/secrets_feature.lua +15 -80
  238. package/project/.sdk/tm/lua/feature/streaming_feature.lua +2 -1
  239. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +18 -7
  240. package/project/.sdk/tm/lua/feature/test_feature.lua +60 -62
  241. package/project/.sdk/tm/lua/test/feature_test.lua +181 -3
  242. package/project/.sdk/tm/lua/utility/clean.lua +6 -9
  243. package/project/.sdk/tm/lua/utility/fetcher.lua +9 -0
  244. package/project/.sdk/tm/lua/utility/make_options.lua +60 -18
  245. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +21 -6
  246. package/project/.sdk/tm/ocaml/sdk_features.ml +392 -68
  247. package/project/.sdk/tm/ocaml/sdk_runtime.ml +47 -21
  248. package/project/.sdk/tm/ocaml/sdk_types.ml +2 -0
  249. package/project/.sdk/tm/ocaml/test/t_feature.ml +107 -2
  250. package/project/.sdk/tm/perl/core/context.pm +3 -0
  251. package/project/.sdk/tm/perl/feature/audit_feature.pm +4 -7
  252. package/project/.sdk/tm/perl/feature/cache_feature.pm +111 -15
  253. package/project/.sdk/tm/perl/feature/debug_feature.pm +2 -2
  254. package/project/.sdk/tm/perl/feature/metrics_feature.pm +5 -0
  255. package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
  256. package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +5 -11
  257. package/project/.sdk/tm/perl/feature/retry_feature.pm +22 -4
  258. package/project/.sdk/tm/perl/feature/secrets_feature.pm +13 -18
  259. package/project/.sdk/tm/perl/feature/streaming_feature.pm +2 -0
  260. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +17 -8
  261. package/project/.sdk/tm/perl/feature/test_feature.pm +45 -50
  262. package/project/.sdk/tm/perl/t/feature.t +68 -2
  263. package/project/.sdk/tm/perl/t/feature_corpus.t +204 -25
  264. package/project/.sdk/tm/perl/utility/clean.pm +6 -8
  265. package/project/.sdk/tm/perl/utility/fetcher.pm +4 -0
  266. package/project/.sdk/tm/perl/utility/make_options.pm +38 -15
  267. package/project/.sdk/tm/php/core/Context.php +4 -0
  268. package/project/.sdk/tm/php/feature/CacheFeature.php +98 -13
  269. package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
  270. package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
  271. package/project/.sdk/tm/php/feature/RatelimitFeature.php +5 -9
  272. package/project/.sdk/tm/php/feature/RetryFeature.php +27 -3
  273. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -15
  274. package/project/.sdk/tm/php/feature/StreamingFeature.php +2 -1
  275. package/project/.sdk/tm/php/feature/TelemetryFeature.php +10 -7
  276. package/project/.sdk/tm/php/feature/TestFeature.php +55 -47
  277. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +262 -17
  278. package/project/.sdk/tm/php/test/FeatureTest.php +68 -0
  279. package/project/.sdk/tm/php/utility/Clean.php +3 -10
  280. package/project/.sdk/tm/php/utility/Fetcher.php +8 -3
  281. package/project/.sdk/tm/php/utility/MakeOptions.php +45 -20
  282. package/project/.sdk/tm/py/pkg/core/context.py +4 -0
  283. package/project/.sdk/tm/py/pkg/feature/cache_feature.py +79 -13
  284. package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
  285. package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
  286. package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +13 -16
  287. package/project/.sdk/tm/py/pkg/feature/retry_feature.py +31 -6
  288. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +15 -66
  289. package/project/.sdk/tm/py/pkg/feature/streaming_feature.py +2 -1
  290. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +10 -6
  291. package/project/.sdk/tm/py/pkg/feature/test_feature.py +56 -53
  292. package/project/.sdk/tm/py/pkg/utility/clean.py +4 -10
  293. package/project/.sdk/tm/py/pkg/utility/make_options.py +77 -30
  294. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +23 -9
  295. package/project/.sdk/tm/py/test/test_feature.py +61 -1
  296. package/project/.sdk/tm/py/test/test_feature_corpus.py +197 -17
  297. package/project/.sdk/tm/py-data/pkg/fetch.py +6 -3
  298. package/project/.sdk/tm/py-data/test/test_fetch.py +7 -4
  299. package/project/.sdk/tm/rb/core/context.rb +4 -1
  300. package/project/.sdk/tm/rb/feature/audit_feature.rb +6 -5
  301. package/project/.sdk/tm/rb/feature/cache_feature.rb +75 -11
  302. package/project/.sdk/tm/rb/feature/debug_feature.rb +2 -2
  303. package/project/.sdk/tm/rb/feature/metrics_feature.rb +8 -0
  304. package/project/.sdk/tm/rb/feature/paging_feature.rb +87 -1
  305. package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +12 -16
  306. package/project/.sdk/tm/rb/feature/retry_feature.rb +19 -3
  307. package/project/.sdk/tm/rb/feature/secrets_feature.rb +9 -64
  308. package/project/.sdk/tm/rb/feature/streaming_feature.rb +2 -1
  309. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +11 -6
  310. package/project/.sdk/tm/rb/feature/test_feature.rb +42 -49
  311. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +191 -25
  312. package/project/.sdk/tm/rb/test/feature_test.rb +75 -1
  313. package/project/.sdk/tm/rb/utility/clean.rb +6 -7
  314. package/project/.sdk/tm/rb/utility/fetcher.rb +6 -0
  315. package/project/.sdk/tm/rb/utility/make_options.rb +37 -16
  316. package/project/.sdk/tm/rust/core/context.rs +8 -0
  317. package/project/.sdk/tm/rust/feature/audit.rs +2 -2
  318. package/project/.sdk/tm/rust/feature/cache.rs +120 -3
  319. package/project/.sdk/tm/rust/feature/metrics.rs +24 -1
  320. package/project/.sdk/tm/rust/feature/paging.rs +189 -3
  321. package/project/.sdk/tm/rust/feature/ratelimit.rs +5 -10
  322. package/project/.sdk/tm/rust/feature/retry.rs +59 -6
  323. package/project/.sdk/tm/rust/feature/secrets.rs +36 -98
  324. package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
  325. package/project/.sdk/tm/rust/feature/support.rs +4 -0
  326. package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
  327. package/project/.sdk/tm/rust/feature/test.rs +63 -57
  328. package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +3 -3
  329. package/project/.sdk/tm/rust/tests/feature_test.rs +274 -0
  330. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
  331. package/project/.sdk/tm/rust/utility/clean.rs +35 -43
  332. package/project/.sdk/tm/rust/utility/fetcher.rs +6 -0
  333. package/project/.sdk/tm/rust/utility/make_options.rs +130 -38
  334. package/project/.sdk/tm/scala/core/Context.scala +4 -0
  335. package/project/.sdk/tm/scala/core/SdkClient.scala +45 -11
  336. package/project/.sdk/tm/scala/feature/AuditFeature.scala +6 -1
  337. package/project/.sdk/tm/scala/feature/CacheFeature.scala +117 -11
  338. package/project/.sdk/tm/scala/feature/MetricsFeature.scala +31 -1
  339. package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
  340. package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +14 -11
  341. package/project/.sdk/tm/scala/feature/RetryFeature.scala +29 -7
  342. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +11 -24
  343. package/project/.sdk/tm/scala/feature/StreamingFeature.scala +2 -1
  344. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +12 -10
  345. package/project/.sdk/tm/scala/feature/TestFeature.scala +44 -44
  346. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +69 -0
  347. package/project/.sdk/tm/scala/utility/Fetcher.scala +5 -0
  348. package/project/.sdk/tm/scala/utility/Make.scala +99 -14
  349. package/project/.sdk/tm/scala/utility/Misc.scala +5 -8
  350. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +3 -0
  351. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
  352. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +122 -11
  353. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
  354. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
  355. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +19 -13
  356. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +40 -5
  357. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +9 -13
  358. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +2 -1
  359. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +11 -9
  360. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +55 -49
  361. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +4 -0
  362. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +56 -17
  363. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +4 -5
  364. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +166 -0
  365. package/project/.sdk/tm/ts/src/Context.ts +4 -0
  366. package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +115 -4
  367. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +3 -2
  368. package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +6 -1
  369. package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +103 -5
  370. package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +5 -9
  371. package/project/.sdk/tm/ts/src/feature/rbac/RbacFeature.ts +4 -4
  372. package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +25 -3
  373. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +14 -2
  374. package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +2 -1
  375. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +11 -6
  376. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +8 -7
  377. package/project/.sdk/tm/ts/src/feature/validate/ValidateFeature.ts +2 -1
  378. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +1 -1
  379. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +63 -12
  380. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +192 -23
  381. package/project/.sdk/tm/ts/test/feature/harness.ts +3 -3
  382. package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
  383. package/project/.sdk/tm/ts/test/pipeline.test.ts +1 -1
  384. package/project/.sdk/tm/zig/core/context.zig +5 -0
  385. package/project/.sdk/tm/zig/core/utility.zig +118 -17
  386. package/project/.sdk/tm/zig/feature/cache.zig +144 -13
  387. package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
  388. package/project/.sdk/tm/zig/feature/paging.zig +172 -4
  389. package/project/.sdk/tm/zig/feature/ratelimit.zig +5 -11
  390. package/project/.sdk/tm/zig/feature/retry.zig +41 -3
  391. package/project/.sdk/tm/zig/feature/secrets.zig +6 -1
  392. package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
  393. package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
  394. package/project/.sdk/tm/zig/feature/test.zig +56 -40
  395. package/project/.sdk/tm/zig/test/feature_test.zig +174 -0
  396. package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
  397. package/project/sdkgen-package.json +1 -1
  398. package/src/cmp/ReadmeExplanation.ts +5 -2
  399. package/src/cmp/ReadmeFeatures.ts +21 -6
  400. package/src/helpers/optspec.ts +2 -2
@@ -49,13 +49,19 @@ class FeatureCorpusTest extends TestCase
49
49
  * Returns the shape the real fetcher returns: a [response, err] PAIR, with
50
50
  * the parsed body behind a `json` closure and `body` as the raw string. A
51
51
  * script that only set `body` would look like an empty result, which reads
52
- * as a feature defect rather than a mis-shaped script.
52
+ * as a feature defect rather than a mis-shaped script. Each URL it is sent
53
+ * is kept in `$sent`, and the time it was sent in `$at`; a `cut` response
54
+ * is one whose body stops before its end.
53
55
  */
54
- private static function scriptedFetcher($res): callable
56
+ private static function scriptedFetcher($res, ?array &$sent = null, ?array &$at = null): callable
55
57
  {
56
58
  $n = -1;
57
- return function ($ctx, $fullurl, $fetchdef) use ($res, &$n) {
59
+ $sent = $sent ?? [];
60
+ $at = $at ?? [];
61
+ return function ($ctx, $fullurl, $fetchdef) use ($res, &$n, &$sent, &$at) {
58
62
  $n++;
63
+ $sent[] = $fullurl;
64
+ $at[] = hrtime(true) / 1e6;
59
65
  $spec = [];
60
66
  if (is_array($res) && count($res) > 0) {
61
67
  $i = $n >= count($res) ? count($res) - 1 : $n;
@@ -69,6 +75,21 @@ class FeatureCorpusTest extends TestCase
69
75
  $status = isset($spec['status']) ? (int)$spec['status'] : 200;
70
76
  $body = $spec['body'] ?? [];
71
77
 
78
+ if (($spec['cut'] ?? null) === true) {
79
+ $raw = (string)json_encode($body);
80
+ return [
81
+ [
82
+ 'status' => $status,
83
+ 'statusText' => $status < 400 ? 'OK' : 'ERR',
84
+ 'headers' => (array)($spec['headers'] ?? []),
85
+ 'json' => function () { return null; },
86
+ 'body' => substr($raw, 0, intdiv(strlen($raw), 2)),
87
+ 'unreadable' => true,
88
+ ],
89
+ null,
90
+ ];
91
+ }
92
+
72
93
  return [
73
94
  [
74
95
  'status' => $status,
@@ -89,8 +110,10 @@ class FeatureCorpusTest extends TestCase
89
110
  * transport: 'base' and REPLACES the transport, so a client in test mode
90
111
  * would shadow the script.
91
112
  */
92
- private static function buildClient(array $kase)
113
+ private static function buildClient(array $kase, ?array &$sent = null, ?array &$at = null)
93
114
  {
115
+ $sent = $sent ?? [];
116
+ $at = $at ?? [];
94
117
  // 'test' here is the OPTION, not the `test` FEATURE. It says "this
95
118
  // client is not live", which is what makes a REQUIRED OpenAPI server
96
119
  // variable resolve to a deterministic test-<name> rather than throw
@@ -99,7 +122,7 @@ class FeatureCorpusTest extends TestCase
99
122
  // and would shadow it.
100
123
  $opts = [
101
124
  'test' => ['active' => true],
102
- 'utility' => ['fetcher' => self::scriptedFetcher($kase['res'] ?? null)],
125
+ 'utility' => ['fetcher' => self::scriptedFetcher($kase['res'] ?? null, $sent, $at)],
103
126
  ];
104
127
  if (isset($kase['feature'])) {
105
128
  $opts['feature'] = $kase['feature'];
@@ -169,12 +192,31 @@ class FeatureCorpusTest extends TestCase
169
192
  return $out;
170
193
  }
171
194
 
172
- private static function invoke($client, array $op, array $ctrl)
195
+ private static function invoke($client, array $op, array $ctrl, array $args = [])
173
196
  {
174
197
  $acc = $op['accessor'];
175
198
  $ent = $client->$acc();
176
199
  $fn = $op['op'];
177
- return $ent->$fn([], $ctrl);
200
+ return $ent->$fn($args, $ctrl);
201
+ }
202
+
203
+ private const ITEM_ARGS = ['id' => 'corpus-item'];
204
+
205
+ /** A write of one entity (#ITEM) that completes when driven with ITEM_ARGS. */
206
+ private static function usableItem(string $accessor): ?array
207
+ {
208
+ foreach (self::candidates(self::buildClient([])) as $cand) {
209
+ if ($cand['accessor'] !== $accessor || !in_array($cand['op'], ['update', 'patch', 'remove'], true)) {
210
+ continue;
211
+ }
212
+ try {
213
+ self::invoke(self::buildClient([]), $cand, [], self::ITEM_ARGS);
214
+ } catch (\Throwable $e) {
215
+ continue;
216
+ }
217
+ return $cand;
218
+ }
219
+ return null;
178
220
  }
179
221
 
180
222
  /**
@@ -200,7 +242,134 @@ class FeatureCorpusTest extends TestCase
200
242
  return $picked;
201
243
  }
202
244
 
245
+ private const READ_OPS = ['list', 'load'];
246
+ private const WRITE_OPS = ['create', 'update', 'patch', 'remove'];
247
+
248
+ /** A read and a write of one entity (#READ, #WRITE), each driven as usableOps drives an op. */
249
+ private static function usablePair(): ?array
250
+ {
251
+ $found = [];
252
+ foreach (self::candidates(self::buildClient([])) as $cand) {
253
+ $role = in_array($cand['op'], self::READ_OPS, true) ? 'read'
254
+ : (in_array($cand['op'], self::WRITE_OPS, true) ? 'write' : null);
255
+ if (null === $role || isset($found[$cand['accessor']][$role])) {
256
+ continue;
257
+ }
258
+ try {
259
+ self::invoke(self::buildClient([]), $cand, []);
260
+ } catch (\Throwable $e) {
261
+ continue;
262
+ }
263
+ $found[$cand['accessor']][$role] = $cand;
264
+ if (isset($found[$cand['accessor']]['read'], $found[$cand['accessor']]['write'])) {
265
+ return $found[$cand['accessor']];
266
+ }
267
+ }
268
+ return null;
269
+ }
270
+
271
+ /** Read one operation through the entity's stream(); how many it yields. */
272
+ private static function streamItems($client, array $op, array $ctrl, array $args): int
273
+ {
274
+ $acc = $op['accessor'];
275
+ $items = 0;
276
+ foreach ($client->$acc()->stream($op['op'], $args, ['ctrl' => $ctrl]) as $_item) {
277
+ $items++;
278
+ }
279
+ return $items;
280
+ }
281
+
282
+ /**
283
+ * Each request a case expects, in order: its path, and its whole query. A
284
+ * path is compared without its leading slash, which an SDK with no base
285
+ * omits.
286
+ */
287
+ private function checkSent(array $sent, array $expect, string $label): void
288
+ {
289
+ $this->assertCount(count($expect), $sent, "$label: requests sent: " . implode(' | ', $sent));
290
+ foreach ($expect as $i => $want) {
291
+ $url = parse_url($sent[$i]);
292
+ if (isset($want['path'])) {
293
+ $this->assertSame(ltrim($want['path'], '/'), ltrim($url['path'] ?? '', '/'),
294
+ "$label: request $i path");
295
+ }
296
+ if (isset($want['query'])) {
297
+ $query = [];
298
+ foreach (explode('&', $url['query'] ?? '') as $pair) {
299
+ if ($pair === '') {
300
+ continue;
301
+ }
302
+ $kv = explode('=', $pair, 2);
303
+ $query[urldecode($kv[0])] = urldecode($kv[1] ?? '');
304
+ }
305
+ ksort($query);
306
+ $wq = $want['query'];
307
+ ksort($wq);
308
+ $this->assertSame($wq, $query, "$label: request $i query");
309
+ }
310
+ }
311
+ }
312
+
313
+ /**
314
+ * One step: it may wait, may add request headers, and may pass `args` as
315
+ * the first argument. A `stream` step reads the operation through
316
+ * stream(), and `items` is how many it yields.
317
+ */
318
+ private static function step($client, array $op, array $step, array $ctrl)
319
+ {
320
+ if (isset($step['wait'])) {
321
+ usleep((int)($step['wait'] * 1000));
322
+ }
323
+ $args = is_array($step['args'] ?? null) ? $step['args'] : [];
324
+ if (($step['stream'] ?? null) === true) {
325
+ $items = self::streamItems($client, $op, $ctrl, $args);
326
+ if (isset($step['items']) && $items !== $step['items']) {
327
+ throw new \PHPUnit\Framework\AssertionFailedError(
328
+ "{$op['key']}: streamed $items item(s), want {$step['items']}");
329
+ }
330
+ return $items;
331
+ }
332
+ if (!isset($step['headers'])) {
333
+ return self::invoke($client, $op, $ctrl, $args);
334
+ }
335
+ $prior = $client->options;
336
+ $client->options['headers'] = array_merge($prior['headers'] ?? [], $step['headers']);
337
+ try {
338
+ return self::invoke($client, $op, $ctrl, $args);
339
+ } finally {
340
+ $client->options = $prior;
341
+ }
342
+ }
343
+
203
344
  /** Replace #OPn throughout a case, keys included. */
345
+ /**
346
+ * A step with `together: N` is N calls. PHP runs one call at a time, so
347
+ * they go in turn; each call's throwable, or null, is returned.
348
+ */
349
+ private static function calls($client, array $op, array $step, array $ctrl): array
350
+ {
351
+ $errs = [];
352
+ for ($i = 0; $i < (int)($step['together'] ?? 1); $i++) {
353
+ try {
354
+ self::step($client, $op, $step, $ctrl);
355
+ $errs[] = null;
356
+ } catch (\Throwable $err) {
357
+ $errs[] = $err;
358
+ }
359
+ }
360
+ return $errs;
361
+ }
362
+
363
+ /** The most requests seen in any window of `ms`. */
364
+ private static function busiest(array $sent, float $ms): int
365
+ {
366
+ $most = 0;
367
+ foreach ($sent as $from) {
368
+ $most = max($most, count(array_filter($sent, fn ($t) => $from <= $t && $t < $from + $ms)));
369
+ }
370
+ return $most;
371
+ }
372
+
204
373
  private static function resolve($node, array $tokens)
205
374
  {
206
375
  if (is_string($node)) {
@@ -255,6 +424,15 @@ class FeatureCorpusTest extends TestCase
255
424
  return;
256
425
  }
257
426
 
427
+ if (is_array($expect)) {
428
+ $this->assertTrue(is_array($actual) && array_is_list($actual) && count($actual) === count($expect),
429
+ "$path: want " . count($expect) . ' item(s), got ' . var_export($actual, true));
430
+ foreach ($expect as $i => $want) {
431
+ $this->subset($actual[$i], $want, "{$path}[$i]");
432
+ }
433
+ return;
434
+ }
435
+
258
436
  if (is_int($expect) || is_float($expect)) {
259
437
  $this->assertTrue(is_int($actual) || is_float($actual),
260
438
  "$path: expected a number, got " . var_export($actual, true));
@@ -387,6 +565,21 @@ class FeatureCorpusTest extends TestCase
387
565
  foreach ($ops as $o) {
388
566
  $byKey[$o['key']] = $o;
389
567
  }
568
+ $pair = self::usablePair();
569
+ foreach ($pair ?? [] as $o) {
570
+ $byKey[$o['key']] = $o;
571
+ }
572
+ $item = null === $pair ? null : self::usableItem($pair['read']['accessor']);
573
+ if (null !== $item) {
574
+ $byKey[$item['key']] = $item;
575
+ }
576
+ $other = null;
577
+ foreach (null === $pair ? [] : $ops as $o) {
578
+ if ($o['accessor'] !== $pair['read']['accessor']) {
579
+ $other = $o;
580
+ break;
581
+ }
582
+ }
390
583
 
391
584
  $ran = 0;
392
585
  foreach ($cases as $raw) {
@@ -397,6 +590,27 @@ class FeatureCorpusTest extends TestCase
397
590
  continue;
398
591
  }
399
592
 
593
+ $paired = 1 === preg_match('/#(READ|WRITE|ITEM|OTHER)\b/', json_encode($raw));
594
+ if ($paired && null === $pair) {
595
+ fwrite(STDERR, sprintf(
596
+ "skip \"%s\": needs a read and a write of one entity, this SDK offers none\n",
597
+ $raw['name'] ?? ''));
598
+ continue;
599
+ }
600
+
601
+ $lacking = null;
602
+ foreach (['#ITEM' => $item, '#OTHER' => $other] as $tok => $found) {
603
+ if ($paired && null === $found && 1 === preg_match('/' . $tok . '\b/', json_encode($raw))) {
604
+ $lacking = $tok;
605
+ break;
606
+ }
607
+ }
608
+ if (null !== $lacking) {
609
+ fwrite(STDERR, sprintf("skip \"%s\": needs %s, which this SDK cannot drive\n",
610
+ $raw['name'] ?? '', $lacking));
611
+ continue;
612
+ }
613
+
400
614
  $missing = self::missingFeature($raw, $have);
401
615
  if (null !== $missing) {
402
616
  fwrite(STDERR, sprintf(
@@ -409,27 +623,48 @@ class FeatureCorpusTest extends TestCase
409
623
  for ($i = 0; $i < $need; $i++) {
410
624
  $tokens['#OP' . ($i + 1)] = $ops[$i]['key'];
411
625
  }
626
+ if ($paired) {
627
+ $tokens['#READ'] = $pair['read']['key'];
628
+ $tokens['#WRITE'] = $pair['write']['key'];
629
+ if (null !== $item) {
630
+ $tokens['#ITEM'] = $item['key'];
631
+ }
632
+ if (null !== $other) {
633
+ $tokens['#OTHER'] = $other['key'];
634
+ }
635
+ }
412
636
  $kase = self::resolve($raw, $tokens);
413
637
  $label = (string)($kase['name'] ?? '');
414
638
  $ran++;
415
639
 
416
640
  // Every failing case is reported, not only the first.
417
641
  try {
418
- $client = self::buildClient($kase);
419
-
642
+ $sent = [];
643
+ $at = [];
644
+ $client = self::buildClient($kase, $sent, $at);
645
+
646
+ // A case-level ctrl is one control every step shares. PHP
647
+ // passes arrays by value, so the paging record is carried
648
+ // on by hand, as the features reference describes.
649
+ $shared = $kase['ctrl'] ?? null;
420
650
  foreach (($kase['op'] ?? []) as $step) {
421
651
  $op = $byKey[$step['op']] ?? null;
422
652
  $this->assertNotNull($op, "$label: no operation {$step['op']}");
423
- $ctrl = $step['ctrl'] ?? [];
653
+ if (is_array($shared) && isset($client->_paging['last'])) {
654
+ $shared['paging'] = $client->_paging['last'];
655
+ }
656
+ $ctrl = $step['ctrl'] ?? $shared ?? [];
424
657
  $wanterr = $step['err'] ?? null;
425
658
 
426
- try {
427
- self::invoke($client, $op, $ctrl);
428
- $this->assertNull($wanterr,
429
- "$label: {$step['op']} was expected to fail, and did not");
430
- } catch (\PHPUnit\Framework\AssertionFailedError $e) {
431
- throw $e;
432
- } catch (\Throwable $err) {
659
+ foreach (self::calls($client, $op, $step, $ctrl) as $err) {
660
+ if (null === $err) {
661
+ $this->assertNull($wanterr,
662
+ "$label: {$step['op']} was expected to fail, and did not");
663
+ continue;
664
+ }
665
+ if ($err instanceof \PHPUnit\Framework\AssertionFailedError) {
666
+ throw $err;
667
+ }
433
668
  $this->assertNotNull($wanterr,
434
669
  "$label: {$step['op']} failed unexpectedly: " . $err->getMessage());
435
670
  if (is_string($wanterr)) {
@@ -447,6 +682,16 @@ class FeatureCorpusTest extends TestCase
447
682
  }
448
683
  }
449
684
 
685
+ if (isset($kase['pace'])) {
686
+ $most = self::busiest($at, (float)$kase['pace']['ms']);
687
+ $this->assertLessThanOrEqual($kase['pace']['max'], $most,
688
+ "$label: $most requests within {$kase['pace']['ms']} ms, "
689
+ . "want at most {$kase['pace']['max']}");
690
+ }
691
+
692
+ if (isset($kase['sent'])) {
693
+ $this->checkSent($sent, $kase['sent'], $label);
694
+ }
450
695
  $this->subset(self::record($client, $name), $kase['out'] ?? [],
451
696
  "$label: _$name");
452
697
  } catch (\Throwable $e) {
@@ -763,6 +763,74 @@ class FeatureTest extends TestCase
763
763
  $this->assertCount(3, $rec->calls);
764
764
  }
765
765
 
766
+ public function test_cache_keys_on_the_request_headers(): void
767
+ {
768
+ $this->needs('cache');
769
+ $rec = new FtRecorder();
770
+ $h = new FtHarness([
771
+ ['name' => 'cache', 'options' => ['ttl' => 10000]],
772
+ ], $rec->server());
773
+ $h->op(['op' => 'load', 'path' => '/w/1', 'headers' => ['x-tenant' => 'tenant-a']]);
774
+ $h->op(['op' => 'load', 'path' => '/w/1', 'headers' => ['X-Tenant' => 'tenant-b']]);
775
+ $this->assertCount(2, $rec->calls);
776
+ $h->op(['op' => 'load', 'path' => '/w/1', 'headers' => ['x-tenant' => 'tenant-b']]);
777
+ $this->assertCount(2, $rec->calls);
778
+ }
779
+
780
+ public function test_cache_a_write_drops_its_collection(): void
781
+ {
782
+ $this->needs('cache');
783
+ $rec = new FtRecorder();
784
+ $h = new FtHarness([
785
+ ['name' => 'cache', 'options' => ['ttl' => 10000]],
786
+ ], $rec->server());
787
+ $paths = ['/w/1', '/w', '/w/1/part', '/other/1', '/w/2'];
788
+ foreach ($paths as $p) {
789
+ $h->op(['op' => 'load', 'path' => $p]);
790
+ }
791
+ $h->op(['op' => 'update', 'method' => 'PUT', 'path' => '/w/1']);
792
+ foreach ($paths as $p) {
793
+ $h->op(['op' => 'load', 'path' => $p]);
794
+ }
795
+ $this->assertCount(9, $rec->calls);
796
+ $this->assertSame(2, $h->client->_cache['hit']);
797
+ }
798
+
799
+ public function test_cache_control_prevents_storing(): void
800
+ {
801
+ $this->needs('cache');
802
+ foreach (['no-store', 'private', 'No-Cache', 'max-age=60, private'] as $control) {
803
+ $rec = new FtRecorder(function (int $_n) use ($control) {
804
+ return FtHarness::response(200, ['ok' => true], ['Cache-Control' => $control]);
805
+ });
806
+ $h = new FtHarness([
807
+ ['name' => 'cache', 'options' => ['ttl' => 10000]],
808
+ ], $rec->server());
809
+ $h->op(['op' => 'load', 'path' => '/w']);
810
+ $h->op(['op' => 'load', 'path' => '/w']);
811
+ $this->assertCount(2, $rec->calls, $control);
812
+ }
813
+ }
814
+
815
+ public function test_cache_max_age_caps_the_ttl(): void
816
+ {
817
+ $this->needs('cache');
818
+ $clock = new FtClock();
819
+ $rec = new FtRecorder(function (int $_n) {
820
+ return FtHarness::response(200, ['ok' => true], ['cache-control' => 'max-age=1']);
821
+ });
822
+ $h = new FtHarness([
823
+ ['name' => 'cache', 'options' => ['ttl' => 10000, 'now' => $clock->now()]],
824
+ ], $rec->server());
825
+ $h->op(['op' => 'load', 'path' => '/w']);
826
+ $clock->advance(500);
827
+ $h->op(['op' => 'load', 'path' => '/w']);
828
+ $this->assertCount(1, $rec->calls);
829
+ $clock->advance(600);
830
+ $h->op(['op' => 'load', 'path' => '/w']);
831
+ $this->assertCount(2, $rec->calls);
832
+ }
833
+
766
834
 
767
835
  // --- idempotency ----------------------------------------------------------
768
836
 
@@ -172,20 +172,13 @@ class ProjectNameClean
172
172
  }));
173
173
  }
174
174
 
175
- // A context without options (make_error is reached with a bare one)
175
+ // A context without a registry (make_error is reached with a bare one)
176
176
  // falls back to the schema defaults, so nothing leaves raw for want of a
177
177
  // constructor.
178
178
  private static function config_of(?ProjectNameContext $ctx): \stdClass
179
179
  {
180
- $derived = null;
181
- if (null !== $ctx && is_array($ctx->options)) {
182
- $derived = $ctx->options['__derived__']['clean'] ?? null;
183
- }
184
- if ($derived instanceof \stdClass) {
185
- return $derived;
186
- }
187
- if (is_array($derived)) {
188
- return (object)$derived;
180
+ if (null !== $ctx && $ctx->cleancfg instanceof \stdClass) {
181
+ return $ctx->cleancfg;
189
182
  }
190
183
  require_once __DIR__ . '/../schema.php';
191
184
  return self::config(\Voxgig\Struct\Struct::getprop(ProjectNameSchema::optspec(), 'clean'));
@@ -166,12 +166,16 @@ class ProjectNameFetcher
166
166
  $header_lines[] = 'User-Agent: ' . self::DEFAULT_USER_AGENT;
167
167
  }
168
168
 
169
+ // A bound in milliseconds, for a caller beneath the timeout feature.
170
+ $bound = $fetchdef['timeout'] ?? null;
171
+ $bound = is_numeric($bound) && 0 < $bound ? (int)$bound : 30000;
172
+
169
173
  // Prefer cURL when available — its header capture is reliable across
170
174
  // PHP versions, while file_get_contents + custom stream wrappers
171
175
  // don't propagate $http_response_header for user-defined wrappers
172
176
  // in PHP 8.3+.
173
177
  if (function_exists('curl_init')) {
174
- return self::curlFetch($fullurl, $method_str, $body_str, $header_lines);
178
+ return self::curlFetch($fullurl, $method_str, $body_str, $header_lines, $bound);
175
179
  }
176
180
 
177
181
  $opts = [
@@ -179,6 +183,7 @@ class ProjectNameFetcher
179
183
  'method' => $method_str,
180
184
  'ignore_errors' => true,
181
185
  'follow_location' => 0,
186
+ 'timeout' => $bound / 1000,
182
187
  ],
183
188
  ];
184
189
 
@@ -280,13 +285,13 @@ class ProjectNameFetcher
280
285
  return [$decoded, null];
281
286
  }
282
287
 
283
- private static function curlFetch(string $fullurl, string $method, $body_str, array $header_lines): array
288
+ private static function curlFetch(string $fullurl, string $method, $body_str, array $header_lines, int $bound): array
284
289
  {
285
290
  $ch = self::curlHandle($fullurl);
286
291
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
287
292
  curl_setopt($ch, CURLOPT_HEADER, false);
288
293
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
289
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
294
+ curl_setopt($ch, CURLOPT_TIMEOUT_MS, $bound);
290
295
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
291
296
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
292
297
  // '' offers every encoding this cURL decodes, and decodes it: a
@@ -25,6 +25,26 @@ class ProjectNameMakeOptions
25
25
  return $val;
26
26
  }
27
27
 
28
+ // The model's options for a feature sit beneath the caller's, key by key: a
29
+ // key the caller sets replaces the default whole, so a list is never merged.
30
+ private static function feature_defaults(mixed $cfgfeature, mixed $feature): ?array
31
+ {
32
+ if (null !== $feature && !is_array($feature)) {
33
+ return null;
34
+ }
35
+ $out = $feature ?? [];
36
+ foreach (is_array($cfgfeature) ? $cfgfeature : [] as $name => $fdef) {
37
+ $dflt = is_array($fdef) ? ($fdef['options'] ?? null) : null;
38
+ $given = $out[$name] ?? null;
39
+ if (!is_array($dflt) || (null === $given && true !== ($dflt['active'] ?? null))
40
+ || (null !== $given && !is_array($given))) {
41
+ continue;
42
+ }
43
+ $out[$name] = array_merge(self::to_array_deep(\Voxgig\Struct\Struct::clone($dflt)), $given ?? []);
44
+ }
45
+ return $out;
46
+ }
47
+
28
48
  public static function call(ProjectNameContext $ctx): array
29
49
  {
30
50
  $options = $ctx->options ?? [];
@@ -60,9 +80,7 @@ class ProjectNameMakeOptions
60
80
  $cfgclean = $block($cfgopts['clean'] ?? null);
61
81
  $specclean = $block(\Voxgig\Struct\Struct::getprop($optspec, 'clean'));
62
82
  $cleancfg = ProjectNameClean::config(array_merge($specclean, $cfgclean, $rawclean));
63
- $cleanctx = new ProjectNameContext([
64
- 'options' => ['__derived__' => ['clean' => $cleancfg]],
65
- ], null);
83
+ $cleanctx = new ProjectNameContext(['cleancfg' => $cleancfg], null);
66
84
  $rawopts = is_object($options) ? get_object_vars($options)
67
85
  : (is_array($options) ? $options : []);
68
86
  unset($rawopts['clean']);
@@ -190,6 +208,11 @@ class ProjectNameMakeOptions
190
208
  $opts['feature'] = $fmap;
191
209
  }
192
210
 
211
+ $fdefaults = self::feature_defaults($config['feature'] ?? null, $opts['feature'] ?? null);
212
+ if (null !== $fdefaults) {
213
+ $opts['feature'] = $fdefaults;
214
+ }
215
+
193
216
  // Empty [] would be treated as a list and clobber the map under merge;
194
217
  // substitute an empty stdClass to preserve map semantics.
195
218
  $cfgopts = ProjectNameHelpers::empty_maps($cfgopts, $optspec);
@@ -278,22 +301,23 @@ class ProjectNameMakeOptions
278
301
  $opts['system']['fetch'] = $sys_fetch;
279
302
  }
280
303
 
281
- // Resolve the feature add-order: an explicit list order (above) wins;
282
- // otherwise order the map test-first, then the remaining names sorted,
283
- // so the outcome is deterministic and `test` is always the base.
284
- if (count($featureorder) === 0) {
304
+ // Resolve the feature add-order: an explicit list order (above) wins, and
305
+ // the names it leaves out follow it test-first, then sorted, so the
306
+ // outcome is deterministic and `test` is the base transport of a map.
307
+ {
285
308
  $fmap = $opts['feature'] ?? null;
286
309
  $names = is_array($fmap)
287
- ? array_values(array_filter(array_keys($fmap), 'is_string'))
310
+ ? array_values(array_filter(array_keys($fmap), function ($n) use ($featureorder) {
311
+ return is_string($n) && !in_array($n, $featureorder, true);
312
+ }))
288
313
  : [];
289
314
  sort($names, SORT_STRING);
290
315
  if (in_array('test', $names, true)) {
291
- $rest = array_values(array_filter($names, function ($n) {
316
+ $rest = array_merge(['test'], array_values(array_filter($names, function ($n) {
292
317
  return $n !== 'test';
293
- }));
294
- $featureorder = array_merge(['test'], $rest);
318
+ })));
295
319
  } else {
296
- $featureorder = $names;
320
+ $rest = $names;
297
321
  }
298
322
  // Station special case, mirroring test's: its transport wrap must
299
323
  // sit immediately outside the base transport (inside every other
@@ -301,12 +325,13 @@ class ProjectNameMakeOptions
301
325
  // test - or first, when no test entry exists. Without this the
302
326
  // sorted default would init station last and wrap OUTSIDE the
303
327
  // recording features, turning its wire-truth events into fiction.
304
- $si = array_search('station', $featureorder, true);
328
+ $si = array_search('station', $rest, true);
305
329
  if (false !== $si) {
306
- array_splice($featureorder, $si, 1);
307
- $ti = array_search('test', $featureorder, true);
308
- array_splice($featureorder, false === $ti ? 0 : $ti + 1, 0, ['station']);
330
+ array_splice($rest, $si, 1);
331
+ $ti = array_search('test', $rest, true);
332
+ array_splice($rest, false === $ti ? 0 : $ti + 1, 0, ['station']);
309
333
  }
334
+ $featureorder = array_merge($featureorder, $rest);
310
335
  }
311
336
 
312
337
  // Again over the merged result: the config's own defaults can carry one.
@@ -314,10 +339,10 @@ class ProjectNameMakeOptions
314
339
  unset($merged['clean']);
315
340
  ProjectNameClean::add_options($cleanctx, $merged);
316
341
 
317
- $opts['__derived__'] = [
318
- 'clean' => $cleancfg,
319
- 'featureorder' => $featureorder,
320
- ];
342
+ $opts['__derived__'] = ['featureorder' => $featureorder];
343
+
344
+ // Beside the options, not in them: options_map hands them to callers.
345
+ $ctx->cleancfg = $cleancfg;
321
346
 
322
347
  return $opts;
323
348
  }
@@ -95,6 +95,10 @@ class ProjectNameContext:
95
95
  else:
96
96
  self.options = None
97
97
 
98
+ # The clean registry, beside the options rather than in them.
99
+ cc = get_ctx_prop(ctxmap, "cleancfg")
100
+ self.cleancfg = cc if cc is not None else getattr(basectx, "cleancfg", None)
101
+
98
102
  # Entity
99
103
  e = get_ctx_prop(ctxmap, "entity")
100
104
  if e is not None: