: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(data-warehouse): send a webhook source to its webhook step, not a dead end (#113865)
Tom Owers9afdf009f7f1
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsxindex a73ba746c0b3..0b5ca68ea664 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx@@ -2297,8 +2297,8 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([props.onComplete()}} else if (values.hasWebhookSchemas) {- // Go to webhook setup step (4)- actions.onNext()+ // Absolute: createSource also runs from WIZARD_DESTINATION_STEP, where onNext would overshoot.+ actions.setStep(4)} else {// Skip webhook step, go directly to progress (5)actions.setStep(5)diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardWebhookStep.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardWebhookStep.test.tsnew file mode 100644index 000000000000..188758e951ad--- /dev/null+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardWebhookStep.test.ts@@ -0,0 +1,62 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'++import { expectLogic } from 'kea-test-utils'++import api from 'lib/api'++import { initKeaTests } from '~/test/init'+import type { ExternalDataSourceSyncSchema } from '~/types'++import type { SourceConfigResponseApi } from 'products/warehouse_sources/frontend/generated/api.schemas'++import { sourceWizardLogic, WIZARD_DESTINATION_STEP } from '../sourceWizardLogic'++// Separate from sourceWizardLogic.test.ts: running createSource to completion there corrupts a memoized selector.+describe('sourceWizardLogic webhook step', () => {+ beforeEach(() => {+ initKeaTests()+ })++ const webhookSource = {+ name: 'Stripe',+ caption: '',+ fields: [],+ label: 'Stripe',+ iconPath: '',+ docsUrl: '',+ existingSource: false,+ unreleasedSource: false,+ } as unknown as SourceConfigResponseApi++ const webhookSchema = {+ table: 'charges',+ should_sync: true,+ sync_type: 'webhook',+ supports_webhooks: true,+ } as ExternalDataSourceSyncSchema++ it.each([+ { name: 'with the destination step', startStep: WIZARD_DESTINATION_STEP },+ { name: 'without the destination step', startStep: 3 },+ ])('sends a webhook source to the webhook step $name', async ({ startStep }) => {+ const logic = sourceWizardLogic({ availableSources: { Stripe: webhookSource } })+ const unmount = logic.mount()+ jest.spyOn(api.externalDataSources, 'create').mockResolvedValue({ id: 'test-webhook-source' } as Awaited<+ ReturnType<typeof api.externalDataSources.create>+ >)+ jest.spyOn(api.productIntents, 'update').mockResolvedValue(MOCK_DEFAULT_TEAM)++ try {+ await expectLogic(logic, () => logic.actions.selectConnector(webhookSource)).toFinishAllListeners()+ logic.actions.setDatabaseSchemas([webhookSchema])+ logic.actions.setStep(startStep)++ await expectLogic(logic, () => logic.actions.createSource()).toFinishAllListeners()++ expect(logic.values.currentStep).toEqual(4)+ } finally {+ jest.restoreAllMocks()+ unmount()+ }+ })+})