Documentation Added: - AI_INSIGHTS_DEMO_SETUP_GUIDE.md: Complete setup guide for demo sessions - AI_INSIGHTS_DATA_FLOW.md: Architecture and data flow diagrams - AI_INSIGHTS_QUICK_START.md: Quick reference guide - DEMO_SESSION_ANALYSIS_REPORT.md: Detailed analysis of demo session d67eaae4 - ROOT_CAUSE_ANALYSIS_AND_FIXES.md: Complete analysis of 8 issues (6 fixed, 2 analyzed) - COMPLETE_FIX_SUMMARY.md: Executive summary of all fixes - FIX_MISSING_INSIGHTS.md: Forecasting and procurement fix guide - FINAL_STATUS_SUMMARY.md: Status overview - verify_fixes.sh: Automated verification script - enhance_procurement_data.py: Procurement data enhancement script Service Improvements: - Demo session cleanup worker: Use proper settings for Redis configuration with TLS/auth - Procurement service: Add Redis initialization with proper error handling and cleanup - Production fixture: Remove duplicate worker assignments (cleaned 56 duplicates) - Orchestrator fixture: Add purchase order metadata for better tracking Impact: - Complete documentation for troubleshooting and setup - Improved Redis connection handling across services - Clean production data without duplicates - Better error handling and logging 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
112 lines
4.3 KiB
Bash
Executable File
112 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Verification Script for Demo Session Fixes
|
|
# Date: 2025-12-16
|
|
|
|
echo "=========================================="
|
|
echo "Demo Session & AI Insights Verification"
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
# Color codes
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# 1. Verify Orchestrator Fix
|
|
echo "1. Checking Orchestrator Import Fix..."
|
|
if grep -q "OrchestrationRun, OrchestrationStatus" services/orchestrator/app/api/internal_demo.py; then
|
|
echo -e "${GREEN}✓ OrchestrationStatus import added${NC}"
|
|
else
|
|
echo -e "${RED}✗ OrchestrationStatus import missing${NC}"
|
|
exit 1
|
|
fi
|
|
echo ""
|
|
|
|
# 2. Check if AI insights data was generated
|
|
echo "2. Checking AI Insights Data in Fixtures..."
|
|
|
|
# Check stock movements
|
|
STOCK_MOVEMENTS=$(cat shared/demo/fixtures/professional/03-inventory.json | jq '.stock_movements | length' 2>/dev/null)
|
|
if [ "$STOCK_MOVEMENTS" -gt 800 ]; then
|
|
echo -e "${GREEN}✓ Stock movements: $STOCK_MOVEMENTS (need 800+)${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠ Stock movements: $STOCK_MOVEMENTS (expected 800+)${NC}"
|
|
echo " Run: python shared/demo/fixtures/professional/generate_ai_insights_data.py"
|
|
fi
|
|
|
|
# Check worker assignments
|
|
WORKERS=$(cat shared/demo/fixtures/professional/06-production.json | jq '[.batches[] | select(.staff_assigned != null)] | length' 2>/dev/null)
|
|
if [ "$WORKERS" -gt 200 ]; then
|
|
echo -e "${GREEN}✓ Worker assignments: $WORKERS (need 200+)${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠ Worker assignments: $WORKERS (expected 200+)${NC}"
|
|
echo " Run: python shared/demo/fixtures/professional/generate_ai_insights_data.py"
|
|
fi
|
|
|
|
# Check stockout events
|
|
STOCKOUTS=$(cat shared/demo/fixtures/professional/03-inventory.json | jq '[.stock_movements[] | select(.quantity_after == 0.0)] | length' 2>/dev/null)
|
|
if [ "$STOCKOUTS" -ge 5 ]; then
|
|
echo -e "${GREEN}✓ Stockout events: $STOCKOUTS (need 5+)${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠ Stockout events: $STOCKOUTS (expected 5+)${NC}"
|
|
echo " Run: python shared/demo/fixtures/professional/generate_ai_insights_data.py"
|
|
fi
|
|
echo ""
|
|
|
|
# 3. Check Kubernetes pods
|
|
echo "3. Checking Kubernetes Pods..."
|
|
kubectl get pods -n bakery-ia | grep -E "(orchestrator|ai-insights|demo-session)" | while read line; do
|
|
POD_NAME=$(echo $line | awk '{print $1}')
|
|
STATUS=$(echo $line | awk '{print $3}')
|
|
|
|
if [[ "$STATUS" == "Running" ]]; then
|
|
echo -e "${GREEN}✓ $POD_NAME: $STATUS${NC}"
|
|
elif [[ "$STATUS" == "Completed" ]]; then
|
|
echo -e "${GREEN}✓ $POD_NAME: $STATUS${NC}"
|
|
else
|
|
echo -e "${RED}✗ $POD_NAME: $STATUS${NC}"
|
|
fi
|
|
done
|
|
echo ""
|
|
|
|
# 4. Instructions
|
|
echo "=========================================="
|
|
echo "Next Steps:"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "1. Redeploy Orchestrator Service:"
|
|
echo " kubectl delete pod -n bakery-ia \$(kubectl get pods -n bakery-ia | grep orchestrator-service | awk '{print \$1}')"
|
|
echo ""
|
|
echo "2. Wait for new pod to be ready:"
|
|
echo " kubectl wait --for=condition=ready pod -l app=orchestrator-service -n bakery-ia --timeout=60s"
|
|
echo ""
|
|
echo "3. Create a new demo session:"
|
|
echo " curl -X POST http://localhost:8000/api/demo/sessions \\"
|
|
echo " -H \"Content-Type: application/json\" \\"
|
|
echo " -d '{\"demo_account_type\":\"professional\"}'"
|
|
echo ""
|
|
echo "4. Monitor cloning progress:"
|
|
echo " kubectl logs -n bakery-ia -f \$(kubectl get pods -n bakery-ia | grep demo-session-service | awk '{print \$1}') | grep -E 'orchestrator|AI insights'"
|
|
echo ""
|
|
echo "5. Verify AI insights generated:"
|
|
echo " # Wait 60 seconds after session ready, then check insights count"
|
|
echo " # Should see 5-10 insights if data was populated"
|
|
echo ""
|
|
|
|
echo "=========================================="
|
|
echo "Troubleshooting:"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "If AI insights count is low (< 5):"
|
|
echo "1. Run the data generator:"
|
|
echo " python shared/demo/fixtures/professional/generate_ai_insights_data.py"
|
|
echo ""
|
|
echo "2. Create a new demo session"
|
|
echo ""
|
|
echo "3. Check service logs for ML model execution:"
|
|
echo " kubectl logs -n bakery-ia \$(kubectl get pods -n bakery-ia | grep inventory-service | awk '{print \$1}') | grep -i 'ai_insights\\|safety_stock'"
|
|
echo " kubectl logs -n bakery-ia \$(kubectl get pods -n bakery-ia | grep production-service | awk '{print \$1}') | grep -i 'ai_insights\\|yield'"
|
|
echo ""
|
|
|