Skip to content

feat: added strategy input APIs#17

Merged
petruki merged 1 commit into
masterfrom
staging
Jun 26, 2026
Merged

feat: added strategy input APIs#17
petruki merged 1 commit into
masterfrom
staging

Conversation

@petruki

@petruki petruki commented Jun 26, 2026

Copy link
Copy Markdown
Member

This pull request introduces a generic Check API for strategy validation and adds a comprehensive set of convenience helpers for all supported strategy types. It also significantly expands and refines the test suite to cover the new API and all strategy types, and updates documentation to reflect these changes.

API Enhancements

  • Introduced a generic Check(strategy, input) method on the Switcher type, enabling validation for any strategy type with a single entry-point.
  • Added convenience helper methods: CheckValue, CheckNumeric, CheckDate, CheckTime, CheckPayload, CheckNetwork, and CheckRegex, all delegating to the generic Check method for a consistent and extensible API.
  • Updated code examples in README.md to demonstrate chaining of multiple strategy checks and the new generic check API. [1] [2] [3]

Test Suite Expansion and Refactoring

  • Refactored local evaluation tests in local_test.go into themed groups (e.g., value, numeric, date, time, payload, regex strategies), and added comprehensive test coverage for all strategy types and their operations using both the generic and helper APIs. [1] [2]
  • Added remote evaluation tests to ensure that generic strategy inputs are correctly sent to the remote criteria endpoint.
  • Added execution logger tests to verify that generic strategy checks are logged and can be retrieved by switcher.

Test Data

  • Added new test snapshot files for date-based strategies (e.g., default_date_only.json) to support the new test cases.

These changes make the SDK more flexible, easier to use, and better tested across all supported feature flag strategies.

@petruki petruki self-assigned this Jun 26, 2026
@petruki petruki added enhancement New feature or request ai-assisted Indicates that AI tools were used to assist this with this change labels Jun 26, 2026
@sonarqubecloud

Copy link
Copy Markdown

@petruki petruki merged commit d0043ac into master Jun 26, 2026
7 checks passed
@petruki petruki deleted the staging branch June 26, 2026 04:04
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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant