@agentic-qe/v3 3.0.0-alpha.6 → 3.0.0-alpha.7
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/assets/agents/v3/subagents/v3-qe-code-reviewer.md +339 -0
- package/assets/agents/v3/subagents/v3-qe-integration-reviewer.md +344 -0
- package/assets/agents/v3/subagents/v3-qe-performance-reviewer.md +351 -0
- package/assets/agents/v3/subagents/v3-qe-security-reviewer.md +374 -0
- package/assets/agents/v3/subagents/v3-qe-tdd-green.md +334 -0
- package/assets/agents/v3/subagents/v3-qe-tdd-red.md +329 -0
- package/assets/agents/v3/subagents/v3-qe-tdd-refactor.md +361 -0
- package/assets/agents/v3/v3-qe-accessibility-auditor.md +266 -0
- package/assets/agents/v3/v3-qe-bdd-generator.md +279 -0
- package/assets/agents/v3/v3-qe-chaos-engineer.md +265 -0
- package/assets/agents/v3/v3-qe-code-complexity.md +298 -0
- package/assets/agents/v3/v3-qe-code-intelligence.md +262 -0
- package/assets/agents/v3/v3-qe-contract-validator.md +267 -0
- package/assets/agents/v3/v3-qe-coverage-specialist.md +227 -0
- package/assets/agents/v3/v3-qe-defect-predictor.md +251 -0
- package/assets/agents/v3/v3-qe-dependency-mapper.md +277 -0
- package/assets/agents/v3/v3-qe-deployment-advisor.md +275 -0
- package/assets/agents/v3/v3-qe-flaky-hunter.md +248 -0
- package/assets/agents/v3/v3-qe-fleet-commander.md +293 -0
- package/assets/agents/v3/v3-qe-gap-detector.md +260 -0
- package/assets/agents/v3/v3-qe-graphql-tester.md +308 -0
- package/assets/agents/v3/v3-qe-impact-analyzer.md +299 -0
- package/assets/agents/v3/v3-qe-integration-tester.md +238 -0
- package/assets/agents/v3/v3-qe-kg-builder.md +273 -0
- package/assets/agents/v3/v3-qe-learning-coordinator.md +226 -0
- package/assets/agents/v3/v3-qe-load-tester.md +280 -0
- package/assets/agents/v3/v3-qe-metrics-optimizer.md +300 -0
- package/assets/agents/v3/v3-qe-mutation-tester.md +301 -0
- package/assets/agents/v3/v3-qe-parallel-executor.md +240 -0
- package/assets/agents/v3/v3-qe-pattern-learner.md +271 -0
- package/assets/agents/v3/v3-qe-performance-tester.md +262 -0
- package/assets/agents/v3/v3-qe-property-tester.md +247 -0
- package/assets/agents/v3/v3-qe-quality-gate.md +218 -0
- package/assets/agents/v3/v3-qe-queen-coordinator.md +214 -0
- package/assets/agents/v3/v3-qe-qx-partner.md +313 -0
- package/assets/agents/v3/v3-qe-regression-analyzer.md +322 -0
- package/assets/agents/v3/v3-qe-requirements-validator.md +360 -0
- package/assets/agents/v3/v3-qe-responsive-tester.md +311 -0
- package/assets/agents/v3/v3-qe-retry-handler.md +256 -0
- package/assets/agents/v3/v3-qe-risk-assessor.md +273 -0
- package/assets/agents/v3/v3-qe-root-cause-analyzer.md +286 -0
- package/assets/agents/v3/v3-qe-security-auditor.md +299 -0
- package/assets/agents/v3/v3-qe-security-scanner.md +235 -0
- package/assets/agents/v3/v3-qe-tdd-specialist.md +239 -0
- package/assets/agents/v3/v3-qe-test-architect.md +233 -0
- package/assets/agents/v3/v3-qe-transfer-specialist.md +295 -0
- package/assets/agents/v3/v3-qe-visual-tester.md +232 -0
- package/assets/skills/accessibility-testing/SKILL.md +216 -0
- package/assets/skills/agentdb-advanced/SKILL.md +550 -0
- package/assets/skills/agentdb-learning/SKILL.md +545 -0
- package/assets/skills/agentdb-memory-patterns/SKILL.md +339 -0
- package/assets/skills/agentdb-optimization/SKILL.md +509 -0
- package/assets/skills/agentdb-vector-search/SKILL.md +339 -0
- package/assets/skills/agentic-jujutsu/SKILL.md +645 -0
- package/assets/skills/agentic-quality-engineering/SKILL.md +335 -0
- package/assets/skills/api-testing-patterns/SKILL.md +294 -0
- package/assets/skills/aqe-v2-v3-migration/skill.md +322 -0
- package/assets/skills/brutal-honesty-review/README.md +218 -0
- package/assets/skills/brutal-honesty-review/SKILL.md +235 -0
- package/assets/skills/brutal-honesty-review/resources/assessment-rubrics.md +295 -0
- package/assets/skills/brutal-honesty-review/resources/review-template.md +102 -0
- package/assets/skills/brutal-honesty-review/scripts/assess-code.sh +179 -0
- package/assets/skills/brutal-honesty-review/scripts/assess-tests.sh +223 -0
- package/assets/skills/bug-reporting-excellence/SKILL.md +225 -0
- package/assets/skills/chaos-engineering-resilience/SKILL.md +158 -0
- package/assets/skills/cicd-pipeline-qe-orchestrator/README.md +304 -0
- package/assets/skills/cicd-pipeline-qe-orchestrator/SKILL.md +315 -0
- package/assets/skills/cicd-pipeline-qe-orchestrator/resources/workflows/microservice-pipeline.md +239 -0
- package/assets/skills/cicd-pipeline-qe-orchestrator/resources/workflows/mobile-pipeline.md +375 -0
- package/assets/skills/cicd-pipeline-qe-orchestrator/resources/workflows/monolith-pipeline.md +268 -0
- package/assets/skills/code-review-quality/SKILL.md +227 -0
- package/assets/skills/compatibility-testing/SKILL.md +205 -0
- package/assets/skills/compliance-testing/SKILL.md +225 -0
- package/assets/skills/consultancy-practices/SKILL.md +202 -0
- package/assets/skills/context-driven-testing/SKILL.md +196 -0
- package/assets/skills/contract-testing/SKILL.md +222 -0
- package/assets/skills/database-testing/SKILL.md +244 -0
- package/assets/skills/exploratory-testing-advanced/SKILL.md +201 -0
- package/assets/skills/flow-nexus-neural/SKILL.md +738 -0
- package/assets/skills/flow-nexus-platform/SKILL.md +1157 -0
- package/assets/skills/flow-nexus-swarm/SKILL.md +610 -0
- package/assets/skills/github-code-review/SKILL.md +1140 -0
- package/assets/skills/github-multi-repo/SKILL.md +874 -0
- package/assets/skills/github-project-management/SKILL.md +1277 -0
- package/assets/skills/github-release-management/SKILL.md +1081 -0
- package/assets/skills/github-workflow-automation/SKILL.md +1065 -0
- package/assets/skills/hive-mind-advanced/SKILL.md +712 -0
- package/assets/skills/holistic-testing-pact/SKILL.md +171 -0
- package/assets/skills/hooks-automation/SKILL.md +1201 -0
- package/assets/skills/localization-testing/SKILL.md +221 -0
- package/assets/skills/mobile-testing/SKILL.md +219 -0
- package/assets/skills/mutation-testing/SKILL.md +229 -0
- package/assets/skills/n8n-expression-testing/SKILL.md +434 -0
- package/assets/skills/n8n-integration-testing-patterns/SKILL.md +540 -0
- package/assets/skills/n8n-security-testing/SKILL.md +599 -0
- package/assets/skills/n8n-trigger-testing-strategies/SKILL.md +541 -0
- package/assets/skills/n8n-workflow-testing-fundamentals/SKILL.md +447 -0
- package/assets/skills/pair-programming/SKILL.md +1202 -0
- package/assets/skills/performance-analysis/SKILL.md +563 -0
- package/assets/skills/performance-testing/SKILL.md +310 -0
- package/assets/skills/quality-metrics/SKILL.md +225 -0
- package/assets/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/assets/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/assets/skills/refactoring-patterns/SKILL.md +205 -0
- package/assets/skills/regression-testing/SKILL.md +227 -0
- package/assets/skills/risk-based-testing/SKILL.md +206 -0
- package/assets/skills/security-testing/SKILL.md +306 -0
- package/assets/skills/sherlock-review/SKILL.md +250 -0
- package/assets/skills/shift-left-testing/SKILL.md +225 -0
- package/assets/skills/shift-right-testing/SKILL.md +227 -0
- package/assets/skills/six-thinking-hats/README.md +190 -0
- package/assets/skills/six-thinking-hats/SKILL.md +280 -0
- package/assets/skills/six-thinking-hats/resources/examples/api-testing-example.md +345 -0
- package/assets/skills/six-thinking-hats/resources/templates/solo-session-template.md +167 -0
- package/assets/skills/six-thinking-hats/resources/templates/team-session-template.md +336 -0
- package/assets/skills/skill-builder/SKILL.md +910 -0
- package/assets/skills/sparc-methodology/SKILL.md +1115 -0
- package/assets/skills/stream-chain/SKILL.md +563 -0
- package/assets/skills/swarm-advanced/SKILL.md +973 -0
- package/assets/skills/swarm-orchestration/SKILL.md +179 -0
- package/assets/skills/tdd-london-chicago/SKILL.md +244 -0
- package/assets/skills/technical-writing/SKILL.md +178 -0
- package/assets/skills/test-automation-strategy/SKILL.md +230 -0
- package/assets/skills/test-data-management/SKILL.md +270 -0
- package/assets/skills/test-design-techniques/SKILL.md +244 -0
- package/assets/skills/test-environment-management/SKILL.md +243 -0
- package/assets/skills/test-reporting-analytics/SKILL.md +214 -0
- package/assets/skills/testability-scoring/README.md +71 -0
- package/assets/skills/testability-scoring/SKILL.md +346 -0
- package/assets/skills/testability-scoring/resources/templates/config.template.js +84 -0
- package/assets/skills/testability-scoring/resources/templates/testability-scoring.spec.template.js +532 -0
- package/assets/skills/testability-scoring/scripts/generate-html-report.js +1007 -0
- package/assets/skills/testability-scoring/scripts/run-assessment.sh +70 -0
- package/assets/skills/v3-qe-chaos-resilience/SKILL.md +238 -0
- package/assets/skills/v3-qe-code-intelligence/SKILL.md +209 -0
- package/assets/skills/v3-qe-contract-testing/SKILL.md +218 -0
- package/assets/skills/v3-qe-coverage-analysis/SKILL.md +187 -0
- package/assets/skills/v3-qe-defect-intelligence/SKILL.md +205 -0
- package/assets/skills/v3-qe-learning-optimization/SKILL.md +238 -0
- package/assets/skills/v3-qe-quality-assessment/SKILL.md +213 -0
- package/assets/skills/v3-qe-requirements-validation/SKILL.md +248 -0
- package/assets/skills/v3-qe-test-execution/SKILL.md +182 -0
- package/assets/skills/v3-qe-test-generation/SKILL.md +141 -0
- package/assets/skills/v3-qe-visual-accessibility/SKILL.md +242 -0
- package/assets/skills/verification-quality/SKILL.md +649 -0
- package/assets/skills/visual-testing-advanced/SKILL.md +219 -0
- package/assets/skills/xp-practices/SKILL.md +229 -0
- package/dist/cli/bundle.js +8 -8
- package/dist/init/agents-installer.js +4 -4
- package/dist/init/agents-installer.js.map +1 -1
- package/dist/init/skills-installer.js +4 -4
- package/dist/init/skills-installer.js.map +1 -1
- package/package.json +7 -1
- package/docs/analysis/V3-INIT-REQUIREMENTS-ANALYSIS.md +0 -352
- package/implementation/README.md +0 -90
- package/implementation/adrs/ADR-030-coherence-gated-quality-gates.md +0 -312
- package/implementation/adrs/ADR-031-strange-loop-self-awareness.md +0 -484
- package/implementation/adrs/ADR-032-time-crystal-scheduling.md +0 -530
- package/implementation/adrs/ADR-033-early-exit-testing.md +0 -634
- package/implementation/adrs/ADR-034-neural-topology-optimizer.md +0 -589
- package/implementation/adrs/ADR-035-causal-discovery.md +0 -610
- package/implementation/adrs/ADR-036-result-persistence.md +0 -326
- package/implementation/adrs/ADR-037-v3-qe-agent-naming.md +0 -105
- package/implementation/adrs/ADR-038-v3-qe-memory-unification.md +0 -154
- package/implementation/adrs/ADR-039-v3-qe-mcp-optimization.md +0 -179
- package/implementation/adrs/ADR-040-v3-qe-agentic-flow-integration.md +0 -240
- package/implementation/adrs/ADR-041-v3-qe-cli-enhancement.md +0 -296
- package/implementation/adrs/ADR-042-v3-qe-token-tracking-integration.md +0 -517
- package/implementation/adrs/v3-adrs.md +0 -2783
- package/implementation/planning/AQE-V3-MASTER-PLAN.md +0 -815
- package/security-scan-report-2026-01-11.md +0 -410
- package/security-verification-report-2026-01-11.md +0 -278
- package/src/benchmarks/performance-benchmarks.ts +0 -646
- package/src/benchmarks/run-benchmarks.ts +0 -324
- package/src/causal-discovery/causal-graph.ts +0 -450
- package/src/causal-discovery/discovery-engine.ts +0 -438
- package/src/causal-discovery/index.ts +0 -117
- package/src/causal-discovery/types.ts +0 -456
- package/src/causal-discovery/weight-matrix.ts +0 -453
- package/src/cli/commands/qe-tools.ts +0 -634
- package/src/cli/index.ts +0 -1976
- package/src/compatibility/agent-mapper.ts +0 -291
- package/src/compatibility/cli-adapter.ts +0 -277
- package/src/compatibility/config-migrator.ts +0 -334
- package/src/compatibility/index.ts +0 -112
- package/src/compatibility/mcp-adapter.ts +0 -248
- package/src/compatibility/types.ts +0 -156
- package/src/coordination/claims/claim-repository.ts +0 -636
- package/src/coordination/claims/claim-service.ts +0 -675
- package/src/coordination/claims/handoff-manager.ts +0 -535
- package/src/coordination/claims/index.ts +0 -276
- package/src/coordination/claims/interfaces.ts +0 -687
- package/src/coordination/claims/work-stealing.ts +0 -436
- package/src/coordination/cross-domain-router.ts +0 -492
- package/src/coordination/index.ts +0 -127
- package/src/coordination/interfaces.ts +0 -691
- package/src/coordination/protocol-executor.ts +0 -760
- package/src/coordination/protocols/code-intelligence-index.ts +0 -855
- package/src/coordination/protocols/defect-investigation.ts +0 -1184
- package/src/coordination/protocols/index.ts +0 -11
- package/src/coordination/protocols/learning-consolidation.ts +0 -1181
- package/src/coordination/protocols/morning-sync.ts +0 -1055
- package/src/coordination/protocols/quality-gate.ts +0 -1566
- package/src/coordination/protocols/security-audit.ts +0 -1587
- package/src/coordination/queen-coordinator.ts +0 -1176
- package/src/coordination/result-saver.ts +0 -780
- package/src/coordination/task-executor.ts +0 -1146
- package/src/coordination/workflow-orchestrator.ts +0 -1917
- package/src/domains/chaos-resilience/coordinator.ts +0 -1032
- package/src/domains/chaos-resilience/index.ts +0 -143
- package/src/domains/chaos-resilience/interfaces.ts +0 -659
- package/src/domains/chaos-resilience/plugin.ts +0 -691
- package/src/domains/chaos-resilience/services/chaos-engineer.ts +0 -1097
- package/src/domains/chaos-resilience/services/index.ts +0 -19
- package/src/domains/chaos-resilience/services/load-tester.ts +0 -799
- package/src/domains/chaos-resilience/services/performance-profiler.ts +0 -792
- package/src/domains/code-intelligence/coordinator.ts +0 -631
- package/src/domains/code-intelligence/index.ts +0 -86
- package/src/domains/code-intelligence/interfaces.ts +0 -162
- package/src/domains/code-intelligence/plugin.ts +0 -451
- package/src/domains/code-intelligence/services/impact-analyzer.ts +0 -567
- package/src/domains/code-intelligence/services/index.ts +0 -26
- package/src/domains/code-intelligence/services/knowledge-graph.ts +0 -1067
- package/src/domains/code-intelligence/services/semantic-analyzer.ts +0 -901
- package/src/domains/contract-testing/coordinator.ts +0 -1038
- package/src/domains/contract-testing/index.ts +0 -122
- package/src/domains/contract-testing/interfaces.ts +0 -458
- package/src/domains/contract-testing/plugin.ts +0 -746
- package/src/domains/contract-testing/services/api-compatibility.ts +0 -748
- package/src/domains/contract-testing/services/contract-validator.ts +0 -1700
- package/src/domains/contract-testing/services/index.ts +0 -19
- package/src/domains/contract-testing/services/schema-validator.ts +0 -1102
- package/src/domains/coverage-analysis/coordinator.ts +0 -485
- package/src/domains/coverage-analysis/index.ts +0 -114
- package/src/domains/coverage-analysis/interfaces.ts +0 -142
- package/src/domains/coverage-analysis/plugin.ts +0 -172
- package/src/domains/coverage-analysis/services/coverage-analyzer.ts +0 -449
- package/src/domains/coverage-analysis/services/coverage-embedder.ts +0 -733
- package/src/domains/coverage-analysis/services/coverage-parser.ts +0 -753
- package/src/domains/coverage-analysis/services/gap-detector.ts +0 -592
- package/src/domains/coverage-analysis/services/hnsw-index.ts +0 -728
- package/src/domains/coverage-analysis/services/index.ts +0 -61
- package/src/domains/coverage-analysis/services/risk-scorer.ts +0 -540
- package/src/domains/coverage-analysis/services/sublinear-analyzer.ts +0 -747
- package/src/domains/defect-intelligence/coordinator.ts +0 -635
- package/src/domains/defect-intelligence/index.ts +0 -83
- package/src/domains/defect-intelligence/interfaces.ts +0 -152
- package/src/domains/defect-intelligence/plugin.ts +0 -483
- package/src/domains/defect-intelligence/services/causal-root-cause-analyzer.ts +0 -494
- package/src/domains/defect-intelligence/services/defect-predictor.ts +0 -852
- package/src/domains/defect-intelligence/services/index.ts +0 -37
- package/src/domains/defect-intelligence/services/pattern-learner.ts +0 -738
- package/src/domains/defect-intelligence/services/root-cause-analyzer.ts +0 -637
- package/src/domains/domain-interface.ts +0 -77
- package/src/domains/index.ts +0 -23
- package/src/domains/learning-optimization/coordinator.ts +0 -1215
- package/src/domains/learning-optimization/index.ts +0 -127
- package/src/domains/learning-optimization/interfaces.ts +0 -570
- package/src/domains/learning-optimization/plugin.ts +0 -851
- package/src/domains/learning-optimization/services/index.ts +0 -29
- package/src/domains/learning-optimization/services/learning-coordinator.ts +0 -972
- package/src/domains/learning-optimization/services/metrics-optimizer.ts +0 -915
- package/src/domains/learning-optimization/services/production-intel.ts +0 -971
- package/src/domains/learning-optimization/services/transfer-specialist.ts +0 -723
- package/src/domains/quality-assessment/coherence/gate-controller.ts +0 -549
- package/src/domains/quality-assessment/coherence/index.ts +0 -211
- package/src/domains/quality-assessment/coherence/lambda-calculator.ts +0 -384
- package/src/domains/quality-assessment/coherence/partition-detector.ts +0 -469
- package/src/domains/quality-assessment/coherence/types.ts +0 -384
- package/src/domains/quality-assessment/coordinator.ts +0 -605
- package/src/domains/quality-assessment/index.ts +0 -97
- package/src/domains/quality-assessment/interfaces.ts +0 -152
- package/src/domains/quality-assessment/plugin.ts +0 -496
- package/src/domains/quality-assessment/services/coherence-gate.ts +0 -358
- package/src/domains/quality-assessment/services/deployment-advisor.ts +0 -571
- package/src/domains/quality-assessment/services/index.ts +0 -34
- package/src/domains/quality-assessment/services/quality-analyzer.ts +0 -670
- package/src/domains/quality-assessment/services/quality-gate.ts +0 -384
- package/src/domains/requirements-validation/coordinator.ts +0 -812
- package/src/domains/requirements-validation/index.ts +0 -92
- package/src/domains/requirements-validation/interfaces.ts +0 -303
- package/src/domains/requirements-validation/plugin.ts +0 -576
- package/src/domains/requirements-validation/services/bdd-scenario-writer.ts +0 -676
- package/src/domains/requirements-validation/services/index.ts +0 -20
- package/src/domains/requirements-validation/services/requirements-validator.ts +0 -559
- package/src/domains/requirements-validation/services/testability-scorer.ts +0 -639
- package/src/domains/security-compliance/coordinator.ts +0 -757
- package/src/domains/security-compliance/index.ts +0 -120
- package/src/domains/security-compliance/interfaces.ts +0 -434
- package/src/domains/security-compliance/plugin.ts +0 -509
- package/src/domains/security-compliance/services/compliance-validator.ts +0 -1226
- package/src/domains/security-compliance/services/index.ts +0 -31
- package/src/domains/security-compliance/services/security-auditor.ts +0 -2227
- package/src/domains/security-compliance/services/security-scanner.ts +0 -2354
- package/src/domains/security-compliance/services/semgrep-integration.ts +0 -289
- package/src/domains/test-execution/coordinator.ts +0 -426
- package/src/domains/test-execution/index.ts +0 -76
- package/src/domains/test-execution/interfaces.ts +0 -119
- package/src/domains/test-execution/plugin.ts +0 -208
- package/src/domains/test-execution/services/flaky-detector.ts +0 -1240
- package/src/domains/test-execution/services/index.ts +0 -8
- package/src/domains/test-execution/services/retry-handler.ts +0 -820
- package/src/domains/test-execution/services/test-executor.ts +0 -885
- package/src/domains/test-generation/coordinator.ts +0 -656
- package/src/domains/test-generation/index.ts +0 -77
- package/src/domains/test-generation/interfaces.ts +0 -118
- package/src/domains/test-generation/plugin.ts +0 -397
- package/src/domains/test-generation/services/index.ts +0 -23
- package/src/domains/test-generation/services/pattern-matcher.ts +0 -1725
- package/src/domains/test-generation/services/test-generator.ts +0 -2750
- package/src/domains/visual-accessibility/coordinator.ts +0 -860
- package/src/domains/visual-accessibility/index.ts +0 -116
- package/src/domains/visual-accessibility/interfaces.ts +0 -435
- package/src/domains/visual-accessibility/plugin.ts +0 -568
- package/src/domains/visual-accessibility/services/accessibility-tester.ts +0 -982
- package/src/domains/visual-accessibility/services/axe-core-audit.ts +0 -630
- package/src/domains/visual-accessibility/services/index.ts +0 -28
- package/src/domains/visual-accessibility/services/responsive-tester.ts +0 -934
- package/src/domains/visual-accessibility/services/visual-tester.ts +0 -458
- package/src/early-exit/early-exit-controller.ts +0 -490
- package/src/early-exit/early-exit-decision.ts +0 -391
- package/src/early-exit/index.ts +0 -115
- package/src/early-exit/quality-signal.ts +0 -389
- package/src/early-exit/speculative-executor.ts +0 -505
- package/src/early-exit/types.ts +0 -407
- package/src/feedback/coverage-learner.ts +0 -456
- package/src/feedback/feedback-loop.ts +0 -426
- package/src/feedback/index.ts +0 -72
- package/src/feedback/pattern-promotion.ts +0 -373
- package/src/feedback/quality-score-calculator.ts +0 -334
- package/src/feedback/test-outcome-tracker.ts +0 -450
- package/src/feedback/types.ts +0 -497
- package/src/index.ts +0 -224
- package/src/init/agents-installer.ts +0 -536
- package/src/init/index.ts +0 -80
- package/src/init/init-wizard.ts +0 -1061
- package/src/init/project-analyzer.ts +0 -696
- package/src/init/self-configurator.ts +0 -488
- package/src/init/skills-installer.ts +0 -467
- package/src/init/types.ts +0 -432
- package/src/integrations/ruvector/ast-complexity.ts +0 -470
- package/src/integrations/ruvector/coverage-router.ts +0 -594
- package/src/integrations/ruvector/diff-risk-classifier.ts +0 -759
- package/src/integrations/ruvector/fallback.ts +0 -942
- package/src/integrations/ruvector/graph-boundaries.ts +0 -809
- package/src/integrations/ruvector/index.ts +0 -363
- package/src/integrations/ruvector/interfaces.ts +0 -609
- package/src/integrations/ruvector/q-learning-router.ts +0 -550
- package/src/kernel/agent-coordinator.ts +0 -165
- package/src/kernel/agentdb-backend.ts +0 -504
- package/src/kernel/event-bus.ts +0 -129
- package/src/kernel/hybrid-backend.ts +0 -538
- package/src/kernel/index.ts +0 -28
- package/src/kernel/interfaces.ts +0 -257
- package/src/kernel/kernel.ts +0 -285
- package/src/kernel/memory-backend.ts +0 -169
- package/src/kernel/memory-factory.ts +0 -293
- package/src/kernel/plugin-loader.ts +0 -179
- package/src/learning/index.ts +0 -219
- package/src/learning/pattern-store.ts +0 -990
- package/src/learning/qe-guidance.ts +0 -832
- package/src/learning/qe-hooks.ts +0 -644
- package/src/learning/qe-patterns.ts +0 -449
- package/src/learning/qe-reasoning-bank.ts +0 -951
- package/src/learning/real-embeddings.ts +0 -277
- package/src/learning/real-qe-reasoning-bank.ts +0 -833
- package/src/learning/sqlite-persistence.ts +0 -554
- package/src/mcp/entry.ts +0 -59
- package/src/mcp/handlers/agent-handlers.ts +0 -285
- package/src/mcp/handlers/core-handlers.ts +0 -317
- package/src/mcp/handlers/domain-handlers.ts +0 -1444
- package/src/mcp/handlers/index.ts +0 -57
- package/src/mcp/handlers/memory-handlers.ts +0 -338
- package/src/mcp/handlers/task-handlers.ts +0 -363
- package/src/mcp/index.ts +0 -30
- package/src/mcp/metrics/index.ts +0 -14
- package/src/mcp/metrics/metrics-collector.ts +0 -503
- package/src/mcp/protocol-server.ts +0 -752
- package/src/mcp/security/cve-prevention.ts +0 -742
- package/src/mcp/security/index.ts +0 -356
- package/src/mcp/security/oauth21-provider.ts +0 -821
- package/src/mcp/security/rate-limiter.ts +0 -615
- package/src/mcp/security/sampling-server.ts +0 -662
- package/src/mcp/security/schema-validator.ts +0 -855
- package/src/mcp/server.ts +0 -657
- package/src/mcp/tool-registry.ts +0 -391
- package/src/mcp/tools/base.ts +0 -399
- package/src/mcp/tools/chaos-resilience/inject.ts +0 -699
- package/src/mcp/tools/code-intelligence/analyze.ts +0 -745
- package/src/mcp/tools/contract-testing/validate.ts +0 -708
- package/src/mcp/tools/coverage-analysis/index.ts +0 -770
- package/src/mcp/tools/defect-intelligence/predict.ts +0 -466
- package/src/mcp/tools/index.ts +0 -214
- package/src/mcp/tools/learning-optimization/optimize.ts +0 -772
- package/src/mcp/tools/quality-assessment/evaluate.ts +0 -385
- package/src/mcp/tools/registry.ts +0 -248
- package/src/mcp/tools/requirements-validation/validate.ts +0 -394
- package/src/mcp/tools/security-compliance/scan.ts +0 -365
- package/src/mcp/tools/test-execution/execute.ts +0 -291
- package/src/mcp/tools/test-generation/generate.ts +0 -544
- package/src/mcp/tools/visual-accessibility/index.ts +0 -791
- package/src/mcp/transport/index.ts +0 -31
- package/src/mcp/transport/stdio.ts +0 -318
- package/src/mcp/types.ts +0 -543
- package/src/neural-optimizer/index.ts +0 -111
- package/src/neural-optimizer/replay-buffer.ts +0 -455
- package/src/neural-optimizer/swarm-topology.ts +0 -508
- package/src/neural-optimizer/topology-optimizer.ts +0 -828
- package/src/neural-optimizer/types.ts +0 -481
- package/src/neural-optimizer/value-network.ts +0 -351
- package/src/optimization/auto-tuner.ts +0 -817
- package/src/optimization/index.ts +0 -77
- package/src/optimization/metric-collectors.ts +0 -474
- package/src/optimization/qe-workers.ts +0 -704
- package/src/optimization/tuning-algorithm.ts +0 -401
- package/src/optimization/types.ts +0 -314
- package/src/routing/index.ts +0 -51
- package/src/routing/qe-agent-registry.ts +0 -963
- package/src/routing/qe-task-router.ts +0 -564
- package/src/routing/routing-feedback.ts +0 -365
- package/src/routing/types.ts +0 -406
- package/src/shared/embeddings/embedding-cache.ts +0 -157
- package/src/shared/embeddings/index.ts +0 -50
- package/src/shared/embeddings/nomic-embedder.ts +0 -404
- package/src/shared/embeddings/ollama-client.ts +0 -195
- package/src/shared/embeddings/types.ts +0 -147
- package/src/shared/entities/agent.ts +0 -141
- package/src/shared/entities/base-entity.ts +0 -79
- package/src/shared/entities/index.ts +0 -6
- package/src/shared/events/domain-events.ts +0 -259
- package/src/shared/events/index.ts +0 -5
- package/src/shared/git/git-analyzer.ts +0 -656
- package/src/shared/git/index.ts +0 -11
- package/src/shared/http/http-client.ts +0 -420
- package/src/shared/http/index.ts +0 -13
- package/src/shared/index.ts +0 -41
- package/src/shared/io/file-reader.ts +0 -525
- package/src/shared/io/index.ts +0 -25
- package/src/shared/llm/cache.ts +0 -473
- package/src/shared/llm/circuit-breaker.ts +0 -369
- package/src/shared/llm/cost-tracker.ts +0 -460
- package/src/shared/llm/index.ts +0 -140
- package/src/shared/llm/interfaces.ts +0 -629
- package/src/shared/llm/provider-manager.ts +0 -685
- package/src/shared/llm/providers/claude.ts +0 -524
- package/src/shared/llm/providers/index.ts +0 -8
- package/src/shared/llm/providers/ollama.ts +0 -575
- package/src/shared/llm/providers/openai.ts +0 -609
- package/src/shared/metrics/code-metrics.ts +0 -520
- package/src/shared/metrics/index.ts +0 -23
- package/src/shared/metrics/system-metrics.ts +0 -353
- package/src/shared/parsers/index.ts +0 -6
- package/src/shared/parsers/typescript-parser.ts +0 -841
- package/src/shared/security/compliance-patterns.ts +0 -666
- package/src/shared/security/index.ts +0 -30
- package/src/shared/security/osv-client.ts +0 -468
- package/src/shared/types/index.ts +0 -150
- package/src/shared/value-objects/index.ts +0 -273
- package/src/strange-loop/healing-controller.ts +0 -833
- package/src/strange-loop/index.ts +0 -104
- package/src/strange-loop/self-model.ts +0 -494
- package/src/strange-loop/strange-loop.ts +0 -446
- package/src/strange-loop/swarm-observer.ts +0 -448
- package/src/strange-loop/topology-analyzer.ts +0 -565
- package/src/strange-loop/types.ts +0 -640
- package/src/time-crystal/default-phases.ts +0 -520
- package/src/time-crystal/index.ts +0 -164
- package/src/time-crystal/oscillator.ts +0 -425
- package/src/time-crystal/phase-executor.ts +0 -521
- package/src/time-crystal/scheduler.ts +0 -1025
- package/src/time-crystal/test-runner.ts +0 -787
- package/src/time-crystal/types.ts +0 -421
- package/src/workers/base-worker.ts +0 -304
- package/src/workers/daemon.ts +0 -264
- package/src/workers/index.ts +0 -119
- package/src/workers/interfaces.ts +0 -393
- package/src/workers/worker-manager.ts +0 -424
- package/src/workers/workers/compliance-checker.ts +0 -445
- package/src/workers/workers/coverage-tracker.ts +0 -344
- package/src/workers/workers/defect-predictor.ts +0 -375
- package/src/workers/workers/flaky-detector.ts +0 -390
- package/src/workers/workers/index.ts +0 -17
- package/src/workers/workers/learning-consolidation.ts +0 -442
- package/src/workers/workers/performance-baseline.ts +0 -434
- package/src/workers/workers/quality-gate.ts +0 -419
- package/src/workers/workers/regression-monitor.ts +0 -357
- package/src/workers/workers/security-scan.ts +0 -349
- package/src/workers/workers/test-health.ts +0 -359
- package/tests/integration/code-intelligence/knowledge-graph-real.test.ts +0 -540
- package/tests/integration/coordination/cross-domain-router.test.ts +0 -403
- package/tests/integration/coordination/protocol-executor.test.ts +0 -454
- package/tests/integration/coordination/workflow-orchestrator.test.ts +0 -418
- package/tests/integration/feedback/feedback-loop-integration.test.ts +0 -560
- package/tests/integration/migration/v2-to-v3-migration.test.ts +0 -471
- package/tests/integration/parsers/typescript-parser.test.ts +0 -463
- package/tests/integration/security/vulnerability-detection.test.ts +0 -628
- package/tests/integration/test-execution/coordinator.test.ts +0 -410
- package/tests/integration/test-generation/coordinator.test.ts +0 -361
- package/tests/mocks/index.ts +0 -228
- package/tests/time-crystal/default-phases.test.ts +0 -476
- package/tests/time-crystal/oscillator.test.ts +0 -541
- package/tests/time-crystal/phase-executor.test.ts +0 -653
- package/tests/time-crystal/scheduler.test.ts +0 -626
- package/tests/time-crystal/test-runner.test.ts +0 -594
- package/tests/unit/causal-discovery/causal-graph.test.ts +0 -504
- package/tests/unit/causal-discovery/causal-root-cause-analyzer.test.ts +0 -347
- package/tests/unit/causal-discovery/discovery-engine.test.ts +0 -435
- package/tests/unit/causal-discovery/weight-matrix.test.ts +0 -328
- package/tests/unit/cli/cli.test.ts +0 -341
- package/tests/unit/cli/commands.test.ts +0 -414
- package/tests/unit/cli/init-command.test.ts +0 -274
- package/tests/unit/cli/migrate-command.test.ts +0 -396
- package/tests/unit/coordination/claims/claim-service.test.ts +0 -949
- package/tests/unit/coordination/claims/handoff-manager.test.ts +0 -773
- package/tests/unit/coordination/claims/work-stealing.test.ts +0 -492
- package/tests/unit/coordination/queen-coordinator.test.ts +0 -966
- package/tests/unit/coordination/result-saver.test.ts +0 -653
- package/tests/unit/coordination/task-executor.test.ts +0 -810
- package/tests/unit/domains/chaos-resilience/chaos-engineer.test.ts +0 -484
- package/tests/unit/domains/chaos-resilience/load-tester.test.ts +0 -559
- package/tests/unit/domains/chaos-resilience/performance-profiler.test.ts +0 -490
- package/tests/unit/domains/code-intelligence/impact-analyzer.test.ts +0 -560
- package/tests/unit/domains/code-intelligence/knowledge-graph.test.ts +0 -460
- package/tests/unit/domains/code-intelligence/semantic-analyzer.test.ts +0 -584
- package/tests/unit/domains/contract-testing/api-compatibility.test.ts +0 -483
- package/tests/unit/domains/contract-testing/contract-validator.test.ts +0 -370
- package/tests/unit/domains/contract-testing/schema-validator.test.ts +0 -610
- package/tests/unit/domains/coverage-analysis/coverage-embedder.test.ts +0 -298
- package/tests/unit/domains/coverage-analysis/hnsw-index.test.ts +0 -292
- package/tests/unit/domains/coverage-analysis/sublinear-analyzer.test.ts +0 -506
- package/tests/unit/domains/defect-intelligence/defect-predictor.test.ts +0 -370
- package/tests/unit/domains/defect-intelligence/pattern-learner.test.ts +0 -546
- package/tests/unit/domains/defect-intelligence/root-cause-analyzer.test.ts +0 -534
- package/tests/unit/domains/learning-optimization/learning-coordinator.test.ts +0 -541
- package/tests/unit/domains/learning-optimization/metrics-optimizer.test.ts +0 -552
- package/tests/unit/domains/learning-optimization/production-intel.test.ts +0 -589
- package/tests/unit/domains/learning-optimization/transfer-specialist.test.ts +0 -453
- package/tests/unit/domains/quality-assessment/coherence-gate.test.ts +0 -1006
- package/tests/unit/domains/quality-assessment/deployment-advisor.test.ts +0 -515
- package/tests/unit/domains/quality-assessment/quality-analyzer.test.ts +0 -401
- package/tests/unit/domains/quality-assessment/quality-gate.test.ts +0 -324
- package/tests/unit/domains/requirements-validation/bdd-scenario-writer.test.ts +0 -479
- package/tests/unit/domains/requirements-validation/requirements-validator.test.ts +0 -452
- package/tests/unit/domains/requirements-validation/testability-scorer.test.ts +0 -505
- package/tests/unit/domains/security-compliance/compliance-validator.test.ts +0 -500
- package/tests/unit/domains/security-compliance/security-auditor.test.ts +0 -498
- package/tests/unit/domains/security-compliance/security-scanner.test.ts +0 -412
- package/tests/unit/domains/visual-accessibility/accessibility-tester.test.ts +0 -432
- package/tests/unit/domains/visual-accessibility/responsive-tester.test.ts +0 -506
- package/tests/unit/domains/visual-accessibility/visual-tester.test.ts +0 -412
- package/tests/unit/early-exit/early-exit-controller.test.ts +0 -548
- package/tests/unit/early-exit/early-exit-decision.test.ts +0 -617
- package/tests/unit/early-exit/index.test.ts +0 -254
- package/tests/unit/early-exit/quality-signal.test.ts +0 -589
- package/tests/unit/early-exit/speculative-executor.test.ts +0 -453
- package/tests/unit/feedback/coverage-learner.test.ts +0 -288
- package/tests/unit/feedback/feedback-loop.test.ts +0 -458
- package/tests/unit/feedback/pattern-promotion.test.ts +0 -390
- package/tests/unit/feedback/quality-score-calculator.test.ts +0 -364
- package/tests/unit/feedback/test-outcome-tracker.test.ts +0 -243
- package/tests/unit/init/init-wizard.test.ts +0 -881
- package/tests/unit/init/project-analyzer.test.ts +0 -807
- package/tests/unit/init/self-configurator.test.ts +0 -493
- package/tests/unit/integrations/ruvector/ast-complexity.test.ts +0 -240
- package/tests/unit/integrations/ruvector/coverage-router.test.ts +0 -366
- package/tests/unit/integrations/ruvector/diff-risk-classifier.test.ts +0 -340
- package/tests/unit/integrations/ruvector/graph-boundaries.test.ts +0 -355
- package/tests/unit/integrations/ruvector/q-learning-router.test.ts +0 -314
- package/tests/unit/kernel/agent-coordinator.test.ts +0 -220
- package/tests/unit/kernel/event-bus.test.ts +0 -197
- package/tests/unit/learning/qe-reasoning-bank.test.ts +0 -666
- package/tests/unit/learning/real-qe-reasoning-bank.benchmark.test.ts +0 -415
- package/tests/unit/mcp/mcp-server.test.ts +0 -544
- package/tests/unit/mcp/metrics/metrics-collector.test.ts +0 -340
- package/tests/unit/mcp/security/cve-prevention.test.ts +0 -512
- package/tests/unit/mcp/security/oauth21-provider.test.ts +0 -624
- package/tests/unit/mcp/security/rate-limiter.test.ts +0 -410
- package/tests/unit/mcp/security/sampling-server.test.ts +0 -420
- package/tests/unit/mcp/security/schema-validator.test.ts +0 -494
- package/tests/unit/mcp/tools/base.test.ts +0 -336
- package/tests/unit/mcp/tools/domain-tools.test.ts +0 -759
- package/tests/unit/mcp/tools/registry.test.ts +0 -240
- package/tests/unit/neural-optimizer/replay-buffer.test.ts +0 -403
- package/tests/unit/neural-optimizer/swarm-topology.test.ts +0 -473
- package/tests/unit/neural-optimizer/topology-optimizer.test.ts +0 -595
- package/tests/unit/neural-optimizer/value-network.test.ts +0 -343
- package/tests/unit/optimization/auto-tuner.test.ts +0 -506
- package/tests/unit/optimization/metric-collectors.test.ts +0 -352
- package/tests/unit/optimization/qe-workers.test.ts +0 -407
- package/tests/unit/optimization/tuning-algorithm.test.ts +0 -467
- package/tests/unit/routing/qe-agent-registry.test.ts +0 -229
- package/tests/unit/routing/qe-task-router.test.ts +0 -390
- package/tests/unit/routing/routing-feedback.test.ts +0 -339
- package/tests/unit/shared/embeddings/nomic-embedder.test.ts +0 -419
- package/tests/unit/shared/http/http-client.test.ts +0 -719
- package/tests/unit/shared/io/file-reader.test.ts +0 -511
- package/tests/unit/shared/llm/cache.test.ts +0 -391
- package/tests/unit/shared/llm/circuit-breaker.test.ts +0 -293
- package/tests/unit/shared/llm/cost-tracker.test.ts +0 -431
- package/tests/unit/shared/llm/provider-manager.test.ts +0 -550
- package/tests/unit/shared/llm/providers.test.ts +0 -532
- package/tests/unit/shared/parsers/typescript-parser.test.ts +0 -693
- package/tests/unit/shared/value-objects.test.ts +0 -184
- package/tests/unit/strange-loop/strange-loop.test.ts +0 -1170
- package/tests/unit/workers/base-worker.test.ts +0 -341
- package/tests/unit/workers/daemon.test.ts +0 -291
- package/tests/unit/workers/worker-manager.test.ts +0 -284
- package/tsconfig.json +0 -32
- package/vitest.config.ts +0 -27
|
@@ -1,1032 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agentic QE v3 - Chaos & Resilience Coordinator
|
|
3
|
-
* Orchestrates chaos engineering and resilience testing workflows
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
-
import { Result, ok, err, DomainEvent } from '../../shared/types';
|
|
8
|
-
import {
|
|
9
|
-
EventBus,
|
|
10
|
-
MemoryBackend,
|
|
11
|
-
AgentCoordinator,
|
|
12
|
-
AgentSpawnConfig,
|
|
13
|
-
} from '../../kernel/interfaces';
|
|
14
|
-
import {
|
|
15
|
-
ChaosExperiment,
|
|
16
|
-
ExperimentResult,
|
|
17
|
-
LoadTestResult,
|
|
18
|
-
FaultType,
|
|
19
|
-
ChaosSuiteReport,
|
|
20
|
-
LoadTestSuiteReport,
|
|
21
|
-
ResilienceAssessment,
|
|
22
|
-
ResilienceWeakness,
|
|
23
|
-
ResilienceRecommendation,
|
|
24
|
-
ResilienceDashboard,
|
|
25
|
-
ServiceArchitecture,
|
|
26
|
-
ServiceDefinition,
|
|
27
|
-
ServiceDependency,
|
|
28
|
-
PerformanceBottleneck,
|
|
29
|
-
IChaosResilienceCoordinator,
|
|
30
|
-
} from './interfaces';
|
|
31
|
-
import { ChaosEngineerService } from './services/chaos-engineer';
|
|
32
|
-
import { LoadTesterService } from './services/load-tester';
|
|
33
|
-
import { PerformanceProfilerService } from './services/performance-profiler';
|
|
34
|
-
import { RiskScore } from '../../shared/value-objects';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Interface for the chaos resilience coordinator
|
|
38
|
-
*/
|
|
39
|
-
export interface IChaosResilienceCoordinatorExtended extends IChaosResilienceCoordinator {
|
|
40
|
-
initialize(): Promise<void>;
|
|
41
|
-
dispose(): Promise<void>;
|
|
42
|
-
getActiveWorkflows(): WorkflowStatus[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Workflow status tracking
|
|
47
|
-
*/
|
|
48
|
-
export interface WorkflowStatus {
|
|
49
|
-
id: string;
|
|
50
|
-
type: 'chaos-suite' | 'load-suite' | 'assessment' | 'experiment-generation';
|
|
51
|
-
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
52
|
-
startedAt: Date;
|
|
53
|
-
completedAt?: Date;
|
|
54
|
-
agentIds: string[];
|
|
55
|
-
progress: number;
|
|
56
|
-
error?: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Coordinator configuration
|
|
61
|
-
*/
|
|
62
|
-
export interface CoordinatorConfig {
|
|
63
|
-
maxConcurrentWorkflows: number;
|
|
64
|
-
defaultTimeout: number;
|
|
65
|
-
enableAutomatedExperiments: boolean;
|
|
66
|
-
publishEvents: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const DEFAULT_CONFIG: CoordinatorConfig = {
|
|
70
|
-
maxConcurrentWorkflows: 3,
|
|
71
|
-
defaultTimeout: 300000, // 5 minutes
|
|
72
|
-
enableAutomatedExperiments: false,
|
|
73
|
-
publishEvents: true,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Chaos Resilience Coordinator
|
|
78
|
-
* Orchestrates chaos engineering workflows and coordinates with agents
|
|
79
|
-
*/
|
|
80
|
-
export class ChaosResilienceCoordinator implements IChaosResilienceCoordinatorExtended {
|
|
81
|
-
private readonly config: CoordinatorConfig;
|
|
82
|
-
private readonly chaosEngineer: ChaosEngineerService;
|
|
83
|
-
private readonly loadTester: LoadTesterService;
|
|
84
|
-
private readonly performanceProfiler: PerformanceProfilerService;
|
|
85
|
-
private readonly workflows: Map<string, WorkflowStatus> = new Map();
|
|
86
|
-
private initialized = false;
|
|
87
|
-
|
|
88
|
-
constructor(
|
|
89
|
-
private readonly eventBus: EventBus,
|
|
90
|
-
private readonly memory: MemoryBackend,
|
|
91
|
-
private readonly agentCoordinator: AgentCoordinator,
|
|
92
|
-
config: Partial<CoordinatorConfig> = {}
|
|
93
|
-
) {
|
|
94
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
95
|
-
this.chaosEngineer = new ChaosEngineerService(memory);
|
|
96
|
-
this.loadTester = new LoadTesterService(memory);
|
|
97
|
-
this.performanceProfiler = new PerformanceProfilerService(memory);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Initialize the coordinator
|
|
102
|
-
*/
|
|
103
|
-
async initialize(): Promise<void> {
|
|
104
|
-
if (this.initialized) return;
|
|
105
|
-
|
|
106
|
-
// Subscribe to relevant events
|
|
107
|
-
this.subscribeToEvents();
|
|
108
|
-
|
|
109
|
-
// Load any persisted workflow state
|
|
110
|
-
await this.loadWorkflowState();
|
|
111
|
-
|
|
112
|
-
this.initialized = true;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Dispose and cleanup
|
|
117
|
-
*/
|
|
118
|
-
async dispose(): Promise<void> {
|
|
119
|
-
await this.saveWorkflowState();
|
|
120
|
-
this.workflows.clear();
|
|
121
|
-
this.initialized = false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Get active workflow statuses
|
|
126
|
-
*/
|
|
127
|
-
getActiveWorkflows(): WorkflowStatus[] {
|
|
128
|
-
return Array.from(this.workflows.values()).filter(
|
|
129
|
-
(w) => w.status === 'running' || w.status === 'pending'
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// ============================================================================
|
|
134
|
-
// IChaosResilienceCoordinator Implementation
|
|
135
|
-
// ============================================================================
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Run a suite of chaos experiments
|
|
139
|
-
*/
|
|
140
|
-
async runChaosSuite(experimentIds: string[]): Promise<Result<ChaosSuiteReport>> {
|
|
141
|
-
const workflowId = uuidv4();
|
|
142
|
-
|
|
143
|
-
try {
|
|
144
|
-
this.startWorkflow(workflowId, 'chaos-suite');
|
|
145
|
-
|
|
146
|
-
if (!this.agentCoordinator.canSpawn()) {
|
|
147
|
-
return err(new Error('Agent limit reached, cannot spawn chaos agents'));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Spawn chaos coordinator agent
|
|
151
|
-
const agentResult = await this.spawnChaosAgent(workflowId, 'coordinator');
|
|
152
|
-
if (!agentResult.success) {
|
|
153
|
-
this.failWorkflow(workflowId, agentResult.error.message);
|
|
154
|
-
return err(agentResult.error);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
this.addAgentToWorkflow(workflowId, agentResult.value);
|
|
158
|
-
|
|
159
|
-
const results: ExperimentResult[] = [];
|
|
160
|
-
const recommendations: ResilienceRecommendation[] = [];
|
|
161
|
-
let passed = 0;
|
|
162
|
-
let failed = 0;
|
|
163
|
-
|
|
164
|
-
// Run each experiment
|
|
165
|
-
for (let i = 0; i < experimentIds.length; i++) {
|
|
166
|
-
const experimentId = experimentIds[i];
|
|
167
|
-
this.updateWorkflowProgress(
|
|
168
|
-
workflowId,
|
|
169
|
-
Math.round(((i + 1) / experimentIds.length) * 100)
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
const result = await this.chaosEngineer.runExperiment(experimentId);
|
|
173
|
-
|
|
174
|
-
if (result.success) {
|
|
175
|
-
results.push(result.value);
|
|
176
|
-
|
|
177
|
-
if (result.value.hypothesisValidated) {
|
|
178
|
-
passed++;
|
|
179
|
-
} else {
|
|
180
|
-
failed++;
|
|
181
|
-
// Generate recommendations for failed experiments
|
|
182
|
-
const recs = this.generateRecommendationsFromExperiment(result.value);
|
|
183
|
-
recommendations.push(...recs);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Publish event
|
|
187
|
-
if (this.config.publishEvents) {
|
|
188
|
-
await this.publishExperimentCompleted(result.value);
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
failed++;
|
|
192
|
-
recommendations.push({
|
|
193
|
-
priority: 'high',
|
|
194
|
-
category: 'experiment-failure',
|
|
195
|
-
recommendation: `Failed to run experiment ${experimentId}: ${result.error.message}`,
|
|
196
|
-
effort: 'moderate',
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Stop agent
|
|
202
|
-
await this.agentCoordinator.stop(agentResult.value);
|
|
203
|
-
this.completeWorkflow(workflowId);
|
|
204
|
-
|
|
205
|
-
const report: ChaosSuiteReport = {
|
|
206
|
-
totalExperiments: experimentIds.length,
|
|
207
|
-
passed,
|
|
208
|
-
failed,
|
|
209
|
-
results,
|
|
210
|
-
recommendations,
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
// Store report
|
|
214
|
-
await this.storeReport('chaos-suite', workflowId, report);
|
|
215
|
-
|
|
216
|
-
return ok(report);
|
|
217
|
-
} catch (error) {
|
|
218
|
-
this.failWorkflow(workflowId, String(error));
|
|
219
|
-
return err(error instanceof Error ? error : new Error(String(error)));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Run a suite of load tests
|
|
225
|
-
*/
|
|
226
|
-
async runLoadTestSuite(testIds: string[]): Promise<Result<LoadTestSuiteReport>> {
|
|
227
|
-
const workflowId = uuidv4();
|
|
228
|
-
|
|
229
|
-
try {
|
|
230
|
-
this.startWorkflow(workflowId, 'load-suite');
|
|
231
|
-
|
|
232
|
-
// Spawn load test agent
|
|
233
|
-
const agentResult = await this.spawnLoadTestAgent(workflowId, 'orchestrator');
|
|
234
|
-
if (!agentResult.success) {
|
|
235
|
-
this.failWorkflow(workflowId, agentResult.error.message);
|
|
236
|
-
return err(agentResult.error);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
this.addAgentToWorkflow(workflowId, agentResult.value);
|
|
240
|
-
|
|
241
|
-
const results: LoadTestResult[] = [];
|
|
242
|
-
const bottlenecks: PerformanceBottleneck[] = [];
|
|
243
|
-
let passed = 0;
|
|
244
|
-
let failed = 0;
|
|
245
|
-
|
|
246
|
-
// Run each load test
|
|
247
|
-
for (let i = 0; i < testIds.length; i++) {
|
|
248
|
-
const testId = testIds[i];
|
|
249
|
-
this.updateWorkflowProgress(
|
|
250
|
-
workflowId,
|
|
251
|
-
Math.round(((i + 1) / testIds.length) * 100)
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
const result = await this.loadTester.runTest(testId);
|
|
255
|
-
|
|
256
|
-
if (result.success) {
|
|
257
|
-
results.push(result.value);
|
|
258
|
-
|
|
259
|
-
if (result.value.status === 'completed') {
|
|
260
|
-
passed++;
|
|
261
|
-
} else {
|
|
262
|
-
failed++;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Detect bottlenecks from test results
|
|
266
|
-
const detectedBottlenecks = this.detectBottlenecks(result.value);
|
|
267
|
-
bottlenecks.push(...detectedBottlenecks);
|
|
268
|
-
|
|
269
|
-
// Publish event
|
|
270
|
-
if (this.config.publishEvents) {
|
|
271
|
-
await this.publishLoadTestCompleted(result.value);
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
failed++;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// Stop agent
|
|
279
|
-
await this.agentCoordinator.stop(agentResult.value);
|
|
280
|
-
this.completeWorkflow(workflowId);
|
|
281
|
-
|
|
282
|
-
const report: LoadTestSuiteReport = {
|
|
283
|
-
totalTests: testIds.length,
|
|
284
|
-
passed,
|
|
285
|
-
failed,
|
|
286
|
-
results,
|
|
287
|
-
bottlenecks,
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
await this.storeReport('load-suite', workflowId, report);
|
|
291
|
-
|
|
292
|
-
return ok(report);
|
|
293
|
-
} catch (error) {
|
|
294
|
-
this.failWorkflow(workflowId, String(error));
|
|
295
|
-
return err(error instanceof Error ? error : new Error(String(error)));
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Perform a full resilience assessment
|
|
301
|
-
*/
|
|
302
|
-
async assessResilience(services: string[]): Promise<Result<ResilienceAssessment>> {
|
|
303
|
-
const workflowId = uuidv4();
|
|
304
|
-
|
|
305
|
-
try {
|
|
306
|
-
this.startWorkflow(workflowId, 'assessment');
|
|
307
|
-
|
|
308
|
-
const serviceScores = new Map<string, number>();
|
|
309
|
-
const strengths: string[] = [];
|
|
310
|
-
const weaknesses: ResilienceWeakness[] = [];
|
|
311
|
-
const recommendations: ResilienceRecommendation[] = [];
|
|
312
|
-
|
|
313
|
-
// Spawn assessment agent
|
|
314
|
-
const agentResult = await this.spawnAssessmentAgent(workflowId);
|
|
315
|
-
if (!agentResult.success) {
|
|
316
|
-
this.failWorkflow(workflowId, agentResult.error.message);
|
|
317
|
-
return err(agentResult.error);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
this.addAgentToWorkflow(workflowId, agentResult.value);
|
|
321
|
-
|
|
322
|
-
// Assess each service
|
|
323
|
-
for (let i = 0; i < services.length; i++) {
|
|
324
|
-
const service = services[i];
|
|
325
|
-
this.updateWorkflowProgress(
|
|
326
|
-
workflowId,
|
|
327
|
-
Math.round(((i + 1) / services.length) * 100)
|
|
328
|
-
);
|
|
329
|
-
|
|
330
|
-
// Test recovery
|
|
331
|
-
const recoveryResult = await this.performanceProfiler.testRecovery(
|
|
332
|
-
service,
|
|
333
|
-
'latency',
|
|
334
|
-
5000 // 5 second expected recovery
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
// Test circuit breaker
|
|
338
|
-
const circuitResult = await this.performanceProfiler.testCircuitBreaker(service);
|
|
339
|
-
|
|
340
|
-
// Test rate limiting
|
|
341
|
-
const rateLimitResult = await this.performanceProfiler.testRateLimiting(service, 100);
|
|
342
|
-
|
|
343
|
-
// Calculate service score
|
|
344
|
-
let score = 0;
|
|
345
|
-
|
|
346
|
-
if (recoveryResult.success && recoveryResult.value.passed) {
|
|
347
|
-
score += 33.3;
|
|
348
|
-
strengths.push(`${service}: Fast recovery (${recoveryResult.value.recoveryTime}ms)`);
|
|
349
|
-
} else {
|
|
350
|
-
const recoveryTime = recoveryResult.success ? recoveryResult.value.recoveryTime : 'unknown';
|
|
351
|
-
weaknesses.push({
|
|
352
|
-
service,
|
|
353
|
-
type: 'recovery',
|
|
354
|
-
description: 'Slow or failed recovery after fault',
|
|
355
|
-
risk: RiskScore.create(0.7),
|
|
356
|
-
});
|
|
357
|
-
recommendations.push({
|
|
358
|
-
priority: 'high',
|
|
359
|
-
category: 'recovery',
|
|
360
|
-
recommendation: `Improve ${service} recovery time - currently ${recoveryTime}ms`,
|
|
361
|
-
effort: 'moderate',
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
if (circuitResult.success && circuitResult.value.passed) {
|
|
366
|
-
score += 33.3;
|
|
367
|
-
strengths.push(`${service}: Circuit breaker functioning correctly`);
|
|
368
|
-
} else {
|
|
369
|
-
weaknesses.push({
|
|
370
|
-
service,
|
|
371
|
-
type: 'circuit-breaker',
|
|
372
|
-
description: 'Circuit breaker not functioning as expected',
|
|
373
|
-
risk: RiskScore.create(0.6),
|
|
374
|
-
});
|
|
375
|
-
recommendations.push({
|
|
376
|
-
priority: 'medium',
|
|
377
|
-
category: 'circuit-breaker',
|
|
378
|
-
recommendation: `Review ${service} circuit breaker configuration`,
|
|
379
|
-
effort: 'minor',
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (rateLimitResult.success && rateLimitResult.value.passed) {
|
|
384
|
-
score += 33.4;
|
|
385
|
-
strengths.push(`${service}: Rate limiting effective`);
|
|
386
|
-
} else {
|
|
387
|
-
weaknesses.push({
|
|
388
|
-
service,
|
|
389
|
-
type: 'rate-limiting',
|
|
390
|
-
description: 'Rate limiting not properly configured',
|
|
391
|
-
risk: RiskScore.create(0.5),
|
|
392
|
-
});
|
|
393
|
-
recommendations.push({
|
|
394
|
-
priority: 'medium',
|
|
395
|
-
category: 'rate-limiting',
|
|
396
|
-
recommendation: `Configure rate limiting for ${service}`,
|
|
397
|
-
effort: 'minor',
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
serviceScores.set(service, score);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// Calculate overall score
|
|
405
|
-
const overallScore =
|
|
406
|
-
services.length > 0
|
|
407
|
-
? Array.from(serviceScores.values()).reduce((a, b) => a + b, 0) / services.length
|
|
408
|
-
: 0;
|
|
409
|
-
|
|
410
|
-
// Stop agent
|
|
411
|
-
await this.agentCoordinator.stop(agentResult.value);
|
|
412
|
-
this.completeWorkflow(workflowId);
|
|
413
|
-
|
|
414
|
-
const assessment: ResilienceAssessment = {
|
|
415
|
-
overallScore,
|
|
416
|
-
serviceScores,
|
|
417
|
-
strengths,
|
|
418
|
-
weaknesses,
|
|
419
|
-
recommendations,
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
await this.storeReport('assessment', workflowId, assessment);
|
|
423
|
-
|
|
424
|
-
return ok(assessment);
|
|
425
|
-
} catch (error) {
|
|
426
|
-
this.failWorkflow(workflowId, String(error));
|
|
427
|
-
return err(error instanceof Error ? error : new Error(String(error)));
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Generate chaos experiments from architecture
|
|
433
|
-
*/
|
|
434
|
-
async generateExperiments(
|
|
435
|
-
architecture: ServiceArchitecture
|
|
436
|
-
): Promise<Result<ChaosExperiment[]>> {
|
|
437
|
-
const workflowId = uuidv4();
|
|
438
|
-
|
|
439
|
-
try {
|
|
440
|
-
this.startWorkflow(workflowId, 'experiment-generation');
|
|
441
|
-
|
|
442
|
-
const experiments: ChaosExperiment[] = [];
|
|
443
|
-
|
|
444
|
-
// Generate experiments for each service
|
|
445
|
-
for (const service of architecture.services) {
|
|
446
|
-
const serviceExperiments = this.generateServiceExperiments(
|
|
447
|
-
service,
|
|
448
|
-
architecture.dependencies
|
|
449
|
-
);
|
|
450
|
-
experiments.push(...serviceExperiments);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// Generate experiments for critical paths
|
|
454
|
-
for (const criticalPath of architecture.criticalPaths) {
|
|
455
|
-
const pathExperiment = this.generateCriticalPathExperiment(
|
|
456
|
-
criticalPath,
|
|
457
|
-
architecture
|
|
458
|
-
);
|
|
459
|
-
experiments.push(pathExperiment);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// Store generated experiments
|
|
463
|
-
for (const experiment of experiments) {
|
|
464
|
-
await this.chaosEngineer.createExperiment(experiment);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
this.completeWorkflow(workflowId);
|
|
468
|
-
|
|
469
|
-
return ok(experiments);
|
|
470
|
-
} catch (error) {
|
|
471
|
-
this.failWorkflow(workflowId, String(error));
|
|
472
|
-
return err(error instanceof Error ? error : new Error(String(error)));
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Get resilience dashboard data
|
|
478
|
-
*/
|
|
479
|
-
async getResilienceDashboard(): Promise<Result<ResilienceDashboard>> {
|
|
480
|
-
try {
|
|
481
|
-
// Gather metrics from stored results
|
|
482
|
-
const experimentResults = await this.memory.search('chaos:results:*', 10);
|
|
483
|
-
const loadTestResults = await this.memory.search('loadtest:results:*', 10);
|
|
484
|
-
|
|
485
|
-
// Calculate metrics
|
|
486
|
-
let lastExperimentDate: Date | undefined;
|
|
487
|
-
let lastLoadTestDate: Date | undefined;
|
|
488
|
-
let activeIncidents = 0;
|
|
489
|
-
let totalRecoveryTime = 0;
|
|
490
|
-
let recoveryCount = 0;
|
|
491
|
-
let failedChanges = 0;
|
|
492
|
-
let totalChanges = 0;
|
|
493
|
-
|
|
494
|
-
// Process experiment results
|
|
495
|
-
for (const key of experimentResults) {
|
|
496
|
-
const result = await this.memory.get<ExperimentResult>(key);
|
|
497
|
-
if (result) {
|
|
498
|
-
if (!lastExperimentDate || result.startTime > lastExperimentDate) {
|
|
499
|
-
lastExperimentDate = result.startTime;
|
|
500
|
-
}
|
|
501
|
-
activeIncidents += result.incidents.filter((i) => !i.resolved).length;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// Process load test results
|
|
506
|
-
for (const key of loadTestResults) {
|
|
507
|
-
const result = await this.memory.get<LoadTestResult>(key);
|
|
508
|
-
if (result && result.timeline.length > 0) {
|
|
509
|
-
const testDate = result.timeline[0].timestamp;
|
|
510
|
-
if (!lastLoadTestDate || testDate > lastLoadTestDate) {
|
|
511
|
-
lastLoadTestDate = testDate;
|
|
512
|
-
}
|
|
513
|
-
totalChanges++;
|
|
514
|
-
if (result.status === 'failed') {
|
|
515
|
-
failedChanges++;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// Calculate derived metrics
|
|
521
|
-
const mttr = recoveryCount > 0 ? totalRecoveryTime / recoveryCount : 0;
|
|
522
|
-
const changeFailureRate =
|
|
523
|
-
totalChanges > 0 ? (failedChanges / totalChanges) * 100 : 0;
|
|
524
|
-
|
|
525
|
-
// Determine overall health
|
|
526
|
-
let overallHealth: 'healthy' | 'degraded' | 'unhealthy' = 'healthy';
|
|
527
|
-
if (activeIncidents > 5 || changeFailureRate > 25) {
|
|
528
|
-
overallHealth = 'unhealthy';
|
|
529
|
-
} else if (activeIncidents > 0 || changeFailureRate > 10) {
|
|
530
|
-
overallHealth = 'degraded';
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
const dashboard: ResilienceDashboard = {
|
|
534
|
-
overallHealth,
|
|
535
|
-
lastExperimentDate,
|
|
536
|
-
lastLoadTestDate,
|
|
537
|
-
activeIncidents,
|
|
538
|
-
uptime: 99.9, // Would be calculated from actual uptime data
|
|
539
|
-
mttr,
|
|
540
|
-
changeFailureRate,
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
return ok(dashboard);
|
|
544
|
-
} catch (error) {
|
|
545
|
-
return err(error instanceof Error ? error : new Error(String(error)));
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
// ============================================================================
|
|
550
|
-
// Agent Spawning Methods
|
|
551
|
-
// ============================================================================
|
|
552
|
-
|
|
553
|
-
private async spawnChaosAgent(
|
|
554
|
-
workflowId: string,
|
|
555
|
-
role: string
|
|
556
|
-
): Promise<Result<string, Error>> {
|
|
557
|
-
const config: AgentSpawnConfig = {
|
|
558
|
-
name: `chaos-${role}-${workflowId.slice(0, 8)}`,
|
|
559
|
-
domain: 'chaos-resilience',
|
|
560
|
-
type: 'specialist',
|
|
561
|
-
capabilities: ['chaos-engineering', 'fault-injection', role],
|
|
562
|
-
config: { workflowId },
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
return this.agentCoordinator.spawn(config);
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
private async spawnLoadTestAgent(
|
|
569
|
-
workflowId: string,
|
|
570
|
-
role: string
|
|
571
|
-
): Promise<Result<string, Error>> {
|
|
572
|
-
const config: AgentSpawnConfig = {
|
|
573
|
-
name: `loadtest-${role}-${workflowId.slice(0, 8)}`,
|
|
574
|
-
domain: 'chaos-resilience',
|
|
575
|
-
type: 'specialist',
|
|
576
|
-
capabilities: ['load-testing', 'performance', role],
|
|
577
|
-
config: { workflowId },
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
return this.agentCoordinator.spawn(config);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
private async spawnAssessmentAgent(workflowId: string): Promise<Result<string, Error>> {
|
|
584
|
-
const config: AgentSpawnConfig = {
|
|
585
|
-
name: `assessment-${workflowId.slice(0, 8)}`,
|
|
586
|
-
domain: 'chaos-resilience',
|
|
587
|
-
type: 'analyzer',
|
|
588
|
-
capabilities: ['resilience-assessment', 'analysis'],
|
|
589
|
-
config: { workflowId },
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
return this.agentCoordinator.spawn(config);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
// ============================================================================
|
|
596
|
-
// Event Publishing Methods
|
|
597
|
-
// ============================================================================
|
|
598
|
-
|
|
599
|
-
private async publishExperimentCompleted(result: ExperimentResult): Promise<void> {
|
|
600
|
-
const event: DomainEvent = {
|
|
601
|
-
id: uuidv4(),
|
|
602
|
-
type: 'chaos-resilience.ExperimentCompleted',
|
|
603
|
-
timestamp: new Date(),
|
|
604
|
-
source: 'chaos-resilience',
|
|
605
|
-
payload: {
|
|
606
|
-
experimentId: result.experimentId,
|
|
607
|
-
status: result.status,
|
|
608
|
-
hypothesisValidated: result.hypothesisValidated,
|
|
609
|
-
incidentCount: result.incidents.length,
|
|
610
|
-
},
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
await this.eventBus.publish(event);
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
private async publishLoadTestCompleted(result: LoadTestResult): Promise<void> {
|
|
617
|
-
const event: DomainEvent = {
|
|
618
|
-
id: uuidv4(),
|
|
619
|
-
type: 'chaos-resilience.LoadTestCompleted',
|
|
620
|
-
timestamp: new Date(),
|
|
621
|
-
source: 'chaos-resilience',
|
|
622
|
-
payload: {
|
|
623
|
-
testId: result.testId,
|
|
624
|
-
status: result.status,
|
|
625
|
-
summary: result.summary,
|
|
626
|
-
assertionsPassed: result.assertionResults.filter((a) => a.passed).length,
|
|
627
|
-
assertionsFailed: result.assertionResults.filter((a) => !a.passed).length,
|
|
628
|
-
},
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
await this.eventBus.publish(event);
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
// ============================================================================
|
|
635
|
-
// Workflow Management
|
|
636
|
-
// ============================================================================
|
|
637
|
-
|
|
638
|
-
private startWorkflow(id: string, type: WorkflowStatus['type']): void {
|
|
639
|
-
const activeWorkflows = this.getActiveWorkflows();
|
|
640
|
-
if (activeWorkflows.length >= this.config.maxConcurrentWorkflows) {
|
|
641
|
-
throw new Error(
|
|
642
|
-
`Maximum concurrent workflows (${this.config.maxConcurrentWorkflows}) reached`
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
this.workflows.set(id, {
|
|
647
|
-
id,
|
|
648
|
-
type,
|
|
649
|
-
status: 'running',
|
|
650
|
-
startedAt: new Date(),
|
|
651
|
-
agentIds: [],
|
|
652
|
-
progress: 0,
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
private completeWorkflow(id: string): void {
|
|
657
|
-
const workflow = this.workflows.get(id);
|
|
658
|
-
if (workflow) {
|
|
659
|
-
workflow.status = 'completed';
|
|
660
|
-
workflow.completedAt = new Date();
|
|
661
|
-
workflow.progress = 100;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
private failWorkflow(id: string, error: string): void {
|
|
666
|
-
const workflow = this.workflows.get(id);
|
|
667
|
-
if (workflow) {
|
|
668
|
-
workflow.status = 'failed';
|
|
669
|
-
workflow.completedAt = new Date();
|
|
670
|
-
workflow.error = error;
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
private addAgentToWorkflow(workflowId: string, agentId: string): void {
|
|
675
|
-
const workflow = this.workflows.get(workflowId);
|
|
676
|
-
if (workflow) {
|
|
677
|
-
workflow.agentIds.push(agentId);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
private updateWorkflowProgress(id: string, progress: number): void {
|
|
682
|
-
const workflow = this.workflows.get(id);
|
|
683
|
-
if (workflow) {
|
|
684
|
-
workflow.progress = Math.min(100, Math.max(0, progress));
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// ============================================================================
|
|
689
|
-
// Helper Methods
|
|
690
|
-
// ============================================================================
|
|
691
|
-
|
|
692
|
-
private generateRecommendationsFromExperiment(
|
|
693
|
-
result: ExperimentResult
|
|
694
|
-
): ResilienceRecommendation[] {
|
|
695
|
-
const recommendations: ResilienceRecommendation[] = [];
|
|
696
|
-
|
|
697
|
-
if (!result.hypothesisValidated) {
|
|
698
|
-
recommendations.push({
|
|
699
|
-
priority: 'high',
|
|
700
|
-
category: 'hypothesis-failure',
|
|
701
|
-
recommendation: `Experiment ${result.experimentId} hypothesis was not validated - review system behavior under fault conditions`,
|
|
702
|
-
effort: 'moderate',
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
if (!result.steadyStateVerified) {
|
|
707
|
-
recommendations.push({
|
|
708
|
-
priority: 'critical',
|
|
709
|
-
category: 'steady-state',
|
|
710
|
-
recommendation: 'System did not maintain steady state - investigate stability issues',
|
|
711
|
-
effort: 'major',
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
for (const incident of result.incidents) {
|
|
716
|
-
if (incident.severity === 'critical' || incident.severity === 'high') {
|
|
717
|
-
recommendations.push({
|
|
718
|
-
priority: incident.severity,
|
|
719
|
-
category: 'incident',
|
|
720
|
-
recommendation: `Address ${incident.type}: ${incident.message}`,
|
|
721
|
-
effort: 'moderate',
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
return recommendations;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
private detectBottlenecks(result: LoadTestResult): PerformanceBottleneck[] {
|
|
730
|
-
const bottlenecks: PerformanceBottleneck[] = [];
|
|
731
|
-
|
|
732
|
-
// High response time bottleneck
|
|
733
|
-
if (result.summary.p95ResponseTime > 1000) {
|
|
734
|
-
bottlenecks.push({
|
|
735
|
-
location: 'api',
|
|
736
|
-
type: 'network',
|
|
737
|
-
description: `P95 response time is ${result.summary.p95ResponseTime}ms (>1000ms)`,
|
|
738
|
-
impact: result.summary.p95ResponseTime > 2000 ? 'high' : 'medium',
|
|
739
|
-
recommendation: 'Investigate API response time, consider caching or query optimization',
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
// High error rate bottleneck
|
|
744
|
-
if (result.summary.errorRate > 5) {
|
|
745
|
-
bottlenecks.push({
|
|
746
|
-
location: 'service',
|
|
747
|
-
type: 'cpu',
|
|
748
|
-
description: `Error rate is ${result.summary.errorRate.toFixed(2)}% (>5%)`,
|
|
749
|
-
impact: result.summary.errorRate > 10 ? 'high' : 'medium',
|
|
750
|
-
recommendation: 'Investigate error causes, scale resources if under load',
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
// Throughput bottleneck
|
|
755
|
-
if (result.summary.requestsPerSecond < 10) {
|
|
756
|
-
bottlenecks.push({
|
|
757
|
-
location: 'backend',
|
|
758
|
-
type: 'io',
|
|
759
|
-
description: `Low throughput: ${result.summary.requestsPerSecond.toFixed(2)} RPS`,
|
|
760
|
-
impact: 'medium',
|
|
761
|
-
recommendation: 'Review I/O operations, database queries, and connection pooling',
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
return bottlenecks;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
private generateServiceExperiments(
|
|
769
|
-
service: ServiceDefinition,
|
|
770
|
-
dependencies: ServiceDependency[]
|
|
771
|
-
): ChaosExperiment[] {
|
|
772
|
-
const experiments: ChaosExperiment[] = [];
|
|
773
|
-
|
|
774
|
-
// Latency experiment
|
|
775
|
-
experiments.push(this.createExperiment(
|
|
776
|
-
`${service.name}-latency`,
|
|
777
|
-
`Test ${service.name} behavior under latency`,
|
|
778
|
-
'latency',
|
|
779
|
-
service.name
|
|
780
|
-
));
|
|
781
|
-
|
|
782
|
-
// Error experiment
|
|
783
|
-
experiments.push(this.createExperiment(
|
|
784
|
-
`${service.name}-error`,
|
|
785
|
-
`Test ${service.name} error handling`,
|
|
786
|
-
'error',
|
|
787
|
-
service.name
|
|
788
|
-
));
|
|
789
|
-
|
|
790
|
-
// Resource stress experiment
|
|
791
|
-
experiments.push(this.createExperiment(
|
|
792
|
-
`${service.name}-cpu-stress`,
|
|
793
|
-
`Test ${service.name} under CPU stress`,
|
|
794
|
-
'cpu-stress',
|
|
795
|
-
service.name
|
|
796
|
-
));
|
|
797
|
-
|
|
798
|
-
// Dependency failure experiments
|
|
799
|
-
const serviceDeps = dependencies.filter((d) => d.from === service.name);
|
|
800
|
-
for (const dep of serviceDeps) {
|
|
801
|
-
if (dep.criticality === 'critical') {
|
|
802
|
-
experiments.push(this.createExperiment(
|
|
803
|
-
`${service.name}-${dep.to}-failure`,
|
|
804
|
-
`Test ${service.name} when ${dep.to} fails`,
|
|
805
|
-
'error',
|
|
806
|
-
dep.to
|
|
807
|
-
));
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
return experiments;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
private generateCriticalPathExperiment(
|
|
815
|
-
path: string[],
|
|
816
|
-
_architecture: ServiceArchitecture
|
|
817
|
-
): ChaosExperiment {
|
|
818
|
-
const pathName = path.join('-');
|
|
819
|
-
|
|
820
|
-
return {
|
|
821
|
-
id: uuidv4(),
|
|
822
|
-
name: `critical-path-${pathName}`,
|
|
823
|
-
description: `Test critical path: ${path.join(' -> ')}`,
|
|
824
|
-
hypothesis: {
|
|
825
|
-
statement: 'System should handle partial path failure gracefully',
|
|
826
|
-
metrics: [
|
|
827
|
-
{ metric: 'error_rate', operator: 'lt', value: 10 },
|
|
828
|
-
{ metric: 'response_time_ms', operator: 'lt', value: 2000 },
|
|
829
|
-
],
|
|
830
|
-
tolerances: [
|
|
831
|
-
{ metric: 'error_rate', maxDeviation: 5, unit: 'percent' },
|
|
832
|
-
],
|
|
833
|
-
},
|
|
834
|
-
steadyState: {
|
|
835
|
-
description: 'All services in path are healthy',
|
|
836
|
-
probes: path.map((service) => ({
|
|
837
|
-
name: `${service}-health`,
|
|
838
|
-
type: 'http' as const,
|
|
839
|
-
target: `http://${service}/health`,
|
|
840
|
-
expected: { status: 200 },
|
|
841
|
-
timeout: 5000,
|
|
842
|
-
})),
|
|
843
|
-
},
|
|
844
|
-
faults: path.slice(0, -1).map((service) => ({
|
|
845
|
-
id: uuidv4(),
|
|
846
|
-
type: 'latency' as FaultType,
|
|
847
|
-
target: {
|
|
848
|
-
type: 'service' as const,
|
|
849
|
-
selector: service,
|
|
850
|
-
},
|
|
851
|
-
parameters: { latencyMs: 500 },
|
|
852
|
-
duration: 30000,
|
|
853
|
-
})),
|
|
854
|
-
blastRadius: {
|
|
855
|
-
scope: 'subset',
|
|
856
|
-
percentage: 50,
|
|
857
|
-
excludeProduction: true,
|
|
858
|
-
},
|
|
859
|
-
rollbackPlan: {
|
|
860
|
-
automatic: true,
|
|
861
|
-
triggerConditions: [
|
|
862
|
-
{ type: 'error-rate', condition: 'error_rate > 20' },
|
|
863
|
-
{ type: 'timeout', condition: 'duration > 60000' },
|
|
864
|
-
],
|
|
865
|
-
steps: [
|
|
866
|
-
{ order: 1, action: 'Remove all faults', timeout: 5000 },
|
|
867
|
-
{ order: 2, action: 'Verify service health' },
|
|
868
|
-
],
|
|
869
|
-
},
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
private createExperiment(
|
|
874
|
-
name: string,
|
|
875
|
-
description: string,
|
|
876
|
-
faultType: FaultType,
|
|
877
|
-
target: string
|
|
878
|
-
): ChaosExperiment {
|
|
879
|
-
return {
|
|
880
|
-
id: uuidv4(),
|
|
881
|
-
name,
|
|
882
|
-
description,
|
|
883
|
-
hypothesis: {
|
|
884
|
-
statement: `${target} should recover within 5 seconds from ${faultType}`,
|
|
885
|
-
metrics: [
|
|
886
|
-
{ metric: 'response_time_ms', operator: 'lt', value: 1000 },
|
|
887
|
-
{ metric: 'error_rate', operator: 'lt', value: 5 },
|
|
888
|
-
],
|
|
889
|
-
tolerances: [
|
|
890
|
-
{ metric: 'response_time_ms', maxDeviation: 50, unit: 'percent' },
|
|
891
|
-
],
|
|
892
|
-
},
|
|
893
|
-
steadyState: {
|
|
894
|
-
description: `${target} is healthy and responsive`,
|
|
895
|
-
probes: [
|
|
896
|
-
{
|
|
897
|
-
name: `${target}-health`,
|
|
898
|
-
type: 'http',
|
|
899
|
-
target: `http://${target}/health`,
|
|
900
|
-
expected: { status: 200 },
|
|
901
|
-
timeout: 5000,
|
|
902
|
-
},
|
|
903
|
-
],
|
|
904
|
-
},
|
|
905
|
-
faults: [
|
|
906
|
-
{
|
|
907
|
-
id: uuidv4(),
|
|
908
|
-
type: faultType,
|
|
909
|
-
target: { type: 'service', selector: target },
|
|
910
|
-
parameters: this.getDefaultFaultParameters(faultType),
|
|
911
|
-
duration: 30000, // 30 seconds
|
|
912
|
-
},
|
|
913
|
-
],
|
|
914
|
-
blastRadius: {
|
|
915
|
-
scope: 'single',
|
|
916
|
-
excludeProduction: true,
|
|
917
|
-
},
|
|
918
|
-
rollbackPlan: {
|
|
919
|
-
automatic: true,
|
|
920
|
-
triggerConditions: [
|
|
921
|
-
{ type: 'error-rate', condition: 'error_rate > 50' },
|
|
922
|
-
],
|
|
923
|
-
steps: [
|
|
924
|
-
{ order: 1, action: `Remove ${faultType} fault` },
|
|
925
|
-
{ order: 2, action: 'Verify recovery' },
|
|
926
|
-
],
|
|
927
|
-
},
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
private getDefaultFaultParameters(faultType: FaultType): Record<string, unknown> {
|
|
932
|
-
const defaults: Record<FaultType, Record<string, unknown>> = {
|
|
933
|
-
'latency': { latencyMs: 500 },
|
|
934
|
-
'error': { errorCode: 500 },
|
|
935
|
-
'timeout': { timeoutMs: 30000 },
|
|
936
|
-
'packet-loss': { packetLossPercent: 10 },
|
|
937
|
-
'cpu-stress': { cpuPercent: 80 },
|
|
938
|
-
'memory-stress': { memoryBytes: 1024 * 1024 * 256 }, // 256MB
|
|
939
|
-
'disk-stress': {},
|
|
940
|
-
'network-partition': {},
|
|
941
|
-
'dns-failure': {},
|
|
942
|
-
'process-kill': {},
|
|
943
|
-
};
|
|
944
|
-
|
|
945
|
-
return defaults[faultType] || {};
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
private async storeReport(type: string, id: string, report: unknown): Promise<void> {
|
|
949
|
-
await this.memory.set(
|
|
950
|
-
`chaos-resilience:reports:${type}:${id}`,
|
|
951
|
-
report,
|
|
952
|
-
{ namespace: 'chaos-resilience', persist: true }
|
|
953
|
-
);
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
// ============================================================================
|
|
957
|
-
// Event Handling
|
|
958
|
-
// ============================================================================
|
|
959
|
-
|
|
960
|
-
private subscribeToEvents(): void {
|
|
961
|
-
// Subscribe to deployment events to trigger chaos tests
|
|
962
|
-
this.eventBus.subscribe(
|
|
963
|
-
'quality-assessment.DeploymentApproved',
|
|
964
|
-
this.handleDeploymentApproved.bind(this)
|
|
965
|
-
);
|
|
966
|
-
|
|
967
|
-
// Subscribe to quality gate events
|
|
968
|
-
this.eventBus.subscribe(
|
|
969
|
-
'quality-assessment.QualityGateEvaluated',
|
|
970
|
-
this.handleQualityGateEvaluated.bind(this)
|
|
971
|
-
);
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
private async handleDeploymentApproved(event: DomainEvent): Promise<void> {
|
|
975
|
-
if (!this.config.enableAutomatedExperiments) return;
|
|
976
|
-
|
|
977
|
-
// Could trigger automated chaos experiments after deployment
|
|
978
|
-
const payload = event.payload as { services?: string[] };
|
|
979
|
-
if (payload.services) {
|
|
980
|
-
// Queue assessment for deployed services
|
|
981
|
-
await this.memory.set(
|
|
982
|
-
`chaos-resilience:pending-assessment:${event.id}`,
|
|
983
|
-
payload.services,
|
|
984
|
-
{ namespace: 'chaos-resilience', ttl: 3600 }
|
|
985
|
-
);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
private async handleQualityGateEvaluated(event: DomainEvent): Promise<void> {
|
|
990
|
-
// Track quality gate results for resilience correlation
|
|
991
|
-
const payload = event.payload as { gateId: string; passed: boolean };
|
|
992
|
-
|
|
993
|
-
if (!payload.passed) {
|
|
994
|
-
// Store for later analysis
|
|
995
|
-
await this.memory.set(
|
|
996
|
-
`chaos-resilience:quality-gate-failures:${event.id}`,
|
|
997
|
-
payload,
|
|
998
|
-
{ namespace: 'chaos-resilience', ttl: 86400 }
|
|
999
|
-
);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
// ============================================================================
|
|
1004
|
-
// State Persistence
|
|
1005
|
-
// ============================================================================
|
|
1006
|
-
|
|
1007
|
-
private async loadWorkflowState(): Promise<void> {
|
|
1008
|
-
const savedState = await this.memory.get<WorkflowStatus[]>(
|
|
1009
|
-
'chaos-resilience:coordinator:workflows'
|
|
1010
|
-
);
|
|
1011
|
-
|
|
1012
|
-
if (savedState) {
|
|
1013
|
-
for (const workflow of savedState) {
|
|
1014
|
-
if (workflow.status === 'running') {
|
|
1015
|
-
workflow.status = 'failed';
|
|
1016
|
-
workflow.error = 'Coordinator restarted';
|
|
1017
|
-
workflow.completedAt = new Date();
|
|
1018
|
-
}
|
|
1019
|
-
this.workflows.set(workflow.id, workflow);
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
private async saveWorkflowState(): Promise<void> {
|
|
1025
|
-
const workflows = Array.from(this.workflows.values());
|
|
1026
|
-
await this.memory.set(
|
|
1027
|
-
'chaos-resilience:coordinator:workflows',
|
|
1028
|
-
workflows,
|
|
1029
|
-
{ namespace: 'chaos-resilience', persist: true }
|
|
1030
|
-
);
|
|
1031
|
-
}
|
|
1032
|
-
}
|