-
Notifications
You must be signed in to change notification settings - Fork 2
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: bandits #11
feat: bandits #11
Conversation
Rust tests will fail depending on Eppo-exp/sdk-test-data#44 |
let assignment = self | ||
.get_assignment( | ||
flag_key, | ||
subject_key, | ||
&subject_attributes.to_generic_attributes(), | ||
Some(VariationType::String), | ||
) | ||
.unwrap_or_default() | ||
.unwrap_or_else(|| Assignment { | ||
value: AssignmentValue::String(default_variation.to_owned()), | ||
event: None, | ||
}); |
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.
One deviation from other SDKs: because of how eppo_core
is structured, it is possible to evaluate assignments without triggering assignment logging. I therefore removed an early return in case of a bandit flag with empty actions and evaluate the assignment immediately.
- In case assignment resolves to non-bandit variation, we return the variation and log the assignment.
- If it's a bandit variation and actions are missing, bandit evaluation will fail and we'll return default variation and skip assignment logging.
- Otherwise, we return variation+action + log the assignment and bandit action.
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.
I think you could mirror the other SDKs if you stored top-level which flags have which bandits. Then you know if a flag involves bandits or not from the get go and can check if assignments is empty.
I do agree it's kind of a pain though.
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.
Yeah, I store that mapping and I can easily mirror the behavior, but I thought that this behavior is more desirable from the user perspective (they receive correct variation instead of the default one).
Split into two workspaces, so eppo_rb is in its workspace and we can commit its Cargo.lock file.
WIP: missing testing on Ruby side