#!/bin/bash # PPO Adapter Validation Script # Date: 2025-10-30 # Purpose: Verify PPO adapter meets production requirements set -e echo "========================================" echo "PPO ADAPTER VALIDATION SCRIPT" echo "========================================" echo "" PASS=0 FAIL=0 # Test 1: Check for synthetic data generation echo "Test 1: Checking for synthetic data generation..." if grep -q "generate_synthetic_trajectories" /home/jgrusewski/Work/foxhunt/ml/src/hyperopt/adapters/ppo.rs; then echo "❌ FAIL: generate_synthetic_trajectories() found in ppo.rs" FAIL=$((FAIL + 1)) else echo "✅ PASS: No synthetic data generation found" PASS=$((PASS + 1)) fi echo "" # Test 2: Check for data loading field echo "Test 2: Checking for dbn_data_dir field..." if grep -q "dbn_data_dir" /home/jgrusewski/Work/foxhunt/ml/src/hyperopt/adapters/ppo.rs; then echo "✅ PASS: dbn_data_dir field found" PASS=$((PASS + 1)) else echo "❌ FAIL: dbn_data_dir field NOT found" FAIL=$((FAIL + 1)) fi echo "" # Test 3: Check for early stopping config in PPOConfig echo "Test 3: Checking for early stopping config..." if grep -q "early_stopping_enabled" /home/jgrusewski/Work/foxhunt/ml/src/ppo/ppo.rs; then echo "✅ PASS: early_stopping_enabled found in PPOConfig" PASS=$((PASS + 1)) else echo "❌ FAIL: early_stopping_enabled NOT found in PPOConfig" FAIL=$((FAIL + 1)) fi echo "" # Test 4: Run unit tests echo "Test 4: Running unit tests..." if cargo test -p ml --lib hyperopt::adapters::ppo 2>&1 | grep -q "test result: ok"; then echo "✅ PASS: Unit tests passed" PASS=$((PASS + 1)) else echo "❌ FAIL: Unit tests failed" FAIL=$((FAIL + 1)) fi echo "" # Test 5: Check if integration tests compile echo "Test 5: Checking integration test compilation..." if cargo test -p ml --test hyperopt_ppo_real_data_test --no-run 2>&1 | grep -q "Finished"; then echo "✅ PASS: Integration tests compile" PASS=$((PASS + 1)) else echo "❌ FAIL: Integration tests don't compile" FAIL=$((FAIL + 1)) fi echo "" # Test 6: Check for EarlyStoppingObserver usage echo "Test 6: Checking for EarlyStoppingObserver integration..." if grep -q "EarlyStoppingObserver" /home/jgrusewski/Work/foxhunt/ml/src/hyperopt/adapters/ppo.rs; then echo "✅ PASS: EarlyStoppingObserver used in adapter" PASS=$((PASS + 1)) else echo "❌ FAIL: EarlyStoppingObserver NOT used in adapter" FAIL=$((FAIL + 1)) fi echo "" # Summary echo "========================================" echo "VALIDATION SUMMARY" echo "========================================" echo "Tests Passed: $PASS/6" echo "Tests Failed: $FAIL/6" echo "" if [ $FAIL -eq 0 ]; then echo "✅ ALL TESTS PASSED - PPO ADAPTER READY FOR DEPLOYMENT" exit 0 else echo "❌ VALIDATION FAILED - DO NOT DEPLOY PPO ADAPTER" echo "" echo "See reports for detailed fix instructions:" echo " - PPO_ADAPTER_VALIDATION_REPORT.md" echo " - PPO_ADAPTER_VALIDATION_SUMMARY.md" exit 1 fi