v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution

- 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>
This commit is contained in:
Dom
2026-01-29 11:23:51 +01:00
parent 21bfa3b337
commit a27b74cf22
1595 changed files with 412691 additions and 400 deletions

View File

@@ -0,0 +1,83 @@
# Code Quality Improvements - 29 November 2025
## Summary
Continuation of code quality improvements from the previous session. Focus on exception handling, logging, and security.
## Changes Made
### 1. Exception Handling Improvements
Replaced bare `except:` clauses with specific exception types:
- **core/detection/ollama_client.py**
- `is_available()`: Now catches `requests.ConnectionError`, `requests.Timeout`
- `list_models()`: Now catches `requests.ConnectionError`, `requests.Timeout`, `json.JSONDecodeError`, `KeyError`
- **core/embedding/faiss_manager.py**
- `_save_index_only()`: Now catches `OSError`, `IOError` specifically
- **core/capture/screen_capturer.py**
- `capture_screen()`: Now catches `OSError`, `ImportError` specifically
### 2. Logging Improvements
Replaced `print()` statements with proper `logging` calls in:
| File | print() removed | Logger added |
|------|-----------------|--------------|
| core/detection/ui_detector.py | 21 | ✅ |
| core/detection/roi_optimizer.py | 6 | ✅ |
| core/embedding/state_embedding_builder.py | 8 | ✅ |
| core/graph/node_matcher.py | 7 | ✅ |
| core/embedding/faiss_manager.py | 2 | ✅ |
| core/capture/screen_capturer.py | 2 | ✅ |
**Total: ~46 print() statements converted to logging**
### 3. Security Improvements
- **server/api_upload.py**: Added production environment check for `ENCRYPTION_PASSWORD`
- Raises `ValueError` if not set in production
- Logs warning when using default key in development
### 4. Configuration System
- **core/config.py**: Already complete centralized configuration system with:
- `ServerConfig`: API and dashboard settings
- `SecurityConfig`: Encryption and secrets with production validation
- `ModelConfig`: ML model settings (CLIP, VLM, OWL)
- `PathConfig`: Directory paths with auto-creation
- `FAISSConfig`: Vector search settings
- `AppConfig`: Main configuration aggregator
- `get_config()`: Singleton pattern for global access
## Test Results
All tests pass after changes:
- ✅ test_faiss_ivf_optimization.py (8/8 tests)
- ✅ test_roi_optimizer.py (12/12 tests)
## Remaining print() Statements
13 `print()` statements remain, all in acceptable locations:
- `if __name__ == "__main__"` blocks (test/example code)
- Docstrings (documentation examples)
## Files Modified
1. core/detection/ollama_client.py
2. core/detection/ui_detector.py
3. core/detection/roi_optimizer.py
4. core/embedding/faiss_manager.py
5. core/embedding/state_embedding_builder.py
6. core/graph/node_matcher.py
7. core/capture/screen_capturer.py
8. server/api_upload.py
## Next Steps (if needed)
1. Add type hints to remaining functions
2. Add docstrings to undocumented functions
3. Consider adding structured logging (JSON format) for production
4. Add request validation with Pydantic models