: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(posthog_ai): reset the debug logs preference to off for staff (#96457)
Georgiy Tarasov6aab3b2b0861
diff --git a/products/posthog_ai/frontend/logics/debugLogsLogic.test.ts b/products/posthog_ai/frontend/logics/debugLogsLogic.test.tsindex fe54d985284e..5846ddbcb49d 100644--- a/products/posthog_ai/frontend/logics/debugLogsLogic.test.ts+++ b/products/posthog_ai/frontend/logics/debugLogsLogic.test.ts@@ -40,6 +40,13 @@ describe('debugLogsLogic', () => {expect(logic.values.showDebugLogs).toBe(false)})+ it('ignores a value left under a superseded storage key', () => {+ localStorage.setItem('posthog_ai.debugLogsEnabled', 'true')+ setup({ user: { is_staff: true }, isDev: false })+ expect(logic.values.debugLogsEnabled).toBe(false)+ expect(logic.values.showDebugLogs).toBe(false)+ })+it('offers no toggle to a staff user who is also impersonating, but still forces logs on', () => {// The toggle would be a no-op during impersonation (logs are force-shown), so it must not render.setup({ user: { is_staff: true, is_impersonated: true }, isDev: false })diff --git a/products/posthog_ai/frontend/logics/debugLogsLogic.ts b/products/posthog_ai/frontend/logics/debugLogsLogic.tsindex 3a2181d466b2..eb32d23f90ba 100644--- a/products/posthog_ai/frontend/logics/debugLogsLogic.ts+++ b/products/posthog_ai/frontend/logics/debugLogsLogic.ts@@ -54,7 +54,7 @@ export const debugLogsLogic = kea<debugLogsLogicType>([reducers({debugLogsEnabled: [false,- { persist: true, storageKey: 'posthog_ai.debugLogsEnabled' },+ { persist: true, storageKey: 'posthog_ai.debugLogsOptIn' },{setDebugLogsEnabled: (_, { enabled }) => enabled,},