Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
raju-opti committed Jan 21, 2025
1 parent cc5d6fd commit 65207e5
Show file tree
Hide file tree
Showing 23 changed files with 108 additions and 204 deletions.
1 change: 0 additions & 1 deletion lib/common_exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
* limitations under the License.
*/

export { LOG_LEVEL } from './utils/enums';
export { createStaticProjectConfigManager } from './project_config/config_manager_factory';
export { PollingConfigManagerConfig } from './project_config/config_manager_factory';
5 changes: 0 additions & 5 deletions lib/core/audience_evaluator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
LOG_LEVEL,
} from '../../utils/enums';
import * as conditionTreeEvaluator from '../condition_tree_evaluator';
import * as customAttributeConditionEvaluator from '../custom_attribute_condition_evaluator';
import * as odpSegmentsConditionEvaluator from './odp_segment_condition_evaluator';
Expand All @@ -24,8 +21,6 @@ import { CONDITION_EVALUATOR_ERROR, UNKNOWN_CONDITION_TYPE } from '../../error_m
import { AUDIENCE_EVALUATION_RESULT, EVALUATING_AUDIENCE} from '../../log_messages';
import { LoggerFacade } from '../../logging/logger';

const MODULE_NAME = 'AUDIENCE_EVALUATOR';

export class AudienceEvaluator {
private logger?: LoggerFacade;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { UNKNOWN_MATCH_TYPE } from '../../../error_messages';
import { LoggerFacade } from '../../../logging/logger';
import { Condition, OptimizelyUserContext } from '../../../shared_types';

const MODULE_NAME = 'ODP_SEGMENT_CONDITION_EVALUATOR';

const QUALIFIED_MATCH_TYPE = 'qualified';

const MATCH_TYPES = [
Expand Down
11 changes: 2 additions & 9 deletions lib/core/bucketer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
/**
* Bucketer API for determining the variation id from the specified parameters
*/
import { sprintf } from '../../utils/fns';
import murmurhash from 'murmurhash';
import { LoggerFacade } from '../../logging/logger';
import {
Expand All @@ -27,7 +26,6 @@ import {
Group,
} from '../../shared_types';

import { LOG_LEVEL } from '../../utils/enums';
import { INVALID_BUCKETING_ID, INVALID_GROUP_ID } from '../../error_messages';
import { OptimizelyError } from '../../error/optimizly_error';

Expand All @@ -40,7 +38,6 @@ export const INVALID_VARIATION_ID = 'Bucketed into an invalid variation ID. Retu
const HASH_SEED = 1;
const MAX_HASH_VALUE = Math.pow(2, 32);
const MAX_TRAFFIC_VALUE = 10000;
const MODULE_NAME = 'BUCKETER';
const RANDOM_POLICY = 'random';

/**
Expand Down Expand Up @@ -86,7 +83,6 @@ export const bucket = function(bucketerParams: BucketerParams): DecisionResponse
);
decideReasons.push([
USER_NOT_IN_ANY_EXPERIMENT,
MODULE_NAME,
bucketerParams.userId,
groupId,
]);
Expand All @@ -106,7 +102,6 @@ export const bucket = function(bucketerParams: BucketerParams): DecisionResponse
);
decideReasons.push([
USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,
MODULE_NAME,
bucketerParams.userId,
bucketerParams.experimentKey,
groupId,
Expand All @@ -126,7 +121,6 @@ export const bucket = function(bucketerParams: BucketerParams): DecisionResponse
);
decideReasons.push([
USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,
MODULE_NAME,
bucketerParams.userId,
bucketerParams.experimentKey,
groupId,
Expand All @@ -143,7 +137,6 @@ export const bucket = function(bucketerParams: BucketerParams): DecisionResponse
);
decideReasons.push([
USER_ASSIGNED_TO_EXPERIMENT_BUCKET,
MODULE_NAME,
bucketValue,
bucketerParams.userId,
]);
Expand All @@ -152,8 +145,8 @@ export const bucket = function(bucketerParams: BucketerParams): DecisionResponse
if (entityId !== null) {
if (!bucketerParams.variationIdMap[entityId]) {
if (entityId) {
bucketerParams.logger?.warn(INVALID_VARIATION_ID, MODULE_NAME);
decideReasons.push([INVALID_VARIATION_ID, MODULE_NAME]);
bucketerParams.logger?.warn(INVALID_VARIATION_ID);
decideReasons.push([INVALID_VARIATION_ID]);
}
return {
result: null,
Expand Down
2 changes: 0 additions & 2 deletions lib/core/custom_attribute_condition_evaluator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import {
} from '../../error_messages';
import { LoggerFacade } from '../../logging/logger';

const MODULE_NAME = 'CUSTOM_ATTRIBUTE_CONDITION_EVALUATOR';

const EXACT_MATCH_TYPE = 'exact';
const EXISTS_MATCH_TYPE = 'exists';
const GREATER_OR_EQUAL_THAN_MATCH_TYPE = 'ge';
Expand Down
39 changes: 26 additions & 13 deletions lib/core/decision_service/index.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,40 @@ import {
getTestProjectConfig,
getTestProjectConfigWithFeatures,
} from '../../tests/test_data';

import {
AUDIENCE_EVALUATION_RESULT_COMBINED,
EVALUATING_AUDIENCES_COMBINED,
USER_FORCED_IN_VARIATION,
USER_HAS_NO_FORCED_VARIATION,
USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE,
USER_NOT_IN_EXPERIMENT,
VALID_BUCKETING_ID,
SAVED_USER_VARIATION,
SAVED_VARIATION_NOT_FOUND,
} from '../../log_messages';

import {
EXPERIMENT_NOT_RUNNING,
RETURNING_STORED_VARIATION,
USER_NOT_IN_EXPERIMENT,
USER_HAS_NO_VARIATION,
USER_HAS_VARIATION,
USER_FORCED_IN_VARIATION,
FORCED_BUCKETING_FAILED,
EVALUATING_AUDIENCES_COMBINED,
AUDIENCE_EVALUATION_RESULT_COMBINED,
USER_IN_ROLLOUT,
USER_NOT_IN_ROLLOUT,
FEATURE_HAS_NO_EXPERIMENTS,
NO_ROLLOUT_EXISTS,
USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE,
USER_NOT_BUCKETED_INTO_TARGETING_RULE,
USER_BUCKETED_INTO_TARGETING_RULE,
USER_IN_ROLLOUT,
NO_ROLLOUT_EXISTS,
INVALID_ROLLOUT_ID,
ROLLOUT_HAS_NO_EXPERIMENTS,
IMPROPERLY_FORMATTED_EXPERIMENT,
USER_HAS_FORCED_VARIATION,
USER_MEETS_CONDITIONS_FOR_TARGETING_RULE,
USER_NOT_BUCKETED_INTO_TARGETING_RULE,
USER_NOT_IN_ROLLOUT,
VALID_BUCKETING_ID,
SAVED_USER_VARIATION,
SAVED_VARIATION_NOT_FOUND
} from '../../log_messages';
import { mock } from 'node:test';
USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE,
} from '../decision_service/index';

import { BUCKETING_ID_NOT_STRING, USER_PROFILE_LOOKUP_ERROR, USER_PROFILE_SAVE_ERROR } from '../../error_messages';

var testData = getTestProjectConfig();
Expand Down
Loading

0 comments on commit 65207e5

Please sign in to comment.