[FSSDK-11150] cmab client implementation#392
Merged
junaed-optimizely merged 5 commits intomasterfrom Sep 25, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements a CMAB (Contextual Multi-Armed Bandit) client for the Optimizely SDK, providing functionality to fetch decisions from the CMAB prediction service with retry mechanisms and proper error handling.
Key Changes:
- Introduced
ICmabClientinterface andDefaultCmabClientimplementation for interacting with CMAB prediction service - Added supporting classes for configuration, models, constants, and exception handling
- Implemented comprehensive unit tests for the CMAB client functionality
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| OptimizelySDK/OptimizelySDK.csproj | Added compilation entries for new CMAB client files |
| OptimizelySDK/Exceptions/OptimizelyException.cs | Introduced CMAB-specific exception classes |
| OptimizelySDK/Cmab/ICmabClient.cs | Defined interface contract for CMAB client |
| OptimizelySDK/Cmab/DefaultCmabClient.cs | Implemented HTTP-based CMAB client with retry logic |
| OptimizelySDK/Cmab/CmabRetryConfig.cs | Configured exponential backoff retry mechanism |
| OptimizelySDK/Cmab/CmabModels.cs | Defined request/response data structures |
| OptimizelySDK/Cmab/CmabConstants.cs | Added service endpoints and error messages |
| OptimizelySDK.Tests/OptimizelySDK.Tests.csproj | Added test file compilation entry |
| OptimizelySDK.Tests/CmabTests/DefaultCmabClientTest.cs | Comprehensive unit tests for CMAB client |
| OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj | Added CMAB files for .NET Standard 2.0 compilation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ICmabClientinterface defining the contract for fetching decisions from the CMAB prediction service.DefaultCmabClientclass, which interacts with the CMAB service usingHttpClient, handles request/response, supports retries, and validates responses.CmabModelsfor request/response structure,CmabConstantsfor endpoint and error messages, andCmabRetryConfigfor exponential backoff configuration.CmabException,CmabFetchException, andCmabInvalidResponseExceptionto represent various CMAB client error states.Test plan
DefaultCmabClientTestunit tests covering success, error, invalid response, and retry scenarios for the CMAB client.Issues