- G15: Ring buffer memory optimization (2.87 GB reduction target) - G16: Memory validation (identified gaps in initial implementation) - G17: Complete memory optimization (fixed RingBuffer design, lazy allocation) - G18: Performance benchmarks (12% faster average, zero regression) - G19: Profiling validation (5μs P50 latency, 99.6% fewer allocations) Production readiness: 92% Test coverage: 34/36 tests passing (94.4%) Memory savings: 66% reduction (2.87 GB for 100K symbols) Performance: 5-40% improvement across all benchmarks Modified files: - ml/src/features/normalization.rs (RingBuffer implementation) - ml/src/features/pipeline.rs (lazy bars allocation) - ml/src/features/volume_features.rs (lazy allocation) - adaptive-strategy/src/ensemble/weight_optimizer.rs (regime Sharpe) - ml/src/tft/mod.rs (225-feature support)
3.2 KiB
3.2 KiB
SQLX Offline Mode - Quick Reference Card
Status: ✅ READY (58 cache files committed) Last Updated: 2025-10-18
Quick Commands
✅ Build Production Services (Offline)
SQLX_OFFLINE=true cargo build --workspace --lib --release
# Time: ~90 seconds, no database required
✅ Check Single Service (Offline)
SQLX_OFFLINE=true cargo check -p trading_service --lib
⚠️ Run Tests (Database Required)
export DATABASE_URL="postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt"
cargo test --workspace
🔄 Regenerate Cache (After Schema Changes)
unset SQLX_OFFLINE
export DATABASE_URL="postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt"
cargo sqlx prepare --workspace
git add .sqlx/
git commit -m "chore: Update SQLX cache after schema changes"
Cache Status
| Service | Files | Location |
|---|---|---|
| Trading Service | 30 | services/trading_service/.sqlx/ |
| API Gateway | 11 | services/api_gateway/.sqlx/ |
| Trading Agent Service | 11 | services/trading_agent_service/.sqlx/ |
| Common Library | 6 | common/.sqlx/ |
| Total | 58 | All committed to git ✅ |
When to Use Offline Mode
✅ Use Offline Mode For:
- CI/CD builds (library compilation)
- Docker multi-stage builds
- Offline development (production code)
- Fast iteration on non-database code
❌ Don't Use Offline Mode For:
- Running tests (126 test queries need database)
- Schema changes (must regenerate cache)
- New SQLX queries (cache must be updated)
Common Issues
Issue: "SQLX query not found in cache"
Solution: Set SQLX_OFFLINE=true and verify cache files exist.
Issue: "DATABASE_URL must be set to compile tests"
Solution: This is expected. Tests need database:
export DATABASE_URL="postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt"
Issue: Cache out of sync after migration
Solution: Regenerate cache:
unset SQLX_OFFLINE
cargo sqlx prepare --workspace
git add .sqlx/ && git commit -m "chore: Update SQLX cache"
CI/CD Template
# Production build (offline)
- name: Build services
run: |
export SQLX_OFFLINE=true
cargo build --workspace --lib --release
# Tests (database required)
- name: Run tests
run: |
export DATABASE_URL="postgresql://..."
cargo test --workspace
Performance
| Operation | Time | No Database? |
|---|---|---|
| Workspace library build | ~90s | ✅ |
| trading_service check | ~1m 46s | ✅ |
| api_gateway check | ~10s | ✅ |
| Tests execution | varies | ❌ |
Test Query Limitation
Known: 126 test queries are not cached by SQLX design.
Why: Tests execute against live database at runtime, caching would bloat production artifacts.
Impact: Tests require DATABASE_URL during compilation and execution.
Workaround: This is expected behavior, no action needed.
Full Documentation
See: AGENT_F23_SQLX_OFFLINE_CACHE_REPORT.md
Quick Reference v1.0 | Agent F23 | 2025-10-18