: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(metrics): make the alpha gate enrollment toggle reachable (#97452)
Daniel Visca1a9593604d3a
diff --git a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsx b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsxindex f6ac390e11ae..9b74fbff0f2a 100644--- a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsx+++ b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsx@@ -418,6 +418,33 @@ describe('FeaturePreviewSceneGate', () => {})})+ describe('alpha stage (self-serve enrollment)', () => {+ const ALPHA_FEATURE = {+ flagKey: BASE_CONFIG.flag,+ enabled: false,+ stage: 'alpha',+ payload: { survey_id: 'survey-1' },+ }++ test('shows the enrollment toggle even when the feature carries a waitlist survey', () => {+ setupMocks({ earlyAccessFeatures: [ALPHA_FEATURE], waitlistSurveysEnabled: true })++ render(<FeaturePreviewSceneGate config={BASE_CONFIG}>{CHILDREN}</FeaturePreviewSceneGate>)++ expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.queryByPlaceholderText('[email protected]')).not.toBeInTheDocument()+ })++ test('toggling on enrolls with the alpha stage, which unlocks the flag', async () => {+ setupMocks({ earlyAccessFeatures: [ALPHA_FEATURE] })++ render(<FeaturePreviewSceneGate config={BASE_CONFIG}>{CHILDREN}</FeaturePreviewSceneGate>)+ await userEvent.click(screen.getByRole('switch'))++ expect(mockUpdateEarlyAccessFeatureEnrollment).toHaveBeenCalledWith(BASE_CONFIG.flag, true, 'alpha')+ })+ })+describe('request access', () => {const CONFIG_WITH_SUPPORT: FeaturePreviewGateConfig = {...BASE_CONFIG,diff --git a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsx b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsxindex f0ce25bb571c..9853b20b0c1b 100644--- a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsx+++ b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsx@@ -56,6 +56,8 @@ function FeaturePreviewGateContent({ config }: { config: FeaturePreviewGateConfi// Concept ("Coming Soon") features never enable their flag, so the enrollment toggle is a// dead end there. When the feature carries a waitlist survey, collect an email instead.+ // Alpha and beta enrollments do enable their flag, so those stages keep the self-serve+ // toggle even when a legacy waitlist survey id is still attached to the payload.if (feature?.stage === 'concept' && feature.payload?.survey_id) {return (<SceneContent>diff --git a/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.test.tsx b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.test.tsxindex 1cb35ef14d77..3eeee7842dd9 100644--- a/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.test.tsx+++ b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.test.tsx@@ -125,6 +125,18 @@ describe('FeaturePreviews', () => {})+ test.each([+ ['beta', true],+ ['alpha', true],+ ['concept', false],+ ] as const)('a %s-stage preview is listed: %s', (stage, expectedVisible) => {+ setupMocks({ features: [{ ...BETA_FEATURE, stage }] })++ render(<FeaturePreviews />)++ expect(!!screen.queryByRole('switch')).toBe(expectedVisible)+ })+test('hides the banner when the instance has only concept previews, which this list does not render', () => {setupMocks({ cloud: false, features: [CONCEPT_FEATURE] })diff --git a/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.tsx b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.tsxindex 2869a33514e0..d0e045744f53 100644--- a/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.tsx+++ b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.tsx@@ -54,7 +54,9 @@ export function FeaturePreviews(): JSX.Element {// fires too early — defer the scroll + highlight until the cards exist.useAnchor(rawEarlyAccessFeaturesLoading ? '' : window.location.hash)- const betaFeatures = filteredEarlyAccessFeatures.filter((f) => f.stage === 'beta')+ // Active stages the enrollment toggle can unlock: alpha and beta both set feature+ // enrollment on their flag. Concept ("Coming Soon") cards live in FeaturePreviewsComingSoon.+ const betaFeatures = filteredEarlyAccessFeatures.filter((f) => f.stage === 'beta' || f.stage === 'alpha')const shouldShowEmptyState =filteredEarlyAccessFeatures.length === 0 && !rawEarlyAccessFeaturesLoading && !searchTermconst failedToLoadFeaturePreviews = shouldShowEmptyState && hasPosthogJsFailedToLoadFeaturePreviews()diff --git a/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.test.ts b/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.test.tsindex aa4bc79ac08b..204c157666ce 100644--- a/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.test.ts+++ b/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.test.ts@@ -19,266 +19,309 @@ jest.mock('lib/lemon-ui/LemonToast')const mockedPosthog = posthog as jest.Mocked<typeof posthog>mockedPosthog.get_session_replay_url = jest.fn(() => 'http://localhost/replay/123')-describe('featurePreviewsLogic - submitEarlyAccessFeatureFeedback', () => {- let logic: ReturnType<typeof featurePreviewsLogic.build>-- beforeEach(() => {- jest.clearAllMocks()-- ;(posthog as any).conversations = {- isAvailable: () => true,- sendMessage: jest.fn().mockResolvedValue({ ticket_id: '123', ticket_status: 'open', created_at: '' }),- }- initKeaTests()- logic = featurePreviewsLogic()- logic.mount()- userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)- })+describe('featurePreviewsLogic', () => {+ describe('submitEarlyAccessFeatureFeedback', () => {+ let logic: ReturnType<typeof featurePreviewsLogic.build>++ beforeEach(() => {+ jest.clearAllMocks()++ ;(posthog as any).conversations = {+ isAvailable: () => true,+ sendMessage: jest.fn().mockResolvedValue({ ticket_id: '123', ticket_status: 'open', created_at: '' }),+ }+ initKeaTests()+ logic = featurePreviewsLogic()+ logic.mount()+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)+ })- test('submitting feedback', async () => {- logic.actions.beginEarlyAccessFeatureFeedback('test')- const promise = logic.asyncActions.submitEarlyAccessFeatureFeedback('test')- await expectLogic(logic)- .toMatchValues({ activeFeedbackFlagKeyLoading: true })- .toDispatchActions(['submitEarlyAccessFeatureFeedback'])- .toNotHaveDispatchedActions(['submitEarlyAccessFeatureFeedbackSuccess'])- await promise- await expectLogic(logic)- .toMatchValues({ activeFeedbackFlagKeyLoading: false })- .toDispatchActions(['submitEarlyAccessFeatureFeedbackSuccess'])+ test('submitting feedback', async () => {+ logic.actions.beginEarlyAccessFeatureFeedback('test')+ const promise = logic.asyncActions.submitEarlyAccessFeatureFeedback('test')+ await expectLogic(logic)+ .toMatchValues({ activeFeedbackFlagKeyLoading: true })+ .toDispatchActions(['submitEarlyAccessFeatureFeedback'])+ .toNotHaveDispatchedActions(['submitEarlyAccessFeatureFeedbackSuccess'])+ await promise+ await expectLogic(logic)+ .toMatchValues({ activeFeedbackFlagKeyLoading: false })+ .toDispatchActions(['submitEarlyAccessFeatureFeedbackSuccess'])+ })})-})-describe('featurePreviewsLogic - submitEarlyAccessFeatureFeedback failure', () => {- let logic: ReturnType<typeof featurePreviewsLogic.build>-- beforeEach(() => {- jest.clearAllMocks()- ;(posthog as any).conversations = {- isAvailable: () => true,- sendMessage: jest.fn().mockRejectedValue(new Error('network down')),- }- initKeaTests()- logic = featurePreviewsLogic()- logic.mount()- userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)- })+ describe('submitEarlyAccessFeatureFeedback failure', () => {+ let logic: ReturnType<typeof featurePreviewsLogic.build>++ beforeEach(() => {+ jest.clearAllMocks()+ ;(posthog as any).conversations = {+ isAvailable: () => true,+ sendMessage: jest.fn().mockRejectedValue(new Error('network down')),+ }+ initKeaTests()+ logic = featurePreviewsLogic()+ logic.mount()+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)+ })- test('keeps the feedback panel open so the text survives for a retry', async () => {- logic.actions.beginEarlyAccessFeatureFeedback('test')- await logic.asyncActions.submitEarlyAccessFeatureFeedback('important feedback')+ test('keeps the feedback panel open so the text survives for a retry', async () => {+ logic.actions.beginEarlyAccessFeatureFeedback('test')+ await logic.asyncActions.submitEarlyAccessFeatureFeedback('important feedback')- // The submit failed, so activeFeedbackFlagKey stays set — the panel (and the component's- // local draft) survive. On success it would be cleared to null, closing the panel.- await expectLogic(logic).toMatchValues({ activeFeedbackFlagKey: 'test', activeFeedbackFlagKeyLoading: false })+ // The submit failed, so activeFeedbackFlagKey stays set — the panel (and the component's+ // local draft) survive. On success it would be cleared to null, closing the panel.+ await expectLogic(logic).toMatchValues({+ activeFeedbackFlagKey: 'test',+ activeFeedbackFlagKeyLoading: false,+ })+ })})-})-describe('featurePreviewsLogic - updateEarlyAccessFeatureEnrollment', () => {- let logic: ReturnType<typeof featurePreviewsLogic.build>- const mockUpdateEnrollment = jest.fn()+ describe('loadEarlyAccessFeatures', () => {+ let logic: ReturnType<typeof featurePreviewsLogic.build>+ const mockGetEarlyAccessFeatures = jest.fn()- beforeEach(() => {- jest.clearAllMocks()+ beforeEach(() => {+ jest.clearAllMocks()+ ;(posthog as any).getEarlyAccessFeatures = mockGetEarlyAccessFeatures- // Set up the mock implementation for posthog- ;(posthog as any).updateEarlyAccessFeatureEnrollment = mockUpdateEnrollment+ initKeaTests()+ logic = featurePreviewsLogic()+ logic.mount()+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)+ })- initKeaTests()- logic = featurePreviewsLogic()- logic.mount()- userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)- })+ test('requests concept, alpha, and beta stages so alpha features render', async () => {+ mockGetEarlyAccessFeatures.mockImplementation((callback: (features: any[]) => void) => callback([]))- test('updating early access feature enrollment without stage', () => {- logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', true)+ await logic.asyncActions.loadEarlyAccessFeatures()- expect(mockUpdateEnrollment).toHaveBeenCalledWith('test-flag', true, undefined)- })+ expect(mockGetEarlyAccessFeatures).toHaveBeenCalledWith(expect.any(Function), true, [+ 'concept',+ 'alpha',+ 'beta',+ ])+ })++ test('an alpha-stage feature is stored so the gate can offer its enrollment toggle', async () => {+ const alphaFeature = { id: '1', name: 'Metrics', stage: 'alpha', flagKey: 'metrics' }+ mockGetEarlyAccessFeatures.mockImplementation((callback: (features: any[]) => void) =>+ callback([alphaFeature])+ )- test('updating early access feature enrollment with stage', () => {- logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', true, 'beta')+ await logic.asyncActions.loadEarlyAccessFeatures()- expect(mockUpdateEnrollment).toHaveBeenCalledWith('test-flag', true, 'beta')+ await expectLogic(logic).toMatchValues({ rawEarlyAccessFeatures: [alphaFeature] })+ })})- test('updating early access feature enrollment with different stages', () => {- // Test concept stage- logic.actions.updateEarlyAccessFeatureEnrollment('concept-flag', false, 'concept')- expect(mockUpdateEnrollment).toHaveBeenCalledWith('concept-flag', false, 'concept')+ describe('updateEarlyAccessFeatureEnrollment', () => {+ let logic: ReturnType<typeof featurePreviewsLogic.build>+ const mockUpdateEnrollment = jest.fn()- // Test alpha stage- logic.actions.updateEarlyAccessFeatureEnrollment('alpha-flag', true, 'alpha')- expect(mockUpdateEnrollment).toHaveBeenCalledWith('alpha-flag', true, 'alpha')- })-})+ beforeEach(() => {+ jest.clearAllMocks()-describe('featurePreviewsLogic - conceptEnrollments reducer', () => {- let logic: ReturnType<typeof featurePreviewsLogic.build>+ // Set up the mock implementation for posthog+ ;(posthog as any).updateEarlyAccessFeatureEnrollment = mockUpdateEnrollment- beforeEach(() => {- jest.clearAllMocks()- ;(posthog as any).updateEarlyAccessFeatureEnrollment = jest.fn()+ initKeaTests()+ logic = featurePreviewsLogic()+ logic.mount()+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)+ })- initKeaTests()- logic = featurePreviewsLogic()- logic.mount()- userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)- })+ test('updating early access feature enrollment without stage', () => {+ logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', true)- test.each([- ['concept', true, { 'concept-flag': true }],- ['beta', true, {}],- ['concept', false, { 'concept-flag': false }],- ])('stage=%s enabled=%s → conceptEnrollments=%j', async (stage, enabled, expected) => {- logic.actions.updateEarlyAccessFeatureEnrollment('concept-flag', enabled, stage)- await expectLogic(logic).toMatchValues({ conceptEnrollments: expected })- })+ expect(mockUpdateEnrollment).toHaveBeenCalledWith('test-flag', true, undefined)+ })- test('tracks multiple concept enrollments', async () => {- logic.actions.updateEarlyAccessFeatureEnrollment('concept-a', true, 'concept')- logic.actions.updateEarlyAccessFeatureEnrollment('concept-b', true, 'concept')+ test('updating early access feature enrollment with stage', () => {+ logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', true, 'beta')- await expectLogic(logic).toMatchValues({- conceptEnrollments: { 'concept-a': true, 'concept-b': true },+ expect(mockUpdateEnrollment).toHaveBeenCalledWith('test-flag', true, 'beta')})- })-})-describe('featurePreviewsLogic - submitConceptSurvey', () => {- let logic: ReturnType<typeof featurePreviewsLogic.build>- const mockCapture = jest.fn()- const mockUpdateEnrollment = jest.fn()- let originalImpersonatedSession: boolean | undefined+ test('updating early access feature enrollment with different stages', () => {+ // Test concept stage+ logic.actions.updateEarlyAccessFeatureEnrollment('concept-flag', false, 'concept')+ expect(mockUpdateEnrollment).toHaveBeenCalledWith('concept-flag', false, 'concept')- afterEach(() => {- window.IMPERSONATED_SESSION = originalImpersonatedSession+ // Test alpha stage+ logic.actions.updateEarlyAccessFeatureEnrollment('alpha-flag', true, 'alpha')+ expect(mockUpdateEnrollment).toHaveBeenCalledWith('alpha-flag', true, 'alpha')+ })})- beforeEach(() => {- jest.clearAllMocks()- originalImpersonatedSession = window.IMPERSONATED_SESSION- ;(posthog as any).capture = mockCapture- ;(posthog as any).updateEarlyAccessFeatureEnrollment = mockUpdateEnrollment+ describe('conceptEnrollments reducer', () => {+ let logic: ReturnType<typeof featurePreviewsLogic.build>- initKeaTests()- logic = featurePreviewsLogic()- logic.mount()- userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)- })+ beforeEach(() => {+ jest.clearAllMocks()+ ;(posthog as any).updateEarlyAccessFeatureEnrollment = jest.fn()- test('captures the survey response, records enrollment, and marks the flag submitted', async () => {- logic.actions.loadEarlyAccessFeaturesSuccess([- {- flagKey: 'concept-flag',- stage: 'concept',- payload: { survey_id: 'survey-123', survey_question_id: 'question-456' },- } as any,- ])-- logic.actions.submitConceptSurvey('concept-flag', '[email protected]')-- expect(mockCapture).toHaveBeenCalledWith('survey sent', {- $survey_id: 'survey-123',- $survey_response: '[email protected]',- '$survey_response_question-456': '[email protected]',+ initKeaTests()+ logic = featurePreviewsLogic()+ logic.mount()+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)})- expect(mockUpdateEnrollment).toHaveBeenCalledWith('concept-flag', true, 'concept')- await expectLogic(logic)- .toDispatchActions(['conceptSurveySubmitted'])- .toMatchValues({ conceptSurveySubmissions: { 'concept-flag': true } })- })- test('captures without a per-question key when the payload has no question id', () => {- logic.actions.loadEarlyAccessFeaturesSuccess([- { flagKey: 'concept-flag', stage: 'concept', payload: { survey_id: 'survey-123' } } as any,- ])+ test.each([+ ['concept', true, { 'concept-flag': true }],+ ['beta', true, {}],+ ['concept', false, { 'concept-flag': false }],+ ])('stage=%s enabled=%s → conceptEnrollments=%j', async (stage, enabled, expected) => {+ logic.actions.updateEarlyAccessFeatureEnrollment('concept-flag', enabled, stage)+ await expectLogic(logic).toMatchValues({ conceptEnrollments: expected })+ })- logic.actions.submitConceptSurvey('concept-flag', '[email protected]')+ test('tracks multiple concept enrollments', async () => {+ logic.actions.updateEarlyAccessFeatureEnrollment('concept-a', true, 'concept')+ logic.actions.updateEarlyAccessFeatureEnrollment('concept-b', true, 'concept')- expect(mockCapture).toHaveBeenCalledWith('survey sent', {- $survey_id: 'survey-123',- $survey_response: '[email protected]',+ await expectLogic(logic).toMatchValues({+ conceptEnrollments: { 'concept-a': true, 'concept-b': true },+ })})})- test('shows an error and does not mark submitted when the feature has no linked survey', async () => {- logic.actions.loadEarlyAccessFeaturesSuccess([- { flagKey: 'concept-flag', stage: 'concept', payload: {} } as any,- ])+ describe('submitConceptSurvey', () => {+ let logic: ReturnType<typeof featurePreviewsLogic.build>+ const mockCapture = jest.fn()+ const mockUpdateEnrollment = jest.fn()+ let originalImpersonatedSession: boolean | undefined- logic.actions.submitConceptSurvey('concept-flag', '[email protected]')+ afterEach(() => {+ window.IMPERSONATED_SESSION = originalImpersonatedSession+ })- expect(mockCapture).not.toHaveBeenCalled()- expect(mockUpdateEnrollment).not.toHaveBeenCalled()- expect(lemonToast.error).toHaveBeenCalledWith(- "This feature isn't accepting sign-ups yet. Please try again later."- )- await expectLogic(logic).toMatchValues({ conceptSurveySubmissions: {} })- })+ beforeEach(() => {+ jest.clearAllMocks()+ originalImpersonatedSession = window.IMPERSONATED_SESSION+ ;(posthog as any).capture = mockCapture+ ;(posthog as any).updateEarlyAccessFeatureEnrollment = mockUpdateEnrollment- test('does not capture anything during an impersonated session', async () => {- window.IMPERSONATED_SESSION = true- logic.actions.loadEarlyAccessFeaturesSuccess([- {- flagKey: 'concept-flag',- stage: 'concept',- payload: { survey_id: 'survey-123' },- } as any,- ])-- logic.actions.submitConceptSurvey('concept-flag', '[email protected]')-- expect(mockCapture).not.toHaveBeenCalled()- expect(mockUpdateEnrollment).not.toHaveBeenCalled()- expect(lemonToast.error).toHaveBeenCalledWith('Cannot sign up for a waitlist while impersonating a user')- await expectLogic(logic).toMatchValues({ conceptSurveySubmissions: {} })- })-})+ initKeaTests()+ logic = featurePreviewsLogic()+ logic.mount()+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)+ })-describe('featurePreviewsLogic - updateEarlyAccessFeatureEnrollment (impersonated session)', () => {- let logic: ReturnType<typeof featurePreviewsLogic.build>- const mockUpdateEnrollment = jest.fn()- let originalImpersonatedSession: boolean | undefined+ test('captures the survey response, records enrollment, and marks the flag submitted', async () => {+ logic.actions.loadEarlyAccessFeaturesSuccess([+ {+ flagKey: 'concept-flag',+ stage: 'concept',+ payload: { survey_id: 'survey-123', survey_question_id: 'question-456' },+ } as any,+ ])++ logic.actions.submitConceptSurvey('concept-flag', '[email protected]')++ expect(mockCapture).toHaveBeenCalledWith('survey sent', {+ $survey_id: 'survey-123',+ $survey_response: '[email protected]',+ '$survey_response_question-456': '[email protected]',+ })+ expect(mockUpdateEnrollment).toHaveBeenCalledWith('concept-flag', true, 'concept')+ await expectLogic(logic)+ .toDispatchActions(['conceptSurveySubmitted'])+ .toMatchValues({ conceptSurveySubmissions: { 'concept-flag': true } })+ })- beforeEach(() => {- jest.clearAllMocks()+ test('captures without a per-question key when the payload has no question id', () => {+ logic.actions.loadEarlyAccessFeaturesSuccess([+ { flagKey: 'concept-flag', stage: 'concept', payload: { survey_id: 'survey-123' } } as any,+ ])- // Mock window.IMPERSONATED_SESSION- originalImpersonatedSession = window.IMPERSONATED_SESSION- window.IMPERSONATED_SESSION = true+ logic.actions.submitConceptSurvey('concept-flag', '[email protected]')- // Set up the mock implementation for posthog- ;(posthog as any).updateEarlyAccessFeatureEnrollment = mockUpdateEnrollment+ expect(mockCapture).toHaveBeenCalledWith('survey sent', {+ $survey_id: 'survey-123',+ $survey_response: '[email protected]',+ })+ })- initKeaTests()- logic = featurePreviewsLogic()- logic.mount()- userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)- })+ test('shows an error and does not mark submitted when the feature has no linked survey', async () => {+ logic.actions.loadEarlyAccessFeaturesSuccess([+ { flagKey: 'concept-flag', stage: 'concept', payload: {} } as any,+ ])- afterEach(() => {- window.IMPERSONATED_SESSION = originalImpersonatedSession- jest.restoreAllMocks()- })+ logic.actions.submitConceptSurvey('concept-flag', '[email protected]')- test('shows error toast when trying to update enrollment while impersonating', () => {- logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', true)+ expect(mockCapture).not.toHaveBeenCalled()+ expect(mockUpdateEnrollment).not.toHaveBeenCalled()+ expect(lemonToast.error).toHaveBeenCalledWith(+ "This feature isn't accepting sign-ups yet. Please try again later."+ )+ await expectLogic(logic).toMatchValues({ conceptSurveySubmissions: {} })+ })- expect(mockUpdateEnrollment).not.toHaveBeenCalled()- expect(lemonToast.error).toHaveBeenCalledWith(- 'Cannot update early access feature enrollment while impersonating a user'- )+ test('does not capture anything during an impersonated session', async () => {+ window.IMPERSONATED_SESSION = true+ logic.actions.loadEarlyAccessFeaturesSuccess([+ {+ flagKey: 'concept-flag',+ stage: 'concept',+ payload: { survey_id: 'survey-123' },+ } as any,+ ])++ logic.actions.submitConceptSurvey('concept-flag', '[email protected]')++ expect(mockCapture).not.toHaveBeenCalled()+ expect(mockUpdateEnrollment).not.toHaveBeenCalled()+ expect(lemonToast.error).toHaveBeenCalledWith('Cannot sign up for a waitlist while impersonating a user')+ await expectLogic(logic).toMatchValues({ conceptSurveySubmissions: {} })+ })})- test('shows error toast for all update attempts during impersonation', () => {- logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', false)- logic.actions.updateEarlyAccessFeatureEnrollment('beta-flag', true, 'beta')+ describe('updateEarlyAccessFeatureEnrollment (impersonated session)', () => {+ let logic: ReturnType<typeof featurePreviewsLogic.build>+ const mockUpdateEnrollment = jest.fn()+ let originalImpersonatedSession: boolean | undefined- expect(mockUpdateEnrollment).not.toHaveBeenCalled()- expect(lemonToast.error).toHaveBeenCalledTimes(2)- expect(lemonToast.error).toHaveBeenCalledWith(- 'Cannot update early access feature enrollment while impersonating a user'- )+ beforeEach(() => {+ jest.clearAllMocks()++ // Mock window.IMPERSONATED_SESSION+ originalImpersonatedSession = window.IMPERSONATED_SESSION+ window.IMPERSONATED_SESSION = true++ // Set up the mock implementation for posthog+ ;(posthog as any).updateEarlyAccessFeatureEnrollment = mockUpdateEnrollment++ initKeaTests()+ logic = featurePreviewsLogic()+ logic.mount()+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)+ })++ afterEach(() => {+ window.IMPERSONATED_SESSION = originalImpersonatedSession+ jest.restoreAllMocks()+ })++ test('shows error toast when trying to update enrollment while impersonating', () => {+ logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', true)++ expect(mockUpdateEnrollment).not.toHaveBeenCalled()+ expect(lemonToast.error).toHaveBeenCalledWith(+ 'Cannot update early access feature enrollment while impersonating a user'+ )+ })++ test('shows error toast for all update attempts during impersonation', () => {+ logic.actions.updateEarlyAccessFeatureEnrollment('test-flag', false)+ logic.actions.updateEarlyAccessFeatureEnrollment('beta-flag', true, 'beta')++ expect(mockUpdateEnrollment).not.toHaveBeenCalled()+ expect(lemonToast.error).toHaveBeenCalledTimes(2)+ expect(lemonToast.error).toHaveBeenCalledWith(+ 'Cannot update early access feature enrollment while impersonating a user'+ )+ })})})diff --git a/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.tsx b/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.tsxindex b556653e3ff8..92debf47077d 100644--- a/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.tsx+++ b/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.tsx@@ -168,7 +168,11 @@ export const featurePreviewsLogic = kea<featurePreviewsLogicType>([{loadEarlyAccessFeatures: async () => {return await new Promise((resolve) =>- posthog.getEarlyAccessFeatures((features) => resolve(features), true, ['concept', 'beta'])+ posthog.getEarlyAccessFeatures((features) => resolve(features), true, [+ 'concept',+ 'alpha',+ 'beta',+ ]))},},