-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: Add support for client-side prerequisite events. #137
feat: Add support for client-side prerequisite events. #137
Conversation
priv/flags-segments-put-data.json
Outdated
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.
Updating this test data to have consistent clientSideAvailability with the clientSide field.
with_reasons => boolean() | ||
%% client_side_only => boolean(), % TODO: Support. | ||
with_reasons => boolean(), | ||
client_side_only => boolean() |
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.
It seemed reasonable to implement this at the same time, and that allows the contract tests to be passed as well.
8d938aa
to
f1d2e58
Compare
f1d2e58
to
2e75104
Compare
@@ -810,6 +812,101 @@ rule_match_rollout_not_in_experiment(_) -> | |||
ExpectedEvents = ActualEvents. | |||
|
|||
all_flags_state(_) -> |
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.
This test was supposed to be without reasons and the other test with reasons, but it originally had a mistake. So both tests were with reasons.
all_flags_state_offline(_) -> | ||
#{ | ||
<<"$flagsState">> := #{}, | ||
<<"$valid">> := false | ||
} = ldclient_eval:all_flags_state(#{key => <<"userKeyA">>, kind => <<"user">>}, #{with_reasons => true}, offline). | ||
|
||
all_flags_state_client_side_only(_) -> |
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.
New test for client-side visibility.
FeatureStore = ldclient_config:get_value(Tag, feature_store), | ||
AllFlags = [Flag || Flag = {_, FlagValue} <- FeatureStore:all(Tag, features), is_not_deleted(FlagValue)], | ||
AllFlags = [Flag || Flag = {_, FlagValue} <- FeatureStore:all(Tag, features), is_not_deleted(FlagValue), is_visible(FlagValue, Options)], |
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.
Update the list comprehension to filter flags based on visibility.
@@ -113,6 +113,26 @@ all_flags_state(Context, Options, Tag) -> | |||
is_not_deleted(#{deleted := true}) -> false; | |||
is_not_deleted(_) -> true. | |||
|
|||
-spec is_prereq_of(FlagKey :: ldclient_flag:key(), Event :: ldclient_event:event()) -> boolean(). | |||
is_prereq_of(FlagKey, #{data := #{prereq_of := PrereqOf}} = _Event) -> |
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.
If prereq_of is set to the flag we are evaluating, then that flag was evaluated as a direct prerequisite.
…vents-support-to-erlang-server-sdk
BEGIN_COMMIT_OVERRIDE
feat: Add support for client-side prerequisite events.
feat: Add support for client-side visibility for all_flags_state.
END_COMMIT_OVERRIDE
SDK-803