Upgrades connection liveness checks so adapters verify backend reachability, not just whether a client object exists.
Breaking API change — is_connected is now a method: is_connected() (no longer a @property).
TTL-cached health probes — Redis uses ping(); MinIO uses bucket_exists(). Results are cached for 1 second (health_check_ttl_seconds, overridable by subclasses).
Cache invalidation — Health cache is cleared on connect() and disconnect().
MinIO stale-client handling — connect() cleans up stale clients before reconnecting.
Redis reconnect robustness — connect() closes an existing client before creating a new one.
## Summary
Upgrades connection liveness checks so adapters verify backend reachability, not just whether a client object exists.
- **Breaking API change** — `is_connected` is now a method: `is_connected()` (no longer a `@property`).
- **TTL-cached health probes** — Redis uses `ping()`; MinIO uses `bucket_exists()`. Results are cached for 1 second (`health_check_ttl_seconds`, overridable by subclasses).
- **Cache invalidation** — Health cache is cleared on `connect()` and `disconnect()`.
- **MinIO stale-client handling** — `connect()` cleans up stale clients before reconnecting.
- **Redis reconnect robustness** — `connect()` closes an existing client before creating a new one.
- **Tests & docs** — Added `tests/unit/connection_health_test.py` (13 tests); updated integration tests and README.
## Test plan
- [x] `pytest tests/unit/connection_health_test.py -v`
- [x] `pytest tests/integration/redis_adapter_test.py tests/integration/minio_adapter_test.py tests/integration/connection_aware_interface_test.py -v`
- [x] `mypy python_repositories/adapters/ python_repositories/interfaces/connection_aware_interface.py`
Convert is_connected to a method that verifies backend liveness via TTL-cached ping (Redis) or bucket_exists (MinIO), with cache invalidation on connect/disconnect.
Co-authored-by: Cursor <cursoragent@cursor.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Upgrades connection liveness checks so adapters verify backend reachability, not just whether a client object exists.
is_connectedis now a method:is_connected()(no longer a@property).ping(); MinIO usesbucket_exists(). Results are cached for 1 second (health_check_ttl_seconds, overridable by subclasses).connect()anddisconnect().connect()cleans up stale clients before reconnecting.connect()closes an existing client before creating a new one.tests/unit/connection_health_test.py(13 tests); updated integration tests and README.Test plan
pytest tests/unit/connection_health_test.py -vpytest tests/integration/redis_adapter_test.py tests/integration/minio_adapter_test.py tests/integration/connection_aware_interface_test.py -vmypy python_repositories/adapters/ python_repositories/interfaces/connection_aware_interface.pyTest Coverage Report:
Test Coverage Report: