Repository navigation
Conversation
alexanto
changed the base branch from
main
to
refactor/extract-aiohttp-transport
November 4, 2026 14:35
alexanto
force-pushed
the
refactor/error-contract
branch
from
November 5, 2026 13:28
a6a60cc to
2163219
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Header validation incorrectly permits None for app_name, instance_id, and connection_id, bypassing the documented constructor TypeError and deferring handling to the HTTP library.
1 open issue
What changed in this PR
This PR makes API request error handling independent of the HTTP library, aligning the synchronous and asynchronous clients.
Changes:
- Treat transport exceptions during registration and metrics submission as failed requests while preserving payload serialization errors.
- Validate header values during configuration and remove redundant initialization-time URL checks.
- Update regression tests and migration documentation for the revised behavior.
| File | Description |
|---|---|
| v7_MIGRATION_GUIDE.md | Documents header validation and trailing-newline handling. |
| UnleashClient/utils.py | Adds header-value validation. |
| UnleashClient/config.py | Validates configured header values at construction. |
| UnleashClient/clients/unleash_client.py | Removes redundant URL validation during initialization. |
| UnleashClient/clients/async_unleash_client.py | Removes redundant URL validation and outdated exception documentation. |
| UnleashClient/_unleash_api_client.py | Handles transport exceptions without requests-specific exception types. |
| UnleashClient/_async_unleash_api_client.py | Broadens transport error handling while preserving cancellation. |
| tests/unit_tests/test_utils.py | Tests header validation and secret-safe errors. |
| tests/unit_tests/test_unleash_api_client.py | Tests transport failures and serialization-error propagation. |
| tests/unit_tests/test_config.py | Tests constructor header validation. |
| tests/unit_tests/test_async_unleash_api_client.py | Tests transport failures, closed transports, and serialization errors. |
| CHANGELOG.md | Records validation and registration-error behavior changes. |
Review effort: Balanced
| ("unleash-instanceid", self.identity.instance_id), | ||
| ("unleash-connection-id", self.connection_id), | ||
| ): | ||
| if value is not None: |
Contributor
Author
There was a problem hiding this comment.
this is hardly a regression and there are defaults for those values in case of None, so I dont this this makes much sense
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

makes the API clients' error handling library-neutral, so a transport built on any HTTP library behaves the same: any exception from
transport.execute()is a failed request and it gets logged, and the client keeps runningbecause of this a malformed header no longer crashes anything, so I added a validate headers check