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 tab-less source URL to the source, not a 404 (#107419)

Tom Owersa049799aafec
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 8c5b35195baf..20cc8e7a0b36 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -437,6 +437,7 @@ export const productRedirects: Record<
'/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),
+ '/data-management/sources/:id': ({ id }) => urls.dataWarehouseSource(id, 'schemas'),
'/engineering-analytics': (_params, searchParams, hashParams): string =>
combineUrl(urls.engineeringAnalytics(), searchParams, hashParams).url,
'/engineering-analytics/test-health': (_params, searchParams, hashParams): string =>
diff --git a/frontend/src/scenes/sceneLogic.test.tsx b/frontend/src/scenes/sceneLogic.test.tsx
index 266391c247e0..9c1a53d64676 100644
--- a/frontend/src/scenes/sceneLogic.test.tsx
+++ b/frontend/src/scenes/sceneLogic.test.tsx
@@ -177,6 +177,26 @@ describe('sceneLogic', () => {
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')
+ await expectLogic(logic).delay(1)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(
+ urls.dataWarehouseSource('src-1', 'schemas')
+ )
+ })
+
+ // The redirect table is keyed on exact paths, so the `:id` entry above must not swallow the
+ // sources list or a source path that already names its tab — the latter would redirect to
+ // itself forever.
+ it.each([
+ ['the sources list', urls.sources()],
+ ['a source that names its tab', urls.dataWarehouseSource('src-1', 'schemas')],
+ ])('leaves %s on its own route', async (_label, path) => {
+ router.actions.push(path)
+ await expectLogic(logic).delay(1)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(path)
+ })
+
it('sends a guessed /replay/vision to replay vision, not the recording-not-found scene', async () => {
// `/replay/:id` would otherwise match and read `vision` as a recording id.
router.actions.push('/replay/vision')
diff --git a/products/data_warehouse/manifest.tsx b/products/data_warehouse/manifest.tsx
index 4afd8623fb48..09ff13c9c0b5 100644
--- a/products/data_warehouse/manifest.tsx
+++ b/products/data_warehouse/manifest.tsx
@@ -94,6 +94,9 @@ export const manifest: ProductManifest = {
'/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),
+ // Every scene route under a source names a tab, so trimming one off a shared link or the
+ // address bar lands on a path no route matches. Send it to the source's first tab.
+ '/data-management/sources/:id': ({ id }) => urls.dataWarehouseSource(id, 'schemas'),
},
urls: {
dataOps: (tab?: string): string => {