@opensip-cli/simulation 0.1.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 (348) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/internal-surface.test.d.ts +9 -0
  5. package/dist/__tests__/internal-surface.test.d.ts.map +1 -0
  6. package/dist/__tests__/internal-surface.test.js +38 -0
  7. package/dist/__tests__/internal-surface.test.js.map +1 -0
  8. package/dist/__tests__/plugin-loader.test.d.ts +2 -0
  9. package/dist/__tests__/plugin-loader.test.d.ts.map +1 -0
  10. package/dist/__tests__/plugin-loader.test.js +64 -0
  11. package/dist/__tests__/plugin-loader.test.js.map +1 -0
  12. package/dist/__tests__/public-api.test.d.ts +15 -0
  13. package/dist/__tests__/public-api.test.d.ts.map +1 -0
  14. package/dist/__tests__/public-api.test.js +73 -0
  15. package/dist/__tests__/public-api.test.js.map +1 -0
  16. package/dist/__tests__/registry-cross-kind.test.d.ts +6 -0
  17. package/dist/__tests__/registry-cross-kind.test.d.ts.map +1 -0
  18. package/dist/__tests__/registry-cross-kind.test.js +86 -0
  19. package/dist/__tests__/registry-cross-kind.test.js.map +1 -0
  20. package/dist/__tests__/scenario-execution.test.d.ts +10 -0
  21. package/dist/__tests__/scenario-execution.test.d.ts.map +1 -0
  22. package/dist/__tests__/scenario-execution.test.js +92 -0
  23. package/dist/__tests__/scenario-execution.test.js.map +1 -0
  24. package/dist/__tests__/sim-capability-contract.test.d.ts +10 -0
  25. package/dist/__tests__/sim-capability-contract.test.d.ts.map +1 -0
  26. package/dist/__tests__/sim-capability-contract.test.js +131 -0
  27. package/dist/__tests__/sim-capability-contract.test.js.map +1 -0
  28. package/dist/__tests__/sim-config-schema.test.d.ts +5 -0
  29. package/dist/__tests__/sim-config-schema.test.d.ts.map +1 -0
  30. package/dist/__tests__/sim-config-schema.test.js +23 -0
  31. package/dist/__tests__/sim-config-schema.test.js.map +1 -0
  32. package/dist/__tests__/sim-failure-signal.test.d.ts +10 -0
  33. package/dist/__tests__/sim-failure-signal.test.d.ts.map +1 -0
  34. package/dist/__tests__/sim-failure-signal.test.js +86 -0
  35. package/dist/__tests__/sim-failure-signal.test.js.map +1 -0
  36. package/dist/__tests__/surviving-surface-edges.test.d.ts +10 -0
  37. package/dist/__tests__/surviving-surface-edges.test.d.ts.map +1 -0
  38. package/dist/__tests__/surviving-surface-edges.test.js +122 -0
  39. package/dist/__tests__/surviving-surface-edges.test.js.map +1 -0
  40. package/dist/__tests__/test-utils/targets.d.ts +26 -0
  41. package/dist/__tests__/test-utils/targets.d.ts.map +1 -0
  42. package/dist/__tests__/test-utils/targets.js +38 -0
  43. package/dist/__tests__/test-utils/targets.js.map +1 -0
  44. package/dist/__tests__/test-utils/with-sim-scope.d.ts +12 -0
  45. package/dist/__tests__/test-utils/with-sim-scope.d.ts.map +1 -0
  46. package/dist/__tests__/test-utils/with-sim-scope.js +22 -0
  47. package/dist/__tests__/test-utils/with-sim-scope.js.map +1 -0
  48. package/dist/__tests__/tool-live-view.test.d.ts +20 -0
  49. package/dist/__tests__/tool-live-view.test.d.ts.map +1 -0
  50. package/dist/__tests__/tool-live-view.test.js +146 -0
  51. package/dist/__tests__/tool-live-view.test.js.map +1 -0
  52. package/dist/__tests__/tool-show-mode.test.d.ts +10 -0
  53. package/dist/__tests__/tool-show-mode.test.d.ts.map +1 -0
  54. package/dist/__tests__/tool-show-mode.test.js +156 -0
  55. package/dist/__tests__/tool-show-mode.test.js.map +1 -0
  56. package/dist/__tests__/tool.test.d.ts +15 -0
  57. package/dist/__tests__/tool.test.d.ts.map +1 -0
  58. package/dist/__tests__/tool.test.js +250 -0
  59. package/dist/__tests__/tool.test.js.map +1 -0
  60. package/dist/cli/__tests__/sim-config.test.d.ts +2 -0
  61. package/dist/cli/__tests__/sim-config.test.d.ts.map +1 -0
  62. package/dist/cli/__tests__/sim-config.test.js +94 -0
  63. package/dist/cli/__tests__/sim-config.test.js.map +1 -0
  64. package/dist/cli/__tests__/sim-runner.test.d.ts +23 -0
  65. package/dist/cli/__tests__/sim-runner.test.d.ts.map +1 -0
  66. package/dist/cli/__tests__/sim-runner.test.js +188 -0
  67. package/dist/cli/__tests__/sim-runner.test.js.map +1 -0
  68. package/dist/cli/__tests__/sim-worker.test.d.ts +12 -0
  69. package/dist/cli/__tests__/sim-worker.test.d.ts.map +1 -0
  70. package/dist/cli/__tests__/sim-worker.test.js +69 -0
  71. package/dist/cli/__tests__/sim-worker.test.js.map +1 -0
  72. package/dist/cli/__tests__/sim.test.d.ts +2 -0
  73. package/dist/cli/__tests__/sim.test.d.ts.map +1 -0
  74. package/dist/cli/__tests__/sim.test.js +232 -0
  75. package/dist/cli/__tests__/sim.test.js.map +1 -0
  76. package/dist/cli/sim-config-schema.d.ts +30 -0
  77. package/dist/cli/sim-config-schema.d.ts.map +1 -0
  78. package/dist/cli/sim-config-schema.js +33 -0
  79. package/dist/cli/sim-config-schema.js.map +1 -0
  80. package/dist/cli/sim-config.d.ts +22 -0
  81. package/dist/cli/sim-config.d.ts.map +1 -0
  82. package/dist/cli/sim-config.js +73 -0
  83. package/dist/cli/sim-config.js.map +1 -0
  84. package/dist/cli/sim-runner.d.ts +60 -0
  85. package/dist/cli/sim-runner.d.ts.map +1 -0
  86. package/dist/cli/sim-runner.js +175 -0
  87. package/dist/cli/sim-runner.js.map +1 -0
  88. package/dist/cli/sim-worker.d.ts +24 -0
  89. package/dist/cli/sim-worker.d.ts.map +1 -0
  90. package/dist/cli/sim-worker.js +65 -0
  91. package/dist/cli/sim-worker.js.map +1 -0
  92. package/dist/cli/sim.d.ts +56 -0
  93. package/dist/cli/sim.d.ts.map +1 -0
  94. package/dist/cli/sim.js +265 -0
  95. package/dist/cli/sim.js.map +1 -0
  96. package/dist/framework/__tests__/assertions.test.d.ts +2 -0
  97. package/dist/framework/__tests__/assertions.test.d.ts.map +1 -0
  98. package/dist/framework/__tests__/assertions.test.js +122 -0
  99. package/dist/framework/__tests__/assertions.test.js.map +1 -0
  100. package/dist/framework/__tests__/misc-coverage.test.d.ts +18 -0
  101. package/dist/framework/__tests__/misc-coverage.test.d.ts.map +1 -0
  102. package/dist/framework/__tests__/misc-coverage.test.js +142 -0
  103. package/dist/framework/__tests__/misc-coverage.test.js.map +1 -0
  104. package/dist/framework/__tests__/resolve-metric.test.d.ts +12 -0
  105. package/dist/framework/__tests__/resolve-metric.test.d.ts.map +1 -0
  106. package/dist/framework/__tests__/resolve-metric.test.js +124 -0
  107. package/dist/framework/__tests__/resolve-metric.test.js.map +1 -0
  108. package/dist/framework/__tests__/result-builder.test.d.ts +2 -0
  109. package/dist/framework/__tests__/result-builder.test.d.ts.map +1 -0
  110. package/dist/framework/__tests__/result-builder.test.js +180 -0
  111. package/dist/framework/__tests__/result-builder.test.js.map +1 -0
  112. package/dist/framework/__tests__/scenario-logger.test.d.ts +9 -0
  113. package/dist/framework/__tests__/scenario-logger.test.d.ts.map +1 -0
  114. package/dist/framework/__tests__/scenario-logger.test.js +110 -0
  115. package/dist/framework/__tests__/scenario-logger.test.js.map +1 -0
  116. package/dist/framework/__tests__/validation.test.d.ts +9 -0
  117. package/dist/framework/__tests__/validation.test.d.ts.map +1 -0
  118. package/dist/framework/__tests__/validation.test.js +126 -0
  119. package/dist/framework/__tests__/validation.test.js.map +1 -0
  120. package/dist/framework/assertions.d.ts +106 -0
  121. package/dist/framework/assertions.d.ts.map +1 -0
  122. package/dist/framework/assertions.js +256 -0
  123. package/dist/framework/assertions.js.map +1 -0
  124. package/dist/framework/execution/__tests__/execution-engine.test.d.ts +9 -0
  125. package/dist/framework/execution/__tests__/execution-engine.test.d.ts.map +1 -0
  126. package/dist/framework/execution/__tests__/execution-engine.test.js +138 -0
  127. package/dist/framework/execution/__tests__/execution-engine.test.js.map +1 -0
  128. package/dist/framework/execution/__tests__/fault-builders.test.d.ts +5 -0
  129. package/dist/framework/execution/__tests__/fault-builders.test.d.ts.map +1 -0
  130. package/dist/framework/execution/__tests__/fault-builders.test.js +23 -0
  131. package/dist/framework/execution/__tests__/fault-builders.test.js.map +1 -0
  132. package/dist/framework/execution/__tests__/fault-model.test.d.ts +6 -0
  133. package/dist/framework/execution/__tests__/fault-model.test.d.ts.map +1 -0
  134. package/dist/framework/execution/__tests__/fault-model.test.js +64 -0
  135. package/dist/framework/execution/__tests__/fault-model.test.js.map +1 -0
  136. package/dist/framework/execution/__tests__/http-target.test.d.ts +5 -0
  137. package/dist/framework/execution/__tests__/http-target.test.d.ts.map +1 -0
  138. package/dist/framework/execution/__tests__/http-target.test.js +36 -0
  139. package/dist/framework/execution/__tests__/http-target.test.js.map +1 -0
  140. package/dist/framework/execution/__tests__/run-load-window.test.d.ts +7 -0
  141. package/dist/framework/execution/__tests__/run-load-window.test.d.ts.map +1 -0
  142. package/dist/framework/execution/__tests__/run-load-window.test.js +89 -0
  143. package/dist/framework/execution/__tests__/run-load-window.test.js.map +1 -0
  144. package/dist/framework/execution/execution-engine.d.ts +55 -0
  145. package/dist/framework/execution/execution-engine.d.ts.map +1 -0
  146. package/dist/framework/execution/execution-engine.js +111 -0
  147. package/dist/framework/execution/execution-engine.js.map +1 -0
  148. package/dist/framework/execution/fault-builders.d.ts +26 -0
  149. package/dist/framework/execution/fault-builders.d.ts.map +1 -0
  150. package/dist/framework/execution/fault-builders.js +24 -0
  151. package/dist/framework/execution/fault-builders.js.map +1 -0
  152. package/dist/framework/execution/fault-model.d.ts +49 -0
  153. package/dist/framework/execution/fault-model.d.ts.map +1 -0
  154. package/dist/framework/execution/fault-model.js +108 -0
  155. package/dist/framework/execution/fault-model.js.map +1 -0
  156. package/dist/framework/execution/fault-spec.d.ts +40 -0
  157. package/dist/framework/execution/fault-spec.d.ts.map +1 -0
  158. package/dist/framework/execution/fault-spec.js +23 -0
  159. package/dist/framework/execution/fault-spec.js.map +1 -0
  160. package/dist/framework/execution/http-target.d.ts +34 -0
  161. package/dist/framework/execution/http-target.d.ts.map +1 -0
  162. package/dist/framework/execution/http-target.js +41 -0
  163. package/dist/framework/execution/http-target.js.map +1 -0
  164. package/dist/framework/execution/latency-tracker.d.ts +44 -0
  165. package/dist/framework/execution/latency-tracker.d.ts.map +1 -0
  166. package/dist/framework/execution/latency-tracker.js +76 -0
  167. package/dist/framework/execution/latency-tracker.js.map +1 -0
  168. package/dist/framework/execution/run-load-window.d.ts +45 -0
  169. package/dist/framework/execution/run-load-window.d.ts.map +1 -0
  170. package/dist/framework/execution/run-load-window.js +136 -0
  171. package/dist/framework/execution/run-load-window.js.map +1 -0
  172. package/dist/framework/execution/scenario-aborted-error.d.ts +14 -0
  173. package/dist/framework/execution/scenario-aborted-error.d.ts.map +1 -0
  174. package/dist/framework/execution/scenario-aborted-error.js +24 -0
  175. package/dist/framework/execution/scenario-aborted-error.js.map +1 -0
  176. package/dist/framework/execution/target.d.ts +35 -0
  177. package/dist/framework/execution/target.d.ts.map +1 -0
  178. package/dist/framework/execution/target.js +21 -0
  179. package/dist/framework/execution/target.js.map +1 -0
  180. package/dist/framework/registry.d.ts +67 -0
  181. package/dist/framework/registry.d.ts.map +1 -0
  182. package/dist/framework/registry.js +113 -0
  183. package/dist/framework/registry.js.map +1 -0
  184. package/dist/framework/resolve-metric.d.ts +79 -0
  185. package/dist/framework/resolve-metric.d.ts.map +1 -0
  186. package/dist/framework/resolve-metric.js +135 -0
  187. package/dist/framework/resolve-metric.js.map +1 -0
  188. package/dist/framework/result-builder.d.ts +72 -0
  189. package/dist/framework/result-builder.d.ts.map +1 -0
  190. package/dist/framework/result-builder.js +214 -0
  191. package/dist/framework/result-builder.js.map +1 -0
  192. package/dist/framework/result-renderers.d.ts +37 -0
  193. package/dist/framework/result-renderers.d.ts.map +1 -0
  194. package/dist/framework/result-renderers.js +62 -0
  195. package/dist/framework/result-renderers.js.map +1 -0
  196. package/dist/framework/runnable-scenario.d.ts +37 -0
  197. package/dist/framework/runnable-scenario.d.ts.map +1 -0
  198. package/dist/framework/runnable-scenario.js +9 -0
  199. package/dist/framework/runnable-scenario.js.map +1 -0
  200. package/dist/framework/scenario-executor-result.d.ts +44 -0
  201. package/dist/framework/scenario-executor-result.d.ts.map +1 -0
  202. package/dist/framework/scenario-executor-result.js +13 -0
  203. package/dist/framework/scenario-executor-result.js.map +1 -0
  204. package/dist/framework/scenario-logger.d.ts +18 -0
  205. package/dist/framework/scenario-logger.d.ts.map +1 -0
  206. package/dist/framework/scenario-logger.js +39 -0
  207. package/dist/framework/scenario-logger.js.map +1 -0
  208. package/dist/framework/scenario-metric-key.d.ts +24 -0
  209. package/dist/framework/scenario-metric-key.d.ts.map +1 -0
  210. package/dist/framework/scenario-metric-key.js +17 -0
  211. package/dist/framework/scenario-metric-key.js.map +1 -0
  212. package/dist/framework/validation.d.ts +83 -0
  213. package/dist/framework/validation.d.ts.map +1 -0
  214. package/dist/framework/validation.js +93 -0
  215. package/dist/framework/validation.js.map +1 -0
  216. package/dist/index.d.ts +35 -0
  217. package/dist/index.d.ts.map +1 -0
  218. package/dist/index.js +53 -0
  219. package/dist/index.js.map +1 -0
  220. package/dist/internal.d.ts +19 -0
  221. package/dist/internal.d.ts.map +1 -0
  222. package/dist/internal.js +16 -0
  223. package/dist/internal.js.map +1 -0
  224. package/dist/kinds/chaos/__tests__/executor.test.d.ts +6 -0
  225. package/dist/kinds/chaos/__tests__/executor.test.d.ts.map +1 -0
  226. package/dist/kinds/chaos/__tests__/executor.test.js +117 -0
  227. package/dist/kinds/chaos/__tests__/executor.test.js.map +1 -0
  228. package/dist/kinds/chaos/config.d.ts +48 -0
  229. package/dist/kinds/chaos/config.d.ts.map +1 -0
  230. package/dist/kinds/chaos/config.js +15 -0
  231. package/dist/kinds/chaos/config.js.map +1 -0
  232. package/dist/kinds/chaos/define.d.ts +32 -0
  233. package/dist/kinds/chaos/define.d.ts.map +1 -0
  234. package/dist/kinds/chaos/define.js +111 -0
  235. package/dist/kinds/chaos/define.js.map +1 -0
  236. package/dist/kinds/chaos/executor.d.ts +21 -0
  237. package/dist/kinds/chaos/executor.d.ts.map +1 -0
  238. package/dist/kinds/chaos/executor.js +107 -0
  239. package/dist/kinds/chaos/executor.js.map +1 -0
  240. package/dist/kinds/chaos/result.d.ts +43 -0
  241. package/dist/kinds/chaos/result.d.ts.map +1 -0
  242. package/dist/kinds/chaos/result.js +12 -0
  243. package/dist/kinds/chaos/result.js.map +1 -0
  244. package/dist/kinds/load/__tests__/executor.test.d.ts +6 -0
  245. package/dist/kinds/load/__tests__/executor.test.d.ts.map +1 -0
  246. package/dist/kinds/load/__tests__/executor.test.js +75 -0
  247. package/dist/kinds/load/__tests__/executor.test.js.map +1 -0
  248. package/dist/kinds/load/config.d.ts +30 -0
  249. package/dist/kinds/load/config.d.ts.map +1 -0
  250. package/dist/kinds/load/config.js +9 -0
  251. package/dist/kinds/load/config.js.map +1 -0
  252. package/dist/kinds/load/define.d.ts +47 -0
  253. package/dist/kinds/load/define.d.ts.map +1 -0
  254. package/dist/kinds/load/define.js +76 -0
  255. package/dist/kinds/load/define.js.map +1 -0
  256. package/dist/kinds/load/executor.d.ts +16 -0
  257. package/dist/kinds/load/executor.d.ts.map +1 -0
  258. package/dist/kinds/load/executor.js +90 -0
  259. package/dist/kinds/load/executor.js.map +1 -0
  260. package/dist/kinds/load/result.d.ts +21 -0
  261. package/dist/kinds/load/result.d.ts.map +1 -0
  262. package/dist/kinds/load/result.js +10 -0
  263. package/dist/kinds/load/result.js.map +1 -0
  264. package/dist/persistence/session-payload.d.ts +32 -0
  265. package/dist/persistence/session-payload.d.ts.map +1 -0
  266. package/dist/persistence/session-payload.js +46 -0
  267. package/dist/persistence/session-payload.js.map +1 -0
  268. package/dist/persistence/session-replay.d.ts +13 -0
  269. package/dist/persistence/session-replay.d.ts.map +1 -0
  270. package/dist/persistence/session-replay.js +76 -0
  271. package/dist/persistence/session-replay.js.map +1 -0
  272. package/dist/persistence/session-replay.test.d.ts +10 -0
  273. package/dist/persistence/session-replay.test.d.ts.map +1 -0
  274. package/dist/persistence/session-replay.test.js +169 -0
  275. package/dist/persistence/session-replay.test.js.map +1 -0
  276. package/dist/plugins/__tests__/loader-scenarios.test.d.ts +12 -0
  277. package/dist/plugins/__tests__/loader-scenarios.test.d.ts.map +1 -0
  278. package/dist/plugins/__tests__/loader-scenarios.test.js +61 -0
  279. package/dist/plugins/__tests__/loader-scenarios.test.js.map +1 -0
  280. package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts +2 -0
  281. package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts.map +1 -0
  282. package/dist/plugins/__tests__/scenario-package-discovery.test.js +43 -0
  283. package/dist/plugins/__tests__/scenario-package-discovery.test.js.map +1 -0
  284. package/dist/plugins/loader.d.ts +32 -0
  285. package/dist/plugins/loader.d.ts.map +1 -0
  286. package/dist/plugins/loader.js +119 -0
  287. package/dist/plugins/loader.js.map +1 -0
  288. package/dist/plugins/scenario-package-discovery.d.ts +23 -0
  289. package/dist/plugins/scenario-package-discovery.d.ts.map +1 -0
  290. package/dist/plugins/scenario-package-discovery.js +42 -0
  291. package/dist/plugins/scenario-package-discovery.js.map +1 -0
  292. package/dist/plugins/types.d.ts +24 -0
  293. package/dist/plugins/types.d.ts.map +1 -0
  294. package/dist/plugins/types.js +18 -0
  295. package/dist/plugins/types.js.map +1 -0
  296. package/dist/recipes/__tests__/recipes.test.d.ts +2 -0
  297. package/dist/recipes/__tests__/recipes.test.d.ts.map +1 -0
  298. package/dist/recipes/__tests__/recipes.test.js +515 -0
  299. package/dist/recipes/__tests__/recipes.test.js.map +1 -0
  300. package/dist/recipes/built-in-recipes.d.ts +16 -0
  301. package/dist/recipes/built-in-recipes.d.ts.map +1 -0
  302. package/dist/recipes/built-in-recipes.js +37 -0
  303. package/dist/recipes/built-in-recipes.js.map +1 -0
  304. package/dist/recipes/define-recipe.d.ts +29 -0
  305. package/dist/recipes/define-recipe.d.ts.map +1 -0
  306. package/dist/recipes/define-recipe.js +68 -0
  307. package/dist/recipes/define-recipe.js.map +1 -0
  308. package/dist/recipes/registry.d.ts +54 -0
  309. package/dist/recipes/registry.d.ts.map +1 -0
  310. package/dist/recipes/registry.js +89 -0
  311. package/dist/recipes/registry.js.map +1 -0
  312. package/dist/recipes/service.d.ts +61 -0
  313. package/dist/recipes/service.d.ts.map +1 -0
  314. package/dist/recipes/service.js +205 -0
  315. package/dist/recipes/service.js.map +1 -0
  316. package/dist/recipes/types.d.ts +62 -0
  317. package/dist/recipes/types.d.ts.map +1 -0
  318. package/dist/recipes/types.js +10 -0
  319. package/dist/recipes/types.js.map +1 -0
  320. package/dist/scaffold/examples.d.ts +22 -0
  321. package/dist/scaffold/examples.d.ts.map +1 -0
  322. package/dist/scaffold/examples.js +91 -0
  323. package/dist/scaffold/examples.js.map +1 -0
  324. package/dist/scope-augmentation.d.ts +70 -0
  325. package/dist/scope-augmentation.d.ts.map +1 -0
  326. package/dist/scope-augmentation.js +28 -0
  327. package/dist/scope-augmentation.js.map +1 -0
  328. package/dist/tool.d.ts +21 -0
  329. package/dist/tool.d.ts.map +1 -0
  330. package/dist/tool.js +347 -0
  331. package/dist/tool.js.map +1 -0
  332. package/dist/types/base-types.d.ts +35 -0
  333. package/dist/types/base-types.d.ts.map +1 -0
  334. package/dist/types/base-types.js +8 -0
  335. package/dist/types/base-types.js.map +1 -0
  336. package/dist/types/framework-types.d.ts +62 -0
  337. package/dist/types/framework-types.d.ts.map +1 -0
  338. package/dist/types/framework-types.js +15 -0
  339. package/dist/types/framework-types.js.map +1 -0
  340. package/dist/types/kind-types.d.ts +24 -0
  341. package/dist/types/kind-types.d.ts.map +1 -0
  342. package/dist/types/kind-types.js +22 -0
  343. package/dist/types/kind-types.js.map +1 -0
  344. package/dist/types/workload.d.ts +30 -0
  345. package/dist/types/workload.d.ts.map +1 -0
  346. package/dist/types/workload.js +20 -0
  347. package/dist/types/workload.js.map +1 -0
  348. package/package.json +120 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @fileoverview Chaos-kind result outcome.
