Files
foxhunt/scripts/fix_ml_tests.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

40 lines
1.2 KiB
Bash

#!/bin/bash
# Fix ML test compilation errors
echo "=== Fixing ML Test Compilation Errors ==="
# Find all test modules and add common missing imports
find ml/src -name "*.rs" -type f | while read file; do
# Check if file has tests
if grep -q "#\[cfg(test)\]" "$file" 2>/dev/null; then
echo "Processing: $file"
# Check if imports section exists
if ! grep -q "^#\[cfg(test)\]" "$file"; then
continue
fi
# Get the test module line number
test_line=$(grep -n "^#\[cfg(test)\]" "$file" | head -1 | cut -d: -f1)
if [ ! -z "$test_line" ]; then
# Check what's missing and add imports after the mod tests { line
mod_line=$((test_line + 1))
# Create a temporary file with the fixes
awk -v modline="$mod_line" '
NR == modline && /^mod tests \{/ {
print $0
print " use candle_core::{Device, DType};"
print " use std::fs::File;"
print " use std::io::Write;"
print " use tempfile::tempdir;"
next
}
{print}
' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
fi
fi
done
echo "=== Done ==="