Skip to content

Commit d41693e

Browse files
committed
Fix unit and FSC errors
1 parent 2e21a7e commit d41693e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/optimizely/decision_service.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ def get_decision_for_flag(feature_flag, user_context, project_config, decide_opt
214214

215215
return DecisionResult.new(experiment_decision.decision, experiment_decision.error, reasons) if experiment_decision.decision
216216

217+
# If there's an error (e.g., CMAB error), return immediately without falling back to rollout
218+
return DecisionResult.new(nil, experiment_decision.error, reasons) if experiment_decision.error
219+
217220
# Check if the feature flag has a rollout and the user is bucketed into that rollout
218221
rollout_decision = get_variation_for_feature_rollout(project_config, feature_flag, user_context)
219222
reasons.push(*rollout_decision.reasons)

spec/decision_service_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@
775775

776776
decision_result = decision_service.get_variation_for_feature(config, feature_flag, user_context)
777777
expect(decision_result.decision).to eq(expected_decision)
778-
expect(decision_result.reasons).to eq([])
778+
expect(decision_result.reasons).to eq(["The user 'test_user' is bucketed into a rollout for feature flag 'string_single_variable_feature'."])
779779
end
780780
end
781781

0 commit comments

Comments
 (0)