-
Notifications
You must be signed in to change notification settings - Fork 420
List intersection action for conditions in feature flags #3531
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
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Interesting, the existing |
Yes, sure I can try to create PR after Christmas and New Year |
May want a couple of intersections:
|
Hi @Rogalek and @gwlester! Thanks for sharing this idea to add more features to our Feature Flags utility. For me, it makes a lot of sense to expand this support. After all, we open up more opportunities to use this utility, such as checking if, given an array, Just a small comment:
We already support it if you use Do you still have plans to send a PR with these changes @Rogalek? Please let me know and we can work together to get it merged. |
@leandrodamascena They are not the same -- All_IN_VALUE would mean that all in the list are in the value, but does not also mean that all in the value are in the list. EQUAL means that all in the list are in the value and also that all in the value are in the list. |
I think I may be taking a shot at implementing this over the next couple of weeks -- does anyone have any issues with that? |
I have the code at https://github.com/gwlester/aws-lambda-powertools-python/tree/feature-3531 -- but not sure what to do about the tests. With the way they are organized now, I don't see a good way to add ones for these three actions (there is another ticket to refactor them). Can I get some feedback about the tests? |
Hey @gwlester! Yep, you're right, I agree!
Do you want to open a PR without testing and we can work together to add these tests? We can do some code reviews until we reach the ideal code for merge. It makes sense? Thanks |
@leandrodamascena pull request created: #3692 |
|
Adding a sample schema for reference as I didn't find them earlier. ALL_IN_VALUE
{
"my_feature": {
"default": false,
"rules": {
"tenant_id is in allowed list": {
"when_match": true,
"conditions": [
{
"action": "ALL_IN_VALUE",
"key": "tenant_id",
"value": [
"Łukasz",
"Gerald",
"Leandro",
"Heitor"
]
}
]
}
}
}
} ANY_IN_VALUE
{
"my_feature": {
"default": false,
"rules": {
"tenant_id is in allowed list": {
"when_match": true,
"conditions": [
{
"action": "ANY_IN_VALUE",
"key": "tenant_id",
"value": [
"Łukasz",
"Gerald",
"Leandro",
"Heitor"
]
}
]
}
}
}
} NONE_IN_VALUE
{
"my_feature": {
"default": false,
"rules": {
"tenant_id is in allowed list": {
"when_match": true,
"conditions": [
{
"action": "NONE_IN_VALUE",
"key": "tenant_id",
"value": [
"Łukasz",
"Gerald",
"Leandro",
"Heitor"
]
}
]
}
}
}
} |
@Rogalek @gwlester I've noticed this is our first built-in condition that an input may not be a list and a silent error (False flag) may not be ideal -- instead of failing flat causing further disruption to other flags, I'm gonna add an exception handler that you could use to trap ANY exception. I'm refactoring the last bits oft the implementation, and will work on the exception handler. For that reason, we'll release early next week only - mon/tue. |
Closing as it's coming in this week's release. PR merged w/ refactorings. |
|
This is now released under 2.34.0 version! |
Use case
I was thinking if there is a way to write action for condition in feature flags that can do list Intersection.
https://www.geeksforgeeks.org/python-intersection-two-lists/
Solution/User Experience
So user could provide key: [A, B] and inside AWS Appconfig json there will be stored value: [B, C]
And if at least one elements match for both list that this will match criteria.
Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: