: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): condense SQL editor sync-warning banner (#62489)
Adam Bowkereb9ff48b3d8f
diff --git a/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx b/frontend/src/scenes/data-warehouse/editor/OutputPane.tsxindex d9d95894b404..7cb0f1e71a87 100644--- a/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx+++ b/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx@@ -75,6 +75,7 @@ import {import { FixErrorButton } from './components/FixErrorButton'import { OutputTab, outputPaneLogic } from './outputPaneLogic'import { sqlEditorLogic } from './sqlEditorLogic'+import { trimRedundantTail } from './syncWarnings'import TabScroller from './TabScroller'interface RowDetailsModalProps {@@ -991,13 +992,11 @@ const SyncWarningsBanner = ({ warnings }: { warnings?: HogQLQueryResponse['warni}return (<LemonBanner type="warning" className="m-2 flex-shrink-0" data-attr="sql-editor-output-pane-sync-warnings">- <div className="font-semibold mb-1">- Some warehouse sources used by this query are out of date — results may not reflect current data- </div>- <ul className="list-disc pl-5 space-y-1">+ Some warehouse sources used by this query are out of date — results may not reflect current data:+ <ul className="list-disc pl-5">{warnings.map((warning, index) => (<li key={`${warning.table_name}-${warning.schema_name}-${index}`}>- {warning.message}+ {trimRedundantTail(warning.message)}{warning.source_id && (<>{' '}diff --git a/frontend/src/scenes/data-warehouse/editor/syncWarnings.test.ts b/frontend/src/scenes/data-warehouse/editor/syncWarnings.test.tsnew file mode 100644index 000000000000..54b66414b915--- /dev/null+++ b/frontend/src/scenes/data-warehouse/editor/syncWarnings.test.ts@@ -0,0 +1,41 @@+import { trimRedundantTail } from './syncWarnings'++describe('syncWarnings', () => {+ describe('trimRedundantTail', () => {+ // Messages mirror those emitted by products/data_warehouse/backend/sync_status.py.+ test.each([+ [+ 'stale completed sync drops the redundant tail',+ '`postgres_posthog_team` (from Postgres) last synced 2 hours ago, more than twice its configured sync interval. Results may be out of date.',+ '`postgres_posthog_team` (from Postgres) last synced 2 hours ago, more than twice its configured sync interval.',+ ],+ [+ 'running sync keeps the in-progress note but drops the redundant tail',+ '`postgres_posthog_team` (from Postgres) last completed syncing 2 hours ago, more than twice its configured sync interval. A new sync is in progress but results may be out of date.',+ '`postgres_posthog_team` (from Postgres) last completed syncing 2 hours ago, more than twice its configured sync interval. A new sync is in progress.',+ ],+ [+ 'billing limit reached drops the redundant tail',+ 'Sync of `t` (from Stripe) is paused because the data warehouse billing limit has been reached. Results may be out of date.',+ 'Sync of `t` (from Stripe) is paused because the data warehouse billing limit has been reached.',+ ],+ [+ 'billing limit too low drops the redundant tail',+ 'Sync of `t` (from Stripe) is paused because the configured billing limit is too low. Results may be out of date.',+ 'Sync of `t` (from Stripe) is paused because the configured billing limit is too low.',+ ],+ [+ 'paused message without the tail is left unchanged',+ 'Sync of `t` (from Stripe) is paused. Results reflect the last successful sync from 2 hours ago.',+ 'Sync of `t` (from Stripe) is paused. Results reflect the last successful sync from 2 hours ago.',+ ],+ [+ 'failed message without the tail is left unchanged',+ 'Last sync of `t` (from Stripe) failed. Results reflect data from 2 hours ago. Check the data warehouse source for details.',+ 'Last sync of `t` (from Stripe) failed. Results reflect data from 2 hours ago. Check the data warehouse source for details.',+ ],+ ])('%s', (_name, input, expected) => {+ expect(trimRedundantTail(input)).toEqual(expected)+ })+ })+})diff --git a/frontend/src/scenes/data-warehouse/editor/syncWarnings.ts b/frontend/src/scenes/data-warehouse/editor/syncWarnings.tsnew file mode 100644index 000000000000..95bb330100a9--- /dev/null+++ b/frontend/src/scenes/data-warehouse/editor/syncWarnings.ts@@ -0,0 +1,8 @@+// The backend `message` on a DataWarehouseSyncWarning is kept self-contained (it also feeds+// LLM/MCP contexts), so it restates "results may be out of date" — which the sync-warning banner+// header already says. Strip that redundant tail for display only, while preserving any+// "a new sync is in progress" detail. Messages without that tail (failed, paused) are left as-is.+export const trimRedundantTail = (message: string): string =>+ message+ .replace(/\.\s*(A new sync is in progress) but results may be out of date\.?\s*$/i, '. $1.')+ .replace(/\.\s*Results may be out of date\.?\s*$/i, '.')