Skip to content

feat: added remote API tuning settings#57

Merged
petruki merged 1 commit intomasterfrom
staging
May 8, 2026
Merged

feat: added remote API tuning settings#57
petruki merged 1 commit intomasterfrom
staging

Conversation

@petruki
Copy link
Copy Markdown
Member

@petruki petruki commented May 8, 2026

This pull request introduces a new RemoteOptions configuration object to centralize and enhance remote transport settings, including SSL certificate path and various timeout controls. The changes improve the flexibility and reliability of remote API calls, especially in scenarios involving silent mode and failover to local evaluation. The update also refactors the client initialization and remote logic to consistently utilize these new options, and expands test helpers for better error simulation.

The most important changes are:

Remote transport configuration and usage:

  • Added a new RemoteOptions dataclass to encapsulate remote transport settings such as cert_path, connect_timeout, read_timeout, write_timeout, and pool_timeout. These options are now part of ContextOptions under the remote field, replacing the previous direct cert_path usage.
  • Refactored the remote HTTP client (Remote._get_client) to use the new timeout values from RemoteOptions and to reinitialize the client if any transport settings change.
  • Updated SSL context creation to use the certificate path from RemoteOptions instead of the now-removed cert_path field in ContextOptions.

Client and context initialization:

  • Modified Client.build_context and related context creation logic to accept and propagate the new RemoteOptions through ContextOptions, ensuring all components use the unified configuration.

Remote request handling improvements:

  • Refactored remote request methods (_do_post, _do_get) to a unified interface that handles request errors more robustly, raising operation-specific exceptions and supporting fail-fast behavior for silent mode. ([switcher_client/lib/remote.pyR169-R191](https://github.com/switcherapi/switcher-client-py/pull/57/files#diff-4ecc9a37ec39f8228d468725cd0c48b183121ffc4c8e8e7aeaa3febd91eeb5c6R169-R191))
  • Updated all remote API methods to use the new request interface, improving error handling and code clarity.

Documentation and test improvements:

  • Updated the README.md to document the new remote configuration, including descriptions and default values for all RemoteOptions fields, and clarified error handling behavior.
  • Enhanced test helpers to support the new context options and to simulate remote exceptions for more robust testing.

These changes make remote communication more configurable, reliable, and easier to maintain.

@petruki petruki added this to the v1.1.0 milestone May 8, 2026
@petruki petruki self-assigned this May 8, 2026
@petruki petruki added the enhancement New feature or request label May 8, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

@petruki petruki merged commit 78ba272 into master May 8, 2026
27 of 28 checks passed
@petruki petruki deleted the staging branch May 8, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant