@@ -1428,6 +1428,58 @@ def test_forward_only_precedence_over_indirect_non_breaking(init_and_plan_contex
14281428 )
14291429
14301430
1431+ @time_machine .travel ("2023-01-08 15:00:00 UTC" )
1432+ def test_breaking_only_impacts_immediate_children (init_and_plan_context : t .Callable ):
1433+ context , plan = init_and_plan_context ("examples/sushi" )
1434+ context .apply (plan )
1435+
1436+ breaking_model = context .get_model ("sushi.orders" )
1437+ breaking_model = breaking_model .copy (update = {"stamp" : "force new version" })
1438+ context .upsert_model (breaking_model )
1439+ breaking_snapshot = context .get_snapshot (breaking_model , raise_if_missing = True )
1440+
1441+ non_breaking_model = context .get_model ("sushi.waiter_revenue_by_day" )
1442+ context .upsert_model (add_projection_to_model (t .cast (SqlModel , non_breaking_model )))
1443+ non_breaking_snapshot = context .get_snapshot (non_breaking_model , raise_if_missing = True )
1444+ top_waiter_snapshot = context .get_snapshot ("sushi.top_waiters" , raise_if_missing = True )
1445+
1446+ plan_builder = context .plan_builder ("dev" , skip_tests = True , enable_preview = False )
1447+ plan_builder .set_choice (breaking_snapshot , SnapshotChangeCategory .BREAKING )
1448+ plan = plan_builder .build ()
1449+ assert (
1450+ plan .context_diff .snapshots [breaking_snapshot .snapshot_id ].change_category
1451+ == SnapshotChangeCategory .BREAKING
1452+ )
1453+ assert (
1454+ plan .context_diff .snapshots [non_breaking_snapshot .snapshot_id ].change_category
1455+ == SnapshotChangeCategory .NON_BREAKING
1456+ )
1457+ assert (
1458+ plan .context_diff .snapshots [top_waiter_snapshot .snapshot_id ].change_category
1459+ == SnapshotChangeCategory .INDIRECT_NON_BREAKING
1460+ )
1461+ assert plan .start == to_timestamp ("2023-01-01" )
1462+ assert not any (i .snapshot_id == top_waiter_snapshot .snapshot_id for i in plan .missing_intervals )
1463+
1464+ context .apply (plan )
1465+ assert (
1466+ not context .plan_builder ("dev" , skip_tests = True , enable_preview = False )
1467+ .build ()
1468+ .requires_backfill
1469+ )
1470+
1471+ # Deploy everything to prod.
1472+ plan = context .plan_builder ("prod" , skip_tests = True ).build ()
1473+ assert not plan .missing_intervals
1474+
1475+ context .apply (plan )
1476+ assert (
1477+ not context .plan_builder ("prod" , skip_tests = True , enable_preview = False )
1478+ .build ()
1479+ .requires_backfill
1480+ )
1481+
1482+
14311483@time_machine .travel ("2023-01-08 15:00:00 UTC" )
14321484def test_run_with_select_models (
14331485 init_and_plan_context : t .Callable ,
0 commit comments