Skip to content

fix: Fix an issue with rollouts with a missing attribute. #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025

Conversation

kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented Jun 24, 2025

When a rollout had a seed, and the context being evaluated was missing the attribute referenced by bucketBy, then the null atom would attempt to be used as a binary.

When the attribute is null, then the bucket value should always be 0.

This doesn't affect the experimentation logic related to presence of the context itself.

Fixes: #152

@@ -147,7 +147,8 @@ match_weighted_variations(Bucket, [#{weight := Weight}|Rest], Sum) ->
FlagKey :: ldclient_flag:key(),
Salt :: binary(),
ContextValue :: binary() | null) -> float().
bucket_context_value(null, _FlagKey, _Salt, null) -> 0.0;

bucket_context_value(_Seed, _FlagKey, _Salt, null) -> 0.0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the problem here was that both the seed and the value needed to be null in order to match this path.
When the bucket-able value is null we should bucket to 0, which is independent of the seed value.

@kinyoklion kinyoklion force-pushed the rlamb/sdk-1349/fix-argumenterror branch from 61ca90d to 9f0dd01 Compare June 24, 2025 16:46
]
}),
#{key => <<"flagKey">>, salt => <<"flagSalt">>},
ldclient_context:new(<<"user-key">>)).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context doesn't have the missing attribute.

<<"kind">> => <<"rollout">>,
<<"contextKind">> => <<"user">>,
<<"bucketBy">> => <<"missing">>,
<<"seed">> => 1234567890,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seed was required to hit this code path.

@kinyoklion kinyoklion force-pushed the rlamb/sdk-1349/fix-argumenterror branch 2 times, most recently from 6f2bf13 to 62f680c Compare June 24, 2025 16:51
@kinyoklion kinyoklion force-pushed the rlamb/sdk-1349/fix-argumenterror branch from 62f680c to 319ba0f Compare June 24, 2025 16:57
@kinyoklion kinyoklion marked this pull request as ready for review June 24, 2025 17:19
@kinyoklion kinyoklion merged commit a94ed9c into main Jun 25, 2025
5 checks passed
@kinyoklion kinyoklion deleted the rlamb/sdk-1349/fix-argumenterror branch June 25, 2025 16:39
kinyoklion pushed a commit that referenced this pull request Jun 25, 2025
🤖 I have created a release *beep* *boop*
---


##
[3.7.2](v3.7.1...v3.7.2)
(2025-06-25)


### Bug Fixes

* Fix an issue with rollouts with a missing attribute.
([#153](#153))
([a94ed9c](a94ed9c)),
closes
[#152](#152)

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

ArgumentError: expected binary but got :null in progressive rollout evaluation
3 participants