-
Notifications
You must be signed in to change notification settings - Fork 32
[FSSDK-11170] update: decision service methods for cmab #583
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
base: master
Are you sure you want to change the base?
[FSSDK-11170] update: decision service methods for cmab #583
Conversation
…e to support CMAB UUID handling
…and include CMAB UUIDs in responses
…ils for CMAB configuration
…ations over CMAB service decisions in DecisionService
…tly verify error state
…izely and DecisionService
…text and related fetcher classes
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.
Changes look good to me. Added few comments.
@Nullable ODPManager odpManager | ||
) { | ||
@Nullable ODPManager odpManager, | ||
@Nonnull CmabService cmabService |
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.
Looks like breaking change, can we make nullable?
* @param options A list of options for decision-making. | ||
* @return A decision result using traditional A/B testing logic only. | ||
*/ | ||
OptimizelyDecision decideWithoutCmab(@Nonnull OptimizelyUserContext user, |
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 we can rename it as decideSync
* @param options A list of options for decision-making. | ||
* @return All decision results mapped by flag keys, using traditional A/B testing logic only. | ||
*/ | ||
Map<String, OptimizelyDecision> decideForKeysWithoutCmab(@Nonnull OptimizelyUserContext user, |
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.
Need to rename the method
* @param options A list of options for decision-making. | ||
* @return All decision results mapped by flag keys, using traditional A/B testing logic only. | ||
*/ | ||
Map<String, OptimizelyDecision> decideAllWithoutCmab(@Nonnull OptimizelyUserContext user, |
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.
Need to rename
private String cmabUUID; | ||
|
||
public DecisionResponse(@Nullable T result, @Nonnull DecisionReasons reasons) { | ||
public DecisionResponse(@Nullable T result, @Nonnull DecisionReasons reasons, @Nonnull boolean error, @Nullable String cmabUUID) { |
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.
Does it impact the existing user?
String experimentKey = experiment.getKey(); | ||
String combinedBucketId = bucketingId + experimentId; | ||
|
||
// Handle CMAB traffic allocation |
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.
Shouldn't we check mutex rules here?
Group experimentGroup = projectConfig.getGroupIdMapping().get(groupId); | ||
|
||
if (experimentGroup.getPolicy().equals(Group.RANDOM_POLICY)) { | ||
Experiment bucketedExperiment = bucketToExperiment(experimentGroup, bucketingId, projectConfig); |
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.
Oh I see, mutex is checking here.
public int hashCode() { | ||
int result = variation != null ? variation.hashCode() : 0; | ||
result = 31 * result + (decisionSource != null ? decisionSource.hashCode() : 0); | ||
result = 31 * result + (cmabUUID != null ? cmabUUID.hashCode() : 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.
Curious to know, what is the significant of 31 here?
* AsyncDecisionsFetcher handles asynchronous decision fetching for multiple flag keys. | ||
* This class follows the same pattern as ODP's async segment fetching. | ||
*/ | ||
public class AsyncDecisionsFetcher extends Thread { |
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.
Can we shift the code into AysncDecisionFeatcher ?
Summary
Decision Service methods to handle CMAB
Test plan
Added unit tests
Issues
FSSDK-11170