Skip to content

Conversation

@ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Sep 10, 2025

Summary by CodeRabbit

  • New Features

    • Unified proxy configuration for both async and sync clients, enabling consistent setup across environments.
    • Support for custom proxy mounts with dedicated transports to fine-tune network behavior.
  • Refactor

    • Standardized proxy handling across clients, improving reliability and clarity.
    • Enhanced type-safety around proxy settings to reduce configuration errors.

@coderabbitai
Copy link

coderabbitai bot commented Sep 10, 2025

Walkthrough

The changes add structured proxy configuration via two public TypedDicts: ProxyConfig (async) and ProxyConfigSync (sync). Type-checking imports for AsyncBaseTransport, BaseTransport, and ProxyTypes are introduced, and Mapping is added to imports. The async request path now builds mounts with httpx.AsyncHTTPTransport and passes a typed ProxyConfig to httpx.AsyncClient. The sync path builds mounts with httpx.HTTPTransport and passes a typed ProxyConfigSync to httpx.Client. Type ignores are removed, and minor control-flow/type updates align the public API and internal usage.

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The current title succinctly summarizes the primary change by indicating a cleanup and refinement of proxy configuration typing, which aligns with the addition of structured TypedDicts and transport adjustments for both async and sync clients detailed in the diff. It is concise, specific to the main focus of the pull request, and provides clear context without extraneous details.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41dfe7c and 9222be5.

📒 Files selected for processing (1)
  • infrahub_sdk/client.py (6 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

When implementing Infrahub checks, subclass InfrahubCheck and override validate(data); do not implement or rely on a check() method

Files:

  • infrahub_sdk/client.py
infrahub_sdk/client.py

📄 CodeRabbit inference engine (CLAUDE.md)

infrahub_sdk/client.py: Use HTTPX for transport with proxy support (single proxy or HTTP/HTTPS mounts)
Support authentication via API tokens or JWT with automatic refresh

Files:

  • infrahub_sdk/client.py
🧬 Code graph analysis (1)
infrahub_sdk/client.py (1)
infrahub_sdk/config.py (1)
  • is_set (33-34)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: unit-tests (3.9)
  • GitHub Check: unit-tests (3.12)
  • GitHub Check: unit-tests (3.11)
  • GitHub Check: unit-tests (3.10)
  • GitHub Check: unit-tests (3.13)
  • GitHub Check: integration-tests-latest-infrahub
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (9)
infrahub_sdk/client.py (9)

8-8: LGTM! Clean import addition.

The addition of Mapping to the imports is appropriate for the new proxy configuration TypedDicts.


64-66: Good use of TYPE_CHECKING for type-only imports.

Properly importing transport types from httpx's private modules only for type checking helps avoid runtime dependencies on internal implementation details.


79-87: Well-structured TypedDict definitions for proxy configuration.

The separation of ProxyConfig (async) and ProxyConfigSync (sync) with appropriate transport types provides clear typing for both client implementations. Using Mapping for mounts ensures immutability at the type level.


1042-1042: Clean type annotation update for async proxy config.

The type annotation correctly uses the new ProxyConfig TypedDict, improving type safety.


1047-1047: Correct usage of AsyncHTTPTransport for async client.

The change from HTTPTransport to AsyncHTTPTransport properly aligns the transport type with the async client implementation.


1052-1052: Type-ignore removed successfully.

The removal of the type-ignore comment demonstrates that the typing issues have been properly resolved with the new TypedDict approach.


2704-2705: Clean type annotation for sync proxy config.

The sync client correctly uses ProxyConfigSync with appropriate typing.


2710-2710: Correct transport type for sync client.

Using httpx.HTTPTransport (without Async prefix) is the appropriate choice for the synchronous client implementation.


2715-2715: Type-ignore successfully eliminated in sync client.

The structured typing approach has resolved the type checking issues in both async and sync implementations.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pog-proxy-config-typing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9222be5
Status: ✅  Deploy successful!
Preview URL: https://75c4b0bd.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-proxy-config-typing.infrahub-sdk-python.pages.dev

View logs

@codecov
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@             Coverage Diff             @@
##           develop     #539      +/-   ##
===========================================
- Coverage    75.94%   75.86%   -0.09%     
===========================================
  Files          100      100              
  Lines         9329     8874     -455     
  Branches      1832     1737      -95     
===========================================
- Hits          7085     6732     -353     
+ Misses        1754     1670      -84     
+ Partials       490      472      -18     
Flag Coverage Δ
integration-tests 34.82% <22.22%> (-1.43%) ⬇️
python-3.10 48.27% <22.22%> (-1.37%) ⬇️
python-3.11 48.29% <22.22%> (-1.35%) ⬇️
python-3.12 48.27% <22.22%> (-1.33%) ⬇️
python-3.13 48.27% <22.22%> (-1.35%) ⬇️
python-3.9 46.92% <22.22%> (-1.13%) ⬇️
python-filler-3.12 25.10% <77.77%> (+0.87%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/client.py 70.15% <100.00%> (+0.19%) ⬆️

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ogenstad ogenstad merged commit ac60214 into develop Sep 11, 2025
20 checks passed
@ogenstad ogenstad deleted the pog-proxy-config-typing branch September 11, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants