Repository navigation
fix: Make TestData valueForAll return its value when targeting is off - #288
Merged
Merged
Conversation
Generated-by: termag
keelerm84
marked this pull request as ready for review
November 5, 2026 19:14
kinyoklion
approved these changes
Nov 9, 2026
keelerm84
pushed a commit
that referenced
this pull request
Nov 10, 2026
🤖 I have created a release *beep* *boop* --- ## [6.12.1](6.12.0...6.12.1) (2026-11-10) ### Bug Fixes * Include the big segments status on evaluation reasons for failed evaluations ([#292](#292)) ([2f2b1fe](2f2b1fe)) * Include the HTTP status in exceptions on evaluation reasons ([#291](#291)) ([52d3303](52d3303)) * Make TestData valueForAll return its value when targeting is off ([#288](#288)) ([b8a9522](b8a9522)) * Prevent allFlagsState from throwing when retrieving flags fails ([#294](#294)) ([2b65bf2](2b65bf2)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
FlagBuilder::valueForAllreplaced the variations with the single value and calledvariationForAll(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. With targeting off, the index was out of range and the flag failed to evaluate. The method is documented to return the value regardless of whether targeting is on or off.valueForAllnow also sets the off variation to 0.variationForAllis unchanged. A new test builds a flag withvalueForAll, checks thatoffVariationis 0, turns targeting off, and checks thatLDClient::variationreturns the value.Same fix as launchdarkly/ruby-server-sdk#489.
Opened from termag
Note
Overview
Fixes TestData
FlagBuilder::valueForAllso flags still evaluate when targeting is turned off.Previously the helper replaced variations with a single value and routed “on” traffic via
variationForAll(0), but did not updateoffVariation. New TestData flags default to a boolean layout withoffVariationindex1, so aftervalueForAllthe built flag had one variation at index0whileoffVariationstill pointed at index1, causing bad evaluations when targeting was off—despite the doc saying the same value should apply on or off.The change chains
offVariation(0)after the existing setup.variationForAllis unchanged. A new integration test assertsoffVariationis0and thatLDClient::variationreturns the configured value with targeting off.Reviewed by Cursor Bugbot for commit 9fe0b55. Bugbot is set up for automated code reviews on this repo. Configure here.