-
Notifications
You must be signed in to change notification settings - Fork 421
Feature Flags -- IN does not appear to work #699
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
Comments
Hey @gwlester thanks for flagging it! That's odd, we basically call Could you try running this locally with debug mode enabled and paste logs here? cc @risenberg-cyberark in case you ran into this. PS: Our test for this can be quickly updated to try and reproduce it. |
@heitorlessa , @risenberg-cyberark That is totally the opposite of what I expected and was attempting to do -- I was giving value as a single value and attempting to see if it was in the list given by key in the context object. So, how do ya'll want me to handle this -- a feature request for a different condition -- if so any suggestion on what to call it instead of IN and NOT_IN???? I'm thinking IN_KEY and NOT_IN_KEY. |
Since I can't push up to a new branch to create a Push Request (or need instruction on how to do so), here is some suggested fixes: In schema.py, change the definition of RuleAction to:class RuleAction(str, Enum):
EQUALS = "EQUALS"
STARTSWITH = "STARTSWITH"
ENDSWITH = "ENDSWITH"
IN = "IN"
NOT_IN = "NOT_IN"
KEY_IN_VALUE = "KEY_IN_VALUE"
KEY_NOT_IN_VALUE = "KEY_NOT_IN_VALUE"
VALUE_IN_KEY = "VALUE_IN_KEY"
VALUE_NOT_IN_KEY = "VALUE_NOT_IN_KEY" In feature_flags.py, change the definition of mapping_by_action in _match_by_action to: mapping_by_action = {
schema.RuleAction.EQUALS.value: lambda a, b: a == b,
schema.RuleAction.STARTSWITH.value: lambda a, b: a.startswith(b),
schema.RuleAction.ENDSWITH.value: lambda a, b: a.endswith(b),
schema.RuleAction.IN.value: lambda a, b: a in b,
schema.RuleAction.NOT_IN.value: lambda a, b: a not in b,
schema.RuleAction.KEY_IN_VALUE.value: lambda a, b: a in b,
schema.RuleAction.KEY_NOT_IN_VALUE.value: lambda a, b: a not in b,
schema.RuleAction.VALUE_IN_KEY.value: lambda a, b: b in a,
schema.RuleAction.VALUE_NOT_IN_KEY.value: lambda a, b: b not in a,
} |
Actually, for clarity sake, I'd suggest the following conditions:
|
It used to be contains but some people found it confusing so it was renamed so IN, and yes, the value is supposed to be a list. |
Now available as part of 1.21.0 - thank you so much for the fix https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v1.21.0 |
We were attempting to enable a feature if a user was in a given group?
Configuration:
Context:
Expected Behavior
We expected the variable all_features to be a list with one element as follows:
Current Behavior
all_features is an empty list.
Possible Solution
Steps to Reproduce (for bugs)
Environment
# paste logs here
The text was updated successfully, but these errors were encountered: