:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(feature-flags): make active param filtering case-insensitive (#68605)
Frank Hamand5e9838a633eb
diff --git a/products/feature_flags/backend/flag_status.py b/products/feature_flags/backend/flag_status.pyindex 7bae90d83978..2519b160c4ce 100644--- a/products/feature_flags/backend/flag_status.py+++ b/products/feature_flags/backend/flag_status.py@@ -112,8 +112,8 @@ def filter_flags_by_active_param(queryset: QuerySet, value: str | bool) -> Query)return queryset.filter(usage_based_stale) | config_based_queryset- # Handle both string "true"/"false" and boolean True/False- is_active = value == "true" or value is True+ # Handle both string "true"/"false" (any casing) and boolean True/False+ is_active = str(value).lower() == "true"return queryset.filter(active=is_active)diff --git a/products/feature_flags/backend/test/test_flag_status.py b/products/feature_flags/backend/test/test_flag_status.pyindex edf3d0005925..0eb627e86260 100644--- a/products/feature_flags/backend/test/test_flag_status.py+++ b/products/feature_flags/backend/test/test_flag_status.py@@ -85,6 +85,10 @@ class TestFilterFlagsByActiveParam(BaseTest):def test_filters_stale(self):assert self._filter("STALE") == {"stale", "stale-by-usage", "stale-multivariate", "stale-empty-variants"}+ def test_active_param_is_case_insensitive(self):+ assert self._filter("True") == self._filter("true")+ assert self._filter("False") == self._filter("false")+def test_accepts_native_booleans(self):assert self._filter(True) == {"enabled",