claude-flow-novice 2.14.14 → 2.14.15
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/commands/cfn-loop-cli.md +45 -122
- package/claude-assets/commands/cfn-loop-cli.md +45 -122
- package/claude-assets/skills/cfn-multi-coordinator-planning/map-dependencies-conflicts.sh +375 -375
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-coordinator-resources.sh +257 -257
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-multi-coordinator-work.sh +266 -266
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-risk-rollout.sh +349 -349
- package/claude-assets/skills/cfn-multi-coordinator-planning/test-multi-coordinator-planning.sh +337 -337
- package/claude-assets/skills/cfn-multi-coordinator-planning/validate-task-planning.sh +188 -188
- package/package.json +1 -1
package/claude-assets/skills/cfn-multi-coordinator-planning/test-multi-coordinator-planning.sh
CHANGED
|
@@ -1,338 +1,338 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
set -euo pipefail
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
-
|
|
7
|
-
# Colors
|
|
8
|
-
RED='\033[0;31m'
|
|
9
|
-
GREEN='\033[0;32m'
|
|
10
|
-
YELLOW='\033[1;33m'
|
|
11
|
-
BLUE='\033[0;34m'
|
|
12
|
-
NC='\033[0m'
|
|
13
|
-
|
|
14
|
-
log() {
|
|
15
|
-
echo -e "${GREEN}[TEST:$(date '+%H:%M:%S')] $1${NC}"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
warn() {
|
|
19
|
-
echo -e "${YELLOW}[TEST:$(date '+%H:%M:%S')] WARNING: $1${NC}"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
error() {
|
|
23
|
-
echo -e "${RED}[TEST:$(date '+%H:%M:%S')] ERROR: $1${NC}"
|
|
24
|
-
return 1
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
info() {
|
|
28
|
-
echo -e "${BLUE}[TEST:$(date '+%H:%M:%S')] INFO: $1${NC}"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
# Test counters
|
|
32
|
-
TESTS_RUN=0
|
|
33
|
-
TESTS_PASSED=0
|
|
34
|
-
TESTS_FAILED=0
|
|
35
|
-
|
|
36
|
-
run_test() {
|
|
37
|
-
local test_name="$1"
|
|
38
|
-
local test_command="$2"
|
|
39
|
-
|
|
40
|
-
((TESTS_RUN++))
|
|
41
|
-
log "Running test: $test_name"
|
|
42
|
-
|
|
43
|
-
if eval "$test_command"; then
|
|
44
|
-
((TESTS_PASSED++))
|
|
45
|
-
log "✓ PASSED: $test_name"
|
|
46
|
-
else
|
|
47
|
-
((TESTS_FAILED++))
|
|
48
|
-
error "✗ FAILED: $test_name"
|
|
49
|
-
fi
|
|
50
|
-
echo
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
create_test_zone_config() {
|
|
54
|
-
local test_config="/tmp/test-zones-config-$(date '+%s').json"
|
|
55
|
-
|
|
56
|
-
cat > "$test_config" << 'EOF'
|
|
57
|
-
{
|
|
58
|
-
"zones": [
|
|
59
|
-
{
|
|
60
|
-
"name": "zone-alpha",
|
|
61
|
-
"task_description": "Implement React authentication component with TypeScript interfaces and comprehensive error handling",
|
|
62
|
-
"deliverables": [
|
|
63
|
-
"src/components/AuthForm.tsx",
|
|
64
|
-
"src/types/auth.ts",
|
|
65
|
-
"src/hooks/useAuth.ts",
|
|
66
|
-
"src/services/authService.ts",
|
|
67
|
-
"tests/auth.test.ts"
|
|
68
|
-
],
|
|
69
|
-
"agent_types": ["react-frontend-engineer", "reviewer", "tester"],
|
|
70
|
-
"acceptance_criteria": [
|
|
71
|
-
"Form validates user input",
|
|
72
|
-
"Authentication state managed globally",
|
|
73
|
-
"Error handling for network failures",
|
|
74
|
-
"Component tested with >80% coverage"
|
|
75
|
-
],
|
|
76
|
-
"in_scope": ["React components", "TypeScript interfaces", "State management"],
|
|
77
|
-
"out_of_scope": ["Backend authentication", "Database integration"],
|
|
78
|
-
"directory": "src/auth",
|
|
79
|
-
"risk_factors": ["external_dependencies", "complex_state_management"]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"name": "zone-beta",
|
|
83
|
-
"task_description": "Create REST API endpoints for user management with comprehensive validation",
|
|
84
|
-
"deliverables": [
|
|
85
|
-
"src/api/users.ts",
|
|
86
|
-
"src/middleware/validation.ts",
|
|
87
|
-
"src/types/user.ts",
|
|
88
|
-
"tests/users.test.ts"
|
|
89
|
-
],
|
|
90
|
-
"agent_types": ["backend-developer", "reviewer"],
|
|
91
|
-
"acceptance_criteria": [
|
|
92
|
-
"CRUD operations implemented",
|
|
93
|
-
"Input validation on all endpoints",
|
|
94
|
-
"Error responses standardized",
|
|
95
|
-
"API documentation generated"
|
|
96
|
-
],
|
|
97
|
-
"in_scope": ["REST API", "Validation middleware", "TypeScript types"],
|
|
98
|
-
"out_of_scope": ["Database queries", "Authentication"],
|
|
99
|
-
"directory": "src/api"
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
EOF
|
|
104
|
-
|
|
105
|
-
echo "$test_config"
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
test_task_validation() {
|
|
109
|
-
local test_config
|
|
110
|
-
test_config=$(create_test_zone_config)
|
|
111
|
-
|
|
112
|
-
# Test valid configuration
|
|
113
|
-
if "$SCRIPT_DIR/validate-task-planning.sh" "$test_config" >/dev/null 2>&1; then
|
|
114
|
-
rm -f "$test_config" "/tmp/validated-task-$(basename "$test_config")"
|
|
115
|
-
return 0
|
|
116
|
-
else
|
|
117
|
-
rm -f "$test_config" "/tmp/validated-task-$(basename "$test_config")"
|
|
118
|
-
return 1
|
|
119
|
-
fi
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
test_task_validation_failures() {
|
|
123
|
-
# Test invalid configuration (generic task)
|
|
124
|
-
local invalid_config="/tmp/invalid-zones-config-$(date '+%s').json"
|
|
125
|
-
|
|
126
|
-
cat > "$invalid_config" << 'EOF'
|
|
127
|
-
{
|
|
128
|
-
"zones": [
|
|
129
|
-
{
|
|
130
|
-
"name": "zone-bad",
|
|
131
|
-
"task_description": "CFN Loop implementation",
|
|
132
|
-
"deliverables": ["implementation"],
|
|
133
|
-
"agent_types": ["backend-developer"]
|
|
134
|
-
}
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
EOF
|
|
138
|
-
|
|
139
|
-
local result=0
|
|
140
|
-
if "$SCRIPT_DIR/validate-task-planning.sh" "$invalid_config" >/dev/null 2>&1; then
|
|
141
|
-
result=1 # Should have failed
|
|
142
|
-
else
|
|
143
|
-
result=0 # Correctly failed
|
|
144
|
-
fi
|
|
145
|
-
|
|
146
|
-
rm -f "$invalid_config"
|
|
147
|
-
return $result
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
test_resource_planning() {
|
|
151
|
-
local test_config
|
|
152
|
-
test_config=$(create_test_zone_config)
|
|
153
|
-
|
|
154
|
-
# Test resource planning
|
|
155
|
-
if "$SCRIPT_DIR/plan-coordinator-resources.sh" "$test_config" >/dev/null 2>&1; then
|
|
156
|
-
# Check if resource plan file was created
|
|
157
|
-
local plan_files
|
|
158
|
-
plan_files=$(find /tmp -name "coordinator-resource-plan-*.json" -type f | wc -l)
|
|
159
|
-
rm -f "$test_config"
|
|
160
|
-
[[ $plan_files -gt 0 ]]
|
|
161
|
-
else
|
|
162
|
-
rm -f "$test_config"
|
|
163
|
-
return 1
|
|
164
|
-
fi
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
test_dependency_analysis() {
|
|
168
|
-
local test_config
|
|
169
|
-
test_config=$(create_test_zone_config)
|
|
170
|
-
|
|
171
|
-
# Test dependency analysis
|
|
172
|
-
if "$SCRIPT_DIR/map-dependencies-conflicts.sh" "$test_config" >/dev/null 2>&1; then
|
|
173
|
-
# Check if analysis file was created
|
|
174
|
-
local analysis_files
|
|
175
|
-
analysis_files=$(find /tmp -name "dependency-conflict-analysis-*.json" -type f | wc -l)
|
|
176
|
-
rm -f "$test_config"
|
|
177
|
-
[[ $analysis_files -gt 0 ]]
|
|
178
|
-
else
|
|
179
|
-
rm -f "$test_config"
|
|
180
|
-
return 1
|
|
181
|
-
fi
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
test_rollout_planning() {
|
|
185
|
-
local test_config
|
|
186
|
-
test_config=$(create_test_zone_config)
|
|
187
|
-
|
|
188
|
-
# Test rollout planning
|
|
189
|
-
if "$SCRIPT_DIR/plan-risk-rollout.sh" "$test_config" 2 >/dev/null; then
|
|
190
|
-
# Check if rollout plan file was created
|
|
191
|
-
local rollout_files
|
|
192
|
-
rollout_files=$(find /tmp -name "rollout-plan-*.json" -type f | wc -l)
|
|
193
|
-
rm -f "$test_config"
|
|
194
|
-
[[ $rollout_files -gt 0 ]]
|
|
195
|
-
else
|
|
196
|
-
rm -f "$test_config"
|
|
197
|
-
return 1
|
|
198
|
-
fi
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
test_end_to_end_planning() {
|
|
202
|
-
local test_config
|
|
203
|
-
test_config=$(create_test_zone_config)
|
|
204
|
-
|
|
205
|
-
# Test end-to-end planning
|
|
206
|
-
if "$SCRIPT_DIR/plan-multi-coordinator-work.sh" "$test_config" --dry-run >/dev/null 2>&1; then
|
|
207
|
-
# Check if summary file was created
|
|
208
|
-
local summary_files
|
|
209
|
-
summary_files=$(find /tmp -name "multi-coordinator-planning-summary-*.json" -type f | wc -l)
|
|
210
|
-
rm -f "$test_config"
|
|
211
|
-
[[ $summary_files -gt 0 ]]
|
|
212
|
-
else
|
|
213
|
-
rm -f "$test_config"
|
|
214
|
-
return 1
|
|
215
|
-
fi
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
test_redis_connectivity() {
|
|
219
|
-
# Test Redis connectivity (required for namespace planning)
|
|
220
|
-
if redis-cli ping >/dev/null 2>&1; then
|
|
221
|
-
return 0
|
|
222
|
-
else
|
|
223
|
-
warn "Redis not available - skipping Redis-dependent tests"
|
|
224
|
-
return 0 # Don't fail test suite, just warn
|
|
225
|
-
fi
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
test_jq_availability() {
|
|
229
|
-
# Test jq availability (required for JSON processing)
|
|
230
|
-
if command -v jq >/dev/null 2>&1; then
|
|
231
|
-
return 0
|
|
232
|
-
else
|
|
233
|
-
return 1
|
|
234
|
-
fi
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
test_zone_config_json_validation() {
|
|
238
|
-
local test_config
|
|
239
|
-
test_config=$(create_test_zone_config)
|
|
240
|
-
|
|
241
|
-
# Test if the generated config is valid JSON
|
|
242
|
-
if jq . "$test_config" >/dev/null 2>&1; then
|
|
243
|
-
rm -f "$test_config"
|
|
244
|
-
return 0
|
|
245
|
-
else
|
|
246
|
-
rm -f "$test_config"
|
|
247
|
-
return 1
|
|
248
|
-
fi
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
test_complexity_scoring() {
|
|
252
|
-
# Test complexity scoring algorithm
|
|
253
|
-
local simple_zone="/tmp/simple-zone-$(date '+%s').json"
|
|
254
|
-
cat > "$simple_zone" << 'EOF'
|
|
255
|
-
{
|
|
256
|
-
"zones": [
|
|
257
|
-
{
|
|
258
|
-
"name": "simple-zone",
|
|
259
|
-
"task_description": "Simple task",
|
|
260
|
-
"deliverables": ["file1.ts"],
|
|
261
|
-
"agent_types": ["developer"]
|
|
262
|
-
}
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
EOF
|
|
266
|
-
|
|
267
|
-
local complex_zone="/tmp/complex-zone-$(date '+%s').json"
|
|
268
|
-
cat > "$complex_zone" << 'EOF'
|
|
269
|
-
{
|
|
270
|
-
"zones": [
|
|
271
|
-
{
|
|
272
|
-
"name": "complex-zone",
|
|
273
|
-
"task_description": "This is a very complex task that requires multiple implementation steps and comprehensive testing strategies with many different components working together",
|
|
274
|
-
"deliverables": ["file1.ts", "file2.ts", "file3.ts", "file4.ts", "file5.ts"],
|
|
275
|
-
"agent_types": ["developer", "reviewer", "tester", "architect"],
|
|
276
|
-
"acceptance_criteria": ["criteria1", "criteria2", "criteria3"],
|
|
277
|
-
"risk_factors": ["risk1", "risk2"]
|
|
278
|
-
}
|
|
279
|
-
]
|
|
280
|
-
}
|
|
281
|
-
EOF
|
|
282
|
-
|
|
283
|
-
# Both should be valid JSON
|
|
284
|
-
local result=0
|
|
285
|
-
if ! jq . "$simple_zone" >/dev/null 2>&1 || ! jq . "$complex_zone" >/dev/null 2>&1; then
|
|
286
|
-
result=1
|
|
287
|
-
fi
|
|
288
|
-
|
|
289
|
-
rm -f "$simple_zone" "$complex_zone"
|
|
290
|
-
return $result
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
cleanup_test_artifacts() {
|
|
294
|
-
# Clean up any test files
|
|
295
|
-
find /tmp -name "test-*.json" -type f -delete 2>/dev/null || true
|
|
296
|
-
find /tmp -name "coordinator-resource-plan-*.json" -type f -delete 2>/dev/null || true
|
|
297
|
-
find /tmp -name "dependency-conflict-analysis-*.json" -type f -delete 2>/dev/null || true
|
|
298
|
-
find /tmp -name "rollout-plan-*.json" -type f -delete 2>/dev/null || true
|
|
299
|
-
find /tmp -name "multi-coordinator-planning-summary-*.json" -type f -delete 2>/dev/null || true
|
|
300
|
-
find /tmp -name "validated-task-*" -type f -delete 2>/dev/null || true
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
main() {
|
|
304
|
-
log "Starting multi-coordinator planning test suite"
|
|
305
|
-
|
|
306
|
-
# Setup cleanup trap
|
|
307
|
-
trap cleanup_test_artifacts EXIT
|
|
308
|
-
|
|
309
|
-
# Run individual tests
|
|
310
|
-
run_test "jq availability" "test_jq_availability"
|
|
311
|
-
run_test "Redis connectivity" "test_redis_connectivity"
|
|
312
|
-
run_test "Zone config JSON validation" "test_zone_config_json_validation"
|
|
313
|
-
run_test "Task validation (valid config)" "test_task_validation"
|
|
314
|
-
run_test "Task validation (invalid config rejection)" "test_task_validation_failures"
|
|
315
|
-
run_test "Resource planning" "test_resource_planning"
|
|
316
|
-
run_test "Dependency analysis" "test_dependency_analysis"
|
|
317
|
-
run_test "Rollout planning" "test_rollout_planning"
|
|
318
|
-
run_test "Complexity scoring" "test_complexity_scoring"
|
|
319
|
-
run_test "End-to-end planning" "test_end_to_end_planning"
|
|
320
|
-
|
|
321
|
-
# Display test results
|
|
322
|
-
echo
|
|
323
|
-
info "=== Test Results ==="
|
|
324
|
-
echo "Tests run: $TESTS_RUN"
|
|
325
|
-
echo "Tests passed: $TESTS_PASSED"
|
|
326
|
-
echo "Tests failed: $TESTS_FAILED"
|
|
327
|
-
|
|
328
|
-
if [[ $TESTS_FAILED -eq 0 ]]; then
|
|
329
|
-
log "✅ All tests passed successfully!"
|
|
330
|
-
exit 0
|
|
331
|
-
else
|
|
332
|
-
error "❌ $TESTS_FAILED test(s) failed"
|
|
333
|
-
exit 1
|
|
334
|
-
fi
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
# Execute main function
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
|
|
7
|
+
# Colors
|
|
8
|
+
RED='\033[0;31m'
|
|
9
|
+
GREEN='\033[0;32m'
|
|
10
|
+
YELLOW='\033[1;33m'
|
|
11
|
+
BLUE='\033[0;34m'
|
|
12
|
+
NC='\033[0m'
|
|
13
|
+
|
|
14
|
+
log() {
|
|
15
|
+
echo -e "${GREEN}[TEST:$(date '+%H:%M:%S')] $1${NC}"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
warn() {
|
|
19
|
+
echo -e "${YELLOW}[TEST:$(date '+%H:%M:%S')] WARNING: $1${NC}"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
error() {
|
|
23
|
+
echo -e "${RED}[TEST:$(date '+%H:%M:%S')] ERROR: $1${NC}"
|
|
24
|
+
return 1
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
info() {
|
|
28
|
+
echo -e "${BLUE}[TEST:$(date '+%H:%M:%S')] INFO: $1${NC}"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Test counters
|
|
32
|
+
TESTS_RUN=0
|
|
33
|
+
TESTS_PASSED=0
|
|
34
|
+
TESTS_FAILED=0
|
|
35
|
+
|
|
36
|
+
run_test() {
|
|
37
|
+
local test_name="$1"
|
|
38
|
+
local test_command="$2"
|
|
39
|
+
|
|
40
|
+
((TESTS_RUN++))
|
|
41
|
+
log "Running test: $test_name"
|
|
42
|
+
|
|
43
|
+
if eval "$test_command"; then
|
|
44
|
+
((TESTS_PASSED++))
|
|
45
|
+
log "✓ PASSED: $test_name"
|
|
46
|
+
else
|
|
47
|
+
((TESTS_FAILED++))
|
|
48
|
+
error "✗ FAILED: $test_name"
|
|
49
|
+
fi
|
|
50
|
+
echo
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
create_test_zone_config() {
|
|
54
|
+
local test_config="/tmp/test-zones-config-$(date '+%s').json"
|
|
55
|
+
|
|
56
|
+
cat > "$test_config" << 'EOF'
|
|
57
|
+
{
|
|
58
|
+
"zones": [
|
|
59
|
+
{
|
|
60
|
+
"name": "zone-alpha",
|
|
61
|
+
"task_description": "Implement React authentication component with TypeScript interfaces and comprehensive error handling",
|
|
62
|
+
"deliverables": [
|
|
63
|
+
"src/components/AuthForm.tsx",
|
|
64
|
+
"src/types/auth.ts",
|
|
65
|
+
"src/hooks/useAuth.ts",
|
|
66
|
+
"src/services/authService.ts",
|
|
67
|
+
"tests/auth.test.ts"
|
|
68
|
+
],
|
|
69
|
+
"agent_types": ["react-frontend-engineer", "reviewer", "tester"],
|
|
70
|
+
"acceptance_criteria": [
|
|
71
|
+
"Form validates user input",
|
|
72
|
+
"Authentication state managed globally",
|
|
73
|
+
"Error handling for network failures",
|
|
74
|
+
"Component tested with >80% coverage"
|
|
75
|
+
],
|
|
76
|
+
"in_scope": ["React components", "TypeScript interfaces", "State management"],
|
|
77
|
+
"out_of_scope": ["Backend authentication", "Database integration"],
|
|
78
|
+
"directory": "src/auth",
|
|
79
|
+
"risk_factors": ["external_dependencies", "complex_state_management"]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "zone-beta",
|
|
83
|
+
"task_description": "Create REST API endpoints for user management with comprehensive validation",
|
|
84
|
+
"deliverables": [
|
|
85
|
+
"src/api/users.ts",
|
|
86
|
+
"src/middleware/validation.ts",
|
|
87
|
+
"src/types/user.ts",
|
|
88
|
+
"tests/users.test.ts"
|
|
89
|
+
],
|
|
90
|
+
"agent_types": ["backend-developer", "reviewer"],
|
|
91
|
+
"acceptance_criteria": [
|
|
92
|
+
"CRUD operations implemented",
|
|
93
|
+
"Input validation on all endpoints",
|
|
94
|
+
"Error responses standardized",
|
|
95
|
+
"API documentation generated"
|
|
96
|
+
],
|
|
97
|
+
"in_scope": ["REST API", "Validation middleware", "TypeScript types"],
|
|
98
|
+
"out_of_scope": ["Database queries", "Authentication"],
|
|
99
|
+
"directory": "src/api"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
EOF
|
|
104
|
+
|
|
105
|
+
echo "$test_config"
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
test_task_validation() {
|
|
109
|
+
local test_config
|
|
110
|
+
test_config=$(create_test_zone_config)
|
|
111
|
+
|
|
112
|
+
# Test valid configuration
|
|
113
|
+
if "$SCRIPT_DIR/validate-task-planning.sh" "$test_config" >/dev/null 2>&1; then
|
|
114
|
+
rm -f "$test_config" "/tmp/validated-task-$(basename "$test_config")"
|
|
115
|
+
return 0
|
|
116
|
+
else
|
|
117
|
+
rm -f "$test_config" "/tmp/validated-task-$(basename "$test_config")"
|
|
118
|
+
return 1
|
|
119
|
+
fi
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
test_task_validation_failures() {
|
|
123
|
+
# Test invalid configuration (generic task)
|
|
124
|
+
local invalid_config="/tmp/invalid-zones-config-$(date '+%s').json"
|
|
125
|
+
|
|
126
|
+
cat > "$invalid_config" << 'EOF'
|
|
127
|
+
{
|
|
128
|
+
"zones": [
|
|
129
|
+
{
|
|
130
|
+
"name": "zone-bad",
|
|
131
|
+
"task_description": "CFN Loop implementation",
|
|
132
|
+
"deliverables": ["implementation"],
|
|
133
|
+
"agent_types": ["backend-developer"]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
EOF
|
|
138
|
+
|
|
139
|
+
local result=0
|
|
140
|
+
if "$SCRIPT_DIR/validate-task-planning.sh" "$invalid_config" >/dev/null 2>&1; then
|
|
141
|
+
result=1 # Should have failed
|
|
142
|
+
else
|
|
143
|
+
result=0 # Correctly failed
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
rm -f "$invalid_config"
|
|
147
|
+
return $result
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
test_resource_planning() {
|
|
151
|
+
local test_config
|
|
152
|
+
test_config=$(create_test_zone_config)
|
|
153
|
+
|
|
154
|
+
# Test resource planning
|
|
155
|
+
if "$SCRIPT_DIR/plan-coordinator-resources.sh" "$test_config" >/dev/null 2>&1; then
|
|
156
|
+
# Check if resource plan file was created
|
|
157
|
+
local plan_files
|
|
158
|
+
plan_files=$(find /tmp -name "coordinator-resource-plan-*.json" -type f | wc -l)
|
|
159
|
+
rm -f "$test_config"
|
|
160
|
+
[[ $plan_files -gt 0 ]]
|
|
161
|
+
else
|
|
162
|
+
rm -f "$test_config"
|
|
163
|
+
return 1
|
|
164
|
+
fi
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
test_dependency_analysis() {
|
|
168
|
+
local test_config
|
|
169
|
+
test_config=$(create_test_zone_config)
|
|
170
|
+
|
|
171
|
+
# Test dependency analysis
|
|
172
|
+
if "$SCRIPT_DIR/map-dependencies-conflicts.sh" "$test_config" >/dev/null 2>&1; then
|
|
173
|
+
# Check if analysis file was created
|
|
174
|
+
local analysis_files
|
|
175
|
+
analysis_files=$(find /tmp -name "dependency-conflict-analysis-*.json" -type f | wc -l)
|
|
176
|
+
rm -f "$test_config"
|
|
177
|
+
[[ $analysis_files -gt 0 ]]
|
|
178
|
+
else
|
|
179
|
+
rm -f "$test_config"
|
|
180
|
+
return 1
|
|
181
|
+
fi
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
test_rollout_planning() {
|
|
185
|
+
local test_config
|
|
186
|
+
test_config=$(create_test_zone_config)
|
|
187
|
+
|
|
188
|
+
# Test rollout planning
|
|
189
|
+
if "$SCRIPT_DIR/plan-risk-rollout.sh" "$test_config" 2 >/dev/null; then
|
|
190
|
+
# Check if rollout plan file was created
|
|
191
|
+
local rollout_files
|
|
192
|
+
rollout_files=$(find /tmp -name "rollout-plan-*.json" -type f | wc -l)
|
|
193
|
+
rm -f "$test_config"
|
|
194
|
+
[[ $rollout_files -gt 0 ]]
|
|
195
|
+
else
|
|
196
|
+
rm -f "$test_config"
|
|
197
|
+
return 1
|
|
198
|
+
fi
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
test_end_to_end_planning() {
|
|
202
|
+
local test_config
|
|
203
|
+
test_config=$(create_test_zone_config)
|
|
204
|
+
|
|
205
|
+
# Test end-to-end planning
|
|
206
|
+
if "$SCRIPT_DIR/plan-multi-coordinator-work.sh" "$test_config" --dry-run >/dev/null 2>&1; then
|
|
207
|
+
# Check if summary file was created
|
|
208
|
+
local summary_files
|
|
209
|
+
summary_files=$(find /tmp -name "multi-coordinator-planning-summary-*.json" -type f | wc -l)
|
|
210
|
+
rm -f "$test_config"
|
|
211
|
+
[[ $summary_files -gt 0 ]]
|
|
212
|
+
else
|
|
213
|
+
rm -f "$test_config"
|
|
214
|
+
return 1
|
|
215
|
+
fi
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
test_redis_connectivity() {
|
|
219
|
+
# Test Redis connectivity (required for namespace planning)
|
|
220
|
+
if redis-cli ping >/dev/null 2>&1; then
|
|
221
|
+
return 0
|
|
222
|
+
else
|
|
223
|
+
warn "Redis not available - skipping Redis-dependent tests"
|
|
224
|
+
return 0 # Don't fail test suite, just warn
|
|
225
|
+
fi
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
test_jq_availability() {
|
|
229
|
+
# Test jq availability (required for JSON processing)
|
|
230
|
+
if command -v jq >/dev/null 2>&1; then
|
|
231
|
+
return 0
|
|
232
|
+
else
|
|
233
|
+
return 1
|
|
234
|
+
fi
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
test_zone_config_json_validation() {
|
|
238
|
+
local test_config
|
|
239
|
+
test_config=$(create_test_zone_config)
|
|
240
|
+
|
|
241
|
+
# Test if the generated config is valid JSON
|
|
242
|
+
if jq . "$test_config" >/dev/null 2>&1; then
|
|
243
|
+
rm -f "$test_config"
|
|
244
|
+
return 0
|
|
245
|
+
else
|
|
246
|
+
rm -f "$test_config"
|
|
247
|
+
return 1
|
|
248
|
+
fi
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
test_complexity_scoring() {
|
|
252
|
+
# Test complexity scoring algorithm
|
|
253
|
+
local simple_zone="/tmp/simple-zone-$(date '+%s').json"
|
|
254
|
+
cat > "$simple_zone" << 'EOF'
|
|
255
|
+
{
|
|
256
|
+
"zones": [
|
|
257
|
+
{
|
|
258
|
+
"name": "simple-zone",
|
|
259
|
+
"task_description": "Simple task",
|
|
260
|
+
"deliverables": ["file1.ts"],
|
|
261
|
+
"agent_types": ["developer"]
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
EOF
|
|
266
|
+
|
|
267
|
+
local complex_zone="/tmp/complex-zone-$(date '+%s').json"
|
|
268
|
+
cat > "$complex_zone" << 'EOF'
|
|
269
|
+
{
|
|
270
|
+
"zones": [
|
|
271
|
+
{
|
|
272
|
+
"name": "complex-zone",
|
|
273
|
+
"task_description": "This is a very complex task that requires multiple implementation steps and comprehensive testing strategies with many different components working together",
|
|
274
|
+
"deliverables": ["file1.ts", "file2.ts", "file3.ts", "file4.ts", "file5.ts"],
|
|
275
|
+
"agent_types": ["developer", "reviewer", "tester", "architect"],
|
|
276
|
+
"acceptance_criteria": ["criteria1", "criteria2", "criteria3"],
|
|
277
|
+
"risk_factors": ["risk1", "risk2"]
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
EOF
|
|
282
|
+
|
|
283
|
+
# Both should be valid JSON
|
|
284
|
+
local result=0
|
|
285
|
+
if ! jq . "$simple_zone" >/dev/null 2>&1 || ! jq . "$complex_zone" >/dev/null 2>&1; then
|
|
286
|
+
result=1
|
|
287
|
+
fi
|
|
288
|
+
|
|
289
|
+
rm -f "$simple_zone" "$complex_zone"
|
|
290
|
+
return $result
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
cleanup_test_artifacts() {
|
|
294
|
+
# Clean up any test files
|
|
295
|
+
find /tmp -name "test-*.json" -type f -delete 2>/dev/null || true
|
|
296
|
+
find /tmp -name "coordinator-resource-plan-*.json" -type f -delete 2>/dev/null || true
|
|
297
|
+
find /tmp -name "dependency-conflict-analysis-*.json" -type f -delete 2>/dev/null || true
|
|
298
|
+
find /tmp -name "rollout-plan-*.json" -type f -delete 2>/dev/null || true
|
|
299
|
+
find /tmp -name "multi-coordinator-planning-summary-*.json" -type f -delete 2>/dev/null || true
|
|
300
|
+
find /tmp -name "validated-task-*" -type f -delete 2>/dev/null || true
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
main() {
|
|
304
|
+
log "Starting multi-coordinator planning test suite"
|
|
305
|
+
|
|
306
|
+
# Setup cleanup trap
|
|
307
|
+
trap cleanup_test_artifacts EXIT
|
|
308
|
+
|
|
309
|
+
# Run individual tests
|
|
310
|
+
run_test "jq availability" "test_jq_availability"
|
|
311
|
+
run_test "Redis connectivity" "test_redis_connectivity"
|
|
312
|
+
run_test "Zone config JSON validation" "test_zone_config_json_validation"
|
|
313
|
+
run_test "Task validation (valid config)" "test_task_validation"
|
|
314
|
+
run_test "Task validation (invalid config rejection)" "test_task_validation_failures"
|
|
315
|
+
run_test "Resource planning" "test_resource_planning"
|
|
316
|
+
run_test "Dependency analysis" "test_dependency_analysis"
|
|
317
|
+
run_test "Rollout planning" "test_rollout_planning"
|
|
318
|
+
run_test "Complexity scoring" "test_complexity_scoring"
|
|
319
|
+
run_test "End-to-end planning" "test_end_to_end_planning"
|
|
320
|
+
|
|
321
|
+
# Display test results
|
|
322
|
+
echo
|
|
323
|
+
info "=== Test Results ==="
|
|
324
|
+
echo "Tests run: $TESTS_RUN"
|
|
325
|
+
echo "Tests passed: $TESTS_PASSED"
|
|
326
|
+
echo "Tests failed: $TESTS_FAILED"
|
|
327
|
+
|
|
328
|
+
if [[ $TESTS_FAILED -eq 0 ]]; then
|
|
329
|
+
log "✅ All tests passed successfully!"
|
|
330
|
+
exit 0
|
|
331
|
+
else
|
|
332
|
+
error "❌ $TESTS_FAILED test(s) failed"
|
|
333
|
+
exit 1
|
|
334
|
+
fi
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
# Execute main function
|
|
338
338
|
main "$@"
|