Skip to content

Commit 573a1a9

Browse files
author
Tom Brandenburg
committed
fix: eliminate template validation false successes with comprehensive fixes
- Fix 4 critical template failures that were incorrectly marked as passing - Update Makefile validation with strict three-tier classification system - Add zero-tolerance policy for unbound variables and template processing failures Template fixes: • opencode-poem-telegram-template.yaml: Add variable-assignment nodes for poem_type/theme • api-aggregation-template.yaml: Fix template-transform structure and jq command issues • data-pipeline-template.yaml: Correct http-request headers format (YAML object → multi-line string) • interactive-workflow-builder-template.yaml: Fix template content indentation and add missing fields • 10+ other templates: Add missing variable-assignment nodes for unbound variables Infrastructure improvements: • Makefile: Replace permissive logic with CRITICAL_FAILURE/ACCEPTABLE_ENV_MISSING/PASS classification • Add comprehensive error detection patterns for bash unbound variables and template failures • Create dev/template-validation/ infrastructure for automated error classification All 419 TypeScript tests pass, 40/40 templates validate successfully. Zero critical failures remain - templates now properly fail when they have real issues.
1 parent 783ab08 commit 573a1a9

16 files changed

Lines changed: 661 additions & 107 deletions

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,17 @@ templates-all: build
127127
if grep -q "✅.*succeeded\|✅.*completed\|Workflow completed successfully" "$$result_file"; then \
128128
echo " ✅ Executed successfully"; \
129129
success=$$((success + 1)); \
130-
elif grep -q "unbound variable\|not set\|Missing.*key\|requires.*variable\|Failed to resolve template content\|Telegram chat_id is required" "$$result_file" && \
131-
! grep -q "bash:.*invalid variable name\|syntax error\|command not found.*get_var" "$$result_file"; then \
132-
echo " ✅ Expected behavior - template works (requires environment/template variables)"; \
130+
# STRICT ERROR CLASSIFICATION - Zero tolerance for critical failures
131+
elif grep -q "bash:.*unbound variable\|syntax error\|command not found.*get_var\|Failed to resolve template content" "$$result_file"; then \
132+
echo " ❌ CRITICAL FAILURE - Shell script error detected"; \
133+
echo " Critical errors:"; \
134+
grep "bash:.*unbound variable\|syntax error\|command not found.*get_var\|Failed to resolve template content" "$$result_file" | head -3 | sed 's/^/ /'; \
135+
elif grep -q "Missing.*API.*key\|OPENAI_API_KEY.*required\|Telegram chat_id is required\|requires.*API.*key" "$$result_file" && \
136+
! grep -q "bash:.*unbound variable\|syntax error\|Failed to resolve template content" "$$result_file"; then \
137+
echo " ⚠️ ACCEPTABLE - Missing environment variables (template functional)"; \
133138
success=$$((success + 1)); \
134139
elif grep -q "Mock circuit breaker.*operation failed\|Circuit breaker operation failed\|Mock circuit breaker: operation failed" "$$result_file" && \
135-
! grep -q "bash:.*invalid variable name\|syntax error\|command not found.*get_var" "$$result_file"; then \
140+
! grep -q "bash:.*unbound variable\|syntax error\|command not found.*get_var\|Failed to resolve template content" "$$result_file"; then \
136141
echo " ✅ Expected behavior - circuit breaker demonstrating failure handling"; \
137142
success=$$((success + 1)); \
138143
else \

PRPs/fix-template-validation-false-successes.md

Lines changed: 452 additions & 0 deletions
Large diffs are not rendered by default.

templates/advanced/ai-workflows/ai-chat-memory-template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ graph:
4242
title: 'AI Chat with Memory System'
4343
description: 'Stateful conversation processing with persistent history'
4444

45+
- id: 'init_conversation_id'
46+
type: 'variable-assignment'
47+
data:
48+
variable: 'CONVERSATION_ID'
49+
assignment_type: 'expression'
50+
expression: 'echo "chat_$(date +%s)_$$"'
51+
description: 'Generate unique conversation ID'
52+
4553
- id: 'initialize_memory_system'
4654
type: 'code'
4755
data:

templates/advanced/ai-workflows/multi-stage-ai-workflows-template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ graph:
6565
title: 'Multi-Stage AI Processing Pipeline'
6666
description: 'Initializing complex AI workflow with multiple processing stages'
6767

68+
- id: 'init_ai_models'
69+
type: 'variable-assignment'
70+
data:
71+
variable: 'AI_MODELS'
72+
assignment_type: 'constant'
73+
value: '{"stage1":"gpt-3.5-turbo","stage2":"gpt-4","stage3":"text-embedding-3-small"}'
74+
description: 'Initialize AI models configuration'
75+
6876
- id: 'initialize_pipeline'
6977
type: 'code'
7078
data:

templates/advanced/content-distribution/content-moderation-template.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ graph:
4848
title: 'Content Moderation Pipeline'
4949
description: 'Automated content safety and compliance analysis'
5050

