You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Address PR #252 review findings: error handling, types, tests
Error handling:
- Add CorruptMirrorError/ValueError handling to all mirror endpoints
- Block unknown models on platform/community keys (fail-closed)
- Add OSError handling to create_mirror_endpoint
- Make cleanup_expired_mirrors resilient to per-mirror failures
- Narrow scheduler cleanup catch to expected exception types
- Add field_validator to RefreshMirrorRequest.community_ids
Type design:
- Make MirrorInfo a frozen dataclass with tuple community_ids
- Move is_safe_identifier to src/core/validation.py (shared utility)
- Add non-negativity validation to MODEL_PRICING at import time
- Expand SecureFormatter key patterns for Anthropic/OpenAI keys
Code quality:
- Replace deprecated asyncio.get_event_loop() with get_running_loop()
- Fix ContextVar comment accuracy (request lifecycle, not per-task)
- Use get_active_mirror() instead of _active_mirror_id.get()
- Fix docstring inaccuracies (caching, asyncio, model names)
Tests:
- Add active_mirror_context tests (set/reset, exception safety)
- Add MirrorInfo invariant tests (empty ids, invalid id, immutability)
- Add serialization round-trip test
- Add TTL clamping test
- Add run_sync_now invalid sync_type test
- Update cost protection test for fail-closed behavior
Closes#256
* Use generic redaction placeholder, remove misleading __all__
- Change redaction string from "sk-or-v1-***[redacted]" to
"***[key-redacted]" since the pattern now covers multiple providers
- Remove __all__ from mirror.py since no callers use wildcard imports
from that module (is_safe_identifier now lives in core.validation)
* Add ValueError catch to delete endpoint, validate community IDs
- Add missing ValueError handling in delete_mirror_endpoint for
consistency with all other mirror endpoints
- Add community ID validation in MirrorInfo.__post_init__ so corrupt
metadata with path-traversal community IDs is caught at load time
- Document CorruptMirrorError in refresh_mirror docstring
0 commit comments