-
Notifications
You must be signed in to change notification settings - Fork 83
[FSSDK-11132] make entity validation configurable in bucketer #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,17 +138,16 @@ export const bucket = function(bucketerParams: BucketerParams): DecisionResponse | |
]); | ||
|
||
const entityId = _findBucket(bucketValue, bucketerParams.trafficAllocationConfig); | ||
if (entityId !== null) { | ||
if (!bucketerParams.variationIdMap[entityId]) { | ||
if (entityId) { | ||
bucketerParams.logger?.warn(INVALID_VARIATION_ID); | ||
decideReasons.push([INVALID_VARIATION_ID]); | ||
} | ||
return { | ||
result: null, | ||
reasons: decideReasons, | ||
}; | ||
|
||
if (bucketerParams.validateEntity && entityId !== null && !bucketerParams.variationIdMap[entityId]) { | ||
if (entityId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the id value could be either string or null, I am confused with copilot here as well! 😅 Why we need this check ? |
||
bucketerParams.logger?.warn(INVALID_VARIATION_ID); | ||
decideReasons.push([INVALID_VARIATION_ID]); | ||
} | ||
return { | ||
result: null, | ||
reasons: decideReasons, | ||
}; | ||
} | ||
|
||
return { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -594,12 +594,16 @@ export class DecisionService { | |||||
bucketingId: string, | ||||||
userId: string | ||||||
): BucketerParams { | ||||||
let validateEntity = true; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Consider using a
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
let trafficAllocationConfig: TrafficAllocation[] = getTrafficAllocation(configObj, experiment.id); | ||||||
if (experiment.cmab) { | ||||||
trafficAllocationConfig = [{ | ||||||
entityId: CMAB_DUMMY_ENTITY_ID, | ||||||
endOfRange: experiment.cmab.trafficAllocation | ||||||
}]; | ||||||
|
||||||
validateEntity = false; | ||||||
} | ||||||
|
||||||
return { | ||||||
|
@@ -613,6 +617,7 @@ export class DecisionService { | |||||
trafficAllocationConfig, | ||||||
userId, | ||||||
variationIdMap: configObj.variationIdMap, | ||||||
validateEntity, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: OPTIONAL: We could simplify this by doing |
||||||
} | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nested
entityId !== null
and truthyentityId
check inside could be consolidated—removing the innerif (entityId)
—to simplify the condition sinceentityId !== null
already guards it.Copilot uses AI. Check for mistakes.