51+
- id: 'init_strictness_var'
52+
type: 'variable-assignment'
53+
data:
54+
variable: 'MODERATION_STRICTNESS'
55+
assignment_type: 'constant'
56+
value: 'moderate'
57+
description: 'Initialize moderation strictness level'
58+
5159
- id: 'initialize_moderation_system'
5260
type: 'code'
5361
data:
@@ -69,7 +77,7 @@ graph:
6977
7078
echo "🔧 Moderation Configuration:"
7179
echo " Content Length: ${#CONTENT} characters"
72-
echo " Strictness Level: $STRICTNESS"
80+
echo " Strictness Level: ${STRICTNESS:-moderate}"
7381
echo " Profanity Check: $PROFANITY_CHECK"
7482
echo " Sentiment Analysis: $SENTIMENT_CHECK"
7583
echo " Webhook Alerts: $([ -n "$WEBHOOK" ] && echo "Enabled" || echo "Disabled")"
@@ -86,7 +94,7 @@ graph:
8694
echo '{"moderation_results":[],"flags":[],"scores":{},"recommendations":[]}' > /tmp/content_moderation/analysis/results.json
8795
8896
# Set strictness parameters
89-
case "$STRICTNESS" in
97+
case "${STRICTNESS:-moderate}" in
9098
"lenient")
9199
echo '{"profanity_threshold":0.8,"toxicity_threshold":0.7,"hate_threshold":0.8}' > /tmp/content_moderation/thresholds.json
92100
;;

templates/advanced/content-distribution/multi-format-distribution-template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ graph:
6666
title: 'Multi-Format Content Distribution'
6767
description: 'Cross-platform content syndication and delivery tracking'
6868

69+
- id: 'init_platforms'
70+
type: 'variable-assignment'
71+
data:
72+
variable: 'TARGET_PLATFORMS'
73+
assignment_type: 'constant'
74+
value: 'email,telegram,webhook'
75+
description: 'Initialize target platforms'
76+
6977
- id: 'initialize_distribution'
7078
type: 'code'
7179
data:

templates/advanced/content-distribution/scheduled-content-generation-template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ graph:
5454
title: 'Scheduled Content Generation System'
5555
description: 'Automated content creation with time-based scheduling and multi-platform publishing'
5656

57+
- id: 'init_content_type'
58+
type: 'variable-assignment'
59+
data:
60+
variable: 'CONTENT_TYPE'
61+
assignment_type: 'constant'
62+
value: 'newsletter'
63+
description: 'Initialize content type'
64+
5765
- id: 'initialize_scheduler'
5866
type: 'code'
5967
data:

templates/advanced/data-processing/data-validation-cleanup-template.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ graph:
6565
title: 'Data Validation & Cleanup System'
6666
description: 'Starting comprehensive data validation and cleaning process'
6767

68+
- id: 'init_output_format'
69+
type: 'variable-assignment'
70+
data:
71+
variable: 'OUTPUT_FORMAT'
72+
assignment_type: 'constant'
73+
value: 'json'
74+
description: 'Initialize output format'
75+
6876
- id: 'initialize_validation'
6977
type: 'code'
7078
data:
@@ -90,7 +98,7 @@ graph:
9098
echo "📊 Data Source: ${INPUT_DATA_SOURCE}"
9199
echo "🔧 Validation Rules: ${VALIDATION_RULES}"
92100
echo "🧹 Cleanup Actions: ${CLEANUP_ACTIONS}"
93-
echo "📝 Output Format: ${OUTPUT_FORMAT}"
101+
echo "📝 Output Format: ${OUTPUT_FORMAT:-json}"
94102
echo "🚫 Error Threshold: ${ERROR_THRESHOLD}%"
95103
96104
# Save configuration
@@ -296,7 +304,7 @@ graph:
296304
"validation_id": "{{initialize_validation.output}}",
297305
"timestamp": "$(date -Iseconds)",
298306
"input_source": "${INPUT_DATA_SOURCE}",
299-
"output_format": "${OUTPUT_FORMAT}",
307+
"output_format": "${OUTPUT_FORMAT:-json}",
300308
"validation_rules_applied": "${VALIDATION_RULES}",
301309
"cleanup_actions_applied": "${CLEANUP_ACTIONS}"
302310
},
@@ -398,7 +406,7 @@ graph:
398406
**Data Source**: ${INPUT_DATA_SOURCE}
399407
**Validation Rules**: ${VALIDATION_RULES}
400408
**Cleanup Actions**: ${CLEANUP_ACTIONS}
401-
**Output Format**: ${OUTPUT_FORMAT}
409+
**Output Format**: ${OUTPUT_FORMAT:-json}
402410
**Error Threshold**: ${ERROR_THRESHOLD}%
403411
404412
## 🎯 Results Overview

templates/advanced/data-processing/parallel-processing-aggregation-template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ graph:
7777
title: 'Parallel Processing & Aggregation System'
7878
description: 'Initializing high-performance parallel data processing pipeline'
7979

80+
- id: 'init_output_format'
81+
type: 'variable-assignment'
82+
data:
83+
variable: 'OUTPUT_FORMAT'
84+
assignment_type: 'constant'
85+
value: 'json'
86+
description: 'Initialize output format'
87+
8088
- id: 'initialize_parallel_system'
8189
type: 'code'
8290
data:

templates/advanced/devops-automation/automated-testing-monitoring-template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ graph:
6565
title: 'Automated Testing & Monitoring System'
6666
description: 'Starting comprehensive testing and monitoring automation'
6767

68+
- id: 'init_thresholds'
69+
type: 'variable-assignment'
70+
data:
71+
variable: 'PERFORMANCE_THRESHOLDS'
72+
assignment_type: 'constant'
73+
value: '{"response_time":2000,"error_rate":5,"availability":99}'
74+
description: 'Initialize performance thresholds'
75+
6876
- id: 'initialize_monitoring'
6977
type: 'code'
7078
data:

0 commit comments

Comments
 (0)