Skip to content

Conversation

junaed-optimizely
Copy link
Contributor

Summary

  • Added ICmabClient interface defining the contract for fetching decisions from the CMAB prediction service.
  • Implemented DefaultCmabClient class, which interacts with the CMAB service using HttpClient, handles request/response, supports retries, and validates responses.
  • Introduced supporting classes: CmabModels for request/response structure, CmabConstants for endpoint and error messages, and CmabRetryConfig for exponential backoff configuration.
  • Added new exception classes: CmabException, CmabFetchException, and CmabInvalidResponseException to represent various CMAB client error states.

Test plan

  • Added DefaultCmabClientTest unit tests covering success, error, invalid response, and retry scenarios for the CMAB client.
  • Updated project files to include new CMAB client, models, constants, and test files for compilation.

Issues

Copy link

@Copilot Copilot AI left a 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 and DefaultCmabClient 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.

Copy link

@muzahidul-opti muzahidul-opti left a 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.

@junaed-optimizely junaed-optimizely merged commit 34c736c into master Sep 25, 2025
10 of 11 checks passed
@junaed-optimizely junaed-optimizely deleted the junaed/fssdk-11150-implement-cmab-client branch September 25, 2025 17:41
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