Redis and MinIO adapters previously disagreed on connect() behavior: MinIO short-circuited when already healthy, while Redis always closed and recreated its client. That inconsistency was awkward for context-manager usage and defensive connect() calls.
This PR moves shared connect orchestration into ConnectionAwareAdapter:
Injected client — validate reachability, do not create or close the client
Already healthy — log "Already connected to {connection_name}" and return
Otherwise — disconnect(), then _establish_connection()
RedisAdapter and MinioAdapter now implement _validate_injected_client() and _establish_connection() instead of duplicating connect logic. The early-return guard uses _is_client_ready() so MinIO cannot falsely short-circuit without bucket context.
Docs updated in ConnectionAwareInterface and README.md to note that connect() is idempotent.
Test plan
uv run pytest tests/unit/redis_adapter_test.py tests/unit/minio_adapter_test.py tests/unit/connection_aware_adapter_test.py -q
uv run pytest tests/integration/redis_adapter_test.py tests/integration/minio_adapter_test.py -m integration -q
Added unit tests for idempotent skip and unhealthy reconnect paths (Redis + MinIO)
## Summary
Redis and MinIO adapters previously disagreed on `connect()` behavior: MinIO short-circuited when already healthy, while Redis always closed and recreated its client. That inconsistency was awkward for context-manager usage and defensive `connect()` calls.
This PR moves shared connect orchestration into `ConnectionAwareAdapter`:
- **Injected client** — validate reachability, do not create or close the client
- **Already healthy** — log `"Already connected to {connection_name}"` and return
- **Otherwise** — `disconnect()`, then `_establish_connection()`
`RedisAdapter` and `MinioAdapter` now implement `_validate_injected_client()` and `_establish_connection()` instead of duplicating connect logic. The early-return guard uses `_is_client_ready()` so MinIO cannot falsely short-circuit without bucket context.
Docs updated in `ConnectionAwareInterface` and `README.md` to note that `connect()` is idempotent.
## Test plan
- [x] `uv run pytest tests/unit/redis_adapter_test.py tests/unit/minio_adapter_test.py tests/unit/connection_aware_adapter_test.py -q`
- [x] `uv run pytest tests/integration/redis_adapter_test.py tests/integration/minio_adapter_test.py -m integration -q`
- [x] Added unit tests for idempotent skip and unhealthy reconnect paths (Redis + MinIO)
- [x] Added Redis integration test mirroring existing MinIO "already connected" log assertion
Move shared connect orchestration into the base adapter so both backends short-circuit when already healthy and only reconnect after a failed probe.
Co-authored-by: Cursor <cursoragent@cursor.com>
Restore 100% coverage for the _validate_injected_client early-return paths in Redis and MinIO adapters.
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
Redis and MinIO adapters previously disagreed on
connect()behavior: MinIO short-circuited when already healthy, while Redis always closed and recreated its client. That inconsistency was awkward for context-manager usage and defensiveconnect()calls.This PR moves shared connect orchestration into
ConnectionAwareAdapter:"Already connected to {connection_name}"and returndisconnect(), then_establish_connection()RedisAdapterandMinioAdapternow implement_validate_injected_client()and_establish_connection()instead of duplicating connect logic. The early-return guard uses_is_client_ready()so MinIO cannot falsely short-circuit without bucket context.Docs updated in
ConnectionAwareInterfaceandREADME.mdto note thatconnect()is idempotent.Test plan
uv run pytest tests/unit/redis_adapter_test.py tests/unit/minio_adapter_test.py tests/unit/connection_aware_adapter_test.py -quv run pytest tests/integration/redis_adapter_test.py tests/integration/minio_adapter_test.py -m integration -qTest Coverage Report: