-
Notifications
You must be signed in to change notification settings - Fork 19
[FSSDK-11649] Fix FSC failed tests for CMAB #411
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?
Conversation
decisionReasons.AddInfo(message) | ||
return decision, decisionReasons, fmt.Errorf("failed to get CMAB decision: %w", err) | ||
// Add CMAB error to decision reasons | ||
errorMessage := fmt.Sprintf(cmab.CmabFetchFailed, experiment.Key) |
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.
this message processing is also being done in cmab_service. I guess we can do this here and keep the code in cmab_service unchanged?
@@ -51,6 +53,21 @@ func (f CompositeFeatureService) GetDecision(decisionContext FeatureDecisionCont | |||
reasons.Append(decisionReasons) | |||
if err != nil { | |||
f.logger.Debug(err.Error()) | |||
// Check if this is a CMAB error - if so, stop the loop and return empty decision | |||
if strings.Contains(err.Error(), "Failed to fetch CMAB data") { |
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.
if there is an error from the featureDecisonfeatureDecisionService.GetDecision() call, we should just return the error from here. The caller of this method should deal with the error.
if strings.Contains(err.Error(), "Failed to fetch CMAB data") { | ||
// Add the CMAB error to reasons before returning - use AddError for critical failures | ||
reasons.AddError(err.Error()) | ||
return FeatureDecision{}, reasons, nil // Return empty decision for CMAB errors |
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.
it should return the error here
} | ||
} | ||
|
||
// Also check for CMAB errors in decision reasons (when err is nil) |
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.
if there was an error, the featureDecisionService.GetDecision() call must return an error, there should be no implicit errors. Please remove this if block
The issue in the CMAB error handling path within the GetDecision method. When the CMAB API returns an error, the previous implementation attempted to append reasons from the failed API call to the accumulated reasons list. This caused FSC tests to fail because:
Fix
Modified the error handling path to return a clean Decision object with properly initialized reasons
https://jira.sso.episerver.net/browse/FSSDK-11649