Repository navigation
Replace httpx with httpx2 - #71
Open
skupriienko-mailgun wants to merge 15 commits into
Open
skupriienko-mailgun wants to merge 15 commits into
skupriienko-mailgun wants to merge 15 commits into
Conversation
- Relax strict production linter rules across tests/** (assert, magic values, unittest assertions, etc.). - Ignore COM812 (missing-trailing-comma) to avoid conflicts with ruff format.
- Convert tuple membership tests to set literals in conftest.py. - Remove redundant dict.keys() calls in assertions. - Combine nested with statements and format files with ruff format.
- Convert membership checks in evil server and pagination fuzzers to set literals. - Simplify conditional branching in webhook signature fuzzer. - Replace manual iteration loops with enumerate in pagination stream harness. - Standardize import ordering and code formatting across all fuzz targets.
- Optimize dict key lookups in sync and async integration test assertions. - Inline unnecessary lambdas in live routing meta tests. - Add raw string prefixes to regex docstrings in regression tests. - Apply consistent ruff format styling across all suites.
…lign error handling - Track prev_url in Endpoint.stream() and AsyncEndpoint.stream() to prevent infinite loops on stagnant cursors. - Wrap requests.HTTPError into ApiError in Endpoint.stream() for contract parity with the async client. - Remove redundant loop break condition in Endpoint.stream().
- Update message tags from httpx-sdk to httpx2-sdk across unit and integration suites. - Append new tokens to tests/fuzz/fuzz.dict.
…otes - Update README.md runtime dependencies to mandate httpx2 >=2.7.0 exclusively. - Add stream pagination hardening, httpx2 engine migration, and merged PRs to CHANGELOG.md.
skupriienko-mailgun
marked this pull request as ready for review
October 8, 2026 11:01
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…errors - Short-circuit retries on unrecoverable requests URL and schema validation exceptions. - Route httpx2 UnsupportedProtocol and DecodingError directly to API error handler.
…t harness - Mock time.sleep to eliminate execution delays during fuzzing runs. - Configure Client with zero-retry policy and safely catch expected URL validation errors.
…latency fixes - Add Unreleased section entries covering retry suppression for requests and httpx2 errors. - Document test execution optimizations in fuzz_audit_events.
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
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.
Links:
Jira
Actions:
Core Engine Modernization (
httpx2):httpx2 >=2.7.0, dropping the unmaintainedhttpx >=0.24.0dependency acrosspyproject.toml,environment.yaml, andenvironment-dev.yaml.mailgun.client,mailgun.endpoints,mailgun.security, andmailgun.typesto interface natively withhttpx2forAsyncClient,Request,Response,Timeout, and exception classes.mailgun/_httpx_compat.pyand its runtime detection flag (HAS_HTTPX2), eliminating dynamic import branching, dual-engine shims, and obsolete tests (tests/unit/test_httpx_compat.py).SECURITY.mdsupported release targets to designate1.10.xas active and deprecate< 1.10.0.Bug Fixes & Network Resilience:
Endpoint.stream()andAsyncEndpoint.stream()to trackprev_url, terminating the generator if Mailgun's pagination API returns duplicate or stagnant cursor tokens (next_url == prev_url) to prevent infinite iteration loops.requests.HTTPErrorintoApiError(exc.response)inEndpoint.stream(), matching the defensive exception contract implemented inAsyncEndpoint.stream()forhttpx2.HTTPStatusError.if not next_url or not items: breakcheck inEndpoint.stream().itemsexistence check intest_post_query_get_account_logsacrosstest_integration_async.pyandtest_integration_sync.pyto preventIndexError: list index out of rangeon accounts with empty log retention windows.raise etoraise) and corrected format string parameter alignment intest_integration_coverage.py.Linting, Tooling & Developer Experience (DX):
missing-trailing-comma(COM812) to[tool.ruff.lint.ignore]inpyproject.tomlto eliminate formatting rule collisions withruff format.per-file-ignoresfortests/**inpyproject.tomlto suppress non-library false positives (such asassert,magic-value-comparison,pytest-unittest-assertion, and private test helper imports).commitizentov4.19.2,semgreptov1.180.0,typostov1.51.1,check-jsonschemato0.38.2,rufftov0.16.10, andmypytov2.4.0in.pre-commit-config.yaml.ruff check --fix --unsafe-fixesandruff formatacross all unit, integration, fuzz, property, and regression test suites.Documentation & Release Preparation:
v1.10.0): Documented thehttpx2migration, stream pagination hardening, tooling updates, and merged Dependabot PRs (build(deps): Bump the minor-and-patch group with 2 updates #68, build(deps): Bump the minor-and-patch group with 2 updates #70) inCHANGELOG.md.README.mdruntime dependencies to mandatehttpx2 >=2.7.0exclusively and aligned integration test tagging metadata tohttpx2-sdk.Verification & Testing:
1. Run the Unit Test Suite:
Validates core client lifecycle, builders, security guards, and
httpx2lazy client instantiation.2. Verify Stream Pagination & Endpoints:
Confirms cyclic cursor detection, type drift casting, and HTTP status handling across sync and async streams.
3. Run the Live Integration Suite:
Executes end-to-end flows against sandbox domains verifying async/sync parity under
httpx2.4. Execute Live Routing Meta-Tests:
Verifies URL formulation across all supported endpoints against live Mailgun servers.
5. Performance & Concurrency Benchmarks:
Proves connection pooling throughput under
httpx2.Limits(max_connections=100).6. Static Analysis & Lint Gates:
Ensures complete Ruff, Mypy, and Pyright compliance across all library and test modules.