claude-flow-novice 2.15.2 → 2.15.4
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/.claude/cfn-extras/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/.claude/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/.claude/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/.claude/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/.claude/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/.claude/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/.claude/commands/cfn-loop-cli.md +16 -2
- package/.claude/commands/switch-api.md +31 -10
- package/.claude/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/.claude/hooks/cfn-invoke-security-validation.sh +69 -69
- package/.claude/hooks/cfn-lint-sql-injection.sh +61 -0
- package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +109 -78
- package/.claude/hooks/cfn-post-edit.config.json +44 -44
- package/.claude/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/.claude/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/.claude/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/.claude/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/.claude/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/.claude/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/.claude/skills/cfn-redis-coordination/get-context.sh +145 -112
- package/.claude/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/.claude/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/.claude/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/.claude/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/.claude/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/.claude/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/.claude/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/.claude/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/.claude/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/.claude/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +107 -92
- package/.claude/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/README.md +116 -475
- package/claude-assets/agents/cfn-dev-team/README.md +103 -0
- package/claude-assets/agents/cfn-dev-team/architecture/goal-planner.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +355 -6
- package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +99 -12
- package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +1 -1
- package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +20 -1
- package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +110 -13
- package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +106 -15
- package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +115 -11
- package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +94 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +87 -9
- package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +85 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +160 -28
- package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +101 -19
- package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +108 -14
- package/claude-assets/agents/cfn-dev-team/reviewers/{reviewer.md → code-reviewer.md} +95 -8
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +107 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +98 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +95 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +136 -9
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +108 -1
- package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +107 -13
- package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +737 -0
- package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +1 -1
- package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +828 -0
- package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +106 -7
- package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +77 -0
- package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +684 -0
- package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +110 -1
- package/claude-assets/agents/cfn-dev-team/testers/tester.md +94 -7
- package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +87 -13
- package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +103 -7
- package/claude-assets/agents/cfn-dev-team/utility/researcher.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +94 -7
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +46 -0
- package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
- package/claude-assets/cfn-extras/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/claude-assets/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/claude-assets/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/claude-assets/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/claude-assets/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/claude-assets/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/claude-assets/commands/cfn-loop-cli.md +16 -2
- package/claude-assets/commands/switch-api.md +31 -10
- package/claude-assets/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/claude-assets/hooks/cfn-invoke-security-validation.sh +69 -69
- package/claude-assets/hooks/cfn-lint-sql-injection.sh +61 -0
- package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +109 -78
- package/claude-assets/hooks/cfn-post-edit.config.json +44 -44
- package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +19 -19
- package/claude-assets/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +19 -19
- package/claude-assets/hooks/detect-hardcoded-credentials.sh +212 -0
- package/claude-assets/skills/SKILL_TEMPLATE.md +774 -0
- package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +543 -572
- package/claude-assets/skills/agent-lifecycle/simple-audit.sh +57 -30
- package/claude-assets/skills/agent-template-generator/SKILL.md +440 -0
- package/claude-assets/skills/agent-template-generator/generate-agent.sh +405 -0
- package/claude-assets/skills/agent-validation-linter/SKILL.md +589 -0
- package/claude-assets/skills/agent-validation-linter/lint-agents.sh +271 -0
- package/claude-assets/skills/bootstrap/bash-fundamentals.md +786 -0
- package/claude-assets/skills/bootstrap/database-connection.md +464 -0
- package/claude-assets/skills/bootstrap/error-handling.md +580 -0
- package/claude-assets/skills/bootstrap/file-operations.md +699 -0
- package/claude-assets/skills/bootstrap/skill-loader.md +616 -0
- package/claude-assets/skills/bootstrap/sqlite-params.sh +287 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/claude-assets/skills/cfn-automatic-memory-persistence/persist-agent-output.sh +48 -48
- package/claude-assets/skills/cfn-automatic-memory-persistence/query-agent-history.sh +34 -34
- package/claude-assets/skills/cfn-automatic-memory-persistence/test-memory-persistence.sh +17 -16
- package/claude-assets/skills/cfn-deliverable-validation/confidence-calculator.sh +261 -261
- package/claude-assets/skills/cfn-deployment/SKILL.md +293 -0
- package/claude-assets/skills/cfn-deployment/execute.sh +21 -0
- package/claude-assets/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +38 -0
- package/claude-assets/skills/cfn-error-batching-strategy/lib/core-functions.sh +47 -47
- package/claude-assets/skills/cfn-expert-update/update-expert.sh +345 -345
- package/claude-assets/skills/cfn-file-operations/SKILL.md +290 -0
- package/claude-assets/skills/cfn-file-operations/execute.sh +129 -0
- package/claude-assets/skills/cfn-file-operations/lib/atomic-write.sh +294 -0
- package/claude-assets/skills/cfn-file-operations/lib/lock.sh +361 -0
- package/claude-assets/skills/cfn-file-operations/test.sh +369 -0
- package/claude-assets/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/claude-assets/skills/cfn-intervention-detector/detect-intervention.sh +110 -110
- package/claude-assets/skills/cfn-intervention-orchestrator/execute-intervention.sh +58 -58
- package/claude-assets/skills/cfn-log-operations/SKILL.md +308 -0
- package/claude-assets/skills/cfn-log-operations/execute.sh +420 -0
- package/claude-assets/skills/cfn-log-operations/lib/rotate.sh +406 -0
- package/claude-assets/skills/cfn-log-operations/lib/search.sh +448 -0
- package/claude-assets/skills/cfn-log-operations/test.sh +394 -0
- package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/claude-assets/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/claude-assets/skills/cfn-loop2-output-processing/process-validator-output.sh +275 -275
- package/claude-assets/skills/cfn-memory-management/check-memory.sh +159 -159
- package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +196 -196
- package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +325 -325
- package/claude-assets/skills/cfn-parameterized-queries/SKILL.md +339 -0
- package/claude-assets/skills/cfn-playbook/query-playbook.sh +19 -15
- package/claude-assets/skills/cfn-playbook/update-playbook.sh +25 -14
- package/claude-assets/skills/cfn-playbook-auto-update/auto-update-playbook.sh +85 -85
- package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +44 -0
- package/claude-assets/skills/cfn-promotion/SKILL.md +305 -0
- package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/claude-assets/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +145 -112
- package/claude-assets/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/claude-assets/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/claude-assets/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/claude-assets/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/claude-assets/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/claude-assets/skills/cfn-scope-simplifier/simplify-scope.sh +67 -67
- package/claude-assets/skills/cfn-skill-loader/SKILL.md +466 -0
- package/claude-assets/skills/cfn-skill-loader/execute.sh +344 -0
- package/claude-assets/skills/cfn-specialist-injection/recommend-specialist.sh +56 -56
- package/claude-assets/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/claude-assets/skills/cfn-standardized-error-handling/capture-agent-error.sh +86 -86
- package/claude-assets/skills/cfn-standardized-error-handling/test-error-handling.sh +165 -165
- package/claude-assets/skills/cfn-task-audit/get-audit-data.sh +42 -21
- package/claude-assets/skills/cfn-task-audit/store-task-audit.sh +17 -10
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -264
- package/claude-assets/skills/cfn-task-decomposition/task-decomposer.sh +278 -278
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh +17 -14
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh.backup-1763392821 +55 -0
- package/claude-assets/skills/cfn-test-runner/store-benchmarks.sh +17 -19
- package/claude-assets/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/claude-assets/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/claude-assets/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/claude-assets/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/claude-assets/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +107 -92
- package/claude-assets/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/claude-assets/skills/cfn-utilities/SKILL.md +237 -0
- package/claude-assets/skills/cfn-utilities/execute.sh +32 -0
- package/claude-assets/skills/cfn-utilities/lib/errors.sh +56 -0
- package/claude-assets/skills/cfn-utilities/lib/file-ops.sh +164 -0
- package/claude-assets/skills/cfn-utilities/lib/logging.sh +77 -0
- package/claude-assets/skills/cfn-utilities/lib/retry.sh +127 -0
- package/claude-assets/skills/cfn-utilities/test.sh +317 -0
- package/claude-assets/skills/docker-build/SKILL.md +96 -203
- package/claude-assets/skills/docker-build/build.sh +73 -73
- package/claude-assets/skills/integration/agent-handoff.sh +492 -0
- package/claude-assets/skills/integration/file-operations.sh +414 -0
- package/claude-assets/skills/json-validation/SKILL.md +431 -0
- package/claude-assets/skills/json-validation/test-validate-success-criteria.sh +421 -0
- package/claude-assets/skills/json-validation/validate-success-criteria.sh +197 -0
- package/claude-assets/skills/redis-coordination/validate-parameters.sh +34 -0
- package/claude-assets/skills/workflow-codification/APPROVAL_WORKFLOW.md +806 -0
- package/claude-assets/skills/workflow-codification/COST_TRACKING.md +637 -0
- package/claude-assets/skills/workflow-codification/DEPLOY_QUICK_REFERENCE.md +106 -0
- package/claude-assets/skills/workflow-codification/EDGE_CASE_TRACKING.md +404 -0
- package/claude-assets/skills/workflow-codification/PROPAGATE_UPDATE_QUICK_REFERENCE.md +366 -0
- package/claude-assets/skills/workflow-codification/README_PHASE4.md +457 -0
- package/claude-assets/skills/workflow-codification/SKILL.md +110 -0
- package/claude-assets/skills/workflow-codification/analyze-patterns.sh +899 -0
- package/claude-assets/skills/workflow-codification/approval-workflow.sh +514 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh +481 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh.backup-1763392820 +512 -0
- package/claude-assets/skills/workflow-codification/generate-skill-update.sh +525 -0
- package/claude-assets/skills/workflow-codification/lib/security-utils.sh +204 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh +648 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh.backup-1763392820 +664 -0
- package/claude-assets/skills/workflow-codification/review-skill.sh +643 -0
- package/claude-assets/skills/workflow-codification/templates/email-notification.txt +114 -0
- package/claude-assets/skills/workflow-codification/templates/slack-notification.md +85 -0
- package/claude-assets/skills/workflow-codification/test-integration.sh +296 -0
- package/claude-assets/skills/workflow-codification/test-metadata-update.sh +350 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh +486 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh.backup-1763392821 +445 -0
- package/claude-assets/skills/workflow-codification/track-edge-case.sh +290 -0
- package/claude-assets/skills/workflow-codification/workflow-codification.db +0 -0
- package/dist/ace/ace-curator.js +10 -2
- package/dist/ace/ace-curator.js.map +1 -1
- package/dist/ace/ace-generator.js +4 -0
- package/dist/ace/ace-generator.js.map +1 -1
- package/dist/ace/ace-reflector.js +1 -1
- package/dist/ace/ace-reflector.js.map +1 -1
- package/dist/ace/context-injection.js +24 -2
- package/dist/ace/context-injection.js.map +1 -1
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/agents/task-agent-integration.js +1 -1
- package/dist/agents/task-agent-integration.js.map +1 -1
- package/dist/api/health-endpoints.js +390 -0
- package/dist/api/health-endpoints.js.map +1 -0
- package/dist/cli/agent-executor.js +4 -1
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-prompt-builder.js +89 -1
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawn.js +130 -37
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/skill-cache-validator.js +412 -0
- package/dist/cli/skill-cache-validator.js.map +1 -0
- package/dist/cli/skill-cli.js +991 -0
- package/dist/cli/skill-cli.js.map +1 -0
- package/dist/cli/skill-execution-logger.js +284 -0
- package/dist/cli/skill-execution-logger.js.map +1 -0
- package/dist/cli/skill-loader.js +457 -0
- package/dist/cli/skill-loader.js.map +1 -0
- package/dist/coordination/event-bus.js +2 -2
- package/dist/coordination/event-bus.js.map +1 -1
- package/dist/coordination/fleet-manager.js +1 -1
- package/dist/coordination/fleet-manager.js.map +1 -1
- package/dist/coordination/index.js +23 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/types/fleet-manager.types.js.map +1 -1
- package/dist/db/migration-manager.js +483 -0
- package/dist/db/migration-manager.js.map +1 -0
- package/dist/db/skills-query.js +535 -0
- package/dist/db/skills-query.js.map +1 -0
- package/dist/integration/DatabaseHandoff.js +507 -0
- package/dist/integration/DatabaseHandoff.js.map +1 -0
- package/dist/integration/StandardAdapter.js +291 -0
- package/dist/integration/StandardAdapter.js.map +1 -0
- package/dist/jobs/edge-case-analyzer.js +367 -0
- package/dist/jobs/edge-case-analyzer.js.map +1 -0
- package/dist/jobs/promotion-sla-enforcer.js +288 -0
- package/dist/jobs/promotion-sla-enforcer.js.map +1 -0
- package/dist/lib/agent-output-parser.js +518 -0
- package/dist/lib/agent-output-parser.js.map +1 -0
- package/dist/lib/agent-output-validator.js +950 -0
- package/dist/lib/agent-output-validator.js.map +1 -0
- package/dist/lib/agent-workspace.js +281 -0
- package/dist/lib/agent-workspace.js.map +1 -0
- package/dist/lib/artifact-registry.js +443 -0
- package/dist/lib/artifact-registry.js.map +1 -0
- package/dist/lib/atomic-file-writer.js +377 -0
- package/dist/lib/atomic-file-writer.js.map +1 -0
- package/dist/lib/backup-manager.js +779 -0
- package/dist/lib/backup-manager.js.map +1 -0
- package/dist/lib/checkpoint-manager.js +837 -0
- package/dist/lib/checkpoint-manager.js.map +1 -0
- package/dist/lib/circuit-breaker.js +340 -0
- package/dist/lib/circuit-breaker.js.map +1 -0
- package/dist/lib/completion-signal-handler.js +243 -0
- package/dist/lib/completion-signal-handler.js.map +1 -0
- package/dist/lib/config-manager.js +312 -0
- package/dist/lib/config-manager.js.map +1 -0
- package/dist/lib/config-migrator.js +386 -0
- package/dist/lib/config-migrator.js.map +1 -0
- package/dist/lib/config-validator.js +687 -0
- package/dist/lib/config-validator.js.map +1 -0
- package/dist/lib/correlation-cache.js +311 -0
- package/dist/lib/correlation-cache.js.map +1 -0
- package/dist/lib/correlation.js +263 -0
- package/dist/lib/correlation.js.map +1 -0
- package/dist/lib/database-service/connection-pool-manager.js +520 -0
- package/dist/lib/database-service/connection-pool-manager.js.map +1 -0
- package/dist/lib/database-service/correlation.js +329 -0
- package/dist/lib/database-service/correlation.js.map +1 -0
- package/dist/lib/database-service/errors.js +120 -0
- package/dist/lib/database-service/errors.js.map +1 -0
- package/dist/lib/database-service/index.js +168 -0
- package/dist/lib/database-service/index.js.map +1 -0
- package/dist/lib/database-service/postgres-adapter.js +526 -0
- package/dist/lib/database-service/postgres-adapter.js.map +1 -0
- package/dist/lib/database-service/redis-adapter.js +360 -0
- package/dist/lib/database-service/redis-adapter.js.map +1 -0
- package/dist/lib/database-service/sqlite-adapter.js +544 -0
- package/dist/lib/database-service/sqlite-adapter.js.map +1 -0
- package/dist/lib/database-service/transaction-manager.js +773 -0
- package/dist/lib/database-service/transaction-manager.js.map +1 -0
- package/dist/lib/database-service/types.js +23 -0
- package/dist/lib/database-service/types.js.map +1 -0
- package/dist/lib/deadlock-resolver.js +292 -0
- package/dist/lib/deadlock-resolver.js.map +1 -0
- package/dist/lib/distributed-lock.js +451 -0
- package/dist/lib/distributed-lock.js.map +1 -0
- package/dist/lib/edge-case-deduplicator.js +227 -0
- package/dist/lib/edge-case-deduplicator.js.map +1 -0
- package/dist/lib/encryption-manager.js +322 -0
- package/dist/lib/encryption-manager.js.map +1 -0
- package/dist/lib/error-aggregator.js +234 -0
- package/dist/lib/error-aggregator.js.map +1 -0
- package/dist/lib/errors.js +287 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/file-lock-manager.js +578 -0
- package/dist/lib/file-lock-manager.js.map +1 -0
- package/dist/lib/file-operations.js +367 -0
- package/dist/lib/file-operations.js.map +1 -0
- package/dist/lib/idempotent-write.js +237 -0
- package/dist/lib/idempotent-write.js.map +1 -0
- package/dist/lib/integration-schema-validator.js +522 -0
- package/dist/lib/integration-schema-validator.js.map +1 -0
- package/dist/lib/lock-health-monitor.js +298 -0
- package/dist/lib/lock-health-monitor.js.map +1 -0
- package/dist/lib/log-shipper.js +422 -0
- package/dist/lib/log-shipper.js.map +1 -0
- package/dist/lib/logging.js +146 -0
- package/dist/lib/logging.js.map +1 -0
- package/dist/lib/message-deduplicator.js +439 -0
- package/dist/lib/message-deduplicator.js.map +1 -0
- package/dist/lib/multi-system-query.js +604 -0
- package/dist/lib/multi-system-query.js.map +1 -0
- package/dist/lib/orphan-detector.js +332 -0
- package/dist/lib/orphan-detector.js.map +1 -0
- package/dist/lib/password-generator.js +166 -0
- package/dist/lib/password-generator.js.map +1 -0
- package/dist/lib/path-validator.js +429 -0
- package/dist/lib/path-validator.js.map +1 -0
- package/dist/lib/query-translator.js +905 -0
- package/dist/lib/query-translator.js.map +1 -0
- package/dist/lib/queue-recovery.js +469 -0
- package/dist/lib/queue-recovery.js.map +1 -0
- package/dist/lib/redis-queue-manager.js +512 -0
- package/dist/lib/redis-queue-manager.js.map +1 -0
- package/dist/lib/reflection-archiver.js +272 -0
- package/dist/lib/reflection-archiver.js.map +1 -0
- package/dist/lib/retry-manager.js +453 -0
- package/dist/lib/retry-manager.js.map +1 -0
- package/dist/lib/retry.js +262 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/schema-transform.js +695 -0
- package/dist/lib/schema-transform.js.map +1 -0
- package/dist/lib/schema-validator.js +491 -0
- package/dist/lib/schema-validator.js.map +1 -0
- package/dist/lib/skill-cache.js +297 -0
- package/dist/lib/skill-cache.js.map +1 -0
- package/dist/lib/skill-content-manager.js +337 -0
- package/dist/lib/skill-content-manager.js.map +1 -0
- package/dist/lib/skill-frontmatter-parser.js +237 -0
- package/dist/lib/skill-frontmatter-parser.js.map +1 -0
- package/dist/lib/skill-git-integration.js +275 -0
- package/dist/lib/skill-git-integration.js.map +1 -0
- package/dist/lib/skill-markdown-validator.js +396 -0
- package/dist/lib/skill-markdown-validator.js.map +1 -0
- package/dist/lib/skill-output-parser.js +312 -0
- package/dist/lib/skill-output-parser.js.map +1 -0
- package/dist/lib/unified-query-api.js +467 -0
- package/dist/lib/unified-query-api.js.map +1 -0
- package/dist/middleware/auth-middleware.js +350 -0
- package/dist/middleware/auth-middleware.js.map +1 -0
- package/dist/middleware/schema-validation.js +347 -0
- package/dist/middleware/schema-validation.js.map +1 -0
- package/dist/providers/anthropic-provider.js +1 -1
- package/dist/providers/anthropic-provider.js.map +1 -1
- package/dist/providers/provider-factory.js +2 -2
- package/dist/providers/provider-factory.js.map +1 -1
- package/dist/services/edge-case-analyzer.js +321 -0
- package/dist/services/edge-case-analyzer.js.map +1 -0
- package/dist/services/edge-case-deduplicator.js +266 -0
- package/dist/services/edge-case-deduplicator.js.map +1 -0
- package/dist/services/edge-case-detector.js +337 -0
- package/dist/services/edge-case-detector.js.map +1 -0
- package/dist/services/edge-case-tracker.js +547 -0
- package/dist/services/edge-case-tracker.js.map +1 -0
- package/dist/services/health-check-system.js +586 -0
- package/dist/services/health-check-system.js.map +1 -0
- package/dist/services/metrics-logger.js +412 -0
- package/dist/services/metrics-logger.js.map +1 -0
- package/dist/services/patch-generator.js +378 -0
- package/dist/services/patch-generator.js.map +1 -0
- package/dist/services/patch-validator.js +337 -0
- package/dist/services/patch-validator.js.map +1 -0
- package/dist/services/performance-monitor.js +811 -0
- package/dist/services/performance-monitor.js.map +1 -0
- package/dist/services/promotion-pipeline.js +918 -0
- package/dist/services/promotion-pipeline.js.map +1 -0
- package/dist/services/promotion-validator.js +394 -0
- package/dist/services/promotion-validator.js.map +1 -0
- package/dist/services/reflection-logger.js +388 -0
- package/dist/services/reflection-logger.js.map +1 -0
- package/dist/services/skill-deployment.js +472 -0
- package/dist/services/skill-deployment.js.map +1 -0
- package/dist/services/skill-loader.js +427 -0
- package/dist/services/skill-loader.js.map +1 -0
- package/dist/services/skill-promotion.js +372 -0
- package/dist/services/skill-promotion.js.map +1 -0
- package/dist/services/skill-validator.js +454 -0
- package/dist/services/skill-validator.js.map +1 -0
- package/dist/services/skill-versioning.js +244 -0
- package/dist/services/skill-versioning.js.map +1 -0
- package/dist/services/workspace-supervisor.js +597 -0
- package/dist/services/workspace-supervisor.js.map +1 -0
- package/dist/types/agent-output.js +44 -0
- package/dist/types/agent-output.js.map +1 -0
- package/dist/types/config.js +28 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/edge-case.js +45 -0
- package/dist/types/edge-case.js.map +1 -0
- package/package.json +201 -176
- package/readme/README.md +19 -4
- package/scripts/artifact-cleanup.sh +392 -0
- package/scripts/backup-cleanup.sh +627 -0
- package/scripts/cleanup-workspaces.sh +412 -0
- package/scripts/cleanup-yaml-configs.sh +141 -0
- package/scripts/deploy-approved-skills.sh +263 -0
- package/scripts/deploy-production.sh +355 -355
- package/scripts/docker-playwright-fix.sh +311 -311
- package/scripts/docker-rebuild-all-agents.sh +127 -127
- package/scripts/health-check.sh +447 -0
- package/scripts/log-aggregator.sh +554 -0
- package/scripts/log-monitor.sh +629 -0
- package/scripts/manage-agent-workspaces.sh +434 -0
- package/scripts/memory-leak-prevention.sh +305 -305
- package/scripts/migrate-artifacts.sh +563 -0
- package/scripts/migrate-schema.sh +533 -0
- package/scripts/migrate-yaml-to-json.sh +465 -0
- package/scripts/promote-staged-skills.sh +423 -0
- package/scripts/run-marketing-tests.sh +42 -42
- package/scripts/update_paths.sh +46 -46
- package/scripts/verify-no-secrets.sh +88 -35
- package/.claude/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/.claude/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/.claude/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
- package/README.md.backup_before_replace +0 -781
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
|
@@ -0,0 +1,828 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: integration-tester
|
|
3
|
+
description: MUST BE USED for integration testing, end-to-end workflow validation, cross-component testing, and system integration verification. Use PROACTIVELY for integration tests, E2E workflows, service integration, database integration, API integration. ALWAYS delegate for "integration testing", "E2E tests", "workflow testing", "system integration". Keywords - integration testing, E2E, end-to-end, workflow validation, cross-component, system integration, service orchestration
|
|
4
|
+
tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
|
|
5
|
+
model: sonnet
|
|
6
|
+
type: specialist
|
|
7
|
+
capabilities:
|
|
8
|
+
- integration-testing
|
|
9
|
+
- e2e-testing
|
|
10
|
+
- workflow-validation
|
|
11
|
+
- cross-component-testing
|
|
12
|
+
- service-integration
|
|
13
|
+
- database-integration
|
|
14
|
+
- api-integration
|
|
15
|
+
acl_level: 1
|
|
16
|
+
validation_hooks:
|
|
17
|
+
- agent-template-validator
|
|
18
|
+
- test-coverage-validator
|
|
19
|
+
---
|
|
20
|
+
# Integration Testing Specialist Agent
|
|
21
|
+
|
|
22
|
+
## Success Criteria Awareness (REQUIRED - Phase 2 TDD)
|
|
23
|
+
|
|
24
|
+
### 1. Read Success Criteria
|
|
25
|
+
Before starting work, read test requirements from environment:
|
|
26
|
+
```bash
|
|
27
|
+
if [[ -n "${AGENT_SUCCESS_CRITERIA:-}" ]]; then
|
|
28
|
+
# Validate JSON before parsing
|
|
29
|
+
if ! echo "$AGENT_SUCCESS_CRITERIA" | jq -e '.' >/dev/null 2>&1; then
|
|
30
|
+
echo "❌ Invalid JSON in AGENT_SUCCESS_CRITERIA" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
CRITERIA=$(echo "$AGENT_SUCCESS_CRITERIA" | jq -r '.')
|
|
35
|
+
TEST_SUITES=$(echo "$CRITERIA" | jq -r '.test_suites[] // empty')
|
|
36
|
+
|
|
37
|
+
if [[ -n "$TEST_SUITES" ]]; then
|
|
38
|
+
echo "📋 Success Criteria Loaded:"
|
|
39
|
+
echo "$TEST_SUITES" | jq -r '.name // "unnamed"'
|
|
40
|
+
fi
|
|
41
|
+
fi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. TDD Protocol (MANDATORY)
|
|
45
|
+
|
|
46
|
+
**Write Tests First (15-20 min):**
|
|
47
|
+
- Extract integration test requirements from success criteria
|
|
48
|
+
- Define end-to-end workflow scenarios
|
|
49
|
+
- Write failing integration tests for each workflow
|
|
50
|
+
- Ensure integration coverage ≥90%
|
|
51
|
+
|
|
52
|
+
**Implement (30-40 min):**
|
|
53
|
+
- Set up test environment (databases, services, mocks)
|
|
54
|
+
- Configure integration test framework (Jest, pytest, etc.)
|
|
55
|
+
- Implement workflow test scenarios
|
|
56
|
+
- Run tests continuously against real services
|
|
57
|
+
|
|
58
|
+
**Validate (5 min):**
|
|
59
|
+
- Run full integration test suite
|
|
60
|
+
- Verify all workflows pass
|
|
61
|
+
- Check database state consistency
|
|
62
|
+
- Validate API interactions
|
|
63
|
+
|
|
64
|
+
### 3. Test-Driven Validation (Replaces Confidence Reporting)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Run integration tests
|
|
68
|
+
TEST_OUTPUT=$(npm run test:integration 2>&1)
|
|
69
|
+
|
|
70
|
+
# Parse results using CFN test result parser
|
|
71
|
+
RESULTS=$(./.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh \
|
|
72
|
+
"jest" "$TEST_OUTPUT")
|
|
73
|
+
|
|
74
|
+
# Store in Redis for Loop 2 consensus
|
|
75
|
+
redis-cli HSET "swarm:${TASK_ID}:loop2-test-results" \
|
|
76
|
+
"integration_tests_passed" "true" \
|
|
77
|
+
"integration_test_output" "$TEST_OUTPUT" \
|
|
78
|
+
"integration_pass_rate" "0.95"
|
|
79
|
+
|
|
80
|
+
# Report completion (no confidence score)
|
|
81
|
+
./.claude/skills/cfn-coordination/report-completion.sh \
|
|
82
|
+
--task-id "$TASK_ID" \
|
|
83
|
+
--agent-id "$AGENT_ID" \
|
|
84
|
+
--test-results "$RESULTS"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 4. Completion Protocol
|
|
88
|
+
|
|
89
|
+
**DO NOT** report confidence scores. Report test metrics:
|
|
90
|
+
```bash
|
|
91
|
+
echo "Integration Test Results:"
|
|
92
|
+
echo " Total Workflows: 12"
|
|
93
|
+
echo " Passed: 11"
|
|
94
|
+
echo " Failed: 1"
|
|
95
|
+
echo " Pass Rate: 92%"
|
|
96
|
+
echo " Critical Workflows: 100% (all passed)"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Role: Integration Testing Specialist (Loop 2 Validator)
|
|
102
|
+
|
|
103
|
+
You are an **integration testing specialist** focused on validating end-to-end workflows and cross-component interactions. Your primary responsibility is ensuring that all system components work together correctly in realistic scenarios.
|
|
104
|
+
|
|
105
|
+
**Core Philosophy:**
|
|
106
|
+
- Test real workflows, not isolated units
|
|
107
|
+
- Use real databases, real services (not mocks when possible)
|
|
108
|
+
- Validate data flows across component boundaries
|
|
109
|
+
- Ensure transactions are atomic and consistent
|
|
110
|
+
- Catch architectural bugs that unit tests miss
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Integration Testing Protocol
|
|
115
|
+
|
|
116
|
+
### Phase 1: Workflow Analysis (5-10 min)
|
|
117
|
+
|
|
118
|
+
**1. Identify Critical Workflows:**
|
|
119
|
+
```bash
|
|
120
|
+
# Read Loop 3 implementation
|
|
121
|
+
DELIVERABLES=$(redis-cli HGET "swarm:${TASK_ID}:deliverables" "files")
|
|
122
|
+
|
|
123
|
+
# Analyze feature for workflows
|
|
124
|
+
# Example: JWT Authentication implementation
|
|
125
|
+
WORKFLOWS=(
|
|
126
|
+
"User registration → Email verification → Login"
|
|
127
|
+
"Login → JWT generation → Protected resource access"
|
|
128
|
+
"Refresh token → New JWT → Continued access"
|
|
129
|
+
"Logout → Token invalidation → Access denied"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
echo "Identified Critical Workflows:"
|
|
133
|
+
for workflow in "${WORKFLOWS[@]}"; do
|
|
134
|
+
echo " - $workflow"
|
|
135
|
+
done
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**2. Map Component Dependencies:**
|
|
139
|
+
```bash
|
|
140
|
+
# Identify components involved in workflows
|
|
141
|
+
COMPONENTS=(
|
|
142
|
+
"Auth Controller (API layer)"
|
|
143
|
+
"JWT Service (Business logic)"
|
|
144
|
+
"User Repository (Data layer)"
|
|
145
|
+
"PostgreSQL Database"
|
|
146
|
+
"Redis Token Store"
|
|
147
|
+
"Email Service"
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# Create dependency graph
|
|
151
|
+
# Auth Controller → JWT Service → User Repo → PostgreSQL
|
|
152
|
+
# → Redis Token Store
|
|
153
|
+
# → Email Service
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### Phase 2: Test Environment Setup (10-15 min)
|
|
159
|
+
|
|
160
|
+
**1. Start Test Services:**
|
|
161
|
+
```bash
|
|
162
|
+
#!/bin/bash
|
|
163
|
+
# scripts/start-integration-test-env.sh
|
|
164
|
+
|
|
165
|
+
echo "Starting integration test environment..."
|
|
166
|
+
|
|
167
|
+
# Start PostgreSQL test database
|
|
168
|
+
docker run -d --name postgres-test \
|
|
169
|
+
-e POSTGRES_DB=testdb \
|
|
170
|
+
-e POSTGRES_USER=test \
|
|
171
|
+
-e POSTGRES_PASSWORD=test \
|
|
172
|
+
-p 5433:5432 \
|
|
173
|
+
postgres:15-alpine
|
|
174
|
+
|
|
175
|
+
# Start Redis test instance
|
|
176
|
+
docker run -d --name redis-test \
|
|
177
|
+
-p 6380:6379 \
|
|
178
|
+
redis:7-alpine
|
|
179
|
+
|
|
180
|
+
# Wait for services to be ready
|
|
181
|
+
sleep 5
|
|
182
|
+
|
|
183
|
+
# Run database migrations
|
|
184
|
+
npm run migrate:test
|
|
185
|
+
|
|
186
|
+
# Seed test data
|
|
187
|
+
npm run seed:test
|
|
188
|
+
|
|
189
|
+
echo "✅ Integration test environment ready"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**2. Configure Test Database:**
|
|
193
|
+
```javascript
|
|
194
|
+
// tests/integration/setup.ts
|
|
195
|
+
import { DataSource } from 'typeorm';
|
|
196
|
+
|
|
197
|
+
export const testDataSource = new DataSource({
|
|
198
|
+
type: 'postgres',
|
|
199
|
+
host: 'localhost',
|
|
200
|
+
port: 5433,
|
|
201
|
+
username: 'test',
|
|
202
|
+
password: 'test',
|
|
203
|
+
database: 'testdb',
|
|
204
|
+
entities: ['src/entities/**/*.ts'],
|
|
205
|
+
synchronize: true,
|
|
206
|
+
logging: false
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
beforeAll(async () => {
|
|
210
|
+
await testDataSource.initialize();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
afterAll(async () => {
|
|
214
|
+
await testDataSource.destroy();
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
afterEach(async () => {
|
|
218
|
+
// Clean up database between tests
|
|
219
|
+
await testDataSource.query('TRUNCATE TABLE users CASCADE');
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### Phase 3: Integration Test Execution (30-40 min)
|
|
226
|
+
|
|
227
|
+
#### A. Authentication Workflow Tests
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// tests/integration/auth.integration.test.ts
|
|
231
|
+
describe('Authentication Workflow Integration', () => {
|
|
232
|
+
let app: Express;
|
|
233
|
+
let database: DataSource;
|
|
234
|
+
|
|
235
|
+
beforeAll(async () => {
|
|
236
|
+
app = await createApp();
|
|
237
|
+
database = testDataSource;
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
describe('User Registration → Email Verification → Login Flow', () => {
|
|
241
|
+
it('should complete full registration workflow', async () => {
|
|
242
|
+
// Step 1: Register user
|
|
243
|
+
const registerResponse = await request(app)
|
|
244
|
+
.post('/api/auth/register')
|
|
245
|
+
.send({
|
|
246
|
+
email: 'newuser@example.com',
|
|
247
|
+
password: 'SecurePass123!',
|
|
248
|
+
name: 'New User'
|
|
249
|
+
})
|
|
250
|
+
.expect(201);
|
|
251
|
+
|
|
252
|
+
expect(registerResponse.body).toMatchObject({
|
|
253
|
+
userId: expect.any(Number),
|
|
254
|
+
email: 'newuser@example.com',
|
|
255
|
+
verified: false
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// Verify database state
|
|
259
|
+
const user = await database
|
|
260
|
+
.getRepository(User)
|
|
261
|
+
.findOne({ where: { email: 'newuser@example.com' } });
|
|
262
|
+
|
|
263
|
+
expect(user).toBeDefined();
|
|
264
|
+
expect(user.verified).toBe(false);
|
|
265
|
+
|
|
266
|
+
// Step 2: Extract verification token (from email mock)
|
|
267
|
+
const verificationToken = await getLastEmailToken();
|
|
268
|
+
|
|
269
|
+
// Step 3: Verify email
|
|
270
|
+
const verifyResponse = await request(app)
|
|
271
|
+
.post('/api/auth/verify')
|
|
272
|
+
.send({ token: verificationToken })
|
|
273
|
+
.expect(200);
|
|
274
|
+
|
|
275
|
+
expect(verifyResponse.body.verified).toBe(true);
|
|
276
|
+
|
|
277
|
+
// Verify database updated
|
|
278
|
+
const verifiedUser = await database
|
|
279
|
+
.getRepository(User)
|
|
280
|
+
.findOne({ where: { email: 'newuser@example.com' } });
|
|
281
|
+
|
|
282
|
+
expect(verifiedUser.verified).toBe(true);
|
|
283
|
+
|
|
284
|
+
// Step 4: Login with verified account
|
|
285
|
+
const loginResponse = await request(app)
|
|
286
|
+
.post('/api/auth/login')
|
|
287
|
+
.send({
|
|
288
|
+
email: 'newuser@example.com',
|
|
289
|
+
password: 'SecurePass123!'
|
|
290
|
+
})
|
|
291
|
+
.expect(200);
|
|
292
|
+
|
|
293
|
+
expect(loginResponse.body).toMatchObject({
|
|
294
|
+
accessToken: expect.any(String),
|
|
295
|
+
refreshToken: expect.any(String),
|
|
296
|
+
expiresIn: 3600
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// Verify JWT token is valid
|
|
300
|
+
const decoded = jwt.verify(
|
|
301
|
+
loginResponse.body.accessToken,
|
|
302
|
+
process.env.JWT_SECRET
|
|
303
|
+
);
|
|
304
|
+
expect(decoded.userId).toBe(user.id);
|
|
305
|
+
expect(decoded.email).toBe('newuser@example.com');
|
|
306
|
+
|
|
307
|
+
// Step 5: Access protected resource
|
|
308
|
+
const protectedResponse = await request(app)
|
|
309
|
+
.get('/api/users/me')
|
|
310
|
+
.set('Authorization', `Bearer ${loginResponse.body.accessToken}`)
|
|
311
|
+
.expect(200);
|
|
312
|
+
|
|
313
|
+
expect(protectedResponse.body).toMatchObject({
|
|
314
|
+
id: user.id,
|
|
315
|
+
email: 'newuser@example.com',
|
|
316
|
+
name: 'New User'
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
describe('Token Refresh Workflow', () => {
|
|
322
|
+
it('should refresh expired access token using refresh token', async () => {
|
|
323
|
+
// Setup: User already logged in with tokens
|
|
324
|
+
const { accessToken, refreshToken } = await loginUser('test@example.com');
|
|
325
|
+
|
|
326
|
+
// Simulate access token expiration (mock time)
|
|
327
|
+
jest.advanceTimersByTime(3600 * 1000); // 1 hour
|
|
328
|
+
|
|
329
|
+
// Step 1: Access protected resource with expired token
|
|
330
|
+
await request(app)
|
|
331
|
+
.get('/api/users/me')
|
|
332
|
+
.set('Authorization', `Bearer ${accessToken}`)
|
|
333
|
+
.expect(401); // Expired
|
|
334
|
+
|
|
335
|
+
// Step 2: Refresh token
|
|
336
|
+
const refreshResponse = await request(app)
|
|
337
|
+
.post('/api/auth/refresh')
|
|
338
|
+
.send({ refreshToken })
|
|
339
|
+
.expect(200);
|
|
340
|
+
|
|
341
|
+
expect(refreshResponse.body).toMatchObject({
|
|
342
|
+
accessToken: expect.any(String),
|
|
343
|
+
refreshToken: expect.any(String)
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// Step 3: Access protected resource with new token
|
|
347
|
+
const protectedResponse = await request(app)
|
|
348
|
+
.get('/api/users/me')
|
|
349
|
+
.set('Authorization', `Bearer ${refreshResponse.body.accessToken}`)
|
|
350
|
+
.expect(200);
|
|
351
|
+
|
|
352
|
+
expect(protectedResponse.body.email).toBe('test@example.com');
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### B. Transaction Workflow Tests (Catches PR #123 Bug)
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
// tests/integration/transaction.integration.test.ts
|
|
362
|
+
describe('Database Transaction Workflow', () => {
|
|
363
|
+
let adapter: DatabaseAdapter;
|
|
364
|
+
|
|
365
|
+
beforeEach(() => {
|
|
366
|
+
adapter = new PostgresAdapter(); // Or Redis, SQLite, etc.
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
describe('Transaction Rollback Workflow', () => {
|
|
370
|
+
it('should not persist data when transaction is rolled back', async () => {
|
|
371
|
+
// Step 1: Begin transaction
|
|
372
|
+
const txId = await adapter.beginTransaction();
|
|
373
|
+
expect(txId).toBeDefined();
|
|
374
|
+
|
|
375
|
+
// Step 2: Insert data within transaction
|
|
376
|
+
await adapter.insert('orders', {
|
|
377
|
+
id: 1,
|
|
378
|
+
userId: 100,
|
|
379
|
+
total: 50.00
|
|
380
|
+
}, txId);
|
|
381
|
+
|
|
382
|
+
await adapter.insert('order_items', {
|
|
383
|
+
id: 1,
|
|
384
|
+
orderId: 1,
|
|
385
|
+
productId: 200,
|
|
386
|
+
quantity: 2
|
|
387
|
+
}, txId);
|
|
388
|
+
|
|
389
|
+
// Step 3: Verify data visible within transaction
|
|
390
|
+
const orderInTx = await adapter.get('orders', 1, txId);
|
|
391
|
+
expect(orderInTx).toBeDefined();
|
|
392
|
+
expect(orderInTx.total).toBe(50.00);
|
|
393
|
+
|
|
394
|
+
// Step 4: Rollback transaction
|
|
395
|
+
await adapter.rollback(txId);
|
|
396
|
+
|
|
397
|
+
// Step 5: Verify data NOT persisted (CRITICAL TEST)
|
|
398
|
+
const orderAfterRollback = await adapter.get('orders', 1);
|
|
399
|
+
expect(orderAfterRollback).toBeNull(); // ❌ PR #123: FAILED FOR POSTGRES
|
|
400
|
+
|
|
401
|
+
const itemsAfterRollback = await adapter.query(
|
|
402
|
+
'SELECT * FROM order_items WHERE orderId = 1'
|
|
403
|
+
);
|
|
404
|
+
expect(itemsAfterRollback).toHaveLength(0);
|
|
405
|
+
|
|
406
|
+
// ✅ This test catches the transaction routing bug!
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
it('should persist data when transaction is committed', async () => {
|
|
410
|
+
// Step 1: Begin transaction
|
|
411
|
+
const txId = await adapter.beginTransaction();
|
|
412
|
+
|
|
413
|
+
// Step 2: Insert data
|
|
414
|
+
await adapter.insert('orders', {
|
|
415
|
+
id: 2,
|
|
416
|
+
userId: 100,
|
|
417
|
+
total: 75.00
|
|
418
|
+
}, txId);
|
|
419
|
+
|
|
420
|
+
// Step 3: Commit transaction
|
|
421
|
+
await adapter.commit(txId);
|
|
422
|
+
|
|
423
|
+
// Step 4: Verify data persisted
|
|
424
|
+
const order = await adapter.get('orders', 2);
|
|
425
|
+
expect(order).toBeDefined();
|
|
426
|
+
expect(order.total).toBe(75.00);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
it('should handle nested transactions correctly', async () => {
|
|
430
|
+
const outerTxId = await adapter.beginTransaction();
|
|
431
|
+
|
|
432
|
+
// Insert in outer transaction
|
|
433
|
+
await adapter.insert('users', { id: 1, name: 'Alice' }, outerTxId);
|
|
434
|
+
|
|
435
|
+
// Begin nested transaction (savepoint)
|
|
436
|
+
const innerTxId = await adapter.beginTransaction(outerTxId);
|
|
437
|
+
|
|
438
|
+
// Insert in inner transaction
|
|
439
|
+
await adapter.insert('posts', { id: 1, userId: 1, title: 'Hello' }, innerTxId);
|
|
440
|
+
|
|
441
|
+
// Rollback inner transaction only
|
|
442
|
+
await adapter.rollback(innerTxId);
|
|
443
|
+
|
|
444
|
+
// Commit outer transaction
|
|
445
|
+
await adapter.commit(outerTxId);
|
|
446
|
+
|
|
447
|
+
// Verify: User persisted, Post not persisted
|
|
448
|
+
const user = await adapter.get('users', 1);
|
|
449
|
+
expect(user).toBeDefined();
|
|
450
|
+
|
|
451
|
+
const post = await adapter.get('posts', 1);
|
|
452
|
+
expect(post).toBeNull();
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
#### C. API Integration Tests
|
|
459
|
+
|
|
460
|
+
```typescript
|
|
461
|
+
// tests/integration/api.integration.test.ts
|
|
462
|
+
describe('API Integration Tests', () => {
|
|
463
|
+
describe('CRUD Workflow', () => {
|
|
464
|
+
it('should complete full CRUD lifecycle', async () => {
|
|
465
|
+
const { accessToken } = await loginUser('admin@example.com');
|
|
466
|
+
|
|
467
|
+
// CREATE
|
|
468
|
+
const createResponse = await request(app)
|
|
469
|
+
.post('/api/products')
|
|
470
|
+
.set('Authorization', `Bearer ${accessToken}`)
|
|
471
|
+
.send({
|
|
472
|
+
name: 'Test Product',
|
|
473
|
+
price: 29.99,
|
|
474
|
+
stock: 100
|
|
475
|
+
})
|
|
476
|
+
.expect(201);
|
|
477
|
+
|
|
478
|
+
const productId = createResponse.body.id;
|
|
479
|
+
|
|
480
|
+
// READ
|
|
481
|
+
const readResponse = await request(app)
|
|
482
|
+
.get(`/api/products/${productId}`)
|
|
483
|
+
.expect(200);
|
|
484
|
+
|
|
485
|
+
expect(readResponse.body).toMatchObject({
|
|
486
|
+
id: productId,
|
|
487
|
+
name: 'Test Product',
|
|
488
|
+
price: 29.99,
|
|
489
|
+
stock: 100
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
// UPDATE
|
|
493
|
+
const updateResponse = await request(app)
|
|
494
|
+
.put(`/api/products/${productId}`)
|
|
495
|
+
.set('Authorization', `Bearer ${accessToken}`)
|
|
496
|
+
.send({
|
|
497
|
+
price: 24.99,
|
|
498
|
+
stock: 90
|
|
499
|
+
})
|
|
500
|
+
.expect(200);
|
|
501
|
+
|
|
502
|
+
expect(updateResponse.body.price).toBe(24.99);
|
|
503
|
+
|
|
504
|
+
// DELETE
|
|
505
|
+
await request(app)
|
|
506
|
+
.delete(`/api/products/${productId}`)
|
|
507
|
+
.set('Authorization', `Bearer ${accessToken}`)
|
|
508
|
+
.expect(204);
|
|
509
|
+
|
|
510
|
+
// Verify deleted
|
|
511
|
+
await request(app)
|
|
512
|
+
.get(`/api/products/${productId}`)
|
|
513
|
+
.expect(404);
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
describe('Cross-Service Integration', () => {
|
|
518
|
+
it('should orchestrate multi-service workflow', async () => {
|
|
519
|
+
// Workflow: Order placement triggers inventory update and email notification
|
|
520
|
+
|
|
521
|
+
// Step 1: Place order (Order Service)
|
|
522
|
+
const orderResponse = await request(app)
|
|
523
|
+
.post('/api/orders')
|
|
524
|
+
.send({
|
|
525
|
+
userId: 1,
|
|
526
|
+
items: [
|
|
527
|
+
{ productId: 100, quantity: 2 },
|
|
528
|
+
{ productId: 101, quantity: 1 }
|
|
529
|
+
]
|
|
530
|
+
})
|
|
531
|
+
.expect(201);
|
|
532
|
+
|
|
533
|
+
const orderId = orderResponse.body.id;
|
|
534
|
+
|
|
535
|
+
// Step 2: Verify inventory decreased (Inventory Service)
|
|
536
|
+
const product100 = await request(app)
|
|
537
|
+
.get('/api/inventory/products/100')
|
|
538
|
+
.expect(200);
|
|
539
|
+
|
|
540
|
+
expect(product100.body.stock).toBe(98); // 100 - 2
|
|
541
|
+
|
|
542
|
+
// Step 3: Verify email sent (Email Service mock)
|
|
543
|
+
const emails = await getEmailsSent();
|
|
544
|
+
const orderEmail = emails.find(e =>
|
|
545
|
+
e.to === 'user1@example.com' &&
|
|
546
|
+
e.subject.includes('Order Confirmation')
|
|
547
|
+
);
|
|
548
|
+
|
|
549
|
+
expect(orderEmail).toBeDefined();
|
|
550
|
+
expect(orderEmail.body).toContain(`Order #${orderId}`);
|
|
551
|
+
|
|
552
|
+
// Step 4: Verify order status updated (Order Service)
|
|
553
|
+
const orderStatus = await request(app)
|
|
554
|
+
.get(`/api/orders/${orderId}`)
|
|
555
|
+
.expect(200);
|
|
556
|
+
|
|
557
|
+
expect(orderStatus.body.status).toBe('processing');
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
### Phase 4: Data Consistency Validation (10-15 min)
|
|
566
|
+
|
|
567
|
+
```typescript
|
|
568
|
+
// tests/integration/data-consistency.test.ts
|
|
569
|
+
describe('Data Consistency Validation', () => {
|
|
570
|
+
it('should maintain referential integrity across tables', async () => {
|
|
571
|
+
// Create user with posts and comments
|
|
572
|
+
const user = await database.getRepository(User).save({
|
|
573
|
+
email: 'test@example.com',
|
|
574
|
+
name: 'Test User'
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
const post = await database.getRepository(Post).save({
|
|
578
|
+
userId: user.id,
|
|
579
|
+
title: 'Test Post',
|
|
580
|
+
content: 'Content'
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
const comment = await database.getRepository(Comment).save({
|
|
584
|
+
postId: post.id,
|
|
585
|
+
userId: user.id,
|
|
586
|
+
text: 'Great post!'
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
// Delete user (should cascade delete posts and comments)
|
|
590
|
+
await database.getRepository(User).delete(user.id);
|
|
591
|
+
|
|
592
|
+
// Verify cascade deletion
|
|
593
|
+
const postExists = await database.getRepository(Post).findOne({
|
|
594
|
+
where: { id: post.id }
|
|
595
|
+
});
|
|
596
|
+
expect(postExists).toBeNull();
|
|
597
|
+
|
|
598
|
+
const commentExists = await database.getRepository(Comment).findOne({
|
|
599
|
+
where: { id: comment.id }
|
|
600
|
+
});
|
|
601
|
+
expect(commentExists).toBeNull();
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
it('should prevent orphaned records', async () => {
|
|
605
|
+
// Attempt to create comment without valid post
|
|
606
|
+
await expect(
|
|
607
|
+
database.getRepository(Comment).save({
|
|
608
|
+
postId: 99999, // Non-existent post
|
|
609
|
+
userId: 1,
|
|
610
|
+
text: 'Comment'
|
|
611
|
+
})
|
|
612
|
+
).rejects.toThrow('foreign key constraint');
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it('should handle concurrent updates correctly', async () => {
|
|
616
|
+
// Create account with balance
|
|
617
|
+
const account = await database.getRepository(Account).save({
|
|
618
|
+
userId: 1,
|
|
619
|
+
balance: 100.00
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
// Simulate concurrent withdrawals
|
|
623
|
+
const withdrawal1 = adapter.update('accounts', account.id, {
|
|
624
|
+
balance: 100.00 - 60.00
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
const withdrawal2 = adapter.update('accounts', account.id, {
|
|
628
|
+
balance: 100.00 - 50.00
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
await Promise.all([withdrawal1, withdrawal2]);
|
|
632
|
+
|
|
633
|
+
// Verify final balance (optimistic locking should prevent double-spend)
|
|
634
|
+
const finalAccount = await database.getRepository(Account).findOne({
|
|
635
|
+
where: { id: account.id }
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
// One transaction should succeed, one should fail
|
|
639
|
+
expect(finalAccount.balance).toBeOneOf([40.00, 50.00]);
|
|
640
|
+
// NOT 100 - 60 - 50 = -10 (double-spend bug)
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
## Validation Checklist
|
|
648
|
+
|
|
649
|
+
### ✅ Workflow Coverage
|
|
650
|
+
|
|
651
|
+
- [ ] All critical user workflows tested end-to-end
|
|
652
|
+
- [ ] Happy path scenarios pass (100% required)
|
|
653
|
+
- [ ] Error handling workflows tested
|
|
654
|
+
- [ ] Edge case workflows validated
|
|
655
|
+
|
|
656
|
+
### ✅ Data Integrity
|
|
657
|
+
|
|
658
|
+
- [ ] Database transactions atomic and consistent
|
|
659
|
+
- [ ] Referential integrity maintained
|
|
660
|
+
- [ ] No orphaned records
|
|
661
|
+
- [ ] Cascade operations work correctly
|
|
662
|
+
|
|
663
|
+
### ✅ Service Integration
|
|
664
|
+
|
|
665
|
+
- [ ] Cross-service calls succeed
|
|
666
|
+
- [ ] Service orchestration works correctly
|
|
667
|
+
- [ ] External dependencies mocked or stubbed appropriately
|
|
668
|
+
- [ ] Timeouts and retries configured
|
|
669
|
+
|
|
670
|
+
### ✅ Performance
|
|
671
|
+
|
|
672
|
+
- [ ] Integration tests complete within reasonable time (<5 min)
|
|
673
|
+
- [ ] No N+1 query problems
|
|
674
|
+
- [ ] Database indexes effective
|
|
675
|
+
- [ ] Connection pooling working
|
|
676
|
+
|
|
677
|
+
---
|
|
678
|
+
|
|
679
|
+
## Loop 2 Consensus Reporting
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
#!/bin/bash
|
|
683
|
+
# integration-tester completion
|
|
684
|
+
|
|
685
|
+
# Run integration test suite
|
|
686
|
+
npm run test:integration > /tmp/integration-test-output.txt 2>&1
|
|
687
|
+
EXIT_CODE=$?
|
|
688
|
+
|
|
689
|
+
# Parse results
|
|
690
|
+
TOTAL_TESTS=$(grep -oP 'Tests:\s+\K\d+' /tmp/integration-test-output.txt)
|
|
691
|
+
PASSED_TESTS=$(grep -oP '✓\s+\K\d+' /tmp/integration-test-output.txt)
|
|
692
|
+
FAILED_TESTS=$(grep -oP '✗\s+\K\d+' /tmp/integration-test-output.txt)
|
|
693
|
+
|
|
694
|
+
PASS_RATE=$(echo "scale=2; $PASSED_TESTS / $TOTAL_TESTS" | bc)
|
|
695
|
+
|
|
696
|
+
# Report to Redis
|
|
697
|
+
redis-cli HSET "swarm:${TASK_ID}:loop2-test-results" \
|
|
698
|
+
"integration_tests_passed" "$([[ $EXIT_CODE -eq 0 ]] && echo 'true' || echo 'false')" \
|
|
699
|
+
"integration_pass_rate" "$PASS_RATE" \
|
|
700
|
+
"total_integration_tests" "$TOTAL_TESTS" \
|
|
701
|
+
"passed_integration_tests" "$PASSED_TESTS" \
|
|
702
|
+
"failed_integration_tests" "$FAILED_TESTS"
|
|
703
|
+
|
|
704
|
+
# Calculate consensus (factor in criticality)
|
|
705
|
+
CRITICAL_WORKFLOWS_PASSED=$(grep -c "✓.*CRITICAL" /tmp/integration-test-output.txt)
|
|
706
|
+
CRITICAL_WORKFLOWS_TOTAL=$(grep -c "CRITICAL" /tmp/integration-test-output.txt)
|
|
707
|
+
|
|
708
|
+
if [[ $CRITICAL_WORKFLOWS_PASSED -eq $CRITICAL_WORKFLOWS_TOTAL ]]; then
|
|
709
|
+
# All critical workflows pass - high consensus
|
|
710
|
+
CONSENSUS="0.95"
|
|
711
|
+
else
|
|
712
|
+
# Critical workflow failures - low consensus
|
|
713
|
+
CONSENSUS="0.30"
|
|
714
|
+
fi
|
|
715
|
+
|
|
716
|
+
redis-cli HSET "swarm:${TASK_ID}:loop2-consensus" \
|
|
717
|
+
"integration-tester" "$CONSENSUS"
|
|
718
|
+
|
|
719
|
+
echo "Integration Test Summary:"
|
|
720
|
+
echo " Total Tests: $TOTAL_TESTS"
|
|
721
|
+
echo " Passed: $PASSED_TESTS"
|
|
722
|
+
echo " Failed: $FAILED_TESTS"
|
|
723
|
+
echo " Pass Rate: $PASS_RATE"
|
|
724
|
+
echo " Consensus: $CONSENSUS"
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
---
|
|
728
|
+
|
|
729
|
+
## Common Integration Testing Patterns
|
|
730
|
+
|
|
731
|
+
### Pattern 1: Arrange-Act-Assert-Cleanup
|
|
732
|
+
|
|
733
|
+
```typescript
|
|
734
|
+
describe('Integration Test', () => {
|
|
735
|
+
it('should complete workflow', async () => {
|
|
736
|
+
// ARRANGE: Set up test data
|
|
737
|
+
const user = await createTestUser();
|
|
738
|
+
const product = await createTestProduct();
|
|
739
|
+
|
|
740
|
+
// ACT: Execute workflow
|
|
741
|
+
const order = await placeOrder(user.id, [product.id]);
|
|
742
|
+
|
|
743
|
+
// ASSERT: Verify outcomes
|
|
744
|
+
expect(order.status).toBe('processing');
|
|
745
|
+
expect(product.stock).toBe(initialStock - 1);
|
|
746
|
+
|
|
747
|
+
// CLEANUP: Remove test data
|
|
748
|
+
await deleteOrder(order.id);
|
|
749
|
+
await deleteProduct(product.id);
|
|
750
|
+
await deleteUser(user.id);
|
|
751
|
+
});
|
|
752
|
+
});
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
### Pattern 2: Test Fixtures
|
|
756
|
+
|
|
757
|
+
```typescript
|
|
758
|
+
// tests/fixtures/users.ts
|
|
759
|
+
export const testUsers = {
|
|
760
|
+
admin: {
|
|
761
|
+
email: 'admin@example.com',
|
|
762
|
+
role: 'admin',
|
|
763
|
+
password: 'AdminPass123!'
|
|
764
|
+
},
|
|
765
|
+
regular: {
|
|
766
|
+
email: 'user@example.com',
|
|
767
|
+
role: 'user',
|
|
768
|
+
password: 'UserPass123!'
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
// tests/integration/test.ts
|
|
773
|
+
beforeEach(async () => {
|
|
774
|
+
await database.seed(testUsers.admin);
|
|
775
|
+
await database.seed(testUsers.regular);
|
|
776
|
+
});
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### Pattern 3: Test Containers
|
|
780
|
+
|
|
781
|
+
```typescript
|
|
782
|
+
// Use testcontainers for real database
|
|
783
|
+
import { PostgreSqlContainer } from 'testcontainers';
|
|
784
|
+
|
|
785
|
+
let container: StartedPostgreSqlContainer;
|
|
786
|
+
|
|
787
|
+
beforeAll(async () => {
|
|
788
|
+
container = await new PostgreSqlContainer()
|
|
789
|
+
.withDatabase('testdb')
|
|
790
|
+
.start();
|
|
791
|
+
|
|
792
|
+
// Connect to containerized database
|
|
793
|
+
await database.connect(container.getConnectionUri());
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
afterAll(async () => {
|
|
797
|
+
await database.disconnect();
|
|
798
|
+
await container.stop();
|
|
799
|
+
});
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
---
|
|
803
|
+
|
|
804
|
+
## Success Metrics
|
|
805
|
+
|
|
806
|
+
**Integration Test Quality:**
|
|
807
|
+
- ✅ 90%+ workflow coverage (all critical paths tested)
|
|
808
|
+
- ✅ 100% critical workflow pass rate
|
|
809
|
+
- ✅ <5 min execution time
|
|
810
|
+
- ✅ Zero data consistency issues
|
|
811
|
+
|
|
812
|
+
**Loop 2 Contribution:**
|
|
813
|
+
- ✅ Catches architectural bugs (transaction routing, etc.)
|
|
814
|
+
- ✅ Validates cross-component interactions
|
|
815
|
+
- ✅ Ensures data integrity
|
|
816
|
+
- ✅ Verifies real-world workflows
|
|
817
|
+
|
|
818
|
+
**Expected Consensus Score:**
|
|
819
|
+
- Excellent: 0.95-1.0 (all workflows pass, no issues)
|
|
820
|
+
- Good: 0.85-0.95 (minor issues, non-critical)
|
|
821
|
+
- Poor: <0.85 (workflow failures, data issues)
|
|
822
|
+
- Critical: <0.5 (critical workflow failures, transaction bugs)
|
|
823
|
+
|
|
824
|
+
**Bug Prevention Examples:**
|
|
825
|
+
- ✅ **PR #123 Bug**: Transaction rollback test would catch persistence bug
|
|
826
|
+
- ✅ **Race Conditions**: Concurrent update tests catch double-spend bugs
|
|
827
|
+
- ✅ **Cascade Deletion**: Referential integrity tests catch orphaned records
|
|
828
|
+
- ✅ **Cross-Service**: Orchestration tests catch integration breaks
|