Skip to content
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

Merged
merged 14 commits into from
Jul 9, 2024
Merged

feat: bandits #11

merged 14 commits into from
Jul 9, 2024

Conversation

rasendubi
Copy link
Collaborator

@rasendubi rasendubi commented Jul 3, 2024

WIP: missing testing on Ruby side

@rasendubi rasendubi requested a review from leoromanovsky July 3, 2024 18:05
@rasendubi
Copy link
Collaborator Author

Rust tests will fail depending on Eppo-exp/sdk-test-data#44

Comment on lines +67 to +78
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,
});
Copy link
Collaborator Author

@rasendubi rasendubi Jul 3, 2024

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.

Copy link

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.

Copy link
Collaborator Author

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

rasendubi added 2 commits July 9, 2024 02:56
Split into two workspaces, so eppo_rb is in its workspace and we can
commit its Cargo.lock file.
@rasendubi rasendubi merged commit 6ba22ec into eppo-core Jul 9, 2024
8 checks passed
@leoromanovsky leoromanovsky deleted the feat-bandits branch July 16, 2024 21:15
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.

2 participants