Skip to content

Commit

Permalink
fix: handle unexpected shaped test account filters (#27068)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Dec 20, 2024
1 parent 7d35d2b commit 25ebebc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def __init__(
def _test_account_filters(self) -> list[AnyPropertyFilter]:
prop_filters: list[AnyPropertyFilter] = []
for prop in self._team.test_account_filters:
match prop["type"]:
match prop.get("type", None):
case "person":
prop_filters.append(PersonPropertyFilter(**prop))
case "event":
Expand All @@ -191,6 +191,9 @@ def _test_account_filters(self) -> list[AnyPropertyFilter]:
prop_filters.append(GroupPropertyFilter(**prop))
case "hogql":
prop_filters.append(HogQLPropertyFilter(**prop))
case None:
logger.warn("test account filter had no type", filter=prop)
prop_filters.append(EventPropertyFilter(**prop))

return prop_filters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3316,7 +3316,9 @@ def test_event_filter_with_test_accounts_excluded(self):
"key": "is_internal_user",
"value": ["false"],
"operator": "exact",
"type": "event",
# in production some test account filters don't include type
# we default to event in that case
# "type": "event",
},
{"key": "properties.$browser == 'Chrome'", "type": "hogql"},
]
Expand Down

0 comments on commit 25ebebc

Please sign in to comment.