: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): hide coming-soon catalog tiles that duplicate a live source (#121808)
Tom Owers019a152dff4b
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.tsindex 93230dc48e8f..d010cfab6201 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts@@ -82,6 +82,15 @@ const SELF_MANAGED_KEYWORDS = ['own storage',]+// A "Coming soon" tile for a service we already connect under another tile is a dead end: the user+// registers interest and leaves without the connector that works today. Each key is hidden while+// its value is in the catalog and connectable.+const LIVE_ALTERNATIVE_TO_COMING_SOON: Partial<Record<string, string>> = {+ [ExternalDataSourceTypeEnumApi.MicrosoftAdvertising]: ExternalDataSourceTypeEnumApi.BingAds,+ // The managed Amazon S3 source is flag-gated, but the self-managed S3 connector links a bucket.+ [ExternalDataSourceTypeEnumApi.AmazonS3]: 'aws',+}+// "Request a data warehouse source" survey. We render our own modal and submit the answer// directly as a `survey sent` event rather than using the posthog-js survey popover.export const SOURCE_REQUEST_SURVEY_ID = '0190ff15-5032-0000-722a-e13933c140ac'@@ -439,7 +448,14 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([const eventSources =!allowedSources && featureFlags[FEATURE_FLAGS.CDP_HOG_SOURCES] ? EVENT_SOURCE_CATALOG_ITEMS : []- return [...managed, ...selfManaged, ...fileUpload, ...eventSources]+ const items = [...managed, ...selfManaged, ...fileUpload, ...eventSources]+ const connectableNames = new Set(+ items.filter((item) => item.status !== 'coming_soon').map((item) => item.name)+ )+ return items.filter((item) => {+ const liveAlternative = LIVE_ALTERNATIVE_TO_COMING_SOON[item.name]+ return !(item.status === 'coming_soon' && liveAlternative && connectableNames.has(liveAlternative))+ })},// featureFlags is a broad dependency that changes identity on every flag refresh;// keeping the previous array when the derived catalog is unchanged stops the Fusediff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.tsindex a2a270fcbec1..a1581642975b 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts@@ -54,6 +54,25 @@ const AVAILABLE_SOURCES: Record<string, SourceConfigResponseApi> = {category: 'Engineering & monitoring',fields: [],} as unknown as SourceConfigResponseApi,+ // Unreleased duplicates of a connector that already works, `BingAds` and the self-managed `aws`.+ BingAds: {+ name: 'BingAds',+ label: 'Bing Ads',+ keywords: ['microsoft advertising'],+ fields: [],+ } as unknown as SourceConfigResponseApi,+ MicrosoftAdvertising: {+ name: 'MicrosoftAdvertising',+ label: 'Microsoft Advertising (Bing Ads)',+ unreleasedSource: true,+ fields: [],+ } as unknown as SourceConfigResponseApi,+ AmazonS3: {+ name: 'AmazonS3',+ label: 'Amazon S3',+ featureFlag: 'dwh-amazon-s3-test',+ fields: [],+ } as unknown as SourceConfigResponseApi,}const CONNECTED_SOURCES = {@@ -305,6 +324,26 @@ describe('sourceCatalogLogic', () => {})+ it.each([+ { search: 'microsoft advertising', hidden: ['MicrosoftAdvertising'], live: 'BingAds', flagOn: false },+ { search: 'amazon s3', hidden: ['AmazonS3'], live: 'aws', flagOn: false },+ { search: 'amazon s3', hidden: [], live: 'AmazonS3', flagOn: true },+ ])(+ 'offers $live and not a "Coming soon" duplicate for "$search" (flag on: $flagOn)',+ ({ search, hidden, live, flagOn }) => {+ const logic = sourceCatalogLogic()+ featureFlagLogic.mount()+ featureFlagLogic.actions.setFeatureFlags(flagOn ? ['dwh-amazon-s3-test'] : [], {+ 'dwh-amazon-s3-test': flagOn,+ })+ logic.actions.setSearch(search)++ const names = logic.values.filteredItems.map((item) => item.name)+ expect(names).toContain(live)+ expect(names.filter((name) => hidden.includes(name))).toEqual([])+ }+ )+it('flags the source types the project already has', () => {const logic = sourceCatalogLogic()sourcesDataLogic.actions.loadSourcesSuccess(CONNECTED_SOURCES)