: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): hide running time calculator noise in history (#93583)
Juraj Majerik7980851accc8
diff --git a/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx b/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsxindex e00f93c35340..0c3026161dc7 100644--- a/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx+++ b/frontend/src/scenes/experiments/activity-descriptions/experimentChangeDescription.tsx@@ -69,6 +69,17 @@ function withoutRunningTimeCalculationKeys(value: unknown): Record<string, unkno)}+const DERIVED_RUNNING_TIME_KEYS = ['recommended_running_time', 'recommended_sample_size']++/** Strip the derived calculator outputs so only deliberate input edits (MDE, exposure estimate) count. */+function withoutDerivedRunningTimeKeys(value: unknown): Record<string, unknown> {+ return Object.fromEntries(+ Object.entries((value as Record<string, unknown> | null) ?? {}).filter(+ ([key]) => !DERIVED_RUNNING_TIME_KEYS.includes(key)+ )+ )+}+function describeExcludedVariantsChange(before: string[] | undefined, after: string[] | undefined): string | null {const beforeSet = new Set(before ?? [])const afterSet = new Set(after ?? [])@@ -284,7 +295,12 @@ export const getExperimentChangeDescription = (}return 'updated parameters'})- .with({ field: 'running_time_calculation' }, () => {+ .with({ field: 'running_time_calculation' }, ({ before, after }) => {+ // Opening the calculator re-saves the recomputed outputs, so they drift as exposure+ // data changes — a row only earns its place when a calculator input was edited.+ if (equal(withoutDerivedRunningTimeKeys(before), withoutDerivedRunningTimeKeys(after))) {+ return null+ }return 'updated the running time calculation'}).with({ field: 'excluded_variants' }, () => {diff --git a/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsx b/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsxindex 1235be9cd783..d83a791477f1 100644--- a/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsx+++ b/frontend/src/scenes/experiments/experimentActivityDescriber.test.tsx@@ -259,5 +259,73 @@ describe('experimentActivityDescriber', () => {)expect(textOf(result)).not.toContain('updated parameters')})++ it.each([+ {+ name: 'recomputed outputs drifted',+ action: 'changed' as const,+ before: { recommended_sample_size: 5442, recommended_running_time: 10 },+ after: { recommended_sample_size: 21781, recommended_running_time: 127 },+ },+ {+ name: 'first save only stored recomputed outputs',+ action: 'created' as const,+ before: null,+ after: { recommended_sample_size: 7307, recommended_running_time: 13 },+ },+ ])('drops the row when no calculator input was edited: $name', ({ action, before, after }) => {+ const result = experimentActivityDescriber(+ baseLogItem({+ activity: 'updated',+ detail: {+ name: 'Checkout funnel',+ changes: [+ {+ type: ActivityScope.EXPERIMENT,+ action,+ field: 'running_time_calculation',+ before,+ after,+ },+ ],+ merge: null,+ trigger: null,+ },+ })+ )+ expect(result.description).toBeNull()+ })++ it('keeps the row when output drift accompanies a real change', () => {+ 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: 'running_time_calculation',+ before: { recommended_sample_size: 5442 },+ after: { recommended_sample_size: 21781 },+ },+ ],+ merge: null,+ trigger: null,+ },+ })+ )+ const text = textOf(result)+ expect(text).toContain('launched experiment')+ expect(text).not.toContain('running time calculation')+ })})})diff --git a/frontend/src/scenes/experiments/experimentActivityDescriber.tsx b/frontend/src/scenes/experiments/experimentActivityDescriber.tsxindex 9fb9c938427a..6bccbb144694 100644--- a/frontend/src/scenes/experiments/experimentActivityDescriber.tsx+++ b/frontend/src/scenes/experiments/experimentActivityDescriber.tsx@@ -343,6 +343,11 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized.filter((part): part is string | JSX.Element => part !== null)}+ if (isExperiment && changes.length > 0 && listParts.length === 0) {+ // humanize() skips log items with a null description+ return { description: null }+ }+if (isExperiment && changes.length > 0 && listParts.length > 0) {const lastIndex = listParts.length - 1listParts[lastIndex] = appendPreposition(listParts[lastIndex])