3
+ *
4
+ * The chaos kind composes a load run with explicit failure injection +
5
+ * recovery assertions. The outcome carries:
6
+ * - the load metrics during the steady-state phase
7
+ * - the steady-state assertion verdicts (held while chaos is active)
8
+ * - the recovery assertion verdicts (held after chaos lifts)
9
+ * - the chaos events that fired during the run
10
+ */
11
+ import type { FaultKind } from '../../framework/execution/fault-spec.js';
12
+ import type { SimulationMetrics } from '../../types/base-types.js';
13
+ import type { ScenarioAssertion, FailedAssertion } from '../../types/framework-types.js';
14
+ /** A single fault occurrence recorded during the run, for diagnostics. */
15
+ export interface ChaosEvent {
16
+ /** Which client-side fault fired. */
17
+ readonly type: FaultKind;
18
+ /** Milliseconds into the steady-state window when it fired. */
19
+ readonly atMs: number;
20
+ /** Where the perturbation was applied (the client request site). */
21
+ readonly target: string;
22
+ }
23
+ /** Verdict bundle for a single assertion phase (steady-state OR recovery). */
24
+ export interface ChaosAssertionVerdict {
25
+ readonly passed: readonly ScenarioAssertion[];
26
+ readonly failed: readonly FailedAssertion[];
27
+ }
28
+ /** Outcome payload for a chaos-kind scenario. */
29
+ export interface ChaosOutcome {
30
+ /** Aggregated metrics for the steady-state (chaos-active) window. */
31
+ readonly steadyStateMetrics: SimulationMetrics;
32
+ /** Aggregated metrics for the recovery window after chaos lifts. */
33
+ readonly recoveryMetrics: SimulationMetrics;
34
+ /** Verdicts for the steady-state assertions. */
35
+ readonly steadyStateAssertions: ChaosAssertionVerdict;
36
+ /** Verdicts for the recovery assertions. */
37
+ readonly recoveryAssertions: ChaosAssertionVerdict;
38
+ /** Chaos events recorded during the run. */
39
+ readonly chaosEvents: readonly ChaosEvent[];
40
+ /** Recovery window in ms after chaos lifts. */
41
+ readonly recoveryWindowMs: number;
42
+ }
43
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/kinds/chaos/result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEzF,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C;AAED,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;IAC/C,oEAAoE;IACpE,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IACtD,4CAA4C;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,qBAAqB,CAAC;IACnD,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,+CAA+C;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Chaos-kind result outcome.
3
+ *
4
+ * The chaos kind composes a load run with explicit failure injection +
5
+ * recovery assertions. The outcome carries:
6
+ * - the load metrics during the steady-state phase
7
+ * - the steady-state assertion verdicts (held while chaos is active)
8
+ * - the recovery assertion verdicts (held after chaos lifts)
9
+ * - the chaos events that fired during the run
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/kinds/chaos/result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @fileoverview Behaviour + validation tests for the load kind against the
3
+ * real driver.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=executor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.test.d.ts","sourceRoot":"","sources":["../../../../src/kinds/load/__tests__/executor.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @fileoverview Behaviour + validation tests for the load kind against the
3
+ * real driver.
4
+ */
5
+ import { describe, expect, it } from 'vitest';
6
+ import { countingTarget, failingTarget, noopTarget, } from '../../../__tests__/test-utils/targets.js';
7
+ import { ASSERTIONS } from '../../../framework/assertions.js';
8
+ import { defineLoadScenario, validateLoadScenarioConfig } from '../define.js';
9
+ import { createLoadScenarioRunner } from '../executor.js';
10
+ const base = (o = {}) => ({
11
+ id: 'l',
12
+ name: 'l',
13
+ description: 'l',
14
+ tags: [],
15
+ target: noopTarget,
16
+ workload: { rps: 50 },
17
+ duration: 0.3,
18
+ assertions: [ASSERTIONS.lowErrorRate(0.5)],
19
+ ...o,
20
+ });
21
+ describe('load executor', () => {
22
+ it('drives the target in a sustained loop (many requests, not one)', async () => {
23
+ const ct = countingTarget();
24
+ const r = await createLoadScenarioRunner(base({ target: ct.target, workload: { rps: 100 } })).run(new AbortController().signal);
25
+ if (r.kind !== 'load')
26
+ throw new Error('expected load result');
27
+ expect(r.outcome.metrics.totalRequests).toBeGreaterThan(5);
28
+ expect(ct.calls()).toBe(r.outcome.metrics.totalRequests);
29
+ });
30
+ it('passes when the target succeeds', async () => {
31
+ const r = await createLoadScenarioRunner(base()).run(new AbortController().signal);
32
+ if (r.kind !== 'load')
33
+ throw new Error('expected load result');
34
+ expect(r.passed).toBe(true);
35
+ });
36
+ it('fails when the target fails', async () => {
37
+ const r = await createLoadScenarioRunner(base({ target: failingTarget, assertions: [ASSERTIONS.lowErrorRate(0.1)] })).run(new AbortController().signal);
38
+ if (r.kind !== 'load')
39
+ throw new Error('expected load result');
40
+ expect(r.passed).toBe(false);
41
+ });
42
+ it('throws on a pre-aborted signal', async () => {
43
+ const ac = new AbortController();
44
+ ac.abort();
45
+ await expect(createLoadScenarioRunner(base()).run(ac.signal)).rejects.toThrow(/abort/i);
46
+ });
47
+ });
48
+ describe('validateLoadScenarioConfig', () => {
49
+ it('accepts a valid config via defineLoadScenario', () => {
50
+ expect(defineLoadScenario(base()).kind).toBe('load');
51
+ });
52
+ it('rejects a non-function target', () => {
53
+ expect(() => validateLoadScenarioConfig(base({ target: undefined }))).toThrow(/target/);
54
+ });
55
+ it('rejects a non-positive rps', () => {
56
+ expect(() => validateLoadScenarioConfig(base({ workload: { rps: 0 } }))).toThrow(/rps/);
57
+ });
58
+ it('rejects rampUp greater than duration', () => {
59
+ expect(() => validateLoadScenarioConfig(base({ duration: 1, workload: { rps: 1, rampUp: 5 } }))).toThrow(/rampUp/);
60
+ });
61
+ it('rejects a negative rampUp (non-negative shape check)', () => {
62
+ expect(() => validateLoadScenarioConfig(base({ workload: { rps: 1, rampUp: -1 } }))).toThrow(/rampUp must be a non-negative number/);
63
+ });
64
+ it('rejects a non-number rampUp', () => {
65
+ expect(() => validateLoadScenarioConfig(base({ workload: { rps: 1, rampUp: 'soon' } }))).toThrow(/rampUp must be a non-negative number/);
66
+ });
67
+ it('rejects a non-positive duration', () => {
68
+ expect(() => validateLoadScenarioConfig(base({ duration: 0 }))).toThrow(/duration/);
69
+ expect(() => validateLoadScenarioConfig(base({ duration: 'x' }))).toThrow(/duration/);
70
+ });
71
+ it('rejects empty assertions', () => {
72
+ expect(() => validateLoadScenarioConfig(base({ assertions: [] }))).toThrow(/assertion/);
73
+ });
74
+ });
75
+ //# sourceMappingURL=executor.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.test.js","sourceRoot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AI,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAC1F,sCAAsC,CACvC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,GAAG,EAAE,CACV,0BAA0B,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,MAAe,EAAE,EAAE,CAAC,CAAC,CACpF,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACpF,MAAM,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAY,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @fileoverview `LoadScenarioConfig` — author-facing configuration.
3
+ *
4
+ * Extracted from `define.ts` into its own leaf module so `executor.ts`
5
+ * can reference the config shape without forming a file-level cycle.
6
+ * See `../chaos/config.ts` for the same pattern.
7
+ */
8
+ import type { Target } from '../../framework/execution/target.js';
9
+ import type { ScenarioAssertion } from '../../types/framework-types.js';
10
+ import type { Workload } from '../../types/workload.js';
11
+ /**
12
+ * Author-facing configuration for a load scenario.
13
+ *
14
+ * The `kind` discriminator is intentionally omitted — `defineLoadScenario`
15
+ * sets it. The `target` is the BYO seam the driver calls once per request.
16
+ */
17
+ export interface LoadScenarioConfig {
18
+ readonly id: string;
19
+ readonly name: string;
20
+ readonly description: string;
21
+ readonly tags: readonly string[];
22
+ /** The BYO target driven once per request (throws on failure). */
23
+ readonly target: Target;
24
+ /** Arrival-rate workload (rps + optional concurrency/ramp). */
25
+ readonly workload: Workload;
26
+ /** Window duration, in seconds. */
27
+ readonly duration: number;
28
+ readonly assertions: readonly ScenarioAssertion[];
29
+ }
30
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/kinds/load/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAEjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IAGjC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAG1B,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACnD"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fileoverview `LoadScenarioConfig` — author-facing configuration.
3
+ *
4
+ * Extracted from `define.ts` into its own leaf module so `executor.ts`
5
+ * can reference the config shape without forming a file-level cycle.
6
+ * See `../chaos/config.ts` for the same pattern.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/kinds/load/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @fileoverview `defineLoadScenario` — load-kind entry point.
3
+ *
4
+ * The load kind drives a BYO `target` at a `workload` (rps + optional
5
+ * concurrency/ramp) over `duration` seconds and asserts measured SLOs. The
6
+ * author-facing config interface is `LoadScenarioConfig` (no `kind` field — the
7
+ * entry point sets it). Validation runs at definition time; registration is the
8
+ * caller's responsibility (the simulation plugin loader walks `module.scenarios`
9
+ * and registers them into `scope.registries.scenarios`).
10
+ */
11
+ import type { LoadScenarioConfig } from './config.js';
12
+ import type { RunnableScenario } from '../../framework/runnable-scenario.js';
13
+ export type { LoadScenarioConfig } from './config.js';
14
+ /**
15
+ * Validate a load scenario configuration. Throws on invalid input.
16
+ *
17
+ * Uniqueness against an existing scenario registry is checked at
18
+ * registration time (`scope.registries.scenarios.register(...)`), not
19
+ * here — `defineX` returns a scenario object without touching any
20
+ * registry.
21
+ *
22
+ * @throws {ValidationError} When the load scenario configuration is invalid
23
+ */
24
+ export declare function validateLoadScenarioConfig(config: LoadScenarioConfig): void;
25
+ /**
26
+ * Define a load-kind simulation scenario.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * export const myScenario = defineLoadScenario({
31
+ * id: 'my-scenario',
32
+ * name: 'My Scenario',
33
+ * description: 'Drives the checkout endpoint',
34
+ * tags: ['smoke'],
35
+ * target: httpTarget({ url: process.env.TARGET_URL! }),
36
+ * workload: { rps: 50, rampUp: 5 },
37
+ * duration: 300,
38
+ * assertions: [
39
+ * ASSERTIONS.lowErrorRate(),
40
+ * ASSERTIONS.lowLatency('p95', 500),
41
+ * ],
42
+ * });
43
+ * ```
44
+ * @throws {ValidationError} When the scenario configuration is invalid
45
+ */
46
+ export declare function defineLoadScenario(config: LoadScenarioConfig): RunnableScenario;
47
+ //# sourceMappingURL=define.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../src/kinds/load/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAK7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAkBtD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAiB3E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAI/E"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @fileoverview `defineLoadScenario` — load-kind entry point.
3
+ *
4
+ * The load kind drives a BYO `target` at a `workload` (rps + optional
5
+ * concurrency/ramp) over `duration` seconds and asserts measured SLOs. The
6
+ * author-facing config interface is `LoadScenarioConfig` (no `kind` field — the
7
+ * entry point sets it). Validation runs at definition time; registration is the
8
+ * caller's responsibility (the simulation plugin loader walks `module.scenarios`
9
+ * and registers them into `scope.registries.scenarios`).
10
+ */
11
+ import { throwValidationErrors, validateScenarioMetadata, validateTargetAndWorkload, } from '../../framework/validation.js';
12
+ import { createLoadScenarioRunner } from './executor.js';
13
+ function validateRampUp(config, errors) {
14
+ const { rampUp } = config.workload ?? {};
15
+ if (rampUp === undefined)
16
+ return;
17
+ if (typeof rampUp !== 'number' || rampUp < 0) {
18
+ errors.push({
19
+ field: 'workload.rampUp',
20
+ message: 'workload.rampUp must be a non-negative number',
21
+ });
22
+ return;
23
+ }
24
+ if (rampUp > config.duration) {
25
+ errors.push({ field: 'workload.rampUp', message: 'workload.rampUp cannot exceed duration' });
26
+ }
27
+ }
28
+ /**
29
+ * Validate a load scenario configuration. Throws on invalid input.
30
+ *
31
+ * Uniqueness against an existing scenario registry is checked at
32
+ * registration time (`scope.registries.scenarios.register(...)`), not
33
+ * here — `defineX` returns a scenario object without touching any
34
+ * registry.
35
+ *
36
+ * @throws {ValidationError} When the load scenario configuration is invalid
37
+ */
38
+ export function validateLoadScenarioConfig(config) {
39
+ const errors = [];
40
+ validateScenarioMetadata(config, errors);
41
+ validateTargetAndWorkload(config, errors);
42
+ if (typeof config.duration !== 'number' || config.duration <= 0) {
43
+ errors.push({ field: 'duration', message: 'duration must be a positive number' });
44
+ }
45
+ validateRampUp(config, errors);
46
+ if (config.assertions.length === 0) {
47
+ errors.push({ field: 'assertions', message: 'at least one assertion is required' });
48
+ }
49
+ throwValidationErrors(errors, 'load');
50
+ }
51
+ /**
52
+ * Define a load-kind simulation scenario.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * export const myScenario = defineLoadScenario({
57
+ * id: 'my-scenario',
58
+ * name: 'My Scenario',
59
+ * description: 'Drives the checkout endpoint',
60
+ * tags: ['smoke'],
61
+ * target: httpTarget({ url: process.env.TARGET_URL! }),
62
+ * workload: { rps: 50, rampUp: 5 },
63
+ * duration: 300,
64
+ * assertions: [
65
+ * ASSERTIONS.lowErrorRate(),
66
+ * ASSERTIONS.lowLatency('p95', 500),
67
+ * ],
68
+ * });
69
+ * ```
70
+ * @throws {ValidationError} When the scenario configuration is invalid
71
+ */
72
+ export function defineLoadScenario(config) {
73
+ validateLoadScenarioConfig(config);
74
+ return createLoadScenarioRunner(config);
75
+ }
76
+ //# sourceMappingURL=define.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.js","sourceRoot":"","sources":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,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oCAAoC,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA0B;IAC3D,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @fileoverview Load-kind executor.
3
+ *
4
+ * Drives the BYO `target` through the shared `runLoadWindow` driver at the
5
+ * configured `workload`, then scores the measured metrics against the
6
+ * scenario's assertions. The load kind is the "default" version of the loop
7
+ * (no fault injection).
8
+ */
9
+ import type { LoadScenarioConfig } from './config.js';
10
+ import type { RunnableScenario } from '../../framework/runnable-scenario.js';
11
+ /**
12
+ * Build a `RunnableScenario` for a load-kind config. The returned object is
13
+ * frozen and carries `kind: 'load'`.
14
+ */
15
+ export declare function createLoadScenarioRunner(config: LoadScenarioConfig): RunnableScenario;
16
+ //# sourceMappingURL=executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/kinds/load/executor.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AASH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAuD7E;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAkCrF"}
@@ -0,0 +1,90 @@
1
+ // @fitness-ignore-file null-safety -- ScenarioResultBuilder.create() returns a fluent builder; chained method calls are always safe
2
+ // @fitness-ignore-file array-validation -- array parameters validated at API boundary
3
+ // @fitness-ignore-file detached-promises -- ScenarioResultBuilder fluent calls and runLoadWindow delegate are synchronous outside their awaited boundaries
4
+ /**
5
+ * @fileoverview Load-kind executor.
6
+ *
7
+ * Drives the BYO `target` through the shared `runLoadWindow` driver at the
8
+ * configured `workload`, then scores the measured metrics against the
9
+ * scenario's assertions. The load kind is the "default" version of the loop
10
+ * (no fault injection).
11
+ */
12
+ import { withSpanAsync } from '@opensip-cli/core';
13
+ import { ScenarioAbortedError } from '../../framework/execution/execution-engine.js';
14
+ import { runLoadWindow } from '../../framework/execution/run-load-window.js';
15
+ import { ScenarioResultBuilder } from '../../framework/result-builder.js';
16
+ import { createScenarioLogger } from '../../framework/scenario-logger.js';
17
+ /**
18
+ * Run the load window against the BYO target and wrap the measured metrics +
19
+ * assertion verdicts into the kind-specific envelope.
20
+ */
21
+ async function executeLoad(config, context) {
22
+ const startTime = Date.now();
23
+ context.logger.info('Starting load scenario execution', {
24
+ duration: config.duration,
25
+ rps: config.workload.rps,
26
+ });
27
+ const window = await withSpanAsync('opensip-cli-simulation', 'simulation.scenario.execute', async () => runLoadWindow({ workload: config.workload }, context, {
28
+ windowMs: config.duration * 1000,
29
+ target: config.target,
30
+ }), {
31
+ 'simulation.scenario.id': config.id,
32
+ 'simulation.kind': 'load',
33
+ });
34
+ const built = ScenarioResultBuilder.create(config.id)
35
+ .withMetrics(window.metrics)
36
+ .withDuration(config.duration)
37
+ .evaluateAssertions(config.assertions)
38
+ .build();
39
+ return Object.freeze({
40
+ kind: 'load',
41
+ scenarioId: config.id,
42
+ passed: built.passed,
43
+ durationMs: Date.now() - startTime,
44
+ signals: built.signals,
45
+ outcome: Object.freeze({
46
+ metrics: built.metrics,
47
+ assertions: built.assertions,
48
+ }),
49
+ });
50
+ }
51
+ // =============================================================================
52
+ // RUNNABLE SCENARIO FACTORY
53
+ // =============================================================================
54
+ /**
55
+ * Build a `RunnableScenario` for a load-kind config. The returned object is
56
+ * frozen and carries `kind: 'load'`.
57
+ */
58
+ export function createLoadScenarioRunner(config) {
59
+ return Object.freeze({
60
+ kind: 'load',
61
+ id: config.id,
62
+ name: config.name,
63
+ description: config.description,
64
+ tags: Object.freeze([...config.tags]),
65
+ run:
66
+ /** @throws {ScenarioAbortedError} When the scenario is aborted via AbortSignal */
67
+ async (abortSignal) => {
68
+ const correlationId = `scenario-${config.id}-${Date.now().toString(36)}`;
69
+ const context = {
70
+ scenarioId: config.id,
71
+ correlationId,
72
+ abortSignal,
73
+ logger: createScenarioLogger(config.id),
74
+ };
75
+ if (abortSignal.aborted) {
76
+ throw new ScenarioAbortedError(config.id);
77
+ }
78
+ try {
79
+ return await executeLoad(config, context);
80
+ }
81
+ catch (error) {
82
+ if (abortSignal.aborted) {
83
+ throw new ScenarioAbortedError(config.id);
84
+ }
85
+ throw error;
86
+ }
87
+ },
88
+ });
89
+ }
90
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/kinds/load/executor.ts"],"names":[],"mappings":"AAAA,oIAAoI;AACpI,sFAAsF;AACtF,2JAA2J;AAC3J;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAO1E;;;GAGG;AACH,KAAK,UAAU,WAAW,CACxB,MAA0B,EAC1B,OAAiC;IAEjC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE;QACtD,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG;KACzB,CA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,WAAW;QAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAErC,GAAG;QACD,kFAAkF;QAClF,KAAK,EAAE,WAAwB,EAAuC,EAAE;YACtE,MAAM,aAAa,GAAG,YAAY,MAAM,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YAEzE,MAAM,OAAO,GAA6B;gBACxC,UAAU,EAAE,MAAM,CAAC,EAAE;gBACrB,aAAa;gBACb,WAAW;gBACX,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;aACxC,CAAC;YAEF,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACxB,MAAM,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC5C,CAAC;YAED,IAAI,CAAC;gBACH,OAAO,MAAM,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;oBACxB,MAAM,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAC5C,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KACJ,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @fileoverview Load-kind result outcome.
3
+ *
4
+ * The load kind's outcome is the SLO-style metrics + assertion verdict that
5
+ * scenarios produce. Field-for-field parity with the `LoadResultPayload`
6
+ * metrics/assertions shape that `ScenarioResultBuilder` emits, so assertions
7
+ * carry through unchanged.
8
+ */
9
+ import type { SimulationMetrics } from '../../types/base-types.js';
10
+ import type { ScenarioAssertion, FailedAssertion } from '../../types/framework-types.js';
11
+ /** Outcome payload for a load-kind scenario. */
12
+ export interface LoadOutcome {
13
+ /** Final aggregated metrics from the simulation loop. */
14
+ readonly metrics: SimulationMetrics;
15
+ /** Assertions split into passed and failed buckets. */
16
+ readonly assertions: {
17
+ readonly passed: readonly ScenarioAssertion[];
18
+ readonly failed: readonly FailedAssertion[];
19
+ };
20
+ }
21
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/kinds/load/result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEzF,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,uDAAuD;IACvD,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;QAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;KAC7C,CAAC;CACH"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @fileoverview Load-kind result outcome.
3
+ *
4
+ * The load kind's outcome is the SLO-style metrics + assertion verdict that
5
+ * scenarios produce. Field-for-field parity with the `LoadResultPayload`
6
+ * metrics/assertions shape that `ScenarioResultBuilder` emits, so assertions
7
+ * carry through unchanged.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/kinds/load/result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,32 @@
1
+ import type { SignalEnvelope } from '@opensip-cli/contracts';
2
+ export type SimulationFindingSeverity = 'error' | 'warning';
3
+ export interface SimulationSessionFinding {
4
+ readonly ruleId: string;
5
+ readonly message: string;
6
+ readonly severity: SimulationFindingSeverity;
7
+ readonly filePath?: string;
8
+ readonly line?: number;
9
+ readonly column?: number;
10
+ readonly suggestion?: string;
11
+ }
12
+ export interface SimulationSessionCheck {
13
+ readonly checkSlug: string;
14
+ readonly passed: boolean;
15
+ readonly violationCount: number;
16
+ readonly findings: readonly SimulationSessionFinding[];
17
+ readonly durationMs: number;
18
+ }
19
+ export interface SimulationSessionPayload {
20
+ /** Inner version per the payload schema evolution convention (v1 shape). */
21
+ readonly __version: 1;
22
+ readonly summary: {
23
+ readonly total: number;
24
+ readonly passed: number;
25
+ readonly failed: number;
26
+ readonly errors: number;
27
+ readonly warnings: number;
28
+ };
29
+ readonly checks: readonly SimulationSessionCheck[];
30
+ }
31
+ export declare function buildSimulationSessionPayload(envelope: SignalEnvelope): SimulationSessionPayload;
32
+ //# sourceMappingURL=session-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-payload.d.ts","sourceRoot":"","sources":["../../src/persistence/session-payload.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,wBAAwB,CAAC;AAGzE,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACvD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC;CACpD;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,cAAc,GAAG,wBAAwB,CA+BhG"}
@@ -0,0 +1,46 @@
1
+ // @fitness-ignore-file batch-operation-limits -- iterates the bounded per-run signal set grouped by source (signals emitted by a single sim run), matching the graph session-payload precedent.
2
+ import { isErrorSignal } from '@opensip-cli/core';
3
+ export function buildSimulationSessionPayload(envelope) {
4
+ const bySource = new Map();
5
+ for (const signal of envelope.signals) {
6
+ const bucket = bySource.get(signal.source);
7
+ if (bucket)
8
+ bucket.push(signal);
9
+ else
10
+ bySource.set(signal.source, [signal]);
11
+ }
12
+ const checks = envelope.units.map((unit) => {
13
+ const findings = findingsFor(bySource.get(unit.slug) ?? []);
14
+ return {
15
+ checkSlug: unit.slug,
16
+ passed: unit.passed,
17
+ violationCount: unit.violationCount ?? findings.length,
18
+ findings,
19
+ durationMs: unit.durationMs,
20
+ };
21
+ });
22
+ const { summary } = envelope.verdict;
23
+ return {
24
+ __version: 1,
25
+ summary: {
26
+ total: summary.total,
27
+ passed: summary.passed,
28
+ failed: summary.failed,
29
+ errors: summary.errors,
30
+ warnings: summary.warnings,
31
+ },
32
+ checks,
33
+ };
34
+ }
35
+ function findingsFor(signals) {
36
+ return signals.map((signal) => ({
37
+ ruleId: signal.ruleId,
38
+ message: signal.message,
39
+ severity: isErrorSignal(signal) ? 'error' : 'warning',
40
+ ...(signal.filePath === '' ? {} : { filePath: signal.filePath }),
41
+ ...(signal.line === undefined ? {} : { line: signal.line }),
42
+ ...(signal.column === undefined ? {} : { column: signal.column }),
43
+ ...(signal.suggestion === undefined ? {} : { suggestion: signal.suggestion }),
44
+ }));
45
+ }
46
+ //# sourceMappingURL=session-payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-payload.js","sourceRoot":"","sources":["../../src/persistence/session-payload.ts"],"names":[],"mappings":"AAAA,gMAAgM;AAChM,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAsClD,MAAM,UAAU,6BAA6B,CAAC,QAAwB;IACpE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC7C,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,MAAM;YAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;YAC3B,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAgB,EAAE,EAAE;QACrD,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5D,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,IAAI;YACpB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,QAAQ,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AAM,CAAC,UAAU,EAAE,CAAC;KAC9E,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { SimDoneResult, StoredSession, ToolSessionReplay } from '@opensip-cli/contracts';
2
+ /**
3
+ * Project a stored sim session back into a {@link SignalEnvelope}/{@link SimDoneResult}.
4
+ *
5
+ * The structural decode of the opaque payload is shared across tools
6
+ * (`decodeSessionPayload`); this function owns only sim's projection
7
+ * (`tool: 'sim'`, `category: 'testing'`, signal id prefix, `sim-done` result).
8
+ *
9
+ * @throws {Error | TypeError} when the stored payload is not the expected shape
10
+ * (propagated from `decodeSessionPayload`).
11
+ */
12
+ export declare function simReplayFromSession(stored: StoredSession): ToolSessionReplay<SimDoneResult>;
13
+ //# sourceMappingURL=session-replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/persistence/session-replay.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,aAAa,EACb,aAAa,EACb,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAGhC;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAyC5F"}