Go to file
matthias.lotz ff4ef2f563 Phase 3: Complete type safety & logging unification (3.1-3.2)
Phase 3.1: Type Safety
- Add bridge_types.py for shared type aliases (EventDict, PowerWatts, Timestamp, DeviceID)
- Define protocols for callbacks and message parsers
- Strict type annotations on all core modules (session_detector, event_queue, device_manager)
- Fix Optional handling and type guards throughout codebase
- Achieve full mypy compliance: 0 errors across 47 source files

Phase 3.2: Logging Unification
- Migrate from stdlib logging to pure structlog across all runtime modules
- Convert all logs to structured event+fields format (snake_case event names)
- Remove f-string and printf-style logger calls
- Add contextvars support for per-request correlation
- Implement FastAPI middleware to bind request_id, http_method, http_path
- Propagate X-Request-ID header in responses
- Remove stdlib logging imports except setup layer (utils/logging.py)
- Ensure log-level consistency across all modules

Files Modified:
- iot_bridge/bridge_types.py (new) - Central type definitions
- iot_bridge/core/* - Type safety and logging unification
- iot_bridge/clients/* - Structured logging with request context
- iot_bridge/parsers/* - Type-safe parsing with structured logs
- iot_bridge/utils/logging.py - Pure structlog setup with contextvars
- iot_bridge/api/server.py - Added request correlation middleware
- iot_bridge/tests/* - Test fixtures updated for type safety
- iot_bridge/OPTIMIZATION_PLAN.md - Phase 3 status updated

Validation:
- mypy . → 0 errors (47 files)
- All unit tests pass
- Runtime behavior unchanged
- API response headers include X-Request-ID
2026-02-18 23:54:27 +01:00
.github/workflows Phase 1: Foundation & Quality Tools 2026-02-18 22:11:25 +01:00
extra-addons/open_workshop/open_workshop_mqtt Update README.md 2026-02-18 23:29:36 +01:00
iot_bridge Phase 3: Complete type safety & logging unification (3.1-3.2) 2026-02-18 23:54:27 +01:00
odoo@fd43f0445a initial MQTT Development 2026-02-11 21:07:32 +01:00
.gitignore initial version 2026-02-10 20:00:27 +01:00
.readthedocs.yaml feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
DEPLOYMENT.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
DOCUMENTATION_STRATEGY.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
FEATURE_REQUEST_DEVICE_STATUS.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
FEATURE_REQUEST_OPEN_WORKSHOP_MQTT_IoT.md feat: benutzerfreundliche GUI für Device-Konfiguration mit Auto-Config-Push 2026-02-17 00:09:51 +01:00
IMPLEMENTATION_PLAN_DEVICE_STATUS.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
IMPLEMENTATION_PLAN.md Update Implementation Plan 2026-02-18 21:20:22 +01:00