@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.
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/internal-surface.test.d.ts +9 -0
- package/dist/__tests__/internal-surface.test.d.ts.map +1 -0
- package/dist/__tests__/internal-surface.test.js +38 -0
- package/dist/__tests__/internal-surface.test.js.map +1 -0
- package/dist/__tests__/plugin-loader.test.d.ts +2 -0
- package/dist/__tests__/plugin-loader.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-loader.test.js +64 -0
- package/dist/__tests__/plugin-loader.test.js.map +1 -0
- package/dist/__tests__/public-api.test.d.ts +15 -0
- package/dist/__tests__/public-api.test.d.ts.map +1 -0
- package/dist/__tests__/public-api.test.js +73 -0
- package/dist/__tests__/public-api.test.js.map +1 -0
- package/dist/__tests__/registry-cross-kind.test.d.ts +6 -0
- package/dist/__tests__/registry-cross-kind.test.d.ts.map +1 -0
- package/dist/__tests__/registry-cross-kind.test.js +86 -0
- package/dist/__tests__/registry-cross-kind.test.js.map +1 -0
- package/dist/__tests__/scenario-execution.test.d.ts +10 -0
- package/dist/__tests__/scenario-execution.test.d.ts.map +1 -0
- package/dist/__tests__/scenario-execution.test.js +92 -0
- package/dist/__tests__/scenario-execution.test.js.map +1 -0
- package/dist/__tests__/sim-capability-contract.test.d.ts +10 -0
- package/dist/__tests__/sim-capability-contract.test.d.ts.map +1 -0
- package/dist/__tests__/sim-capability-contract.test.js +131 -0
- package/dist/__tests__/sim-capability-contract.test.js.map +1 -0
- package/dist/__tests__/sim-config-schema.test.d.ts +5 -0
- package/dist/__tests__/sim-config-schema.test.d.ts.map +1 -0
- package/dist/__tests__/sim-config-schema.test.js +23 -0
- package/dist/__tests__/sim-config-schema.test.js.map +1 -0
- package/dist/__tests__/sim-failure-signal.test.d.ts +10 -0
- package/dist/__tests__/sim-failure-signal.test.d.ts.map +1 -0
- package/dist/__tests__/sim-failure-signal.test.js +86 -0
- package/dist/__tests__/sim-failure-signal.test.js.map +1 -0
- package/dist/__tests__/surviving-surface-edges.test.d.ts +10 -0
- package/dist/__tests__/surviving-surface-edges.test.d.ts.map +1 -0
- package/dist/__tests__/surviving-surface-edges.test.js +122 -0
- package/dist/__tests__/surviving-surface-edges.test.js.map +1 -0
- package/dist/__tests__/test-utils/targets.d.ts +26 -0
- package/dist/__tests__/test-utils/targets.d.ts.map +1 -0
- package/dist/__tests__/test-utils/targets.js +38 -0
- package/dist/__tests__/test-utils/targets.js.map +1 -0
- package/dist/__tests__/test-utils/with-sim-scope.d.ts +12 -0
- package/dist/__tests__/test-utils/with-sim-scope.d.ts.map +1 -0
- package/dist/__tests__/test-utils/with-sim-scope.js +22 -0
- package/dist/__tests__/test-utils/with-sim-scope.js.map +1 -0
- package/dist/__tests__/tool-live-view.test.d.ts +20 -0
- package/dist/__tests__/tool-live-view.test.d.ts.map +1 -0
- package/dist/__tests__/tool-live-view.test.js +146 -0
- package/dist/__tests__/tool-live-view.test.js.map +1 -0
- package/dist/__tests__/tool-show-mode.test.d.ts +10 -0
- package/dist/__tests__/tool-show-mode.test.d.ts.map +1 -0
- package/dist/__tests__/tool-show-mode.test.js +156 -0
- package/dist/__tests__/tool-show-mode.test.js.map +1 -0
- package/dist/__tests__/tool.test.d.ts +15 -0
- package/dist/__tests__/tool.test.d.ts.map +1 -0
- package/dist/__tests__/tool.test.js +250 -0
- package/dist/__tests__/tool.test.js.map +1 -0
- package/dist/cli/__tests__/sim-config.test.d.ts +2 -0
- package/dist/cli/__tests__/sim-config.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-config.test.js +94 -0
- package/dist/cli/__tests__/sim-config.test.js.map +1 -0
- package/dist/cli/__tests__/sim-runner.test.d.ts +23 -0
- package/dist/cli/__tests__/sim-runner.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-runner.test.js +188 -0
- package/dist/cli/__tests__/sim-runner.test.js.map +1 -0
- package/dist/cli/__tests__/sim-worker.test.d.ts +12 -0
- package/dist/cli/__tests__/sim-worker.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-worker.test.js +69 -0
- package/dist/cli/__tests__/sim-worker.test.js.map +1 -0
- package/dist/cli/__tests__/sim.test.d.ts +2 -0
- package/dist/cli/__tests__/sim.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim.test.js +232 -0
- package/dist/cli/__tests__/sim.test.js.map +1 -0
- package/dist/cli/sim-config-schema.d.ts +30 -0
- package/dist/cli/sim-config-schema.d.ts.map +1 -0
- package/dist/cli/sim-config-schema.js +33 -0
- package/dist/cli/sim-config-schema.js.map +1 -0
- package/dist/cli/sim-config.d.ts +22 -0
- package/dist/cli/sim-config.d.ts.map +1 -0
- package/dist/cli/sim-config.js +73 -0
- package/dist/cli/sim-config.js.map +1 -0
- package/dist/cli/sim-runner.d.ts +60 -0
- package/dist/cli/sim-runner.d.ts.map +1 -0
- package/dist/cli/sim-runner.js +175 -0
- package/dist/cli/sim-runner.js.map +1 -0
- package/dist/cli/sim-worker.d.ts +24 -0
- package/dist/cli/sim-worker.d.ts.map +1 -0
- package/dist/cli/sim-worker.js +65 -0
- package/dist/cli/sim-worker.js.map +1 -0
- package/dist/cli/sim.d.ts +56 -0
- package/dist/cli/sim.d.ts.map +1 -0
- package/dist/cli/sim.js +265 -0
- package/dist/cli/sim.js.map +1 -0
- package/dist/framework/__tests__/assertions.test.d.ts +2 -0
- package/dist/framework/__tests__/assertions.test.d.ts.map +1 -0
- package/dist/framework/__tests__/assertions.test.js +122 -0
- package/dist/framework/__tests__/assertions.test.js.map +1 -0
- package/dist/framework/__tests__/misc-coverage.test.d.ts +18 -0
- package/dist/framework/__tests__/misc-coverage.test.d.ts.map +1 -0
- package/dist/framework/__tests__/misc-coverage.test.js +142 -0
- package/dist/framework/__tests__/misc-coverage.test.js.map +1 -0
- package/dist/framework/__tests__/resolve-metric.test.d.ts +12 -0
- package/dist/framework/__tests__/resolve-metric.test.d.ts.map +1 -0
- package/dist/framework/__tests__/resolve-metric.test.js +124 -0
- package/dist/framework/__tests__/resolve-metric.test.js.map +1 -0
- package/dist/framework/__tests__/result-builder.test.d.ts +2 -0
- package/dist/framework/__tests__/result-builder.test.d.ts.map +1 -0
- package/dist/framework/__tests__/result-builder.test.js +180 -0
- package/dist/framework/__tests__/result-builder.test.js.map +1 -0
- package/dist/framework/__tests__/scenario-logger.test.d.ts +9 -0
- package/dist/framework/__tests__/scenario-logger.test.d.ts.map +1 -0
- package/dist/framework/__tests__/scenario-logger.test.js +110 -0
- package/dist/framework/__tests__/scenario-logger.test.js.map +1 -0
- package/dist/framework/__tests__/validation.test.d.ts +9 -0
- package/dist/framework/__tests__/validation.test.d.ts.map +1 -0
- package/dist/framework/__tests__/validation.test.js +126 -0
- package/dist/framework/__tests__/validation.test.js.map +1 -0
- package/dist/framework/assertions.d.ts +106 -0
- package/dist/framework/assertions.d.ts.map +1 -0
- package/dist/framework/assertions.js +256 -0
- package/dist/framework/assertions.js.map +1 -0
- package/dist/framework/execution/__tests__/execution-engine.test.d.ts +9 -0
- package/dist/framework/execution/__tests__/execution-engine.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/execution-engine.test.js +138 -0
- package/dist/framework/execution/__tests__/execution-engine.test.js.map +1 -0
- package/dist/framework/execution/__tests__/fault-builders.test.d.ts +5 -0
- package/dist/framework/execution/__tests__/fault-builders.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/fault-builders.test.js +23 -0
- package/dist/framework/execution/__tests__/fault-builders.test.js.map +1 -0
- package/dist/framework/execution/__tests__/fault-model.test.d.ts +6 -0
- package/dist/framework/execution/__tests__/fault-model.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/fault-model.test.js +64 -0
- package/dist/framework/execution/__tests__/fault-model.test.js.map +1 -0
- package/dist/framework/execution/__tests__/http-target.test.d.ts +5 -0
- package/dist/framework/execution/__tests__/http-target.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/http-target.test.js +36 -0
- package/dist/framework/execution/__tests__/http-target.test.js.map +1 -0
- package/dist/framework/execution/__tests__/run-load-window.test.d.ts +7 -0
- package/dist/framework/execution/__tests__/run-load-window.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/run-load-window.test.js +89 -0
- package/dist/framework/execution/__tests__/run-load-window.test.js.map +1 -0
- package/dist/framework/execution/execution-engine.d.ts +55 -0
- package/dist/framework/execution/execution-engine.d.ts.map +1 -0
- package/dist/framework/execution/execution-engine.js +111 -0
- package/dist/framework/execution/execution-engine.js.map +1 -0
- package/dist/framework/execution/fault-builders.d.ts +26 -0
- package/dist/framework/execution/fault-builders.d.ts.map +1 -0
- package/dist/framework/execution/fault-builders.js +24 -0
- package/dist/framework/execution/fault-builders.js.map +1 -0
- package/dist/framework/execution/fault-model.d.ts +49 -0
- package/dist/framework/execution/fault-model.d.ts.map +1 -0
- package/dist/framework/execution/fault-model.js +108 -0
- package/dist/framework/execution/fault-model.js.map +1 -0
- package/dist/framework/execution/fault-spec.d.ts +40 -0
- package/dist/framework/execution/fault-spec.d.ts.map +1 -0
- package/dist/framework/execution/fault-spec.js +23 -0
- package/dist/framework/execution/fault-spec.js.map +1 -0
- package/dist/framework/execution/http-target.d.ts +34 -0
- package/dist/framework/execution/http-target.d.ts.map +1 -0
- package/dist/framework/execution/http-target.js +41 -0
- package/dist/framework/execution/http-target.js.map +1 -0
- package/dist/framework/execution/latency-tracker.d.ts +44 -0
- package/dist/framework/execution/latency-tracker.d.ts.map +1 -0
- package/dist/framework/execution/latency-tracker.js +76 -0
- package/dist/framework/execution/latency-tracker.js.map +1 -0
- package/dist/framework/execution/run-load-window.d.ts +45 -0
- package/dist/framework/execution/run-load-window.d.ts.map +1 -0
- package/dist/framework/execution/run-load-window.js +136 -0
- package/dist/framework/execution/run-load-window.js.map +1 -0
- package/dist/framework/execution/scenario-aborted-error.d.ts +14 -0
- package/dist/framework/execution/scenario-aborted-error.d.ts.map +1 -0
- package/dist/framework/execution/scenario-aborted-error.js +24 -0
- package/dist/framework/execution/scenario-aborted-error.js.map +1 -0
- package/dist/framework/execution/target.d.ts +35 -0
- package/dist/framework/execution/target.d.ts.map +1 -0
- package/dist/framework/execution/target.js +21 -0
- package/dist/framework/execution/target.js.map +1 -0
- package/dist/framework/registry.d.ts +67 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +113 -0
- package/dist/framework/registry.js.map +1 -0
- package/dist/framework/resolve-metric.d.ts +79 -0
- package/dist/framework/resolve-metric.d.ts.map +1 -0
- package/dist/framework/resolve-metric.js +135 -0
- package/dist/framework/resolve-metric.js.map +1 -0
- package/dist/framework/result-builder.d.ts +72 -0
- package/dist/framework/result-builder.d.ts.map +1 -0
- package/dist/framework/result-builder.js +214 -0
- package/dist/framework/result-builder.js.map +1 -0
- package/dist/framework/result-renderers.d.ts +37 -0
- package/dist/framework/result-renderers.d.ts.map +1 -0
- package/dist/framework/result-renderers.js +62 -0
- package/dist/framework/result-renderers.js.map +1 -0
- package/dist/framework/runnable-scenario.d.ts +37 -0
- package/dist/framework/runnable-scenario.d.ts.map +1 -0
- package/dist/framework/runnable-scenario.js +9 -0
- package/dist/framework/runnable-scenario.js.map +1 -0
- package/dist/framework/scenario-executor-result.d.ts +44 -0
- package/dist/framework/scenario-executor-result.d.ts.map +1 -0
- package/dist/framework/scenario-executor-result.js +13 -0
- package/dist/framework/scenario-executor-result.js.map +1 -0
- package/dist/framework/scenario-logger.d.ts +18 -0
- package/dist/framework/scenario-logger.d.ts.map +1 -0
- package/dist/framework/scenario-logger.js +39 -0
- package/dist/framework/scenario-logger.js.map +1 -0
- package/dist/framework/scenario-metric-key.d.ts +24 -0
- package/dist/framework/scenario-metric-key.d.ts.map +1 -0
- package/dist/framework/scenario-metric-key.js +17 -0
- package/dist/framework/scenario-metric-key.js.map +1 -0
- package/dist/framework/validation.d.ts +83 -0
- package/dist/framework/validation.d.ts.map +1 -0
- package/dist/framework/validation.js +93 -0
- package/dist/framework/validation.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +19 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +16 -0
- package/dist/internal.js.map +1 -0
- package/dist/kinds/chaos/__tests__/executor.test.d.ts +6 -0
- package/dist/kinds/chaos/__tests__/executor.test.d.ts.map +1 -0
- package/dist/kinds/chaos/__tests__/executor.test.js +117 -0
- package/dist/kinds/chaos/__tests__/executor.test.js.map +1 -0
- package/dist/kinds/chaos/config.d.ts +48 -0
- package/dist/kinds/chaos/config.d.ts.map +1 -0
- package/dist/kinds/chaos/config.js +15 -0
- package/dist/kinds/chaos/config.js.map +1 -0
- package/dist/kinds/chaos/define.d.ts +32 -0
- package/dist/kinds/chaos/define.d.ts.map +1 -0
- package/dist/kinds/chaos/define.js +111 -0
- package/dist/kinds/chaos/define.js.map +1 -0
- package/dist/kinds/chaos/executor.d.ts +21 -0
- package/dist/kinds/chaos/executor.d.ts.map +1 -0
- package/dist/kinds/chaos/executor.js +107 -0
- package/dist/kinds/chaos/executor.js.map +1 -0
- package/dist/kinds/chaos/result.d.ts +43 -0
- package/dist/kinds/chaos/result.d.ts.map +1 -0
- package/dist/kinds/chaos/result.js +12 -0
- package/dist/kinds/chaos/result.js.map +1 -0
- package/dist/kinds/load/__tests__/executor.test.d.ts +6 -0
- package/dist/kinds/load/__tests__/executor.test.d.ts.map +1 -0
- package/dist/kinds/load/__tests__/executor.test.js +75 -0
- package/dist/kinds/load/__tests__/executor.test.js.map +1 -0
- package/dist/kinds/load/config.d.ts +30 -0
- package/dist/kinds/load/config.d.ts.map +1 -0
- package/dist/kinds/load/config.js +9 -0
- package/dist/kinds/load/config.js.map +1 -0
- package/dist/kinds/load/define.d.ts +47 -0
- package/dist/kinds/load/define.d.ts.map +1 -0
- package/dist/kinds/load/define.js +76 -0
- package/dist/kinds/load/define.js.map +1 -0
- package/dist/kinds/load/executor.d.ts +16 -0
- package/dist/kinds/load/executor.d.ts.map +1 -0
- package/dist/kinds/load/executor.js +90 -0
- package/dist/kinds/load/executor.js.map +1 -0
- package/dist/kinds/load/result.d.ts +21 -0
- package/dist/kinds/load/result.d.ts.map +1 -0
- package/dist/kinds/load/result.js +10 -0
- package/dist/kinds/load/result.js.map +1 -0
- package/dist/persistence/session-payload.d.ts +32 -0
- package/dist/persistence/session-payload.d.ts.map +1 -0
- package/dist/persistence/session-payload.js +46 -0
- package/dist/persistence/session-payload.js.map +1 -0
- package/dist/persistence/session-replay.d.ts +13 -0
- package/dist/persistence/session-replay.d.ts.map +1 -0
- package/dist/persistence/session-replay.js +76 -0
- package/dist/persistence/session-replay.js.map +1 -0
- package/dist/persistence/session-replay.test.d.ts +10 -0
- package/dist/persistence/session-replay.test.d.ts.map +1 -0
- package/dist/persistence/session-replay.test.js +169 -0
- package/dist/persistence/session-replay.test.js.map +1 -0
- package/dist/plugins/__tests__/loader-scenarios.test.d.ts +12 -0
- package/dist/plugins/__tests__/loader-scenarios.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/loader-scenarios.test.js +61 -0
- package/dist/plugins/__tests__/loader-scenarios.test.js.map +1 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.js +43 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.js.map +1 -0
- package/dist/plugins/loader.d.ts +32 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +119 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/scenario-package-discovery.d.ts +23 -0
- package/dist/plugins/scenario-package-discovery.d.ts.map +1 -0
- package/dist/plugins/scenario-package-discovery.js +42 -0
- package/dist/plugins/scenario-package-discovery.js.map +1 -0
- package/dist/plugins/types.d.ts +24 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +18 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/recipes/__tests__/recipes.test.d.ts +2 -0
- package/dist/recipes/__tests__/recipes.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/recipes.test.js +515 -0
- package/dist/recipes/__tests__/recipes.test.js.map +1 -0
- package/dist/recipes/built-in-recipes.d.ts +16 -0
- package/dist/recipes/built-in-recipes.d.ts.map +1 -0
- package/dist/recipes/built-in-recipes.js +37 -0
- package/dist/recipes/built-in-recipes.js.map +1 -0
- package/dist/recipes/define-recipe.d.ts +29 -0
- package/dist/recipes/define-recipe.d.ts.map +1 -0
- package/dist/recipes/define-recipe.js +68 -0
- package/dist/recipes/define-recipe.js.map +1 -0
- package/dist/recipes/registry.d.ts +54 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +89 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/service.d.ts +61 -0
- package/dist/recipes/service.d.ts.map +1 -0
- package/dist/recipes/service.js +205 -0
- package/dist/recipes/service.js.map +1 -0
- package/dist/recipes/types.d.ts +62 -0
- package/dist/recipes/types.d.ts.map +1 -0
- package/dist/recipes/types.js +10 -0
- package/dist/recipes/types.js.map +1 -0
- package/dist/scaffold/examples.d.ts +22 -0
- package/dist/scaffold/examples.d.ts.map +1 -0
- package/dist/scaffold/examples.js +91 -0
- package/dist/scaffold/examples.js.map +1 -0
- package/dist/scope-augmentation.d.ts +70 -0
- package/dist/scope-augmentation.d.ts.map +1 -0
- package/dist/scope-augmentation.js +28 -0
- package/dist/scope-augmentation.js.map +1 -0
- package/dist/tool.d.ts +21 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +347 -0
- package/dist/tool.js.map +1 -0
- package/dist/types/base-types.d.ts +35 -0
- package/dist/types/base-types.d.ts.map +1 -0
- package/dist/types/base-types.js +8 -0
- package/dist/types/base-types.js.map +1 -0
- package/dist/types/framework-types.d.ts +62 -0
- package/dist/types/framework-types.d.ts.map +1 -0
- package/dist/types/framework-types.js +15 -0
- package/dist/types/framework-types.js.map +1 -0
- package/dist/types/kind-types.d.ts +24 -0
- package/dist/types/kind-types.d.ts.map +1 -0
- package/dist/types/kind-types.js +22 -0
- package/dist/types/kind-types.js.map +1 -0
- package/dist/types/workload.d.ts +30 -0
- package/dist/types/workload.d.ts.map +1 -0
- package/dist/types/workload.js +20 -0
- package/dist/types/workload.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-kind result renderers.
|
|
3
|
+
*
|
|
4
|
+
* Persistence layers (recipe-service, dashboard) need a stable per-result
|
|
5
|
+
* projection: a small bag of view-friendly fields (metrics, assertion counts,
|
|
6
|
+
* outcome label) that doesn't leak per-kind types. The renderers below
|
|
7
|
+
* dispatch on `result.kind` and return a normalized `ScenarioResultView` so
|
|
8
|
+
* downstream code can render every kind uniformly while preserving the
|
|
9
|
+
* kind-specific outcome via the typed `result` field.
|
|
10
|
+
*
|
|
11
|
+
* Adding a new scenario kind requires adding a `case` here — the
|
|
12
|
+
* exhaustiveness `_exhaustive: never` assignment in `default:` surfaces the
|
|
13
|
+
* omission as a compile-time error.
|
|
14
|
+
*/
|
|
15
|
+
import type { ScenarioExecutorResult } from './scenario-executor-result.js';
|
|
16
|
+
import type { SimulationMetrics } from '../types/base-types.js';
|
|
17
|
+
/** View-friendly summary common to every kind. */
|
|
18
|
+
export interface ScenarioResultView {
|
|
19
|
+
readonly kind: ScenarioExecutorResult['kind'];
|
|
20
|
+
readonly scenarioId: string;
|
|
21
|
+
readonly passed: boolean;
|
|
22
|
+
readonly durationMs: number;
|
|
23
|
+
readonly metrics: SimulationMetrics;
|
|
24
|
+
readonly assertionsPassed: number;
|
|
25
|
+
readonly assertionsFailed: number;
|
|
26
|
+
/** Short human label describing the kind-specific outcome. */
|
|
27
|
+
readonly outcomeLabel: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Project a `ScenarioExecutorResult` into a uniform view shape.
|
|
31
|
+
*
|
|
32
|
+
* @throws {Error} When `result.kind` is not in the known discriminated-union
|
|
33
|
+
* variants. This is an exhaustiveness guard — a runtime hit means a new
|
|
34
|
+
* variant was added without updating this dispatch.
|
|
35
|
+
*/
|
|
36
|
+
export declare function renderScenarioResultView(result: ScenarioExecutorResult): ScenarioResultView;
|
|
37
|
+
//# sourceMappingURL=result-renderers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-renderers.d.ts","sourceRoot":"","sources":["../../src/framework/result-renderers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,kDAAkD;AAClD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,8DAA8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,sBAAsB,GAAG,kBAAkB,CA6C3F"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-kind result renderers.
|
|
3
|
+
*
|
|
4
|
+
* Persistence layers (recipe-service, dashboard) need a stable per-result
|
|
5
|
+
* projection: a small bag of view-friendly fields (metrics, assertion counts,
|
|
6
|
+
* outcome label) that doesn't leak per-kind types. The renderers below
|
|
7
|
+
* dispatch on `result.kind` and return a normalized `ScenarioResultView` so
|
|
8
|
+
* downstream code can render every kind uniformly while preserving the
|
|
9
|
+
* kind-specific outcome via the typed `result` field.
|
|
10
|
+
*
|
|
11
|
+
* Adding a new scenario kind requires adding a `case` here — the
|
|
12
|
+
* exhaustiveness `_exhaustive: never` assignment in `default:` surfaces the
|
|
13
|
+
* omission as a compile-time error.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Project a `ScenarioExecutorResult` into a uniform view shape.
|
|
17
|
+
*
|
|
18
|
+
* @throws {Error} When `result.kind` is not in the known discriminated-union
|
|
19
|
+
* variants. This is an exhaustiveness guard — a runtime hit means a new
|
|
20
|
+
* variant was added without updating this dispatch.
|
|
21
|
+
*/
|
|
22
|
+
export function renderScenarioResultView(result) {
|
|
23
|
+
switch (result.kind) {
|
|
24
|
+
case 'load': {
|
|
25
|
+
return {
|
|
26
|
+
kind: 'load',
|
|
27
|
+
scenarioId: result.scenarioId,
|
|
28
|
+
passed: result.passed,
|
|
29
|
+
durationMs: result.durationMs,
|
|
30
|
+
metrics: result.outcome.metrics,
|
|
31
|
+
assertionsPassed: result.outcome.assertions.passed.length,
|
|
32
|
+
assertionsFailed: result.outcome.assertions.failed.length,
|
|
33
|
+
outcomeLabel: `${result.outcome.metrics.totalRequests} req, ${result.outcome.assertions.failed.length} failed`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
case 'chaos': {
|
|
37
|
+
const passedCount = result.outcome.steadyStateAssertions.passed.length +
|
|
38
|
+
result.outcome.recoveryAssertions.passed.length;
|
|
39
|
+
const failedCount = result.outcome.steadyStateAssertions.failed.length +
|
|
40
|
+
result.outcome.recoveryAssertions.failed.length;
|
|
41
|
+
return {
|
|
42
|
+
kind: 'chaos',
|
|
43
|
+
scenarioId: result.scenarioId,
|
|
44
|
+
passed: result.passed,
|
|
45
|
+
durationMs: result.durationMs,
|
|
46
|
+
metrics: result.outcome.steadyStateMetrics,
|
|
47
|
+
assertionsPassed: passedCount,
|
|
48
|
+
assertionsFailed: failedCount,
|
|
49
|
+
outcomeLabel: `${result.outcome.chaosEvents.length} chaos events, ${failedCount} failed`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
default: {
|
|
53
|
+
// Exhaustiveness guard — adding a new variant to the discriminated union
|
|
54
|
+
// turns this assignment into a compile-time error, forcing every dispatch
|
|
55
|
+
// site (including this one) to add the missing branch.
|
|
56
|
+
const _exhaustive = result;
|
|
57
|
+
// @fitness-ignore-next-line result-pattern-consistency -- exhaustiveness probe; runtime should never hit this
|
|
58
|
+
throw new Error(`Unreachable: ScenarioExecutorResult kind exhaustiveness violation (${String(_exhaustive)})`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=result-renderers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-renderers.js","sourceRoot":"","sources":["../../src/framework/result-renderers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAkBH;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAA8B;IACrE,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;gBAC/B,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;gBACzD,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;gBACzD,YAAY,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,SAAS,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,SAAS;aAC/G,CAAC;QACJ,CAAC;QAED,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,WAAW,GACf,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM;gBAClD,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC;YAClD,MAAM,WAAW,GACf,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM;gBAClD,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC;YAClD,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB;gBAC1C,gBAAgB,EAAE,WAAW;gBAC7B,gBAAgB,EAAE,WAAW;gBAC7B,YAAY,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,kBAAkB,WAAW,SAAS;aACzF,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,yEAAyE;YACzE,0EAA0E;YAC1E,uDAAuD;YACvD,MAAM,WAAW,GAAU,MAAM,CAAC;YAClC,8GAA8G;YAC9G,MAAM,IAAI,KAAK,CACb,sEAAsE,MAAM,CAAC,WAAW,CAAC,GAAG,CAC7F,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared runtime contract for scenarios across all kinds.
|
|
3
|
+
*
|
|
4
|
+
* Every kind's `defineXxxScenario` entry point produces a `RunnableScenario`
|
|
5
|
+
* carrying its `kind` discriminator. Consumers (registry, recipe service,
|
|
6
|
+
* persistence, dashboard) dispatch on `kind` to handle per-kind result variants.
|
|
7
|
+
*/
|
|
8
|
+
import type { ScenarioExecutorResult } from './scenario-executor-result.js';
|
|
9
|
+
import type { ScenarioKind } from '../types/kind-types.js';
|
|
10
|
+
/**
|
|
11
|
+
* A validated, runnable scenario.
|
|
12
|
+
*
|
|
13
|
+
* The `kind` field is the architectural discriminator: persistence and
|
|
14
|
+
* dashboard code branch on it to handle each kind's `outcome` payload variant
|
|
15
|
+
* inside `ScenarioExecutorResult`.
|
|
16
|
+
*/
|
|
17
|
+
export interface RunnableScenario {
|
|
18
|
+
readonly kind: ScenarioKind;
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly tags: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Run the scenario with the given abort signal.
|
|
25
|
+
* The returned result's `kind` field MUST match this scenario's `kind`.
|
|
26
|
+
*/
|
|
27
|
+
run(abortSignal: AbortSignal): Promise<ScenarioExecutorResult>;
|
|
28
|
+
}
|
|
29
|
+
/** Registry-compatible entry. */
|
|
30
|
+
export interface ScenarioRegistryEntry {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly kind: ScenarioKind;
|
|
34
|
+
readonly scenario: RunnableScenario;
|
|
35
|
+
readonly tags: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=runnable-scenario.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnable-scenario.d.ts","sourceRoot":"","sources":["../../src/framework/runnable-scenario.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,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;IAEjC;;;OAGG;IACH,GAAG,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAChE;AAED,iCAAiC;AACjC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared runtime contract for scenarios across all kinds.
|
|
3
|
+
*
|
|
4
|
+
* Every kind's `defineXxxScenario` entry point produces a `RunnableScenario`
|
|
5
|
+
* carrying its `kind` discriminator. Consumers (registry, recipe service,
|
|
6
|
+
* persistence, dashboard) dispatch on `kind` to handle per-kind result variants.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=runnable-scenario.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnable-scenario.js","sourceRoot":"","sources":["../../src/framework/runnable-scenario.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Discriminated union over scenario execution results, by `kind`.
|
|
3
|
+
*
|
|
4
|
+
* Per DEC-338, each kind has its own outcome shape. The shared envelope
|
|
5
|
+
* carries `kind`, `scenarioId`, `passed`, `signals`, and `durationMs`; the
|
|
6
|
+
* per-kind `outcome` payload carries the kind-specific evidence.
|
|
7
|
+
*
|
|
8
|
+
* Persistence + dashboard code dispatch on `result.kind` to per-kind
|
|
9
|
+
* renderers. Adding a new kind is a compile-time exhaustiveness break in
|
|
10
|
+
* every dispatch site.
|
|
11
|
+
*/
|
|
12
|
+
import type { ChaosOutcome } from '../kinds/chaos/result.js';
|
|
13
|
+
import type { LoadOutcome } from '../kinds/load/result.js';
|
|
14
|
+
import type { Signal } from '@opensip-cli/core';
|
|
15
|
+
/** Common envelope fields for every kind's result. */
|
|
16
|
+
interface BaseScenarioExecutorResult {
|
|
17
|
+
/** Scenario id this result was produced from (correlates with the registry). */
|
|
18
|
+
readonly scenarioId: string;
|
|
19
|
+
/** Top-level pass/fail. Each kind defines its own predicate for `passed`. */
|
|
20
|
+
readonly passed: boolean;
|
|
21
|
+
/** Wall-clock duration the scenario ran for, in milliseconds. */
|
|
22
|
+
readonly durationMs: number;
|
|
23
|
+
/** Signals emitted during execution (may be empty for kinds that don't emit). */
|
|
24
|
+
readonly signals: readonly Signal[];
|
|
25
|
+
}
|
|
26
|
+
/** Load-kind result envelope. */
|
|
27
|
+
export interface LoadScenarioExecutorResult extends BaseScenarioExecutorResult {
|
|
28
|
+
readonly kind: 'load';
|
|
29
|
+
readonly outcome: LoadOutcome;
|
|
30
|
+
}
|
|
31
|
+
/** Chaos-kind result envelope. */
|
|
32
|
+
export interface ChaosScenarioExecutorResult extends BaseScenarioExecutorResult {
|
|
33
|
+
readonly kind: 'chaos';
|
|
34
|
+
readonly outcome: ChaosOutcome;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Discriminated union over scenario executor results.
|
|
38
|
+
*
|
|
39
|
+
* Use exhaustive `switch (result.kind)` to dispatch — TypeScript's narrowing
|
|
40
|
+
* makes per-kind `outcome` access compile-time safe.
|
|
41
|
+
*/
|
|
42
|
+
export type ScenarioExecutorResult = LoadScenarioExecutorResult | ChaosScenarioExecutorResult;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=scenario-executor-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-executor-result.d.ts","sourceRoot":"","sources":["../../src/framework/scenario-executor-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,sDAAsD;AACtD,UAAU,0BAA0B;IAClC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,iCAAiC;AACjC,MAAM,WAAW,0BAA2B,SAAQ,0BAA0B;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC/B;AAED,kCAAkC;AAClC,MAAM,WAAW,2BAA4B,SAAQ,0BAA0B;IAC7E,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Discriminated union over scenario execution results, by `kind`.
|
|
3
|
+
*
|
|
4
|
+
* Per DEC-338, each kind has its own outcome shape. The shared envelope
|
|
5
|
+
* carries `kind`, `scenarioId`, `passed`, `signals`, and `durationMs`; the
|
|
6
|
+
* per-kind `outcome` payload carries the kind-specific evidence.
|
|
7
|
+
*
|
|
8
|
+
* Persistence + dashboard code dispatch on `result.kind` to per-kind
|
|
9
|
+
* renderers. Adding a new kind is a compile-time exhaustiveness break in
|
|
10
|
+
* every dispatch site.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=scenario-executor-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-executor-result.js","sourceRoot":"","sources":["../../src/framework/scenario-executor-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-scenario structured logger.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the shared @opensip-cli/core logger with `evt: simulation.scenario.<level>`
|
|
5
|
+
* tags and a stable `scenarioId` field, so every log entry from a running
|
|
6
|
+
* scenario is greppable by scenario in the JSONL log stream. Each kind-
|
|
7
|
+
* specific executor (load, chaos, …) constructs one of these per scenario
|
|
8
|
+
* and passes it into the runtime as `ScenarioExecutionContext.logger`.
|
|
9
|
+
*
|
|
10
|
+
* The logger is identical across executor kinds — there's nothing
|
|
11
|
+
* load-specific or chaos-specific about how a scenario reports info /
|
|
12
|
+
* warn / error / debug. It lives in framework/ alongside the other
|
|
13
|
+
* cross-kind runtime helpers (latency-tracker, personas, result-builder)
|
|
14
|
+
* rather than being duplicated into each kinds/<kind>/executor.ts.
|
|
15
|
+
*/
|
|
16
|
+
import type { ScenarioLogger } from '../types/framework-types.js';
|
|
17
|
+
export declare function createScenarioLogger(scenarioId: string): ScenarioLogger;
|
|
18
|
+
//# sourceMappingURL=scenario-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-logger.d.ts","sourceRoot":"","sources":["../../src/framework/scenario-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAqBvE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-scenario structured logger.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the shared @opensip-cli/core logger with `evt: simulation.scenario.<level>`
|
|
5
|
+
* tags and a stable `scenarioId` field, so every log entry from a running
|
|
6
|
+
* scenario is greppable by scenario in the JSONL log stream. Each kind-
|
|
7
|
+
* specific executor (load, chaos, …) constructs one of these per scenario
|
|
8
|
+
* and passes it into the runtime as `ScenarioExecutionContext.logger`.
|
|
9
|
+
*
|
|
10
|
+
* The logger is identical across executor kinds — there's nothing
|
|
11
|
+
* load-specific or chaos-specific about how a scenario reports info /
|
|
12
|
+
* warn / error / debug. It lives in framework/ alongside the other
|
|
13
|
+
* cross-kind runtime helpers (latency-tracker, personas, result-builder)
|
|
14
|
+
* rather than being duplicated into each kinds/<kind>/executor.ts.
|
|
15
|
+
*/
|
|
16
|
+
import { logger } from '@opensip-cli/core';
|
|
17
|
+
export function createScenarioLogger(scenarioId) {
|
|
18
|
+
return {
|
|
19
|
+
info: (message, data) => {
|
|
20
|
+
logger.info({ evt: 'simulation.scenario.info', scenarioId, msg: message, ...data });
|
|
21
|
+
},
|
|
22
|
+
warn: (message, data) => {
|
|
23
|
+
logger.warn({ evt: 'simulation.scenario.warn', scenarioId, msg: message, ...data });
|
|
24
|
+
},
|
|
25
|
+
error: (message, data) => {
|
|
26
|
+
logger.error({
|
|
27
|
+
evt: 'simulation.scenario.error',
|
|
28
|
+
err: data?.err instanceof Error ? data.err : undefined,
|
|
29
|
+
scenarioId,
|
|
30
|
+
msg: message,
|
|
31
|
+
...data,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
debug: (message, data) => {
|
|
35
|
+
logger.debug({ evt: 'simulation.scenario.debug', scenarioId, msg: message, ...data });
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=scenario-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-logger.js","sourceRoot":"","sources":["../../src/framework/scenario-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACrD,OAAO;QACL,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,0BAA0B,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;QACtF,CAAC;QACD,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,0BAA0B,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;QACtF,CAAC;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;YACvB,MAAM,CAAC,KAAK,CAAC;gBACX,GAAG,EAAE,2BAA2B;gBAChC,GAAG,EAAE,IAAI,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;gBACtD,UAAU;gBACV,GAAG,EAAE,OAAO;gBACZ,GAAG,IAAI;aACR,CAAC,CAAC;QACL,CAAC;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;YACvB,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,2BAA2B,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;QACxF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `ScenarioMetricKey` — the union of metric ids recognised
|
|
3
|
+
* by `resolveMetric`.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from `resolve-metric.ts` into its own leaf module so
|
|
6
|
+
* `../types/base-types.ts` can reference the union (for
|
|
7
|
+
* `ScenarioAssertion.metric`) without forming a file-level cycle:
|
|
8
|
+
*
|
|
9
|
+
* `resolve-metric.ts` →(type) `base-types.ts` (uses `SimulationMetrics`)
|
|
10
|
+
* `base-types.ts` →(type) `resolve-metric.ts` (uses `ScenarioMetricKey`)
|
|
11
|
+
*
|
|
12
|
+
* With the union hosted here — a leaf that imports nothing from the
|
|
13
|
+
* type or runtime layers — both consumers import without closing the
|
|
14
|
+
* cycle. `resolve-metric.ts` re-exports the union for back-compat.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Union of every metric key recognised by `resolveMetric`.
|
|
18
|
+
*
|
|
19
|
+
* `ScenarioAssertion.metric` is typed as this union so a typo like
|
|
20
|
+
* `'p99-latnecy'` is a TypeScript error at the assertion-construction
|
|
21
|
+
* call site.
|
|
22
|
+
*/
|
|
23
|
+
export type ScenarioMetricKey = 'error_rate' | 'success_rate' | 'recovery_rate' | 'requests_per_second' | 'avg_latency' | 'avg_latency_ms' | 'p50_latency' | 'p50_latency_ms' | 'p95_latency' | 'p95_latency_ms' | 'p99_latency' | 'p99_latency_ms' | 'total_requests' | 'successful_requests' | 'failed_requests' | 'errors_generated' | 'max_latency_ms' | 'memory_mb' | 'cpu_percent';
|
|
24
|
+
//# sourceMappingURL=scenario-metric-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-metric-key.d.ts","sourceRoot":"","sources":["../../src/framework/scenario-metric-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAEzB,YAAY,GACZ,cAAc,GACd,eAAe,GACf,qBAAqB,GAErB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAEhB,gBAAgB,GAChB,qBAAqB,GACrB,iBAAiB,GACjB,kBAAkB,GAElB,gBAAgB,GAChB,WAAW,GACX,aAAa,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `ScenarioMetricKey` — the union of metric ids recognised
|
|
3
|
+
* by `resolveMetric`.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from `resolve-metric.ts` into its own leaf module so
|
|
6
|
+
* `../types/base-types.ts` can reference the union (for
|
|
7
|
+
* `ScenarioAssertion.metric`) without forming a file-level cycle:
|
|
8
|
+
*
|
|
9
|
+
* `resolve-metric.ts` →(type) `base-types.ts` (uses `SimulationMetrics`)
|
|
10
|
+
* `base-types.ts` →(type) `resolve-metric.ts` (uses `ScenarioMetricKey`)
|
|
11
|
+
*
|
|
12
|
+
* With the union hosted here — a leaf that imports nothing from the
|
|
13
|
+
* type or runtime layers — both consumers import without closing the
|
|
14
|
+
* cycle. `resolve-metric.ts` re-exports the union for back-compat.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=scenario-metric-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-metric-key.js","sourceRoot":"","sources":["../../src/framework/scenario-metric-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared validation helpers for `defineXxxScenario` entry
|
|
3
|
+
* points.
|
|
4
|
+
*
|
|
5
|
+
* Each kind's `defineXxxScenarioConfig` validator used to repeat the same
|
|
6
|
+
* three blocks: identifier-shape checks, registry-uniqueness checks, and
|
|
7
|
+
* the `errors -> ValidationError` collector. Centralising them here gives
|
|
8
|
+
* uniform semantics (every kind enforces id/name shape the same way and
|
|
9
|
+
* stamps the same `code: 'VALIDATION.SCENARIO.INVALID_CONFIG'`).
|
|
10
|
+
*
|
|
11
|
+
* Kind-specific checks (e.g. chaos's recovery window) stay inline in
|
|
12
|
+
* each define.ts.
|
|
13
|
+
*/
|
|
14
|
+
import type { ScenarioKind } from '../types/kind-types.js';
|
|
15
|
+
import type { Target } from './execution/target.js';
|
|
16
|
+
import type { Workload } from '../types/workload.js';
|
|
17
|
+
/** A single validation error: which field failed and why. */
|
|
18
|
+
export interface ScenarioValidationError {
|
|
19
|
+
readonly field: string;
|
|
20
|
+
readonly message: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Subset of fields every scenario kind shares — id / name / description.
|
|
24
|
+
* The validators below operate on this shape so each kind can pass its
|
|
25
|
+
* concrete config in.
|
|
26
|
+
*/
|
|
27
|
+
export interface ScenarioMetadataInput {
|
|
28
|
+
readonly id?: string;
|
|
29
|
+
readonly name?: string;
|
|
30
|
+
readonly description?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The common `target` + `workload` subset every driven scenario kind
|
|
34
|
+
* shares (load, chaos). Both `LoadScenarioConfig` and `ChaosScenarioConfig`
|
|
35
|
+
* are assignable to this — the shared validator operates on this shape so
|
|
36
|
+
* each kind can pass its concrete config in.
|
|
37
|
+
*/
|
|
38
|
+
export interface TargetWorkloadInput {
|
|
39
|
+
readonly target: Target;
|
|
40
|
+
readonly workload: Workload;
|
|
41
|
+
}
|
|
42
|
+
/** Options for shared metadata validation. */
|
|
43
|
+
export interface ValidateMetadataOptions {
|
|
44
|
+
/**
|
|
45
|
+
* If true (default), `id` is checked against `^[a-z0-9-]+$`. Some kinds
|
|
46
|
+
* (load) historically reported the empty-id case separately; setting
|
|
47
|
+
* `requireId: 'shape'` keeps the strict form check, while
|
|
48
|
+
* `requireId: 'present-only'` only checks for non-empty.
|
|
49
|
+
*/
|
|
50
|
+
readonly requireId?: 'shape' | 'present-only';
|
|
51
|
+
/** When true (default), `name` must be a non-empty trimmed string. */
|
|
52
|
+
readonly requireName?: boolean;
|
|
53
|
+
/** When true (default), `description` must be a non-empty trimmed string. */
|
|
54
|
+
readonly requireDescription?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Validate the shared metadata block (id / name / description) on any
|
|
58
|
+
* scenario config. Mutates `errors` in place — no return value, matching
|
|
59
|
+
* each kind's existing helper-collector style.
|
|
60
|
+
*/
|
|
61
|
+
export declare function validateScenarioMetadata(config: ScenarioMetadataInput, errors: ScenarioValidationError[], options?: ValidateMetadataOptions): void;
|
|
62
|
+
/**
|
|
63
|
+
* Validate the shared `target` + `workload` block common to every driven
|
|
64
|
+
* scenario kind (load, chaos):
|
|
65
|
+
* - `target` must be a function (the BYO seam),
|
|
66
|
+
* - `workload.rps` must be a positive number,
|
|
67
|
+
* - `workload.concurrency`, when defined, must be >= 1.
|
|
68
|
+
*
|
|
69
|
+
* Mutates `errors` in place — no return value, matching the helper-collector
|
|
70
|
+
* style of `validateScenarioMetadata`. Kind-specific workload checks
|
|
71
|
+
* (e.g. load's `rampUp` vs `duration`, chaos's inline `rampUp`/`duration`)
|
|
72
|
+
* stay inline in each define.ts.
|
|
73
|
+
*/
|
|
74
|
+
export declare function validateTargetAndWorkload(config: TargetWorkloadInput, errors: ScenarioValidationError[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Format a `ScenarioValidationError[]` and throw a `CoreValidationError`
|
|
77
|
+
* with the canonical `'VALIDATION.SCENARIO.INVALID_CONFIG'` code if any
|
|
78
|
+
* errors were collected. No-op when the list is empty.
|
|
79
|
+
*
|
|
80
|
+
* @throws {CoreValidationError} When `errors` is non-empty.
|
|
81
|
+
*/
|
|
82
|
+
export declare function throwValidationErrors(errors: readonly ScenarioValidationError[], kind: ScenarioKind): void;
|
|
83
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/framework/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMrD,6DAA6D;AAC7D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,8CAA8C;AAC9C,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IAC9C,sEAAsE;IACtE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACvC;AAMD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,uBAAuB,EAAE,EACjC,OAAO,GAAE,uBAA4B,GACpC,IAAI,CAyBN;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,uBAAuB,EAAE,GAChC,IAAI,CAUN;AAMD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,uBAAuB,EAAE,EAC1C,IAAI,EAAE,YAAY,GACjB,IAAI,CAQN"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared validation helpers for `defineXxxScenario` entry
|
|
3
|
+
* points.
|
|
4
|
+
*
|
|
5
|
+
* Each kind's `defineXxxScenarioConfig` validator used to repeat the same
|
|
6
|
+
* three blocks: identifier-shape checks, registry-uniqueness checks, and
|
|
7
|
+
* the `errors -> ValidationError` collector. Centralising them here gives
|
|
8
|
+
* uniform semantics (every kind enforces id/name shape the same way and
|
|
9
|
+
* stamps the same `code: 'VALIDATION.SCENARIO.INVALID_CONFIG'`).
|
|
10
|
+
*
|
|
11
|
+
* Kind-specific checks (e.g. chaos's recovery window) stay inline in
|
|
12
|
+
* each define.ts.
|
|
13
|
+
*/
|
|
14
|
+
import { ValidationError as CoreValidationError } from '@opensip-cli/core';
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// METADATA VALIDATION
|
|
17
|
+
// =============================================================================
|
|
18
|
+
/**
|
|
19
|
+
* Validate the shared metadata block (id / name / description) on any
|
|
20
|
+
* scenario config. Mutates `errors` in place — no return value, matching
|
|
21
|
+
* each kind's existing helper-collector style.
|
|
22
|
+
*/
|
|
23
|
+
export function validateScenarioMetadata(config, errors, options = {}) {
|
|
24
|
+
const requireId = options.requireId ?? 'shape';
|
|
25
|
+
const requireName = options.requireName ?? true;
|
|
26
|
+
const requireDescription = options.requireDescription ?? true;
|
|
27
|
+
// id
|
|
28
|
+
const id = config.id;
|
|
29
|
+
if (!id || id.trim() === '') {
|
|
30
|
+
errors.push({ field: 'id', message: 'id is required' });
|
|
31
|
+
}
|
|
32
|
+
else if (requireId === 'shape' && !/^[a-z0-9-]+$/.test(id)) {
|
|
33
|
+
errors.push({
|
|
34
|
+
field: 'id',
|
|
35
|
+
message: 'id must be lowercase alphanumeric with hyphens',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// name
|
|
39
|
+
if (requireName && (!config.name || config.name.trim() === '')) {
|
|
40
|
+
errors.push({ field: 'name', message: 'name is required' });
|
|
41
|
+
}
|
|
42
|
+
// description
|
|
43
|
+
if (requireDescription && (!config.description || config.description.trim() === '')) {
|
|
44
|
+
errors.push({ field: 'description', message: 'description is required' });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// TARGET + WORKLOAD VALIDATION
|
|
49
|
+
// =============================================================================
|
|
50
|
+
/**
|
|
51
|
+
* Validate the shared `target` + `workload` block common to every driven
|
|
52
|
+
* scenario kind (load, chaos):
|
|
53
|
+
* - `target` must be a function (the BYO seam),
|
|
54
|
+
* - `workload.rps` must be a positive number,
|
|
55
|
+
* - `workload.concurrency`, when defined, must be >= 1.
|
|
56
|
+
*
|
|
57
|
+
* Mutates `errors` in place — no return value, matching the helper-collector
|
|
58
|
+
* style of `validateScenarioMetadata`. Kind-specific workload checks
|
|
59
|
+
* (e.g. load's `rampUp` vs `duration`, chaos's inline `rampUp`/`duration`)
|
|
60
|
+
* stay inline in each define.ts.
|
|
61
|
+
*/
|
|
62
|
+
export function validateTargetAndWorkload(config, errors) {
|
|
63
|
+
if (typeof config.target !== 'function') {
|
|
64
|
+
errors.push({ field: 'target', message: 'target must be a function (the BYO seam)' });
|
|
65
|
+
}
|
|
66
|
+
if (typeof config.workload?.rps !== 'number' || config.workload.rps <= 0) {
|
|
67
|
+
errors.push({ field: 'workload.rps', message: 'workload.rps must be a positive number' });
|
|
68
|
+
}
|
|
69
|
+
if (config.workload?.concurrency !== undefined && config.workload.concurrency < 1) {
|
|
70
|
+
errors.push({ field: 'workload.concurrency', message: 'workload.concurrency must be >= 1' });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// =============================================================================
|
|
74
|
+
// THROW COLLECTED ERRORS
|
|
75
|
+
// =============================================================================
|
|
76
|
+
/**
|
|
77
|
+
* Format a `ScenarioValidationError[]` and throw a `CoreValidationError`
|
|
78
|
+
* with the canonical `'VALIDATION.SCENARIO.INVALID_CONFIG'` code if any
|
|
79
|
+
* errors were collected. No-op when the list is empty.
|
|
80
|
+
*
|
|
81
|
+
* @throws {CoreValidationError} When `errors` is non-empty.
|
|
82
|
+
*/
|
|
83
|
+
export function throwValidationErrors(errors, kind) {
|
|
84
|
+
if (errors.length === 0)
|
|
85
|
+
return;
|
|
86
|
+
const messages = errors.map((e) => ` - ${e.field}: ${e.message}`).join('\n');
|
|
87
|
+
// @fitness-ignore-next-line result-pattern-consistency -- definition-time validation, throw is appropriate
|
|
88
|
+
throw new CoreValidationError(`Invalid ${kind} scenario configuration:\n${messages}`, {
|
|
89
|
+
code: 'VALIDATION.SCENARIO.INVALID_CONFIG',
|
|
90
|
+
metadata: { errors: [...errors], kind },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/framework/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAqD3E,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAA6B,EAC7B,MAAiC,EACjC,UAAmC,EAAE;IAErC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC;IAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC;IAChD,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,IAAI,IAAI,CAAC;IAE9D,KAAK;IACL,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC1D,CAAC;SAAM,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,gDAAgD;SAC1D,CAAC,CAAC;IACL,CAAC;IAED,OAAO;IACP,IAAI,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,cAAc;IACd,IAAI,kBAAkB,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACpF,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,+BAA+B;AAC/B,gFAAgF;AAEhF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAA2B,EAC3B,MAAiC;IAEjC,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,0CAA0C,EAAE,CAAC,CAAC;IACxF,CAAC;IACD,IAAI,OAAO,MAAM,CAAC,QAAQ,EAAE,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QACzE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,wCAAwC,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,WAAW,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC;QAClF,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC,CAAC;IAC/F,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,yBAAyB;AACzB,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAA0C,EAC1C,IAAkB;IAElB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAChC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9E,2GAA2G;IAC3G,MAAM,IAAI,mBAAmB,CAAC,WAAW,IAAI,6BAA6B,QAAQ,EAAE,EAAE;QACpF,IAAI,EAAE,oCAAoC;QAC1C,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE;KACxC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @opensip-cli/simulation — Simulation scenarios for codebase analysis.
|
|
3
|
+
*
|
|
4
|
+
* The package exposes two kind-specific scenario authoring entry points
|
|
5
|
+
* sharing one runtime contract:
|
|
6
|
+
*
|
|
7
|
+
* - `defineLoadScenario` ← BYO target + workload + assert SLO
|
|
8
|
+
* - `defineChaosScenario` ← BYO target + client-side faults + recovery
|
|
9
|
+
*/
|
|
10
|
+
import './scope-augmentation.js';
|
|
11
|
+
export type { SimulationSubscope } from './scope-augmentation.js';
|
|
12
|
+
export type { ScenarioKind } from './types/kind-types.js';
|
|
13
|
+
export { SCENARIO_KINDS } from './types/kind-types.js';
|
|
14
|
+
export type { RunnableScenario, ScenarioRegistryEntry } from './framework/runnable-scenario.js';
|
|
15
|
+
export type { ScenarioExecutorResult, LoadScenarioExecutorResult, ChaosScenarioExecutorResult, } from './framework/scenario-executor-result.js';
|
|
16
|
+
export { defineLoadScenario, validateLoadScenarioConfig, type LoadScenarioConfig, } from './kinds/load/define.js';
|
|
17
|
+
export type { LoadOutcome } from './kinds/load/result.js';
|
|
18
|
+
export { defineChaosScenario, validateChaosScenarioConfig, type ChaosScenarioConfig, } from './kinds/chaos/define.js';
|
|
19
|
+
export type { ChaosOutcome, ChaosEvent, ChaosAssertionVerdict } from './kinds/chaos/result.js';
|
|
20
|
+
export { simulationTool, simulationTool as tool } from './tool.js';
|
|
21
|
+
export { SIMULATION_CONTRACT_VERSION } from './tool.js';
|
|
22
|
+
export type { SimPluginExports } from './plugins/types.js';
|
|
23
|
+
export { ASSERTIONS, type AssertionFactory, evaluateAssertion, evaluateOperator, getOperatorDescription, } from './framework/assertions.js';
|
|
24
|
+
export { httpTarget, type HttpTargetOptions } from './framework/execution/http-target.js';
|
|
25
|
+
export { fault } from './framework/execution/fault-builders.js';
|
|
26
|
+
export type { Target, TargetContext } from './framework/execution/target.js';
|
|
27
|
+
export type { Workload } from './types/workload.js';
|
|
28
|
+
export type { Fault, FaultKind, FaultSpec } from './framework/execution/fault-spec.js';
|
|
29
|
+
export { ScenarioResultBuilder, createEmptyMetrics, mergeMetrics, } from './framework/result-builder.js';
|
|
30
|
+
export { resolveMetric, type ScenarioMetricKey } from './framework/resolve-metric.js';
|
|
31
|
+
export { ScenarioAbortedError, scenarioAborted, validateAssertions, updateLatencyMetrics, sleepWithAbort, } from './framework/execution/execution-engine.js';
|
|
32
|
+
export { defineSimulationRecipe } from './recipes/define-recipe.js';
|
|
33
|
+
export type { SimulationRecipe, SimulationRecipeConfig, SimulationExecutionOptions, ScenarioSelector, ExplicitScenarioSelector, AllScenarioSelector, TagsScenarioSelector, KindScenarioSelector, } from './recipes/types.js';
|
|
34
|
+
export type { AssertionOperator, ScenarioAssertion, FailedAssertion, ScenarioExecutionContext, ScenarioLogger, SimulationMetrics, LoadResultPayload, } from './types/framework-types.js';
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAQH,OAAO,yBAAyB,CAAC;AACjC,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAMlE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMvD,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAChG,YAAY,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,yCAAyC,CAAC;AAMjD,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAM1D,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAU/F,OAAO,EAAE,cAAc,EAAE,cAAc,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAWxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAS3D,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEvF,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,GACb,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEtF,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,GACf,MAAM,2CAA2C,CAAC;AAMnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC"}
|