: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(experiments): Quiet noisy rows in the experiment history feed (#95002)
Juraj Majerik5aca36a5d47a
diff --git a/frontend/src/lib/components/ActivityLog/activityLogLogic.feature-flag.test.tsx b/frontend/src/lib/components/ActivityLog/activityLogLogic.feature-flag.test.tsxindex 4fa318091ac6..d4fffd7ed37f 100644--- a/frontend/src/lib/components/ActivityLog/activityLogLogic.feature-flag.test.tsx+++ b/frontend/src/lib/components/ActivityLog/activityLogLogic.feature-flag.test.tsx@@ -15,6 +15,36 @@ describe('the activity log logic', () => {`/api/projects/${MOCK_TEAM_ID}/feature_flags/7/activity/`)+ it('drops an entry whose only change is the version bump', async () => {+ const logic = await featureFlagsTestSetup('test flag', 'updated', [+ {+ type: ActivityScope.FEATURE_FLAG,+ action: 'changed',+ field: 'version',+ before: 1,+ after: 2,+ },+ ])++ expect(logic.values.humanizedActivity).toHaveLength(0)+ })++ it('keeps the generic row for a describable change the handler cannot narrate', async () => {+ const logic = await featureFlagsTestSetup('test flag', 'updated', [+ {+ type: ActivityScope.FEATURE_FLAG,+ action: 'changed',+ field: 'filters',+ before: { groups: [{ properties: [], rollout_percentage: 50 }] },+ after: {},+ },+ ])++ const actual = logic.values.humanizedActivity+ expect(actual).toHaveLength(1)+ expect(render(<>{actual[0].description}</>).container).toHaveTextContent('peter updated')+ })+it('can handle change of key', async () => {const logic = await featureFlagsTestSetup('test flag', 'updated', [{diff --git a/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx b/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsxindex 0c3026161dc7..24f8d41ae7a8 100644--- a/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx+++ b/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx@@ -39,6 +39,8 @@ export const nameOrLinkToExperiment = (name: string | null, id?: string): JSX.Eltype AllowedExperimentFields = Pick<Experiment,| 'conclusion'+ | 'conclusion_comment'+ | 'status'| 'start_date'| 'end_date'| 'metrics'@@ -308,6 +310,15 @@ export const getExperimentChangeDescription = (// mirrored while `parameters` is deprecated — avoid a duplicate line.return null})+ .with({ field: 'status' }, () => {+ // Status only moves together with a lifecycle change (launch, stop, pause), and those+ // already produce their own descriptions, so an "updated status" clause adds nothing.+ return null+ })+ .with({ field: 'conclusion_comment' }, () => {+ // The describer renders the comment text as the row's extended description instead.+ return null+ }).otherwise(({ field, action }) => {// Fallback for unhandled fields - ensures all activity is visibleconst fieldName = field.replace(/_/g, ' ')diff --git a/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsx b/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsxindex d83a791477f1..078544fd4f56 100644--- a/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsx+++ b/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsx@@ -328,4 +328,138 @@ describe('experimentActivityDescriber', () => {expect(text).not.toContain('running time calculation')})})++ describe('lifecycle entries', () => {+ it('describes a stop entry without narrating status or the conclusion comment', () => {+ const result = experimentActivityDescriber(+ baseLogItem({+ activity: 'updated',+ detail: {+ name: 'Checkout funnel',+ changes: [+ {+ type: ActivityScope.EXPERIMENT,+ action: 'created',+ field: 'end_date',+ before: null,+ after: '2026-06-18T14:25:34Z',+ },+ {+ type: ActivityScope.EXPERIMENT,+ action: 'changed',+ field: 'status',+ before: 'running',+ after: 'complete',+ },+ {+ type: ActivityScope.EXPERIMENT,+ action: 'created',+ field: 'conclusion',+ before: null,+ after: 'won',+ },+ {+ type: ActivityScope.EXPERIMENT,+ action: 'created',+ field: 'conclusion_comment',+ before: null,+ after: 'Variant B lifted signups.',+ },+ ],+ merge: null,+ trigger: null,+ },+ })+ )+ const text = textOf(result)+ expect(text).toContain('stopped experiment')+ expect(text).toContain('completed it as')+ expect(text).not.toContain('status')+ expect(text).not.toContain('conclusion comment')+ const extended = render(<>{result.extendedDescription}</>).container.textContent+ expect(extended).toContain('Variant B lifted signups.')+ })++ it('drops the status clause from a launch entry', () => {+ const result = experimentActivityDescriber(+ baseLogItem({+ activity: 'updated',+ detail: {+ name: 'Checkout funnel',+ changes: [+ {+ type: ActivityScope.EXPERIMENT,+ action: 'created',+ field: 'start_date',+ before: null,+ after: '2026-06-18T14:25:34Z',+ },+ {+ type: ActivityScope.EXPERIMENT,+ action: 'changed',+ field: 'status',+ before: 'draft',+ after: 'running',+ },+ ],+ merge: null,+ trigger: null,+ },+ })+ )+ const text = textOf(result)+ expect(text).toContain('launched experiment')+ expect(text).not.toContain('status')+ expect(text).not.toContain(': on')+ })++ it('keeps a row for a comment-only conclusion edit', () => {+ const result = experimentActivityDescriber(+ baseLogItem({+ activity: 'updated',+ detail: {+ name: 'Checkout funnel',+ changes: [+ {+ type: ActivityScope.EXPERIMENT,+ action: 'changed',+ field: 'conclusion_comment',+ before: 'Variant B lifted signups.',+ after: 'Variant B lifted signups by 4%.',+ },+ ],+ merge: null,+ trigger: null,+ },+ })+ )+ expect(textOf(result)).toContain('changed the conclusion')+ const extended = render(<>{result.extendedDescription}</>).container.textContent+ expect(extended).toContain('Variant B lifted signups by 4%.')+ })++ it('keeps a row for a comment-only conclusion removal', () => {+ const result = experimentActivityDescriber(+ baseLogItem({+ activity: 'updated',+ detail: {+ name: 'Checkout funnel',+ changes: [+ {+ type: ActivityScope.EXPERIMENT,+ action: 'changed',+ field: 'conclusion_comment',+ before: 'Variant B lifted signups.',+ after: null,+ },+ ],+ merge: null,+ trigger: null,+ },+ })+ )+ expect(textOf(result)).toContain('removed the conclusion comment')+ expect(result.extendedDescription).toBeUndefined()+ })+ })})diff --git a/frontend/src/scenes/experiments/experimentActivityDescriber.tsx b/frontend/src/scenes/experiments/experimentActivityDescriber.tsxindex 6bccbb144694..2d1e44580f51 100644--- a/frontend/src/scenes/experiments/experimentActivityDescriber.tsx+++ b/frontend/src/scenes/experiments/experimentActivityDescriber.tsx@@ -100,6 +100,10 @@ const humanizeExperimentChange = (}const appendPreposition = (item: string | JSX.Element): string | JSX.Element => {+ // A part that ends with a colon already introduces the experiment name.+ if (extractText(item).trimEnd().endsWith(':')) {+ return item+ }const preposition = getPreposition(item)return typeof item === 'string' ? (`${item} ${preposition}`@@ -321,6 +325,18 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): HumanizedupdateLogDetail.type !== 'holdout' &&updateLogDetail.type !== 'saved_metric_config'+ const conclusionCommentChange = isExperiment+ ? changes.find((change) => change.field === 'conclusion_comment')+ : undefined+ const conclusionComment =+ typeof conclusionCommentChange?.after === 'string' && conclusionCommentChange.after.trim()+ ? conclusionCommentChange.after+ : undefined+ const conclusionCommentRemoved =+ !conclusionComment &&+ typeof conclusionCommentChange?.before === 'string' &&+ Boolean(conclusionCommentChange.before.trim())+let listParts: (string | JSX.Element)[]if (changes.length === 0) {listParts = ['updated']@@ -344,8 +360,15 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized}if (isExperiment && changes.length > 0 && listParts.length === 0) {- // humanize() skips log items with a null description- return { description: null }+ if (conclusionComment) {+ // A comment-only edit still gets a row; the comment renders below it.+ listParts = ['changed the conclusion']+ } else if (conclusionCommentRemoved) {+ listParts = ['removed the conclusion comment']+ } else {+ // humanize() skips log items with a null description+ return { description: null }+ }}if (isExperiment && changes.length > 0 && listParts.length > 0) {@@ -366,6 +389,9 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanizedsuffix={suffix}/>),+ extendedDescription: conclusionComment ? (+ <blockquote className="border-l-2 pl-2 text-secondary">{conclusionComment}</blockquote>+ ) : undefined,}}).otherwise(() => {diff --git a/frontend/src/scenes/feature-flags/activityDescriptions.tsx b/frontend/src/scenes/feature-flags/activityDescriptions.tsxindex 69aa2bc829a7..347c9c302849 100644--- a/frontend/src/scenes/feature-flags/activityDescriptions.tsx+++ b/frontend/src/scenes/feature-flags/activityDescriptions.tsx@@ -53,6 +53,11 @@ const getRuntimeLabel = (runtime: string): string => {}}+// Shared handler for fields the feed deliberately never describes. EXCLUDED_FLAG_FIELDS is+// derived by identity from this function, so excluded fields stay distinguishable from+// describable fields whose handler returned null for one particular change.+const excludedFieldHandler = (): null => null+const featureFlagActionsMapping: Record<keyof FeatureFlagType,(change?: ActivityChange, logItem?: ActivityLogItem) => ChangeMapping | null@@ -377,28 +382,34 @@ const featureFlagActionsMapping: Record<return { description: changes }},// fields that are excluded on the backend- id: () => null,- created_at: () => null,- created_by: () => null,- updated_at: () => null,- experiment_set: () => null,- experiment_set_metadata: () => null,- features: () => null,- usage_dashboard: () => null,- can_edit: () => null,- has_enriched_analytics: () => null,- surveys: () => null,- user_access_level: () => null,- is_remote_configuration: () => null,- has_encrypted_payloads: () => null,- status: () => null,- version: () => null,- last_modified_by: () => null,- last_called_at: () => null,- is_used_in_replay_settings: () => null,- _create_in_folder: () => null,+ id: excludedFieldHandler,+ created_at: excludedFieldHandler,+ created_by: excludedFieldHandler,+ updated_at: excludedFieldHandler,+ experiment_set: excludedFieldHandler,+ experiment_set_metadata: excludedFieldHandler,+ features: excludedFieldHandler,+ usage_dashboard: excludedFieldHandler,+ can_edit: excludedFieldHandler,+ has_enriched_analytics: excludedFieldHandler,+ surveys: excludedFieldHandler,+ user_access_level: excludedFieldHandler,+ is_remote_configuration: excludedFieldHandler,+ has_encrypted_payloads: excludedFieldHandler,+ status: excludedFieldHandler,+ version: excludedFieldHandler,+ last_modified_by: excludedFieldHandler,+ last_called_at: excludedFieldHandler,+ is_used_in_replay_settings: excludedFieldHandler,+ _create_in_folder: excludedFieldHandler,}+const EXCLUDED_FLAG_FIELDS = new Set(+ Object.keys(featureFlagActionsMapping).filter(+ (field) => featureFlagActionsMapping[field as keyof FeatureFlagType] === excludedFieldHandler+ )+)+const getActorName = (logItem: ActivityLogItem): JSX.Element => {const userName = userNameForLogItem(logItem)if (logItem.detail.trigger?.job_type === 'scheduled_change') {@@ -525,6 +536,18 @@ export function flagActivityDescriber(logItem: ActivityLogItem, asNotification?:description: <SentenceList listParts={changes} prefix={getActorName(logItem)} suffix={changeSuffix} />,}}++ const updateChanges = logItem.detail.changes || []+ if (+ updateChanges.length > 0 &&+ updateChanges.every((change) => change.field && EXCLUDED_FLAG_FIELDS.has(change.field))+ ) {+ // Every change is to an excluded field, which happens when a save only bumps the+ // optimistic-concurrency `version`. The fallback would render a contentless+ // "updated <flag>" row, so drop the entry instead. A describable change whose+ // handler produced no text still falls through to the generic fallback.+ return { description: null }+ }}return defaultDescriber(logItem, asNotification, nameOrLinkToFlag(logItem?.item_id, logItem?.detail.name))