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.

chore(insights): stop converting legacy filters to describe an insight edit (#96216)

Thomas Obermüller931101d08ae0
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 6ca716b3aa70..d63cd2e2e8c0 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -73,9 +73,9 @@ snapshots:
components-activitylog--feature-flag-activity--light:
hash: v1.k794b7964.5a8358a3bb67728abcc71ec423255206af014e13d1d95aaeaf2daba16bc96b45.tMsr51f9bhJSycyXPJYsOjM-kNAGQI2hFI3CbJBoyOk
components-activitylog--insight-activity--dark:
- hash: v1.k794b7964.41b2c011efcf7aa3223a71cfec6444fba566bd2b39ee41166320907844b0ceae.5HLSP_ex1j65lKKvsc5brJ3sK5TNdqwoJJkJy_QGmj4
+ hash: v1.k794b7964.eeb2e5b54ba0acf05e292aba372702616dc9c6326fd8bcbf4bbf1125fcb7c637.XMwf5MqrlV-FQsYrL-4Db38vN69QQAmBms5tmbFQlSw
components-activitylog--insight-activity--light:
- hash: v1.k794b7964.fd12a180d82b7fdaa9656b349b6772db22db42d2c5420d278cc9a4a29ab53bd7.z80OD8wV95-cjP_d3ROg7m6u-y25eLBYY6TXZG1odVg
+ hash: v1.k794b7964.94aae0b511d11de8cf139dd502bc7170494be36e74fd517187ce37048c514447.ZOKfzkSSO6DcNPVEP0DWvmeA3hHVd35t1AYL5yrrkPk
components-activitylog--persons-activity--dark:
hash: v1.k794b7964.432ff34c2d8dd67ca60593d6440de2eb053e4a8ddbfcc6cbfe4a25bce324f0d9.kljasPbvnNb_HfMKLGFlj58Wgh283EQnarNEpOf8J4U
components-activitylog--persons-activity--light:
diff --git a/frontend/src/lib/components/ActivityLog/__mocks__/activityLogMocks.ts b/frontend/src/lib/components/ActivityLog/__mocks__/activityLogMocks.ts
index f7929c42e52f..cb7d7091423f 100644
--- a/frontend/src/lib/components/ActivityLog/__mocks__/activityLogMocks.ts
+++ b/frontend/src/lib/components/ActivityLog/__mocks__/activityLogMocks.ts
@@ -999,6 +999,84 @@ export const insightsActivityResponseJson: ActivityLogItem[] = [
},
created_at: '2023-04-20T18:35:14.033429Z',
},
+ {
+ user: {
+ first_name: 'Employee 427',
+ email: '[email protected]',
+ },
+ activity: 'updated',
+ scope: ActivityScope.INSIGHT,
+ item_id: '40',
+ detail: {
+ merge: null,
+ changes: [
+ {
+ type: ActivityScope.INSIGHT,
+ action: 'changed',
+ field: 'query',
+ after: {
+ kind: 'InsightVizNode',
+ source: {
+ kind: 'TrendsQuery',
+ series: [
+ { kind: 'EventsNode', event: '$pageview', name: '$pageview', math: 'total' },
+ { kind: 'EventsNode', event: 'signed up', name: 'signed up', math: 'dau' },
+ ],
+ interval: 'day',
+ dateRange: { date_from: '-30d' },
+ properties: [{ key: '$browser', type: 'event', value: ['Chrome'], operator: 'exact' }],
+ breakdownFilter: { breakdown: '$browser', breakdown_type: 'event' },
+ trendsFilter: { display: 'ActionsLineGraph' },
+ },
+ },
+ },
+ ],
+ trigger: null,
+ name: 'Pageviews and signups by browser',
+ short_id: 'HcLbVmQp' as InsightShortId,
+ },
+ created_at: '2023-04-21T09:12:44.033429Z',
+ },
+ {
+ user: {
+ first_name: 'Employee 427',
+ email: '[email protected]',
+ },
+ activity: 'updated',
+ scope: ActivityScope.INSIGHT,
+ item_id: '41',
+ detail: {
+ merge: null,
+ changes: [
+ {
+ type: ActivityScope.INSIGHT,
+ action: 'changed',
+ field: 'query',
+ after: {
+ kind: 'InsightVizNode',
+ source: {
+ kind: 'FunnelsQuery',
+ series: [
+ {
+ kind: 'EventsNode',
+ event: '$pageview',
+ name: '$pageview',
+ custom_name: 'Visited the site',
+ },
+ { kind: 'EventsNode', event: 'signed up', name: 'signed up' },
+ ],
+ dateRange: { date_from: '-14d' },
+ funnelsFilter: { funnelVizType: 'steps' },
+ },
+ },
+ },
+ ],
+ trigger: null,
+ name: 'Signup funnel',
+ short_id: 'Zk3RtYw2' as InsightShortId,
+ },
+ created_at: '2023-04-21T09:14:02.033429Z',
+ },
{
user: { first_name: 'Cameron', email: '[email protected]' },
activity: 'updated',
diff --git a/frontend/src/scenes/saved-insights/activityDescriptions.tsx b/frontend/src/scenes/saved-insights/activityDescriptions.tsx
index 8f233a9ce296..9d0fe481dd4c 100644
--- a/frontend/src/scenes/saved-insights/activityDescriptions.tsx
+++ b/frontend/src/scenes/saved-insights/activityDescriptions.tsx
@@ -23,7 +23,6 @@ import { areObjectValuesEmpty } from 'lib/utils/objects'
import { pluralize } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
-import { filtersToQueryNode } from '~/queries/nodes/InsightQuery/utils/filtersToQueryNode'
import { HogQLQuery, InsightQueryNode, QuerySchema } from '~/queries/schema/schema-general'
import {
isDataTableNodeWithHogQLQuery,
@@ -83,11 +82,10 @@ const insightActionsMapping: Record<
filters: function onChangedFilter(change) {
const filtersAfter = change?.after as Partial<FilterType>
- return areObjectValuesEmpty(filtersAfter)
- ? null
- : summarizeQueryChanges(
- filtersToQueryNode(filtersAfter, { source: 'saved_insights_activity_descriptions' })
- )
+ // Only an insight written before queries logs this field, so these entries are years old and
+ // no new one can be written. Summarizing the definition would mean converting legacy filters,
+ // which no other read path still does, and the headline reads the same either way.
+ return areObjectValuesEmpty(filtersAfter) ? null : { description: ['changed query definition'] }
},
query: function onChangedQuery(change) {
if (change?.action === 'deleted') {