Skip to content

refactor: extract requests transport - #469

Merged
alexanto merged 10 commits into
mainfrom
refactor/extract-requests-transport
Nov 10, 2026
Merged

alexanto merged 10 commits into
mainfrom
refactor/extract-requests-transport

Conversation

@alexanto

@alexanto alexanto commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

extracting the i/o from the api_client as transport. this is the first step towards a custom HTTP transport.
so far really just refactoring, and RequestsTransport is going to be the default transport implementation for the sync client

@alexanto
alexanto added this pull request to stack #468 November 3, 2026 12:20
@alexanto alexanto changed the title Refactor/extract requests transport refactor: extract requests transport Nov 3, 2026
@gastonfournier gastonfournier moved this from New to In Progress in Issues and PRs Nov 4, 2026
Base automatically changed from refactor/rename-transport to main November 5, 2026 13:13
@alexanto
alexanto requested review from ppicom and a balanced review from Copilot and removed request for Copilot November 5, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Transport-contract gaps break ETag caching, raise unexpectedly after retry exhaustion, corrupt non-UTF-8 feature data, and allow injected network failures to bypass metric restoration or abort initialization.

4 open issues
What changed in this PR

Extracts HTTP I/O from the synchronous API client into a transport layer, preparing the SDK for custom transports while keeping RequestsTransport as the default.

Changes:

  • Adds request and response models, a transport protocol, and a requests-based implementation.
  • Routes feature fetching, registration, and metrics submission through the transport.
  • Adds tests for transport injection, request handling, retries, and session isolation.
File Description
UnleashClient/​_unleash_api_client.py Delegates HTTP calls to an injectable transport and interprets its responses.
UnleashClient/​_transport.py Defines transport interfaces and the default requests implementation.
tests/​unit_tests/​test_unleash_api_client.py Tests transport delegation for all three API operations.
tests/​unit_tests/​test_transport.py Tests request forwarding, responses, retries, errors, and session isolation.

Review effort: Balanced

Comment thread UnleashClient/_transport.py Resolved
Comment thread UnleashClient/_transport.py Resolved
Comment thread UnleashClient/_unleash_api_client.py Resolved
Comment thread UnleashClient/_unleash_api_client.py Resolved
Comment thread UnleashClient/_transport.py Resolved
Comment thread UnleashClient/_transport.py Resolved
Comment thread UnleashClient/_unleash_api_client.py Resolved
@github-project-automation github-project-automation Bot moved this from In Progress to Approved PRs in Issues and PRs Nov 9, 2026
@alexanto
alexanto merged commit c21dce0 into main Nov 10, 2026
8 checks passed
@alexanto
alexanto deleted the refactor/extract-requests-transport branch November 10, 2026 11:27
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Issues and PRs Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants