Repository navigation
Conversation
… off FlagBuilderV2#value_for_all set a single variation but kept the off variation, which is 1 for a new flag. That index is out of range, so the flag failed to evaluate when targeting was off. The method now also sets the off variation to the single variation, so the flag returns the value whether targeting is on or off, as its documentation says.
This was referenced Nov 5, 2026
fix: Make TestData ValueForAll return its value when targeting is off
launchdarkly/go-server-sdk#507
Merged
Merged
Merged
Merged
This branch has not been deployed
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.
FlagBuilderV2#value_for_all set a single variation but kept the off
variation, which is 1 for a new flag. That index is out of range, so the
flag failed to evaluate when targeting was off. The method now also sets
the off variation to the single variation, so the flag returns the value
whether targeting is on or off, as its documentation says.
Note
Overview
Fixes TestDataV2
FlagBuilderV2#value_for_allso flags with a single custom variation evaluate correctly when targeting is off.The method already collapsed the flag to one variation and set fallthrough to index 0, but it left off variation at the default boolean flag index (1). With only one variation, that index is invalid and evaluation could fail with targeting off. The builder now also calls
off_variation(0), matching the documented behavior of returning the same value whether targeting is on or off.Adds a spec that built flags expose
offVariation0 for both targeting on and off.Reviewed by Cursor Bugbot for commit 1011bdc. Bugbot is set up for automated code reviews on this repo. Configure here.