Commit Graph

3 Commits

Author SHA1 Message Date
BiFangKNT 7e239f1629 fix(maintenance): guard media cache cleanup and annotate exception suppression
- Safely resolve media_cache via getattr in cleanup_expired_files to prevent AttributeError when storage_mgr is unset in cloud/test fixtures
- Only attach 'media_files' in cleanup return dictionary when media cache is active on singleton, preserving exact return contract for cloud maintenance tests
- Add explanatory comments to exception suppression in MediaCache.touch and cleanup loops to address code-quality review findings
2026-09-15 20:30:34 +08:00
BiFangKNT c16cd433e0 refactor(storage): enforce xxHash3-128 and remove sha256 fallback in MediaCache
- Import xxhash directly instead of conditional try-except block
- Remove unused hashlib import and sha256 fallback branch in hash_bytes
- Update docstrings to reflect pure xxHash3-128 content-addressing
2026-09-15 19:48:08 +08:00
BiFangKNT 1143d6a5ae feat(storage): media content-addressable cache and monitoring base64 externalization
- Add MediaCache using xxHash3-128 (with sha256 fallback) content-addressable storage
- Externalize message chain image payloads before recording monitoring and discarded messages
- Strip base64 payloads to null in SQLite monitoring_messages, dropping row size from megabytes to hundreds of bytes
- Add GET /api/v1/files/media/<filename> route with immutable HTTP cache headers to serve cached media
- Integrate age-based retention (default 30 days) and configurable disk quota with MaintenanceService cleanup loop
- Add defensive sanitizer in MonitoringService.record_message against oversized raw base64 payloads
- Add comprehensive unit tests and end-to-end verification covering CAS deduplication, route serving, and LRU pruning
2026-09-15 17:58:23 +08:00