-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
evaluation log update: hashed value + max 10 length lists
- Loading branch information
Showing
14 changed files
with
90 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class EvaluationLogBuilder(object): | ||
def __init__(self): | ||
self.indent_level = 0 | ||
self.text = '' | ||
|
||
@staticmethod | ||
def trunc_comparison_value_if_needed(comparator_text, comparison_value): | ||
if '(hashed)' in comparator_text: | ||
if isinstance(comparison_value, list): | ||
length = len(comparison_value) | ||
if length > 1: | ||
return '[<{} hashed values>]'.format(length) | ||
return '[<{} hashed value>]'.format(length) | ||
|
||
return '<hashed value>' | ||
|
||
if isinstance(comparison_value, list): | ||
limit = 10 | ||
length = len(comparison_value) | ||
if length > limit: | ||
remaining = length - limit | ||
if remaining == 1: | ||
more_text = "(1 more value)" | ||
else: | ||
more_text = "({} more values)".format(remaining) | ||
|
||
return str(comparison_value[:limit])[:-1] + ', ... ' + more_text + ']' | ||
|
||
return str(comparison_value) | ||
|
||
def increase_indent(self): | ||
self.indent_level += 1 | ||
return self | ||
|
||
def decrease_indent(self): | ||
self.indent_level = max(0, self.indent_level - 1) | ||
return self | ||
|
||
def append(self, text): | ||
self.text += text | ||
return self | ||
|
||
def new_line(self, text=None): | ||
self.text += '\n' + ' ' * self.indent_level | ||
if text: | ||
self.text += text | ||
return self | ||
|
||
def __str__(self): | ||
return self.text |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...gcatclienttests/data/evaluation/2_targeting_rules/2_rules_matching_targeted_attribute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF (hashed) ['265522bb68...', '72ff4554fa...']) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF (hashed) [<2 hashed values>]) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier":"12345","Custom1":"admin"}' | ||
Evaluating targeting rules and applying the first match if any: | ||
- IF User.Email IS ONE OF (hashed) ['265522bb68...', '72ff4554fa...'] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing | ||
- IF User.Email IS ONE OF (hashed) [<2 hashed values>] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing | ||
The current targeting rule is ignored and the evaluation continues with the next rule. | ||
- IF User.Custom1 IS ONE OF (hashed) ['3eec7c82dd...'] THEN 'Dog' => MATCH, applying rule | ||
- IF User.Custom1 IS ONE OF (hashed) [<1 hashed value>] THEN 'Dog' => MATCH, applying rule | ||
Returning 'Dog'. |
8 changes: 4 additions & 4 deletions
8
configcatclienttests/data/evaluation/2_targeting_rules/2_rules_no_targeted_attribute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF (hashed) ['265522bb68...', '72ff4554fa...']) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
WARNING [3003] Cannot evaluate condition (User.Custom1 IS ONE OF (hashed) ['3eec7c82dd...']) for setting 'stringIsInDogDefaultCat' (the User.Custom1 attribute is missing). You should set the User.Custom1 attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF (hashed) [<2 hashed values>]) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
WARNING [3003] Cannot evaluate condition (User.Custom1 IS ONE OF (hashed) [<1 hashed value>]) for setting 'stringIsInDogDefaultCat' (the User.Custom1 attribute is missing). You should set the User.Custom1 attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier":"12345"}' | ||
Evaluating targeting rules and applying the first match if any: | ||
- IF User.Email IS ONE OF (hashed) ['265522bb68...', '72ff4554fa...'] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing | ||
- IF User.Email IS ONE OF (hashed) [<2 hashed values>] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing | ||
The current targeting rule is ignored and the evaluation continues with the next rule. | ||
- IF User.Custom1 IS ONE OF (hashed) ['3eec7c82dd...'] THEN 'Dog' => cannot evaluate, the User.Custom1 attribute is missing | ||
- IF User.Custom1 IS ONE OF (hashed) [<1 hashed value>] THEN 'Dog' => cannot evaluate, the User.Custom1 attribute is missing | ||
The current targeting rule is ignored and the evaluation continues with the next rule. | ||
Returning 'Cat'. |
4 changes: 2 additions & 2 deletions
4
configcatclienttests/data/evaluation/2_targeting_rules/2_rules_no_user.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'stringIsInDogDefaultCat' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
INFO [5000] Evaluating 'stringIsInDogDefaultCat' | ||
Evaluating targeting rules and applying the first match if any: | ||
- IF User.Email IS ONE OF (hashed) ['265522bb68...', '72ff4554fa...'] THEN 'Dog' => cannot evaluate, User Object is missing | ||
- IF User.Email IS ONE OF (hashed) [<2 hashed values>] THEN 'Dog' => cannot evaluate, User Object is missing | ||
The current targeting rule is ignored and the evaluation continues with the next rule. | ||
- IF User.Custom1 IS ONE OF (hashed) ['3eec7c82dd...'] THEN 'Dog' => cannot evaluate, User Object is missing | ||
- IF User.Custom1 IS ONE OF (hashed) [<1 hashed value>] THEN 'Dog' => cannot evaluate, User Object is missing | ||
The current targeting rule is ignored and the evaluation continues with the next rule. | ||
Returning 'Cat'. |
6 changes: 3 additions & 3 deletions
6
...clienttests/data/evaluation/2_targeting_rules/2_rules_not_matching_targeted_attribute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF (hashed) ['265522bb68...', '72ff4554fa...']) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF (hashed) [<2 hashed values>]) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier":"12345","Custom1":"user"}' | ||
Evaluating targeting rules and applying the first match if any: | ||
- IF User.Email IS ONE OF (hashed) ['265522bb68...', '72ff4554fa...'] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing | ||
- IF User.Email IS ONE OF (hashed) [<2 hashed values>] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing | ||
The current targeting rule is ignored and the evaluation continues with the next rule. | ||
- IF User.Custom1 IS ONE OF (hashed) ['3eec7c82dd...'] THEN 'Dog' => no match | ||
- IF User.Custom1 IS ONE OF (hashed) [<1 hashed value>] THEN 'Dog' => no match | ||
Returning 'Cat'. |
2 changes: 1 addition & 1 deletion
2
configcatclienttests/data/evaluation/and_rules/and_rules_no_user.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'emailAnd' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/ | ||
INFO [5000] Evaluating 'emailAnd' | ||
Evaluating targeting rules and applying the first match if any: | ||
- IF User.Email STARTS WITH ANY OF (hashed) ['4_489600ff...'] => false, skipping the remaining AND conditions | ||
- IF User.Email STARTS WITH ANY OF (hashed) [<1 hashed value>] => false, skipping the remaining AND conditions | ||
THEN 'Dog' => cannot evaluate, User Object is missing | ||
The current targeting rule is ignored and the evaluation continues with the next rule. | ||
Returning 'Cat'. |
4 changes: 2 additions & 2 deletions
4
configcatclienttests/data/evaluation/and_rules/and_rules_user.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
INFO [5000] Evaluating 'emailAnd' for User '{"Identifier":"12345","Email":"[email protected]"}' | ||
Evaluating targeting rules and applying the first match if any: | ||
- IF User.Email STARTS WITH ANY OF (hashed) ['4_489600ff...'] => true | ||
- IF User.Email STARTS WITH ANY OF (hashed) [<1 hashed value>] => true | ||
AND User.Email CONTAINS ANY OF ['@'] => true | ||
AND User.Email ENDS WITH ANY OF (hashed) ['20_be728e1...'] => false, skipping the remaining AND conditions | ||
AND User.Email ENDS WITH ANY OF (hashed) [<1 hashed value>] => false, skipping the remaining AND conditions | ||
THEN 'Dog' => no match | ||
Returning 'Cat'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters