Skip to content

Commit e558dd7

Browse files
przemekborutaclaude
andcommitted
fix: document transport param and annotate private attr chains in tests
Address Greptile P2 review comments on PR #460: - Add docstring entry for the new `transport` parameter in `create_retry_transport` explaining accepted types and None default - Add inline comments in pool-size regression tests explaining the private attribute chain (_sync/_async_transport → _pool → _max_connections) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Przemysław <przemekboruta@interia.pl>
1 parent d482067 commit e558dd7

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

packages/data-designer-engine/src/data_designer/engine/models/clients/retry.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ def create_retry_transport(
5656
AIMD feedback loop. When ``False`` (used by the sync engine, which has
5757
no salvage queue), 429 is kept in the retry list so the transport layer
5858
retries it transparently.
59+
transport: Optional pre-configured inner transport to pass directly to
60+
``RetryTransport``. Pass ``httpx.HTTPTransport`` for sync clients or
61+
``httpx.AsyncHTTPTransport`` for async clients — typically with a custom
62+
``limits=`` — so that the connection pool is sized correctly. When
63+
``None`` (default), ``RetryTransport`` creates its own default pools for
64+
both sync and async requests.
5965
"""
6066
cfg = config or RetryConfig()
6167
status_codes = cfg.retryable_status_codes

packages/data-designer-engine/tests/engine/models/clients/test_native_http_clients.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ def test_sync_client_pool_size_respects_max_parallel_requests() -> None:
308308
with patch(_SYNC_CLIENT_PATCH):
309309
client._get_sync_client()
310310

311+
# Attribute chain explained:
312+
# RetryTransport._sync_transport → the httpx.HTTPTransport we injected
313+
# HTTPTransport._pool → the underlying httpcore.ConnectionPool
314+
# ConnectionPool._max_connections → the hard cap configured via Limits
311315
# pool_max = max(32, 2 * 300) = 600
312316
assert client._transport._sync_transport._pool._max_connections == 600
313317

@@ -325,5 +329,9 @@ async def test_async_client_pool_size_respects_max_parallel_requests() -> None:
325329
with patch(_ASYNC_CLIENT_PATCH):
326330
client._get_async_client()
327331

332+
# Attribute chain explained:
333+
# RetryTransport._async_transport → the httpx.AsyncHTTPTransport we injected
334+
# AsyncHTTPTransport._pool → the underlying httpcore.AsyncConnectionPool
335+
# AsyncConnectionPool._max_connections → the hard cap configured via Limits
328336
# pool_max = max(32, 2 * 300) = 600
329337
assert client._transport._async_transport._pool._max_connections == 600

0 commit comments

Comments
 (0)