- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3.3 KiB
3.3 KiB
Storage Manager Repair - Complete ✅
Date: 24 novembre 2025
Status: 100% Tests Passing
Summary
Successfully repaired the StorageManager tests by fixing missing dependencies and aligning mock objects with real model structures.
Problems Fixed
1. RawSession Missing Fields
Problem: Mock was missing required fields from the real RawSession model
- Missing:
agent_version,environment,user,context - Mock used
start_timebut real model usesstarted_at(datetime object)
Solution:
- Added all required fields to MockRawSession
- Updated test to compare ISO strings instead of datetime vs string
- Fixed round-trip test to use correct attribute name
2. ScreenState Missing Fields
Problem: Mock structure didn't match real ScreenState model
- Missing:
windowfield (was incorrectly incontext) - Mock used
state_idbut real model usesscreen_state_id - Perception level missing
embeddingstructure
Solution:
- Added
windowas separate field with WindowContext structure - Added
session_idfield - Fixed perception to include proper
embeddingwith EmbeddingRef structure - Updated tests to use
screen_state_idinstead ofstate_id
3. Storage Stats Embedding Count
Problem: get_storage_stats() was counting .json files for embeddings
- Embeddings are stored as
.npyfiles, not JSON
Solution:
- Changed embeddings counting to use
*.npypattern instead of*.json - Sessions and screen_states still use
*.jsoncorrectly
Test Results
Before Repair
- 5 failed, 11 passed (68.75% pass rate)
- Errors:
KeyError: 'agent_version'(2 tests)KeyError: 'window'(2 tests)assert 0 >= 1(1 test)
After Repair
- 16 passed, 0 failed (100% pass rate) ✅
- All storage manager tests passing
- All related tests passing:
- FAISS IVF Optimization: 8/8 ✅
- ROI Optimizer: 12/12 ✅
- Fusion Engine: 9/9 ✅
- Performance Benchmarks: 10/10 ✅
Files Modified
-
tests/unit/test_storage_manager.py
- Updated MockRawSession with all required fields
- Updated MockScreenState with correct structure
- Fixed test assertions to match real model attributes
-
core/persistence/storage_manager.py
- Fixed
get_storage_stats()to count.npyfiles for embeddings
- Fixed
Validation
# Storage Manager Tests
python -m pytest tests/unit/test_storage_manager.py -v
# Result: 16 passed ✅
# All Related Tests
python -m pytest tests/unit/test_storage_manager.py \
tests/unit/test_faiss_ivf_optimization.py \
tests/unit/test_roi_optimizer.py \
tests/unit/test_fusion_engine.py \
tests/performance/test_performance_benchmarks.py -v
# Result: 55 passed ✅
Impact
- Storage Manager: 100% functional with complete test coverage
- Data Persistence: RawSession and ScreenState serialization working correctly
- Embedding Storage: Proper counting and management of .npy files
- System Stability: All Phase 11 optimizations validated and working
Next Steps
The storage manager is now fully operational and all tests are passing. The system is ready for:
- Production data persistence
- Session recording and playback
- Screen state analysis
- Embedding storage and retrieval
Repair completed successfully - All tests at 100%! 🎉