-
Notifications
You must be signed in to change notification settings - Fork 20
[FSSDK-11150] cmab client implementation #392
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
[FSSDK-11150] cmab client implementation #392
Conversation
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.
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
ICmabClient
interface andDefaultCmabClient
implementation 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.
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.
Changes look good to me.
Summary
ICmabClient
interface defining the contract for fetching decisions from the CMAB prediction service.DefaultCmabClient
class, which interacts with the CMAB service usingHttpClient
, handles request/response, supports retries, and validates responses.CmabModels
for request/response structure,CmabConstants
for endpoint and error messages, andCmabRetryConfig
for exponential backoff configuration.CmabException
,CmabFetchException
, andCmabInvalidResponseException
to represent various CMAB client error states.Test plan
DefaultCmabClientTest
unit tests covering success, error, invalid response, and retry scenarios for the CMAB client.Issues