Skip to content

Commit

Permalink
Sticky bucketing test was added. Fixed issue with fallback ignoring w…
Browse files Browse the repository at this point in the history
…hen attribute "id" is available
  • Loading branch information
Bohdan-Kim committed Sep 27, 2024
1 parent 782b291 commit 2142820
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ internal class GBUtils {

val (fallbackAttribute, fallbackValue) = getHashAttribute(
context = context,
attr = null,
fallback = expFallBackAttribute,
attr = expFallBackAttribute,
fallback = null,
attributeOverrides = attributeOverrides
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5810,6 +5810,72 @@
}
}
],
[
"upgrades a sticky bucket doc from a fallbackAttribute to a hashAttribute",
{
"attributes": {
"id": "i123",
"anonymousId": "ses123",
"foo": "bar",
"country": "USA"
},
"features": {
"exp1": {
"defaultValue": "control",
"rules": [
{
"key": "feature-exp",
"seed": "feature-exp",
"hashAttribute": "id",
"fallbackAttribute": "anonymousId",
"hashVersion": 2,
"bucketVersion": 0,
"condition": { "country": "USA" },
"variations": ["control", "red", "blue"],
"meta": [{ "key": "0" }, { "key": "1" }, { "key": "2" }],
"coverage": 1,
"weights": [0.3334, 0.3333, 0.3333],
"phase": "0"
}
]
}
}
},
[
{
"attributeName": "anonymousId",
"attributeValue": "ses123",
"assignments": {
"feature-exp__0": "1"
}
}
],
"exp1",
{
"bucket": 0.9943,
"featureId": "exp1",
"hashAttribute": "id",
"hashUsed": true,
"hashValue": "i123",
"inExperiment": true,
"key": "1",
"stickyBucketUsed": true,
"value": "red",
"variationId": 1
},
{
"anonymousId||ses123": {
"assignments": { "feature-exp__0": "1" },
"attributeName": "anonymousId",
"attributeValue": "ses123"
},
"id||i123": {
"assignments": { "feature-exp__0": "1" },
"attributeName": "id",
"attributeValue": "i123"
}
}
],
[
"favors a sticky bucket doc based on hashAttribute over fallbackAttribute",
{
Expand Down

0 comments on commit 2142820

Please sign in to comment.