: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
test(flags): cover every malformed v1 groups shape in the parity fixture (#121754)
Phil Haack5daa34cac9c6
diff --git a/products/feature_flags/backend/test/test_flags_cache.py b/products/feature_flags/backend/test/test_flags_cache.pyindex 114241a709d8..51df313bd074 100644--- a/products/feature_flags/backend/test/test_flags_cache.py+++ b/products/feature_flags/backend/test/test_flags_cache.py@@ -629,8 +629,9 @@ def _insert_config_format_fixture(team: Team, user) -> tuple[dict, dict[str, Feafilters = copy.deepcopy(row["filters"])groups = filters.get("groups") if isinstance(filters, dict) else Nonefor group in groups if isinstance(groups, list) else []:- for prop in group.get("properties") or []:- if prop.get("type") == "flag":+ properties = group.get("properties") if isinstance(group, dict) else None+ for prop in properties if isinstance(properties, list) else []:+ if isinstance(prop, dict) and prop.get("type") == "flag":reference = prop["key"]prop["key"] = str(fixture["missing_dependency_id"] if reference == "$missing" else flags[reference].iddiff --git a/rust/feature-flags/tests/fixtures/flags_cache_config_formats.json b/rust/feature-flags/tests/fixtures/flags_cache_config_formats.jsonindex c3f2461f4b22..f303dd67dc94 100644--- a/rust/feature-flags/tests/fixtures/flags_cache_config_formats.json+++ b/rust/feature-flags/tests/fixtures/flags_cache_config_formats.json@@ -286,6 +286,42 @@"filters": { "groups": "not a list" },"expect": "unsupported"},+ {+ "key": "malformed-v1-groups-object",+ "active": true,+ "filters": { "groups": { "key": "value" } },+ "expect": "unsupported"+ },+ {+ "key": "malformed-v1-group-not-object",+ "active": true,+ "filters": { "groups": [1] },+ "expect": "unsupported"+ },+ {+ "key": "malformed-v1-properties-string",+ "active": true,+ "filters": { "groups": [{ "properties": "x" }] },+ "expect": "unsupported"+ },+ {+ "key": "malformed-v1-property-not-object",+ "active": true,+ "filters": { "groups": [{ "properties": [[]] }] },+ "expect": "unsupported"+ },+ {+ "key": "malformed-v1-groups-number",+ "active": true,+ "filters": { "groups": 5 },+ "expect": "unsupported"+ },+ {+ "key": "malformed-v1-properties-boolean",+ "active": true,+ "filters": { "groups": [{ "properties": true }] },+ "expect": "unsupported"+ },{"key": "malformed-non-object-document","active": true,