-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(flags): handle deleted flags and some property matching edge cases #28308
Conversation
Hey @dmarticus! 👋 |
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.
PR Summary
This PR improves feature flag handling by focusing on deleted flags, property matching edge cases, and enhanced logging for better debugging capabilities.
- Added debug-level logging in feature-flags service and Redis operations to improve observability during development and troubleshooting
- Fixed critical bug in Redis client where pickle deserialization is performed twice unnecessarily
- Modified SQL query in
flag_operations.rs
to filter out deleted/inactive flags at database level withdeleted = false AND active = true
conditions - Made
filters
field optional inCohort
struct to properly handle null/undefined cases in cohort definitions - Enhanced property matching logic for inverted operators (IsNot, NotIcontains, NotRegex) to return true when properties don't exist, making behavior more predictable
10 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile
"properties": [ | ||
{ | ||
"key": "email", | ||
"value": ".*@posthog\\.com$", |
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.
style: The regex pattern '.@posthog.com$' could be simplified to '@posthog.com$' since the . at the start is redundant
"value": ".*@posthog\\.com$", | |
"value": "@posthog\\.com$", |
Context
I wrote a test harness for new flags that went like this:
true
for all of the conditionsis_feature_enabled
on each flag key with the corresponding person that has matching properties (I used the python SDK because it's easiest to run locally)/flags
instead of/decide
.And confirm that the responses are the same for each.
In doing this, I found the following issues with new flags:
not_icontains
,is_not
, andnot_regex
) for a given property (e.g.email
), I was evaluating people that were missing the property altogether asfalse
, rather thantrue
(which is what/decide
does).