-
Notifications
You must be signed in to change notification settings - Fork 38
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
Conversation
@@ -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; |
There was a problem hiding this comment.
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.
61ca90d
to
9f0dd01
Compare
] | ||
}), | ||
#{key => <<"flagKey">>, salt => <<"flagSalt">>}, | ||
ldclient_context:new(<<"user-key">>)). |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
6f2bf13
to
62f680c
Compare
62f680c
to
319ba0f
Compare
🤖 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>
When a rollout had a seed, and the context being evaluated was missing the attribute referenced by
bucketBy
, then thenull
atom would attempt to be used as a binary.When the attribute is
null
, then the bucket value should always be0
.This doesn't affect the experimentation logic related to presence of the context itself.
Fixes: #152