Skip to content

Conversation

FarhanAnjum-opti
Copy link
Contributor

Summary

Decision Service methods to handle CMAB

Test plan

Added unit tests

Issues

FSSDK-11170

…ations over CMAB service decisions in DecisionService
Copy link
Contributor

@muzahidul-opti muzahidul-opti left a 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
Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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 {
Copy link
Contributor

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 ?

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