Skip to content

fix: simplified remote APIs, timeout settings, replaced tests#5

Merged
petruki merged 1 commit into
masterfrom
staging
May 12, 2026
Merged

fix: simplified remote APIs, timeout settings, replaced tests#5
petruki merged 1 commit into
masterfrom
staging

Conversation

@petruki
Copy link
Copy Markdown
Member

@petruki petruki commented May 12, 2026

This pull request refactors how remote request timeouts are configured and simplifies the remote evaluation logic for switchers. It consolidates multiple timeout settings into a single Timeout field, improves the handling of value checks, and adds comprehensive test coverage for the updated behaviors. Several redundant or error-prone code paths and tests are removed, resulting in a cleaner and more robust implementation.

Remote Timeout Configuration:

  • Consolidated ReadTimeout, WriteTimeout, and PoolTimeout into a single Timeout field in RemoteOptions, updating all usages and documentation accordingly.
  • Updated the HTTP client construction to use the new Timeout field directly, removing the requestTimeout helper and related logic.

Switcher Value Check Logic:

  • Changed CheckValue to always overwrite previous value entries, ensuring only the latest value check is used in remote evaluation.
  • Refactored IsOn and IsOnWithDetails to share a common submit method, clarifying the distinction between detailed and non-detailed requests.

Testing Improvements and Coverage:

  • Added new tests to verify token reuse, token renewal, correct passing of input parameters, and correct behavior of detailed vs. non-detailed switcher checks.
  • Enhanced the remote test server to allow for custom authentication request handling.
  • Updated context and client tests to reflect the new timeout configuration and context rebuilding logic.

Codebase Simplification:

  • Removed redundant error handling in JSON marshaling and HTTP request creation in favor of simpler code, as errors are not expected in the tested scenarios.
  • Deleted obsolete helper functions and their associated tests, such as appendFilteredEntries and requestTimeout.

Documentation Updates:

  • Updated the README.md to reflect the new timeout configuration and clarify the meaning of the consolidated Timeout field.

These changes make the remote evaluation logic more predictable and maintainable, while also improving test coverage and documentation.

@petruki petruki self-assigned this May 12, 2026
@petruki petruki added documentation Improvements or additions to documentation enhancement New feature or request ai-assisted Indicates that AI tools were used to assist this with this change labels May 12, 2026
@sonarqubecloud
Copy link
Copy Markdown

@petruki petruki merged commit b578ee6 into master May 12, 2026
7 checks passed
@petruki petruki deleted the staging branch May 12, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Indicates that AI tools were used to assist this with this change documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant