Skip to content

Conversation

@petruki
Copy link
Member

@petruki petruki commented Oct 13, 2025

This pull request introduces improvements to how strategy inputs are managed in the Switcher client SDK, refactors entry handling for better consistency, and adds new tests to ensure correct behavior when flushing and changing strategy inputs. The changes focus on providing a more robust and predictable API for managing strategy entries and their lifecycle.

Entry management and API improvements:

  • Added a new flush() method to SwitcherBuilder that clears all previously added entries, replacing the older resetEntry() method and providing a more consistent way to reset strategy inputs. [1] [2]
  • Updated the check() method in SwitcherBuilder to remove existing entries for the same strategy before adding a new one, ensuring only the latest input for a strategy is considered.
  • Refactored entry clearing in SwitcherRequest by replacing direct list clearing with the new flush() method, standardizing entry management across the codebase. [1] [2]

Result mapping and correctness fixes:

  • Improved the mapping of entries in Mapper.mapFrom to ensure that a copy of the current entry list is set in the result only when entries are present, preventing unintended mutations.

Other minor changes:

  • Fixed a bug in the Entry.equals method to correctly return false when objects are not equal.

These changes collectively improve the reliability and clarity of strategy input handling in the SDK.

@petruki petruki added this to the v2.5.2 milestone Oct 13, 2025
@petruki petruki self-assigned this Oct 13, 2025
@petruki petruki added the patch Updating internal dependencies label Oct 13, 2025
@sonarqubecloud
Copy link

@petruki petruki merged commit 3c11284 into master-2 Oct 13, 2025
9 checks passed
@petruki petruki deleted the bugfix_374 branch October 13, 2025 19:56
petruki added a commit that referenced this pull request Oct 13, 2025
)

* Fixes #374 - prevent invalidate cache reference when async (#375)

* fix: replaced List.copyOf with new ArrayList()

* fix-test: reduced counter for shouldReturnTrue_withThrottle test

* Revert "fix-test: reduced counter for shouldReturnTrue_withThrottle test"

This reverts commit c5f5bd0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Updating internal dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants