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): show schemas with sync paused instead of hiding them (#70876)

Eric Duong0f0cd0d6ac11
diff --git a/frontend/src/scenes/data-warehouse/scene/warehouseStatusDisplay.tsx b/frontend/src/scenes/data-warehouse/scene/warehouseStatusDisplay.tsx
index 5c2191249724..9fca891ca6bc 100644
--- a/frontend/src/scenes/data-warehouse/scene/warehouseStatusDisplay.tsx
+++ b/frontend/src/scenes/data-warehouse/scene/warehouseStatusDisplay.tsx
@@ -18,6 +18,7 @@ export const STATUS_LABELS: Record<ManagedWarehouseReadinessStateEnumApi, string
up_to_date: 'Up to date',
needs_attention: 'Needs attention',
unknown: 'Status unavailable',
+ sync_paused: 'Sync paused',
}
export const STATUS_TAG_TYPES: Record<ManagedWarehouseReadinessStateEnumApi, LemonTagType> = {
@@ -28,6 +29,7 @@ export const STATUS_TAG_TYPES: Record<ManagedWarehouseReadinessStateEnumApi, Lem
up_to_date: 'success',
needs_attention: 'danger',
unknown: 'muted',
+ sync_paused: 'default',
}
// Most severe first, matching the order the API returns sources/tables in.
@@ -37,8 +39,9 @@ export const STATUS_SEVERITY: Record<ManagedWarehouseReadinessStateEnumApi, numb
catching_up: 2,
waiting: 3,
unknown: 4,
- up_to_date: 5,
- not_configured: 6,
+ sync_paused: 5,
+ up_to_date: 6,
+ not_configured: 7,
}
export function StatusTag({ readinessState }: { readinessState: ManagedWarehouseReadinessStateEnumApi }): JSX.Element {
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index 27cfa567d4f0..ba04381be7a9 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -611,6 +611,7 @@ SPECTACULAR_SETTINGS = {
"up_to_date",
"needs_attention",
"unknown",
+ "sync_paused",
],
# Full signal taxonomy on the report `signals` endpoint; the source-config serializer's
# subset enums keep their own auto-resolved names.
diff --git a/products/data_warehouse/backend/logic/managed_warehouse_data_status.py b/products/data_warehouse/backend/logic/managed_warehouse_data_status.py
index 70a043d1c6dd..947d32d4e408 100644
--- a/products/data_warehouse/backend/logic/managed_warehouse_data_status.py
+++ b/products/data_warehouse/backend/logic/managed_warehouse_data_status.py
@@ -30,16 +30,21 @@ ReadinessState = Literal[
"up_to_date",
"needs_attention",
"unknown",
+ "sync_paused",
]
QUEUE_RETENTION_DAYS = 14
PERSISTENT_BACKFILL_FAILURES = 3
+# sync_paused ranks below every active-work or failure state (those are still worth surfacing even
+# on a paused schema's source) but above up_to_date: a source with some schemas paused shouldn't
+# read as fully "up to date" when part of it isn't being kept current at all.
READINESS_PRIORITY: tuple[ReadinessState, ...] = (
"needs_attention",
"backfilling",
"catching_up",
"waiting",
"unknown",
+ "sync_paused",
"up_to_date",
)
@@ -300,10 +305,13 @@ def _schema_table_statuses(team_id: int, *, source_id: str | None = None) -> lis
if not states:
return []
+ # should_sync is deliberately not filtered here: a schema with sync paused still has real,
+ # queryable data in the warehouse (or a genuine backfill-in-progress state), and hiding it
+ # entirely reads as "nothing here" rather than "this one isn't actively syncing right now".
+ # Only schemas/sources that no longer exist (soft-deleted) are excluded.
schema_filter: dict[str, object] = {
"team_id": team_id,
"id__in": [state.schema_id for state in states],
- "should_sync": True,
"deleted": False,
"source__deleted": False,
}
@@ -323,7 +331,15 @@ def _schema_table_statuses(team_id: int, *, source_id: str | None = None) -> lis
schema_id = str(state.schema_id)
schema = schema_by_id[schema_id]
queue_status = queue_statuses.get(schema_id) if queue_statuses is not None else None
- readiness_state, detail = source_table_readiness(state, queue_status, queue_available)
+ if schema.should_sync:
+ readiness_state, detail = source_table_readiness(state, queue_status, queue_available)
+ else:
+ # Paused wins over whatever the sink state says: a stale failure streak from before
+ # the pause isn't actionable while nothing is actively importing for this table.
+ readiness_state, detail = (
+ "sync_paused",
+ "Sync is paused for this table. Data already in the warehouse is unaffected.",
+ )
tables.append(
{
"schema_id": schema_id,
@@ -356,6 +372,7 @@ _SOURCE_SUMMARY_DETAILS: dict[ReadinessState, str] = {
"catching_up": "Recent imports are still being applied for one or more schemas.",
"waiting": "One or more schemas are waiting to start.",
"unknown": "Live import status is temporarily unavailable for one or more schemas.",
+ "sync_paused": "Sync is paused for one or more schemas.",
"up_to_date": "All schemas are up to date.",
"not_configured": "No schemas are configured for this source.",
}
@@ -434,6 +451,7 @@ def _sources_status(team_id: int) -> SourcesStatus:
"catching_up": "Recent imports are still being applied to the warehouse.",
"waiting": "One or more imported sources are waiting to start.",
"unknown": "Some live import statuses are temporarily unavailable.",
+ "sync_paused": "Sync is paused for one or more imported sources.",
"up_to_date": "All imported sources are up to date.",
"not_configured": "No imported source tables are configured for this warehouse.",
}
diff --git a/products/data_warehouse/backend/presentation/managed_warehouse_data_status.py b/products/data_warehouse/backend/presentation/managed_warehouse_data_status.py
index 1ccba1afb16a..8eb839360435 100644
--- a/products/data_warehouse/backend/presentation/managed_warehouse_data_status.py
+++ b/products/data_warehouse/backend/presentation/managed_warehouse_data_status.py
@@ -8,6 +8,7 @@ READINESS_STATE_CHOICES = [
"up_to_date",
"needs_attention",
"unknown",
+ "sync_paused",
]
diff --git a/products/data_warehouse/backend/tests/test_managed_warehouse_data_status.py b/products/data_warehouse/backend/tests/test_managed_warehouse_data_status.py
index 9019cb40bc5b..c42df65a4d83 100644
--- a/products/data_warehouse/backend/tests/test_managed_warehouse_data_status.py
+++ b/products/data_warehouse/backend/tests/test_managed_warehouse_data_status.py
@@ -361,6 +361,42 @@ class TestRollupSources(SimpleTestCase):
assert summary["last_synced_at"] == newer
+ def test_a_paused_schema_outranks_up_to_date_but_not_a_real_problem(self) -> None:
+ # A source where some schemas aren't being kept current at all shouldn't read as fully
+ # healthy, but an active problem elsewhere in the same source still has to win.
+ source_id = str(uuid4())
+ mostly_healthy = [
+ _table(source_id=source_id, source_name="Stripe", table_name="charges", readiness_state="up_to_date"),
+ _table(source_id=source_id, source_name="Stripe", table_name="invoices", readiness_state="sync_paused"),
+ ]
+ with_a_real_problem = [
+ *mostly_healthy,
+ _table(source_id=source_id, source_name="Stripe", table_name="refunds", readiness_state="needs_attention"),
+ ]
+
+ [healthy_summary] = _rollup_sources(mostly_healthy)
+ [problem_summary] = _rollup_sources(with_a_real_problem)
+
+ assert healthy_summary["readiness_state"] == "sync_paused"
+ assert problem_summary["readiness_state"] == "needs_attention"
+
+ def test_a_paused_schema_still_counts_toward_backfilled(self) -> None:
+ # Pausing future syncs doesn't undo a historical backfill that already completed.
+ source_id = str(uuid4())
+ tables = [
+ _table(
+ source_id=source_id,
+ source_name="Stripe",
+ table_name="charges",
+ readiness_state="sync_paused",
+ backfilled=True,
+ ),
+ ]
+
+ [summary] = _rollup_sources(tables)
+
+ assert summary["backfilled_schemas"] == 1
+
class TestGetSourceSchemaStatuses(TestCase):
# The queue-tail lookup reads SourceBatch, which lives in its own database.
@@ -388,3 +424,34 @@ class TestGetSourceSchemaStatuses(TestCase):
result = get_source_schema_statuses(team.id, str(source_a.id))
assert [row["schema_id"] for row in result] == [str(schema_a.id)]
+
+ def test_a_paused_schema_is_visible_as_sync_paused_not_hidden(self) -> None:
+ # A team that pauses a table's sync still has real data in the warehouse for it - it
+ # should show up as paused, not vanish as if nothing were ever configured.
+ team = Team.objects.create(organization=Organization.objects.create(name="org"), name="t")
+ source = ExternalDataSource.objects.create(
+ team=team, source_id="a", connection_id="ca", source_type="Stripe", status="Running"
+ )
+ paused_schema = ExternalDataSchema.objects.create(team=team, name="charges", source=source, should_sync=False)
+ DuckgresSinkSchemaState.objects.create(
+ team=team, schema_id=paused_schema.id, state=DuckgresSinkSchemaState.State.PRIMED
+ )
+
+ [result] = get_source_schema_statuses(team.id, str(source.id))
+
+ assert result["readiness_state"] == "sync_paused"
+ assert result["backfilled"] is True
+
+ def test_a_deleted_schema_stays_excluded_even_though_should_sync_no_longer_filters(self) -> None:
+ team = Team.objects.create(organization=Organization.objects.create(name="org"), name="t")
+ source = ExternalDataSource.objects.create(
+ team=team, source_id="a", connection_id="ca", source_type="Stripe", status="Running"
+ )
+ deleted_schema = ExternalDataSchema.objects.create(team=team, name="charges", source=source, deleted=True)
+ DuckgresSinkSchemaState.objects.create(
+ team=team, schema_id=deleted_schema.id, state=DuckgresSinkSchemaState.State.PRIMED
+ )
+
+ result = get_source_schema_statuses(team.id, str(source.id))
+
+ assert result == []
diff --git a/products/data_warehouse/frontend/generated/api.schemas.ts b/products/data_warehouse/frontend/generated/api.schemas.ts
index 02bbc42892f7..3000763cf191 100644
--- a/products/data_warehouse/frontend/generated/api.schemas.ts
+++ b/products/data_warehouse/frontend/generated/api.schemas.ts
@@ -92,6 +92,7 @@ export interface EnableWarehouseBackfillResponseApi {
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
* * `unknown` - unknown
+ * * `sync_paused` - sync_paused
*/
export type ManagedWarehouseReadinessStateEnumApi =
(typeof ManagedWarehouseReadinessStateEnumApi)[keyof typeof ManagedWarehouseReadinessStateEnumApi]
@@ -104,6 +105,7 @@ export const ManagedWarehouseReadinessStateEnumApi = {
UpToDate: 'up_to_date',
NeedsAttention: 'needs_attention',
Unknown: 'unknown',
+ SyncPaused: 'sync_paused',
} as const
/**
@@ -131,7 +133,8 @@ export interface ManagedWarehouseDatasetStatusApi {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnumApi
/** Human-readable explanation of the current readiness state. */
detail: string
@@ -169,7 +172,8 @@ export interface ManagedWarehouseSourceSummaryApi {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnumApi
/** Human-readable explanation of this source's readiness state. */
detail: string
@@ -198,7 +202,8 @@ export interface ManagedWarehouseSourcesStatusApi {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnumApi
/** Human-readable explanation of imported source readiness. */
detail: string
@@ -215,7 +220,8 @@ export interface ManagedWarehouseDataStatusResponseApi {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
overall_readiness_state: ManagedWarehouseReadinessStateEnumApi
/** Events backfill readiness. */
events: ManagedWarehouseDatasetStatusApi
@@ -246,7 +252,8 @@ export interface ManagedWarehouseSourceTableStatusApi {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnumApi
/** Human-readable explanation of the table's readiness state. */
detail: string
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 835468dc8dfc..cf4715a65d5e 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -33736,6 +33736,7 @@ export namespace Schemas {
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
* * `unknown` - unknown
+ * * `sync_paused` - sync_paused
*/
export type ManagedWarehouseReadinessStateEnum = typeof ManagedWarehouseReadinessStateEnum[keyof typeof ManagedWarehouseReadinessStateEnum];
@@ -33748,6 +33749,7 @@ export namespace Schemas {
UpToDate: 'up_to_date',
NeedsAttention: 'needs_attention',
Unknown: 'unknown',
+ SyncPaused: 'sync_paused',
} as const;
export interface ManagedWarehouseDatasetStatus {
@@ -33764,7 +33766,8 @@ export namespace Schemas {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnum;
/** Human-readable explanation of the current readiness state. */
detail: string;
@@ -33802,7 +33805,8 @@ export namespace Schemas {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnum;
/** Human-readable explanation of this source's readiness state. */
detail: string;
@@ -33831,7 +33835,8 @@ export namespace Schemas {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnum;
/** Human-readable explanation of imported source readiness. */
detail: string;
@@ -33848,7 +33853,8 @@ export namespace Schemas {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
overall_readiness_state: ManagedWarehouseReadinessStateEnum;
/** Events backfill readiness. */
events: ManagedWarehouseDatasetStatus;
@@ -33879,7 +33885,8 @@ export namespace Schemas {
* * `catching_up` - catching_up
* * `up_to_date` - up_to_date
* * `needs_attention` - needs_attention
- * * `unknown` - unknown */
+ * * `unknown` - unknown
+ * * `sync_paused` - sync_paused */
readiness_state: ManagedWarehouseReadinessStateEnum;
/** Human-readable explanation of the table's readiness state. */
detail: string;