: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(marketing-analytics): name required tables in source warnings (#117444)
Javier Bahamondesa7bd17532fbf
diff --git a/docs/internal/marketing-source-suggestions.md b/docs/internal/marketing-source-suggestions.mdindex 5d7957945c3f..9443d72c9014 100644--- a/docs/internal/marketing-source-suggestions.md+++ b/docs/internal/marketing-source-suggestions.md@@ -280,3 +280,10 @@ The banner only appears when a project has a Bing Ads integration marked with `oIt asks users to reconnect before November 30, 2026.The flag controls the warning only; changing it does not disable fallback credentials or migrate existing grants.Use project targeting to release the warning gradually.++## Required table status++The source status banner names each required table that needs attention and links native connections directly to their Schemas tab.+Disabled imports, missing tables, running syncs, failures, pauses, cancellations, and tables awaiting a completed sync have separate messages.+Multiple table problems remain visible together, even when the connection has one overall status.+Google Ads connections using the legacy `campaign_stats` schema retain support and display that actual schema name.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex f3ef72b40449..236fc8d3a8ca 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12691,9 +12691,9 @@ snapshots:scenes-app-marketing-analytics-source-setup-panel--syncing--light:hash: v1.k794b7964.6a2719e03a7020806535edd43ece2c6107122e44bb2df4fe5fe154cefeba0c18.fLb8TeFan3iHWanMHIjOmLRq3b2ypZcUkxs-j2oBTBYscenes-app-marketing-analytics-source-status--source-issues--dark:- hash: v1.k794b7964.f387ac40dbf399676c91b2f6de86c2b169e9aaa86205af692abf51a141ead5d7.3PpHqWiSeMKvXuYLv4lU1yM_tqF38xD4NiUkUX6XW2U+ hash: v1.k794b7964.d2057a7b1316abc7100c30b86214f5eb891f35b01c19e899a33a3b9164fc4cc4.YhYj7qFW2Z65don1TkJCwtepa3O1JZOcF3_56hu3Tf0scenes-app-marketing-analytics-source-status--source-issues--light:- hash: v1.k794b7964.9bc9c27858206a2c2ecee18b7e72a9b80c91488ab539e78955a62b0254176a8e.gYszI9sP1_uusVkRVzBFdMoACwSmYaBfgxSuUX_pZpQ+ hash: v1.k794b7964.4eb5be20ab5424108e909aaa65495dd7a5dfb4f38b029a776b20f342b11b2d80.OuI8j51vqJlLwrue-jStdSchUhd0un0cOQo4GIxQveUscenes-app-marketing-analytics-table-scrolling--scrollable-rows--dark:hash: v1.k794b7964.3c54ce90caac67d3ad1d2f7faef547a79f6bbb514ffcda9d610fa3f56e170468.dys_SI3zdCZYMnc4Jt9M45lJxWqvQ-1R-3n550vG9kQscenes-app-marketing-analytics-table-scrolling--scrollable-rows--light:diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.ts b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.tsindex 3bb213f419b5..c99b2d24d336 100644--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.ts+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.test.ts@@ -744,6 +744,102 @@ describe('marketingAnalyticsLogic', () => {.toDispatchActions(['reloadAll'])})+ it.each([+ ['disabled', false, ExternalDataSchemaStatus.Completed, 'import disabled', MarketingSourceStatus.Warning],+ ['missing', true, ExternalDataSchemaStatus.Completed, 'not found', MarketingSourceStatus.Warning],+ ['failed', true, ExternalDataSchemaStatus.Failed, 'sync failed', ExternalDataSchemaStatus.Failed],+ ['running', true, ExternalDataSchemaStatus.Running, 'syncing', ExternalDataSchemaStatus.Running],+ ['paused', true, ExternalDataSchemaStatus.Paused, 'sync paused', ExternalDataSchemaStatus.Paused],+ ['canceled', true, ExternalDataSchemaStatus.Cancelled, 'sync canceled', ExternalDataSchemaStatus.Cancelled],+ ['pending', true, null, 'waiting for a completed sync', MarketingSourceStatus.Warning],+ ] as const)(+ 'names required tables for a %s import without affecting another connection',+ async (kind, shouldSync, status, message, expectedStatus) => {+ logic = marketingAnalyticsLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ const requiredNames = [+ MARKETING_INTEGRATION_CONFIGS.GoogleAds.campaignTableName,+ MARKETING_INTEGRATION_CONFIGS.GoogleAds.statsTableName,+ ]+ const sources = ['affected', 'healthy'].map((id) => ({+ id,+ source_type: 'GoogleAds',+ prefix: id,+ schemas: requiredNames.flatMap((name) =>+ id === 'affected' && kind === 'missing'+ ? []+ : [+ {+ id: `${id}-${name}`,+ name,+ should_sync: id === 'healthy' || shouldSync,+ status: id === 'healthy' ? ExternalDataSchemaStatus.Completed : status,+ },+ ]+ ),+ })) as ExternalDataSource[]+ await expectLogic(logic, () =>+ logic.actions.loadSourcesSuccess({ count: 2, next: null, previous: null, results: sources })+ ).toFinishAllListeners()+ const affected = logic.values.allAvailableSourcesWithStatus.find(({ id }) => id === 'affected')!+ expect(affected.status).toBe(expectedStatus)+ for (const name of requiredNames) {+ expect(affected.statusMessage).toContain(`${name}: ${message}`)+ }+ expect(logic.values.allAvailableSourcesWithStatus.find(({ id }) => id === 'healthy')?.status).toBe(+ ExternalDataSchemaStatus.Completed+ )+ }+ )++ it('keeps disabled and failed table details together using the actual legacy schema name', async () => {+ logic = marketingAnalyticsLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ const source = {+ id: 'example-mixed-source',+ source_type: 'GoogleAds',+ schemas: [+ {+ id: 'example-campaign',+ name: 'campaign',+ should_sync: false,+ status: ExternalDataSchemaStatus.Completed,+ },+ {+ id: 'example-stats',+ name: 'campaign_stats',+ should_sync: true,+ status: ExternalDataSchemaStatus.Failed,+ },+ ],+ } as ExternalDataSource+ await expectLogic(logic, () =>+ logic.actions.loadSourcesSuccess({ count: 1, next: null, previous: null, results: [source] })+ ).toFinishAllListeners()+ expect(logic.values.allAvailableSourcesWithStatus[0]).toMatchObject({+ status: MarketingSourceStatus.Warning,+ statusMessage: expect.stringContaining('campaign: import disabled'),+ })+ expect(logic.values.allAvailableSourcesWithStatus[0].statusMessage).toContain('campaign_stats: sync failed')+ expect(logic.values.allAvailableSourcesWithStatus[0].statusMessage).not.toContain(+ 'campaign_overview_stats: not found'+ )+ const readySource = {+ ...source,+ schemas: source.schemas.map((schema) => ({+ ...schema,+ should_sync: true,+ status: ExternalDataSchemaStatus.Completed,+ })),+ }+ await expectLogic(logic, () =>+ logic.actions.loadSourcesSuccess({ count: 1, next: null, previous: null, results: [readySource] })+ ).toFinishAllListeners()+ expect(logic.values.allAvailableSourcesWithStatus[0].status).toBe(ExternalDataSchemaStatus.Completed)+ })+it('shows validation errors for the affected connection and clears them after reload', async () => {let errors: Record<string, string[]> = {}useMocks({diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.ts b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.tsindex 774fc27cef83..f4b9ba4421a3 100644--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.ts+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.ts@@ -213,35 +213,46 @@ function getSourceStatus(findSchemaByFieldName(nativeSource.schemas, fieldName, nativeSource.source_type))- // Check for tables not selected for sync (should_sync=false) or missing entirely+ const tableMessages = requiredFields.flatMap((fieldName, index) => {+ const schema = schemas[index]+ if (!schema) {+ return [`${fieldName}: not found. Check the source configuration.`]+ }+ if (!schema.should_sync) {+ return [`${schema.name}: import disabled. Enable this table in the source's Schemas tab.`]+ }+ switch (schema.status) {+ case ExternalDataSchemaStatus.Completed:+ return []+ case ExternalDataSchemaStatus.Failed:+ return [`${schema.name}: sync failed. Review the error in the source's Schemas tab.`]+ case ExternalDataSchemaStatus.Running:+ return [`${schema.name}: syncing. Wait for the sync to finish.`]+ case ExternalDataSchemaStatus.Paused:+ return [`${schema.name}: sync paused. Review the table in the source's Schemas tab.`]+ case ExternalDataSchemaStatus.Cancelled:+ return [`${schema.name}: sync canceled. Review the table in the source's Schemas tab.`]+ default:+ return [`${schema.name}: waiting for a completed sync. Check the source's Schemas tab.`]+ }+ })+ const message = tableMessages.join(' ')const disabledTables = schemas.filter((s) => s && !s.should_sync)const missingTables = schemas.filter((s) => !s)if (disabledTables.length > 0 || missingTables.length > 0) {- return {- status: MarketingSourceStatus.Warning,- message:- 'Some required tables are not selected for import. Enable them in the data warehouse source settings.',- }+ return { status: MarketingSourceStatus.Warning, message }}const schemaStatuses = schemas.map((s) => s?.status).filter(Boolean)- if (schemaStatuses.includes(ExternalDataSchemaStatus.Failed)) {- return { status: ExternalDataSchemaStatus.Failed, message: 'One or more required tables failed to sync' }- }- if (schemaStatuses.includes(ExternalDataSchemaStatus.Running)) {- return {- status: ExternalDataSchemaStatus.Running,- message: 'One or more required tables are still syncing',- }- }- if (schemaStatuses.includes(ExternalDataSchemaStatus.Paused)) {- return { status: ExternalDataSchemaStatus.Paused, message: 'One or more required tables sync is paused' }- }- if (schemaStatuses.includes(ExternalDataSchemaStatus.Cancelled)) {- return {- status: ExternalDataSchemaStatus.Cancelled,- message: 'One or more required tables sync is cancelled',+ for (const status of [+ ExternalDataSchemaStatus.Failed,+ ExternalDataSchemaStatus.Running,+ ExternalDataSchemaStatus.Paused,+ ExternalDataSchemaStatus.Cancelled,+ ]) {+ if (schemaStatuses.includes(status)) {+ return { status, message }}}if (validationWarning) {@@ -256,7 +267,7 @@ function getSourceStatus(message: 'Ready to use! All required fields have synced.',}}- return { status: MarketingSourceStatus.Warning, message: 'Some required tables need to be synced' }+ return { status: MarketingSourceStatus.Warning, message: message || 'Some required tables need to be synced' }}const externalTable = validExternalTables.find((t) => t.source_map_id === source.id)