Skip to content

[FSSDK-11175] Update: Implement Decision Service methods to handle CMAB #457

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

FarhanAnjum-opti
Copy link
Contributor

Summary

Decision Service methods to handle CMAB

Test plan

Added unit tests

Issues

FSSDK-11175

@Mat001 Mat001 requested review from raju-opti and Mat001 June 16, 2025 18:43
decide_reasons += decision_variation_value.get('reasons', [])
cmab_decision = decision_variation_value.get('result')
if not cmab_decision or decision_variation_value['error']:
self.logger.error(Errors.CMAB_FETCH_FAILED.format(decide_reasons[0]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you log the cmab error but does not propagate it upward as an exception or error object.
Instead you return
In the _decide method in optimizely.py do you then check the returned decision for cmab errors?

My understanding is that cmab error should be handled by the client and error should propagate all the way to the client.

Maybe you define error and could return smth like:
return None, decide_reasons, cmab_uuid, CmabFetchError(error_msg)

and then in the _decide in optimzely.py you could do smth like:
if error and is instance(error, CmabFetchError):
self.logger.warning(f"Received error while making a decision for feature {key}: {error}")
# Create an error decision
return OptimizelyDecision(
flag_key=key,
user_context=user_context,
reasons=[str(error)] if include_reasons else []
)

@raju-opti what do you think?

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