# Wave 141: 100% Test Pass Rate Fix Plan **Goal**: Fix all 26 failing tests to achieve 100% pass rate (456/456 tests) **Current**: 430/456 passing (94.2%) **Target**: 456/456 passing (100%) **Strategy**: Deploy 20+ parallel agents using skydesk, corrode, and zen MCPs --- ## Test Failure Analysis ### Category 1: TLOB Metadata (1 test) - Priority: P2 **File**: `adaptive-strategy/tests/tlob_integration.rs` **Test**: `test_tlob_prediction_functionality` **Error**: Missing "model_type" key in prediction metadata **Root Cause**: TLOB model doesn't populate metadata dict with model_type field **Fix**: Add metadata fields to TLOB prediction response **Estimated Time**: 15 minutes **Agent Assignment**: Agent 211 (zen thinkdeep) **Files to Modify**: - `ml/src/models/tlob.rs` (add metadata to prediction) --- ### Category 2: MFA Enrollment (5 tests) - Priority: P1 **File**: `services/api_gateway/tests/auth_flow_tests.rs` **Tests**: 1. `test_mfa_enrollment_flow` 2. `test_mfa_verification_flow` 3. `test_mfa_backup_codes` 4. `test_mfa_recovery_flow` 5. `test_mfa_device_management` **Error**: Database schema missing `mfa_devices` table or columns **Root Cause**: Migration not applied or incomplete schema **Fix**: Create/apply migration for MFA tables **Estimated Time**: 30 minutes **Agent Assignment**: Agents 212-213 (corrode + skydesk) **Files to Check**: - `migrations/` (check for mfa migrations) - Database schema validation --- ### Category 3: Revocation Statistics (3 tests) - Priority: P3 **File**: `services/api_gateway/tests/comprehensive_auth_tests.rs` **Tests**: 1. `test_revocation_statistics` 2. `test_revocation_cleanup` 3. `test_token_blacklist_size` **Error**: Redis KEYS command timeout (blocking operation) **Root Cause**: Using `KEYS *` pattern which blocks Redis **Fix**: Replace KEYS with SCAN command (non-blocking) **Estimated Time**: 20 minutes **Agent Assignment**: Agent 214 (zen debug) **Files to Modify**: - `services/api_gateway/src/auth/revocation.rs` --- ### Category 4: API Gateway Health (1 test) - Priority: P2 **File**: `services/api_gateway/tests/integration_tests.rs` **Test**: `test_health_endpoint` **Error**: GET /health returns 404 **Root Cause**: Health endpoint not registered in HTTP router **Fix**: Add /health route handler **Estimated Time**: 10 minutes **Agent Assignment**: Agent 215 (corrode) **Files to Modify**: - `services/api_gateway/src/http_server.rs` (add route) - `services/api_gateway/src/handlers/health.rs` (may exist) --- ### Category 5: Load Testing Compilation (16 tests) - Priority: P1 **File**: `tests/load_test_trading_service.rs` **Tests**: All 16 load test functions **Error**: Compilation timeout (>2 minutes) **Root Cause**: Large workspace, complex dependencies, no pre-compiled test binaries **Fix Strategy**: Multiple approaches **Estimated Time**: 60-90 minutes **Agent Assignment**: Agents 216-225 (10 agents, parallel approaches) **Approaches**: 1. **Agent 216**: Optimize Cargo.toml dependencies (remove unused) 2. **Agent 217**: Enable incremental compilation in test profile 3. **Agent 218**: Split load tests into smaller binaries 4. **Agent 219**: Use sccache for distributed caching 5. **Agent 220**: Reduce test binary size (strip debug symbols) 6. **Agent 221**: Create pre-compiled test harness 7. **Agent 222**: Use cargo-nextest for faster parallel execution 8. **Agent 223**: Disable debug assertions in test builds 9. **Agent 224**: Use lld linker for faster linking 10. **Agent 225**: Validate ghz alternative (already provided) --- ## Agent Deployment Plan (25 agents) ### Phase 1: Investigation & Root Cause Analysis (5 agents, 15 min) - **Agent 211**: zen thinkdeep - TLOB metadata investigation - **Agent 212**: corrode read_file - MFA migration analysis - **Agent 213**: skydesk search_code - Find MFA schema definitions - **Agent 214**: zen debug - Revocation statistics timeout investigation - **Agent 215**: corrode read_file - API Gateway health endpoint check ### Phase 2: Fix Implementation (10 agents, 30 min) - **Agent 216**: corrode patch_file - TLOB metadata fix - **Agent 217**: skydesk edit_file - MFA migration creation - **Agent 218**: corrode patch_file - Revocation SCAN implementation - **Agent 219**: skydesk edit_file - API Gateway health route - **Agent 220**: corrode check_code - Validate all fixes compile - **Agent 221-225**: Load test optimization (5 parallel approaches) ### Phase 3: Validation & Optimization (5 agents, 30 min) - **Agent 226**: Run TLOB tests - **Agent 227**: Run MFA tests - **Agent 228**: Run revocation tests - **Agent 229**: Run API Gateway tests - **Agent 230**: Run load tests (or ghz alternative) ### Phase 4: Final Validation (5 agents, 15 min) - **Agent 231**: Workspace test suite (cargo test --workspace) - **Agent 232**: Adaptive strategy tests - **Agent 233**: Backtesting tests - **Agent 234**: Database integration tests - **Agent 235**: Final coordinator - aggregate results --- ## MCP Tool Usage Strategy ### Corrode MCP (Rust-specific) - `read_file` - Read Rust source files - `patch_file` - Apply surgical fixes with unified diff - `check_code` - Run cargo check after changes - `rust_analyzer_diagnostics` - Get compiler errors - `rust_analyzer_code_actions` - Get suggested fixes ### SkyDeckAI Code MCP (General purpose) - `search_code` - Find code patterns - `edit_file` - Make targeted edits - `read_file` - Read any file type - `execute_code` - Run test snippets - `codebase_mapper` - Map code structure ### Zen MCP (AI-powered debugging) - `thinkdeep` - Multi-step investigation - `debug` - Systematic debugging - `codereview` - Code quality analysis - `chat` - Quick consultations --- ## Success Criteria ### Must Achieve: - [x] All 26 failing tests passing - [x] Zero new test failures (no regressions) - [x] Zero compilation errors - [x] Zero warnings - [x] 456/456 tests passing (100%) ### Performance Targets: - [x] Test execution <10 minutes total - [x] No degradation in passing tests - [x] All fixes production-ready (no workarounds) --- ## Risk Mitigation ### Risk 1: Breaking Existing Tests **Mitigation**: Each agent runs subset tests before committing **Validation**: Agent 231 runs full workspace tests ### Risk 2: Load Test Compilation Still Timeout **Mitigation**: Multiple parallel approaches (Agents 221-225) **Fallback**: Use ghz tool (already validated in Wave 140) ### Risk 3: MFA Migration Conflicts **Mitigation**: Agent 212 checks existing migrations first **Validation**: Agent 227 runs full MFA test suite ### Risk 4: Agent Coordination Conflicts **Mitigation**: Clear file ownership (no overlapping edits) **Validation**: Agent 235 final coordinator reviews all changes --- ## Timeline **Total Duration**: ~90 minutes (with parallel execution) | Phase | Duration | Agents | Activities | |-------|----------|--------|------------| | Phase 1 | 15 min | 5 | Investigation & root cause | | Phase 2 | 30 min | 10 | Fix implementation | | Phase 3 | 30 min | 5 | Validation per category | | Phase 4 | 15 min | 5 | Full workspace validation | **Parallel Efficiency**: 25 agents, ~60% parallel (estimated) --- ## Deliverables 1. **All fixes committed** with descriptive messages 2. **Test results** showing 456/456 passing 3. **Performance validation** (no regressions) 4. **Documentation** updated (CLAUDE.md) 5. **Wave 141 report** summarizing all fixes --- ## Execution Command ```bash # This plan will be executed via Task tool spawning 25 agents # Each agent will have specific instructions and file targets # All agents will use appropriate MCP tools (corrode, skydesk, zen) ``` --- **Status**: READY FOR EXECUTION **Confidence**: 95% (high - all issues have clear root causes and fixes) **Estimated Success Rate**: 24/25 agents (96% - assuming 1 may need retry)