Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 25 additions & 31 deletions lib/core/decision_service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ import { Maybe, OpType } from '../../utils/type';
import { Value } from '../../utils/promise/operation_value';
import { Platform } from '../../platform_support';

import { localHoldout } from '../../feature_toggle';

export const EXPERIMENT_NOT_RUNNING = 'Experiment %s is not running.';
export const RETURNING_STORED_VARIATION =
'Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.';
Expand Down Expand Up @@ -1609,21 +1607,19 @@ export class DecisionService {
});
}

if (localHoldout()) {
// Check local holdouts targeting this specific experiment rule.
// Inserted immediately after the forced-decision block, before regular rule evaluation.
const localHoldoutsForExperiment = getHoldoutsForRule(configObj, rule.id);
for (const holdout of localHoldoutsForExperiment) {
const holdoutDecision = this.getVariationForHoldout(configObj, holdout, user);
decideReasons.push(...holdoutDecision.reasons);
if (holdoutDecision.result.variation) {
// Signal the caller to use the holdout decision directly, preserving the holdout as experiment.
return Value.of<OP, LocalHoldoutResult>(op, {
result: holdoutDecision.result,
reasons: decideReasons,
holdoutDecision: true,
});
}
// Check local holdouts targeting this specific experiment rule.
// Inserted immediately after the forced-decision block, before regular rule evaluation.
const localHoldoutsForExperiment = getHoldoutsForRule(configObj, rule.id);
for (const holdout of localHoldoutsForExperiment) {
const holdoutDecision = this.getVariationForHoldout(configObj, holdout, user);
decideReasons.push(...holdoutDecision.reasons);
if (holdoutDecision.result.variation) {
// Signal the caller to use the holdout decision directly, preserving the holdout as experiment.
return Value.of<OP, LocalHoldoutResult>(op, {
result: holdoutDecision.result,
reasons: decideReasons,
holdoutDecision: true,
});
}
}

Expand Down Expand Up @@ -1663,20 +1659,18 @@ export class DecisionService {
};
}

if (localHoldout()) {
// Check local holdouts targeting this specific delivery rule (FSSDK-12369).
// Inserted immediately after the forced-decision block, before audience and traffic allocation checks.
const localHoldoutsForDelivery = getHoldoutsForRule(configObj, rule.id);
for (const holdout of localHoldoutsForDelivery) {
const holdoutDecision = this.getVariationForHoldout(configObj, holdout, user);
decideReasons.push(...holdoutDecision.reasons);
if (holdoutDecision.result.variation) {
return {
result: holdoutDecision.result,
reasons: decideReasons,
holdoutDecision: true,
};
}
// Check local holdouts targeting this specific delivery rule (FSSDK-12369).
// Inserted immediately after the forced-decision block, before audience and traffic allocation checks.
const localHoldoutsForDelivery = getHoldoutsForRule(configObj, rule.id);
for (const holdout of localHoldoutsForDelivery) {
const holdoutDecision = this.getVariationForHoldout(configObj, holdout, user);
decideReasons.push(...holdoutDecision.reasons);
if (holdoutDecision.result.variation) {
return {
result: holdoutDecision.result,
reasons: decideReasons,
holdoutDecision: true,
};
}
}

Expand Down
3 changes: 0 additions & 3 deletions lib/feature_toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,4 @@ import { Platform } from './platform_support';

export type IfActive<T extends () => boolean, Y, N = unknown> = ReturnType<T> extends true ? Y : N;


export const localHoldout = () => true as const;

export const __platforms: Platform[] = ['__universal__'];
Loading