Skip to content

feat: added remote API module#3

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

feat: added remote API module#3
petruki merged 1 commit into
masterfrom
staging

Conversation

@petruki
Copy link
Copy Markdown
Member

@petruki petruki commented May 10, 2026

This pull request introduces significant improvements to the feature flag client, focusing on enhanced remote evaluation support, improved error handling, and updated documentation and tests to reflect these changes. The core logic for remote criteria evaluation has been added, along with new error types and result handling structures. The usage examples and tests have been updated to use the new error-aware API.

Remote criteria evaluation and error handling:

  • Added remote.go with logic for remote criteria evaluation, including token management, criteria checks, and HTTP client configuration. This enables secure and robust remote feature flag evaluation.
  • Introduced structured error types in errors.go (RemoteError, RemoteAuthError, RemoteCriteriaError) for clearer error management during remote operations.
  • Added ResultDetail struct in result.go to encapsulate detailed results of feature evaluation, including metadata and reasons.

Switcher API enhancements:

  • Updated Switcher methods in switcher.go to support error returns: IsOn() and IsOnWithDetails() now return errors, and new methods like CheckValue, Prepare, and appendFilteredEntries provide more flexible criteria management.
  • Added new fields to Client for authentication token management.

Documentation and test updates:

  • Updated all usage examples in README.md to handle errors returned by IsOn() and related methods, ensuring best practices are followed in client usage.
  • Enhanced tests in switcher_test.go to cover new error scenarios, token preparation, and entry filtering logic.

These changes collectively make the client more robust, secure, and user-friendly, especially in remote and error-prone environments.

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

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

Labels

ai-generated Indicates that AI tools were used to generate 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