Skip to content

: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.

fix(insights): keep "at least" on the Performed filter (#93137)

Daniel Parker0d7f8b7906cd
diff --git a/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.test.ts b/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.test.ts
index 12bc28757ea8..0b34cc662c64 100644
--- a/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.test.ts
+++ b/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.test.ts
@@ -133,6 +133,32 @@ describe('cleanEntityProperties', () => {
])
})
+ it('leaves a behavioral filter without a count operator alone', () => {
+ const properties = [
+ {
+ key: '$pageview',
+ type: 'behavioral',
+ value: 'performed_event',
+ event_type: 'events',
+ time_value: 30,
+ time_interval: 'day',
+ },
+ ]
+
+ const result = cleanEntityProperties(properties)
+
+ expect(result).toEqual([
+ {
+ key: '$pageview',
+ type: 'behavioral',
+ value: 'performed_event',
+ event_type: 'events',
+ time_value: 30,
+ time_interval: 'day',
+ },
+ ])
+ })
+
it('handles negation for cohorts', () => {
let properties: any = [
{
diff --git a/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.ts b/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.ts
index 82edbfb56cfb..dff537f0e50b 100644
--- a/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.ts
+++ b/frontend/src/queries/nodes/InsightQuery/utils/cleanProperties.ts
@@ -132,8 +132,10 @@ const cleanProperty = (property: Record<string, any>): AnyPropertyFilter => {
property['key'] = 'id'
}
- // set a default operator for properties that support it, but don't have an operator set
- if (isPropertyWithOperator(property) && property['operator'] === undefined) {
+ // set a default operator for properties that support it, but don't have an operator set.
+ // A behavioral filter is exempt: its operator is the count comparison for
+ // performed_event_multiple, so an absent one means "no count comparison", not "exactly".
+ if (isPropertyWithOperator(property) && property['type'] !== 'behavioral' && property['operator'] === undefined) {
property['operator'] = 'exact'
}