Skip to content

fix: Make TestDataV2 value_for_all return its value when targeting is off - #489

Open
keelerm84 wants to merge 1 commit into
feat/9.xfrom
mk/SDK-3477/value-for-all
Open

keelerm84 wants to merge 1 commit into
feat/9.xfrom
mk/SDK-3477/value-for-all

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

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_all so 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 offVariation 0 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.

… 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 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