Repository navigation
fix: Make TestData valueForAll return its value when targeting is off - #251
Merged
Merged
Conversation
Generated-by: termag
keelerm84
marked this pull request as ready for review
November 5, 2026 19:14
joker23
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestData.FlagBuilder.valueForAllreplaced the flag's variations with the single value and then calledvariationForAll(0). That set the fallthrough to 0 but left the off variation unchanged. A new test flag is a boolean flag with off variation 1, so the built flag hadvariations: [value]andoffVariation: 1. The index was out of range, and the flag failed to evaluate (malformed flag) when targeting was off. The method's documentation says it returns the value regardless of whether targeting is on or off.valueForAllnow also sets the off variation to 0.variationForAllis unchanged. The new tests check the built flag with targeting on and off, and check that a client evaluates the flag to the value when targeting is off.This matches the Ruby fix in launchdarkly/ruby-server-sdk#489.
Opened from termag
Note
Overview
Fixes
TestData.FlagBuilder.valueForAllso flags evaluate correctly when targeting is off. After collapsing variations to a single value, the builder only set fallthrough viavariationForAll(0), leaving the default boolean off variation index 1—invalid for one variation and causing malformed-flag evaluation instead of returning the configured value.valueForAllnow also callsoffVariation(0), matching documented behavior (same value on or off).variationForAllis unchanged. New unit and client tests cover the built flag shape and off-targeting evaluation.Reviewed by Cursor Bugbot for commit 0a798d5. Bugbot is set up for automated code reviews on this repo. Configure here.