## Summary Third major cleanup wave after investigating 287 remaining root files. Archived historical reports, organized documentation, removed regeneratable artifacts, and fixed critical security issue. ## Files Cleaned (119 total) - Archived: 78 files (7 WAVE reports + 71 summaries) → docs/archive/ - Archived: 7 build logs → docs/archive/build_logs/ - Organized: 10 markdown files → docs/guides/ + docs/checklists/ - Deleted: 17 test/coverage artifacts (regeneratable) - Deleted: 7 empty/obsolete files (docker override, clippy baselines) - Deleted: 3 large files (119MB - .venv, ppo_hyperopt_output.txt, backup) ## Space Recovered - Total: ~120.7 MB - Large files: 119.25 MB (.venv, ppo_hyperopt_output.txt) - Archives: 1.04 MB (summaries + build logs) - Test artifacts: 980 KB ## Security Fix (CRITICAL) - Fixed: certs/security.env removed from git tracking (contained JWT secrets) - Updated: .gitignore to prevent future tracking of sensitive cert files - Removed: 4 files from git history (security.env, production.env.template, *.serial) ## Documentation Organization - Created: docs/archive/ (wave_reports/, summaries/, build_logs/) - Created: docs/guides/ (7 detailed implementation guides) - Created: docs/checklists/ (3 operational checklists) - Retained: 30 essential .md files in root (quick refs, CLAUDE.md) ## Investigation Reports Created - MARKDOWN_ORGANIZATION_REPORT.md - TXT_FILES_INVENTORY_AND_ARCHIVAL_PLAN.md - ROOT_CONFIG_FILES_ANALYSIS_REPORT.md - DOCKER_ROOT_FILES_ANALYSIS.md - DATABASE_INITIALIZATION_AND_SETUP_ANALYSIS.md - (6 additional investigation/index files) ## Cleanup Wave Progress - Wave 1: 899 files deleted (1,071,884 lines) - Wave 2: 543 files archived/deleted (~34GB) - Wave 3: 119 files archived/deleted/organized (~121MB) - Total: 1,561 files cleaned, ~35.1GB space recovered ## Result Root directory: 287 files → ~180 files (excluding investigation reports) Clean, organized, production-ready structure maintained. Related: Second cleanup wave (previous commit)
7.8 KiB
Safe Deployment Checklist
CRITICAL: Follow this checklist EVERY TIME before deploying to Runpod.
Last Updated: 2025-10-29 Purpose: Prevent deploying wrong binaries to production (prevents wasted time and money)
Pre-Deployment Validation
1. Build Binary
# Build the binary with CUDA support
cargo build -p ml --example <binary_name> --release --features cuda
Example binaries:
hyperopt_mamba2_demohyperopt_dqn_demohyperopt_ppo_demohyperopt_tft_demotrain_mamba2_parquettrain_dqntrain_ppo
2. Test Binary Locally
# Smoke test - verify binary runs
target/release/examples/<binary_name> --help
# Full test with actual data (1 trial, 1 epoch)
target/release/examples/<binary_name> \
--parquet-file test_data/ES_FUT_180d.parquet \
--base-dir /tmp/test \
--trials 1 --epochs 1
CRITICAL: Verify the binary has --base-dir argument:
target/release/examples/<binary_name> --help | grep "base-dir"
If --base-dir is missing, the binary was built BEFORE VarMap fix and must be rebuilt.
3. Validate Checksum (MANDATORY)
./scripts/validate_binary.sh <binary_name>
Expected Output:
========================================
Binary Validation: <binary_name>
========================================
✅ Local binary exists
✅ Local binary works and has correct arguments
🔍 Calculating local SHA256...
Local SHA256: <64-char-hash>
🔍 Checking S3 binary...
S3 Size: <bytes>
S3 Modified: <timestamp>
⬇️ Downloading S3 binary for checksum...
🔍 Calculating S3 SHA256...
S3 SHA256: <64-char-hash>
========================================
✅ VALIDATION PASSED
Local and S3 binaries match perfectly
========================================
If validation fails:
# 1. Delete outdated S3 binary
aws s3 rm s3://se3zdnb5o4/binaries/current/<binary_name> \
--endpoint-url https://s3api-eur-is-1.runpod.io \
--profile runpod
# 2. Upload correct local binary
aws s3 cp target/release/examples/<binary_name> \
s3://se3zdnb5o4/binaries/current/<binary_name> \
--endpoint-url https://s3api-eur-is-1.runpod.io \
--profile runpod
# 3. Re-validate
./scripts/validate_binary.sh <binary_name>
4. Deploy Pod
# Deploy with automatic checksum validation
python3 scripts/runpod_deploy.py \
--gpu-type "RTX A4000" \
--command "/runpod-volume/binaries/<binary_name> --parquet-file /runpod-volume/test_data/ES_FUT_180d.parquet --base-dir /runpod-volume/hyperopt --trials 10 --epochs 50"
The deployment script will automatically:
- Check binary exists in S3
- Validate local vs S3 checksum
- Block deployment if checksums don't match
- Only deploy if validation passes
Validation Guarantees
✅ Local binary exists and is executable
✅ Local binary has correct CLI arguments (--base-dir present)
✅ Local binary passes smoke test
✅ Local SHA256 matches S3 SHA256
✅ Deployment blocked if validation fails
What This Prevents
❌ Deploying outdated binaries from S3 ❌ Deploying binaries without VarMap fixes ❌ Wasting time/money on broken pods (3 failed pods = $0.75+ wasted) ❌ Manual checksum verification errors
Common Issues and Solutions
Issue 1: Binary missing --base-dir argument
Error:
❌ FAIL: Local binary missing --base-dir argument
This binary was built BEFORE VarMap fix!
Solution:
# Rebuild binary
cargo clean -p ml
cargo build -p ml --example <binary_name> --release --features cuda
# Verify fix
target/release/examples/<binary_name> --help | grep "base-dir"
Issue 2: Checksum mismatch
Error:
❌ VALIDATION FAILED
Local and S3 binaries DO NOT MATCH
Local: abc123...
S3: def456...
Solution:
# Option A: Upload new local binary (if local is correct)
aws s3 rm s3://se3zdnb5o4/binaries/current/<binary_name> \
--endpoint-url https://s3api-eur-is-1.runpod.io --profile runpod
aws s3 cp target/release/examples/<binary_name> \
s3://se3zdnb5o4/binaries/current/<binary_name> \
--endpoint-url https://s3api-eur-is-1.runpod.io --profile runpod
# Option B: Rebuild local binary (if S3 is correct)
cargo clean -p ml
cargo build -p ml --example <binary_name> --release --features cuda
Issue 3: S3 binary doesn't exist
Output:
⚠️ S3 binary does not exist - will be uploaded
VALIDATION: LOCAL_ONLY
Solution:
# Upload binary to S3
aws s3 cp target/release/examples/<binary_name> \
s3://se3zdnb5o4/binaries/current/<binary_name> \
--endpoint-url https://s3api-eur-is-1.runpod.io \
--profile runpod
# Verify upload
aws s3 ls s3://se3zdnb5o4/binaries/current/ \
--endpoint-url https://s3api-eur-is-1.runpod.io --profile runpod
Testing Instructions
Run Full Validation Test Suite
./scripts/test_binary_validation.sh
Expected Output:
========================================
Binary Validation System Test Suite
========================================
Test 1: Validate hyperopt_mamba2_demo binary
----------------------------------------
✅ Test 1 passed: Validation script works
Test 2: Smoke test binary functionality
----------------------------------------
✅ Test 2 passed: Binary has correct CLI arguments
Test 3: Checksum calculation
----------------------------------------
Local SHA256: <hash>
✅ Test 3 passed: Checksum calculated correctly (64 chars)
Test 4: Python script integration
----------------------------------------
✅ Test 4 passed: Python can call validation script
========================================
✅ All validation tests passed
========================================
Test Deployment (Dry Run)
# Test deployment without actually deploying
python3 scripts/runpod_deploy.py --dry-run \
--command "/runpod-volume/binaries/hyperopt_mamba2_demo --parquet-file /runpod-volume/test_data/ES_FUT_180d.parquet --base-dir /runpod-volume/hyperopt --trials 1 --epochs 1"
This will:
- Run checksum validation
- Show deployment plan
- Skip actual deployment
Deployment Workflow Example
Scenario: Deploy MAMBA-2 hyperopt with 100 trials
# Step 1: Build binary
cargo build -p ml --example hyperopt_mamba2_demo --release --features cuda
# Step 2: Test locally (1 trial smoke test)
target/release/examples/hyperopt_mamba2_demo \
--parquet-file test_data/ES_FUT_180d.parquet \
--base-dir /tmp/test \
--trials 1 --epochs 1
# Step 3: Validate checksum
./scripts/validate_binary.sh hyperopt_mamba2_demo
# Step 4: Deploy
python3 scripts/runpod_deploy.py \
--gpu-type "RTX A4000" \
--command "/runpod-volume/binaries/hyperopt_mamba2_demo --parquet-file /runpod-volume/test_data/ES_FUT_180d.parquet --base-dir /runpod-volume/hyperopt --trials 100 --epochs 50"
# Step 5: Monitor (from another terminal)
python3 scripts/monitor_pod.py
Cost Savings
Before validation system:
- 3 failed deployments = 3 × $0.25/hr × 1hr = $0.75 wasted
- Manual investigation time = 30-60 minutes
After validation system:
- Deployment blocked before pod creation = $0.00 cost
- Automatic detection = 2 minutes
Savings per incident: $0.75 + 30-60 minutes of engineering time
Related Documentation
scripts/validate_binary.sh: Checksum validation scriptscripts/runpod_deploy.py: Deployment script with validationscripts/test_binary_validation.sh: Test suiteRUNPOD_VOLUME_MOUNT_ARCHITECTURE.md: Deployment architectureML_TRAINING_PARQUET_GUIDE.md: Training guide
Questions?
If validation fails and you're unsure why:
- Check recent commits:
git log --oneline -10 - Verify VarMap fix is present:
git log --grep="VarMap" - Check binary size:
ls -lh target/release/examples/<binary_name> - Compare with known-good binary:
./scripts/validate_binary.sh hyperopt_mamba2_demo
Always validate before deploying. Always.