: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-modeling): reconcile dags that hold no tiers yet (#93609)
Jovan Sakovic7d693e416585
diff --git a/products/data_modeling/backend/logic/schedule_reconcile.py b/products/data_modeling/backend/logic/schedule_reconcile.pyindex 3f2a3bfe1a28..b711e90dc00f 100644--- a/products/data_modeling/backend/logic/schedule_reconcile.py+++ b/products/data_modeling/backend/logic/schedule_reconcile.py@@ -539,7 +539,11 @@ async def _apply_reconciliation(temporal = await async_connect()existing_ids = await _list_execute_dag_schedule_ids(temporal, dag_id)- if require_tiered and not any(is_tier_schedule_id(schedule_id) for schedule_id in existing_ids):+ # `require_tiered` protects a DAG that still holds legacy (non-tier) schedules: tiering only+ # the seeded nodes would delete the whole-DAG schedule and leave the unseeded ones with no+ # scheduler. A DAG holding no schedule at all carries no such risk and has no scheduler to+ # lose, so it reconciles: that is a DAG whose views were all paused and one re-enabled.+ if require_tiered and existing_ids and not any(is_tier_schedule_id(schedule_id) for schedule_id in existing_ids):logger.debug("DAG not converted to cadence tiers yet, skipping reconcile", dag_id=dag_id)return False# An empty tier set on a DAG that still has only legacy (non-tier) schedules means an unseededdiff --git a/products/data_modeling/backend/test/test_schedule_reconcile.py b/products/data_modeling/backend/test/test_schedule_reconcile.pyindex 9cc301fcdfe2..aa499da52366 100644--- a/products/data_modeling/backend/test/test_schedule_reconcile.py+++ b/products/data_modeling/backend/test/test_schedule_reconcile.py@@ -428,8 +428,8 @@ class TestMaybeReconcileDag(BaseTest):return temporaldef test_untiered_dag_is_left_alone(self):- # a legacy single-schedule DAG converts only via the conversion command; a mutation- # trigger must neither unschedule it nor create tiers next to live v1 schedules+ # a legacy single-schedule DAG converts only via the conversion command: tiering the+ # seeded nodes here would delete the whole-DAG schedule the unseeded ones still ridedag = self._dag_with_target()with (mock.patch(@@ -445,6 +445,19 @@ class TestMaybeReconcileDag(BaseTest):update.assert_not_called()delete.assert_not_called()+ def test_dag_with_no_schedule_regains_a_tier(self):+ dag = self._dag_with_target()+ with (+ mock.patch(f"{RECONCILE}.async_connect", new=mock.AsyncMock(return_value=self._temporal_listing([]))),+ mock.patch(f"{RECONCILE}.a_create_schedule", new=mock.AsyncMock()) as create,+ mock.patch(f"{RECONCILE}.a_delete_schedule", new=mock.AsyncMock()) as delete,+ ):+ with self.captureOnCommitCallbacks(execute=True):+ maybe_reconcile_dag(dag)+ create.assert_called_once()+ self.assertEqual(create.call_args.kwargs["id"], tier_schedule_id(str(dag.id), M15))+ delete.assert_not_called()+def test_tiered_dag_reconciles_after_commit(self):dag = self._dag_with_target()tier_id = tier_schedule_id(str(dag.id), M15)