Skip to content

fix: Make TestData value_for_all return its value when targeting is off - #210

Merged
keelerm84 merged 1 commit into
mainfrom
mk/SDK-3477/value-for-all
Nov 10, 2026
Merged

keelerm84 merged 1 commit into
mainfrom
mk/SDK-3477/value-for-all

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

ldclient_flagbuilder:value_for_all/2 replaced the variations with the single value and called variation_for_all(0, ...), but left the off variation unchanged. A new test flag is a boolean flag with off variation 1, so the built flag had one variation and an off variation of 1. When targeting was off, the off variation was out of range and the flag returned the default value instead of the value. The function is documented to return the value whether targeting is on or off.

value_for_all/2 now also sets the off variation to 0. variation_for_all/2 is unchanged. A new test in ldclient_testdata_SUITE turns targeting off after value_for_all/2 and checks that the flag evaluates to the value.

This matches the fix in launchdarkly/ruby-server-sdk#489.

Opened from termag


Note

Overview
value_for_all/2 in the TestData flag builder now sets off variation to 0 after collapsing the flag to a single variation. Previously it only updated fallthrough via variation_for_all, so the default boolean off variation 1 stayed in place; with one variation, evaluation used the client default when targeting was off despite the docs promising the same value in both states.

A new Common Test case test_value_for_all_targeting_off turns targeting off after value_for_all and asserts the configured value is returned (not the default).

Reviewed by Cursor Bugbot for commit d8f8593. Bugbot is set up for automated code reviews on this repo. Configure here.

@keelerm84
keelerm84 marked this pull request as ready for review November 5, 2026 19:14
@keelerm84
keelerm84 requested a review from a team as a code owner November 5, 2026 19:14
@keelerm84
keelerm84 merged commit baf5cbc into main Nov 10, 2026
10 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3477/value-for-all branch November 10, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants