Repository navigation
fix: Make TestData ValueForAll return its value when targeting is off - #400
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. The method already replaced variations with a single value and set fallthrough viaVariationForAll(0), but it left the default boolean off variation index at1, which is out of range for a one-variation flag and produced a malformed flag instead of the documented “same value on or off” behavior.ValueForAllnow also callsOffVariation(0)afterVariationForAll(0);VariationForAllbehavior is unchanged. New unit tests assert the built flag shape (targeting on/off) and an integration test confirmsLdClientreturns the configured string when targeting is off.Reviewed by Cursor Bugbot for commit 9de4a3d. Bugbot is set up for automated code reviews on this repo. Configure here.