Skip to content

Commit 674ec56

Browse files
[AI-FSSDK] [FSSDK-12337] Update experiment type values to short-form abbreviations and add constants
1 parent e6fdbfa commit 674ec56

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

lib/project_config/project_config.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ describe('Feature Rollout support', () => {
13581358
key: 'rollout_experiment',
13591359
layerId: 'layer_rollout',
13601360
status: 'Running',
1361-
type: 'feature_rollout',
1361+
type: 'fr',
13621362
variations: [{ id: 'var_rollout_1', key: 'variation_rollout_1', variables: [] }],
13631363
trafficAllocation: [{ entityId: 'var_rollout_1', endOfRange: 5000 }],
13641364
audienceIds: [],
@@ -1416,7 +1416,7 @@ describe('Feature Rollout support', () => {
14161416
expect(abExperiment.type).toBeUndefined();
14171417
});
14181418

1419-
it('should inject everyone else variation into feature_rollout experiments', () => {
1419+
it('should inject everyone else variation into fr (feature rollout) experiments', () => {
14201420
const datafile = makeDatafile();
14211421
const config = projectConfig.createProjectConfig(datafile as any);
14221422
const rolloutExperiment = config.experimentIdMap['exp_rollout'];
@@ -1481,6 +1481,6 @@ describe('Feature Rollout support', () => {
14811481
const datafile = makeDatafile();
14821482
const config = projectConfig.createProjectConfig(datafile as any);
14831483
const rolloutExperiment = config.experimentIdMap['exp_rollout'];
1484-
expect(rolloutExperiment.type).toBe('feature_rollout');
1484+
expect(rolloutExperiment.type).toBe('fr');
14851485
});
14861486
});

lib/project_config/project_config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
import { find, objectEntries, objectValues, keyBy, assignBy } from '../utils/fns';
1717

18-
import { FEATURE_VARIABLE_TYPES } from '../utils/enums';
18+
import { EXPERIMENT_TYPES, FEATURE_VARIABLE_TYPES } from '../utils/enums';
1919
import configValidator from '../utils/config_validator';
2020

2121
import { LoggerFacade } from '../logging/logger';
@@ -301,15 +301,15 @@ export const createProjectConfig = function(datafileObj?: JSON, datafileStr: str
301301
});
302302
});
303303

304-
// Inject "everyone else" variation into feature_rollout experiments
304+
// Inject "everyone else" variation into feature rollout (FR) experiments
305305
(projectConfig.featureFlags || []).forEach(featureFlag => {
306306
const everyoneElseVariation = getEveryoneElseVariation(projectConfig, featureFlag);
307307
if (!everyoneElseVariation) {
308308
return;
309309
}
310310
(featureFlag.experimentIds || []).forEach(experimentId => {
311311
const experiment = projectConfig.experimentIdMap[experimentId];
312-
if (experiment && experiment.type === 'feature_rollout') {
312+
if (experiment && experiment.type === EXPERIMENT_TYPES.FR) {
313313
experiment.variations.push(everyoneElseVariation);
314314
experiment.trafficAllocation.push({
315315
entityId: everyoneElseVariation.id,

lib/utils/enums/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ export const DECISION_SOURCES = {
6161

6262
export type DecisionSource = typeof DECISION_SOURCES[keyof typeof DECISION_SOURCES];
6363

64+
export const EXPERIMENT_TYPES = {
65+
AB: 'ab',
66+
MAB: 'mab',
67+
CMAB: 'cmab',
68+
TD: 'td',
69+
FR: 'fr',
70+
} as const;
71+
6472
export const AUDIENCE_EVALUATION_TYPES = {
6573
RULE: 'rule',
6674
EXPERIMENT: 'experiment',

0 commit comments

Comments
 (0)