Skip to content

Conversation

@junaed-optimizely
Copy link
Contributor

Summary

  • Decision service change: propagate CMAB decisions through DecisionService, bucketer, decision metadata, and related core flows.
  • Impression event change: include CMAB variation IDs and UUIDs in impression event payloads.
  • Exposed CMAB configuration: add CmabConfig, factory setters, and initialization plumbing to pass cache size, TTL, and custom caches into CMAB service creation.

Test Plan

  • Extend CMAB-related coverage in service, factory, impression event, integration, and user-context test suites.

Issues

  • FSSDK-11177
  • FSSDK-11186

/// <param name="userId">User identifier</param>
/// <param name="trafficAllocations">Traffic allocations to use for bucketing</param>
/// <returns>Entity ID (string) if user is bucketed, null otherwise</returns>
public virtual Result<string> BucketToEntityId(ProjectConfig config, Experiment experiment,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can accept ExperimentCore parameter, and reuse the part upto BucketToEntityId for the Bucket metheod below. Logic for bucket would be:

  1. get entityId by calling BucketToEntityId()
  2. get the variation from the config and return using the entityId from step 1


if (config.CustomCache != null)
{
_cmabCache = config.CustomCache as LruCache<CmabCacheEntry>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not assume that customCache must be LruCache. It could be any implementation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the class field _cmabCache should also be of type ICache<>, not LruCache

/// <param name="cmabConfig">Configuration for CMAB cache. If null, default values are used.</param>
/// <param name="cmabClient">Client for fetching decisions from the CMAB prediction service. If null, a default client is created.</param>
/// <param name="logger">Optional logger for recording service operations.</param>
public DefaultCmabService(CmabConfig cmabConfig = null,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of taking in the config here, we can take in a ICache<> here and push the resposibility of supplying the cache to the caller, similar to cmabClient

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see all of them can be null. We can just make them required and put the construction responsibility to the caller

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.

3 participants