Skip to content

: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.

fix(data-warehouse): send a guessed new-source url to the wizard (#116702)

Tom Owersd6162408139a
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 19edbb908ebf..1416545e1f31 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -514,6 +514,7 @@ export const productRedirects: Record<
},
'/data-warehouse': () => urls.sources(),
'/data-warehouse/new': () => urls.dataWarehouseSourceNew(),
+ '/data-management/sources/new': () => urls.dataWarehouseSourceNew(),
'/data-warehouse/sources': () => urls.sources(),
'/data-warehouse/sources/:id': ({ id }) => urls.dataWarehouseSource(id, 'schemas'),
'/data-warehouse/sources/:id/:tab': ({ id, tab }) => urls.dataWarehouseSource(id, tab as SourceSceneTab),
diff --git a/frontend/src/scenes/sceneLogic.test.tsx b/frontend/src/scenes/sceneLogic.test.tsx
index 7b8a2c8fc004..91309ba8b668 100644
--- a/frontend/src/scenes/sceneLogic.test.tsx
+++ b/frontend/src/scenes/sceneLogic.test.tsx
@@ -290,11 +290,14 @@ describe('sceneLogic', () => {
expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.projectHomepage())
})
- it('redirects /data-warehouse/new to the new-source wizard instead of a 404', async () => {
- router.actions.push('/data-warehouse/new')
- await expectLogic(logic).delay(1)
- expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.dataWarehouseSourceNew())
- })
+ it.each(['/data-warehouse/new', '/data-management/sources/new'])(
+ 'redirects %s to the new-source wizard instead of a 404',
+ async (path) => {
+ router.actions.push(path)
+ await expectLogic(logic).delay(1)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.dataWarehouseSourceNew())
+ }
+ )
it('sends a tab-less data warehouse source path to the source instead of a 404', async () => {
router.actions.push('/data-management/sources/src-1')
diff --git a/products/data_warehouse/manifest.tsx b/products/data_warehouse/manifest.tsx
index d6511de76bae..d1ade27e757d 100644
--- a/products/data_warehouse/manifest.tsx
+++ b/products/data_warehouse/manifest.tsx
@@ -91,6 +91,8 @@ export const manifest: ProductManifest = {
// `/data-warehouse/new` is a natural URL for "add a source" but was never a real route.
// Redirect it to the new-source wizard rather than 404ing.
'/data-warehouse/new': () => urls.dataWarehouseSourceNew(),
+ // Listed before `/data-management/sources/:id`, which would otherwise read `new` as a source id.
+ '/data-management/sources/new': () => urls.dataWarehouseSourceNew(),
'/data-warehouse/sources': () => urls.sources(),
'/data-warehouse/sources/:id': ({ id }) => urls.dataWarehouseSource(id, 'schemas'),
'/data-warehouse/sources/:id/:tab': ({ id, tab }) => urls.dataWarehouseSource(id, tab as SourceSceneTab),