Files
foxhunt/scripts/fix_wave112_compilation.sh
jgrusewski 8d89fe80ff chore: Second cleanup wave - organize root directory
- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/
- Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root)
- Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/
- Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts
- Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries)
- Tests: Move 14 .rs files → tests/standalone/
- SQL: Move 5 files → sql/ (keep init-db*.sql for Docker)
- Wave 153: Archive to docs/archive/historical/wave153/
- Docs: Archive 9 markdown files to wave_d/reports/ and historical/

Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files
Directory count reduced from 65 to 31 (52% reduction)
All historical data preserved in organized archive structure
2025-10-30 01:26:02 +01:00

79 lines
3.1 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# WAVE 112 AGENT 25: Automatic Compilation Fix Script
# Fixes all 18 compilation errors in api_gateway tests
set -e
echo "🔧 WAVE 112 AGENT 25: Applying Compilation Fixes"
echo "================================================"
echo ""
# Fix 1: Add MFA module export (2 errors)
echo "📝 Fix 1: Adding MFA module export..."
if ! grep -q "^pub mod mfa;" /home/jgrusewski/Work/foxhunt/services/api_gateway/src/auth/mod.rs; then
sed -i '20a pub mod mfa;' /home/jgrusewski/Work/foxhunt/services/api_gateway/src/auth/mod.rs
echo " ✅ Added 'pub mod mfa;' to auth/mod.rs"
else
echo " MFA module already exported"
fi
# Fix 2: SecretString boxing (2 errors)
echo ""
echo "📝 Fix 2: Fixing SecretString type mismatches..."
sed -i 's/SecretString::new("JBSWY3DPEHPK3PXP"\.to_string())/SecretString::new("JBSWY3DPEHPK3PXP".to_string().into())/g' \
/home/jgrusewski/Work/foxhunt/services/api_gateway/tests/mfa_comprehensive.rs
echo " ✅ Fixed SecretString boxing (2 occurrences)"
# Fix 3: RateLimiter Result unwrapping in auth_flow_tests (1 error)
echo ""
echo "📝 Fix 3: Fixing RateLimiter in auth_flow_tests.rs..."
sed -i 's/let rate_limiter = RateLimiter::new(/let rate_limiter = RateLimiter::new(/g' \
/home/jgrusewski/Work/foxhunt/services/api_gateway/tests/auth_flow_tests.rs
sed -i '/let rate_limiter = RateLimiter::new(/,/;/s/;/?;/' \
/home/jgrusewski/Work/foxhunt/services/api_gateway/tests/auth_flow_tests.rs
sed -i 's/rate_limiter,/rate_limiter?,/g' \
/home/jgrusewski/Work/foxhunt/services/api_gateway/tests/auth_flow_tests.rs
echo " ✅ Fixed RateLimiter Result unwrapping"
# Fix 4: RateLimiter Result unwrapping in rate_limiter_stress_test (13 errors)
echo ""
echo "📝 Fix 4: Fixing RateLimiter in rate_limiter_stress_test.rs..."
# Create a comprehensive sed script
cat > /tmp/fix_rate_limiter.sed << 'SED'
# Unwrap RateLimiter::new() calls
s/let rate_limiter = RateLimiter::new(\([^)]*\));/let rate_limiter = RateLimiter::new(\1)?;/g
s/let limiter1 = RateLimiter::new(\([^)]*\));/let limiter1 = RateLimiter::new(\1)?;/g
s/let limiter2 = RateLimiter::new(\([^)]*\));/let limiter2 = RateLimiter::new(\1)?;/g
s/let limiter3 = RateLimiter::new(\([^)]*\));/let limiter3 = RateLimiter::new(\1)?;/g
# Unwrap Arc<RateLimiter::new()> calls
s/Arc::new(RateLimiter::new(\([^)]*\)))/Arc::new(RateLimiter::new(\1)?)/g
SED
sed -i -f /tmp/fix_rate_limiter.sed \
/home/jgrusewski/Work/foxhunt/services/api_gateway/tests/rate_limiter_stress_test.rs
echo " ✅ Fixed RateLimiter Result unwrapping (13 occurrences)"
# Validate
echo ""
echo "✅ All fixes applied!"
echo ""
echo "🔍 Validating compilation..."
echo ""
if cargo test -p api_gateway --no-run 2>&1 | grep -q "error"; then
echo "❌ Compilation still has errors. Manual review needed."
exit 1
else
echo "✅ api_gateway tests compile successfully!"
fi
echo ""
echo "🎉 SUCCESS: All 18 compilation errors fixed!"
echo ""
echo "Next steps:"
echo " 1. Run: cargo test --workspace --all-features --no-run"
echo " 2. Run: cargo fix --workspace --all-features --allow-dirty"
echo " 3. Run: cargo clippy --workspace --all-features"