Skip to content

fix: Make TestData valueForAll return its value when targeting is off - #126

Open
keelerm84 wants to merge 1 commit into
mainfrom
mk/SDK-3477/value-for-all
Open

keelerm84 wants to merge 1 commit into
mainfrom
mk/SDK-3477/value-for-all

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

valueForAll replaced the variations with the single value and called variationForAll 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.

valueForAll now also sets the off variation to 0. variationForAll is unchanged. A new test turns targeting off after valueForAll and checks that the flag evaluates to the value. valueForAllUsers is an alias, so it gets the fix too.

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

Opened from termag


Note

Overview
valueForAll in the TestData flag builder now sets off variation to index 0 in addition to a single variation and fallthrough, so evaluation matches its documented behavior when targeting is off.

Previously, shrinking the flag to one variation left the default boolean off variation at index 1, which was invalid and caused the SDK to return the client default instead of the configured value.

A new integration test applies valueForAll then on False and asserts the flag still returns the configured string value.

Reviewed by Cursor Bugbot for commit 9f987d4. 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

This branch has not been deployed

No deployments
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.

1 participant