@@ -100,7 +100,7 @@ def test_forward_only_plan_with_effective_date(context_fixture: Context, request
100100 plan .context_diff .snapshots [top_waiters_snapshot .snapshot_id ].change_category
101101 == SnapshotChangeCategory .FORWARD_ONLY
102102 )
103- assert plan .start == to_date ("2023-01-07" )
103+ assert to_timestamp ( plan .start ) == to_timestamp ("2023-01-07" )
104104 assert plan .missing_intervals == [
105105 SnapshotIntervals (
106106 snapshot_id = top_waiters_snapshot .snapshot_id ,
@@ -335,7 +335,7 @@ def test_forward_only_model_regular_plan_preview_enabled(init_and_plan_context:
335335 plan .context_diff .snapshots [top_waiters_snapshot .snapshot_id ].change_category
336336 == SnapshotChangeCategory .FORWARD_ONLY
337337 )
338- assert plan .start == to_date ("2023-01-07" )
338+ assert to_timestamp ( plan .start ) == to_timestamp ("2023-01-07" )
339339 assert plan .missing_intervals == [
340340 SnapshotIntervals (
341341 snapshot_id = top_waiters_snapshot .snapshot_id ,
@@ -472,7 +472,7 @@ def test_full_history_restatement_model_regular_plan_preview_enabled(
472472 == SnapshotChangeCategory .FORWARD_ONLY
473473 )
474474
475- assert plan .start == to_date ("2023-01-07" )
475+ assert to_timestamp ( plan .start ) == to_timestamp ("2023-01-07" )
476476 assert plan .missing_intervals == [
477477 SnapshotIntervals (
478478 snapshot_id = active_customers_snapshot .snapshot_id ,
@@ -690,6 +690,50 @@ def test_cron_not_aligned_with_day_boundary(
690690 ]
691691
692692
693+ @time_machine .travel ("2023-01-08 00:00:00 UTC" )
694+ def test_forward_only_monthly_model (init_and_plan_context : t .Callable ):
695+ context , _ = init_and_plan_context ("examples/sushi" )
696+
697+ model = context .get_model ("sushi.waiter_revenue_by_day" )
698+ model = SqlModel .parse_obj (
699+ {
700+ ** model .dict (),
701+ "kind" : model .kind .copy (update = {"forward_only" : True }),
702+ "cron" : "0 0 1 * *" ,
703+ "start" : "2022-01-01" ,
704+ "audits" : [],
705+ }
706+ )
707+ context .upsert_model (model )
708+
709+ plan = context .plan_builder ("prod" , skip_tests = True ).build ()
710+ context .apply (plan )
711+
712+ waiter_revenue_by_day_snapshot = context .get_snapshot (model .name , raise_if_missing = True )
713+ assert waiter_revenue_by_day_snapshot .intervals == [
714+ (to_timestamp ("2022-01-01" ), to_timestamp ("2023-01-01" ))
715+ ]
716+
717+ model = add_projection_to_model (t .cast (SqlModel , model ), literal = True )
718+ context .upsert_model (model )
719+
720+ waiter_revenue_by_day_snapshot = context .get_snapshot (
721+ "sushi.waiter_revenue_by_day" , raise_if_missing = True
722+ )
723+
724+ plan = context .plan_builder (
725+ "dev" , select_models = [model .name ], skip_tests = True , enable_preview = True
726+ ).build ()
727+ assert to_timestamp (plan .start ) == to_timestamp ("2022-12-01" )
728+ assert to_timestamp (plan .end ) == to_timestamp ("2023-01-08" )
729+ assert plan .missing_intervals == [
730+ SnapshotIntervals (
731+ snapshot_id = waiter_revenue_by_day_snapshot .snapshot_id ,
732+ intervals = [(to_timestamp ("2022-12-01" ), to_timestamp ("2023-01-01" ))],
733+ ),
734+ ]
735+
736+
693737@time_machine .travel ("2023-01-08 15:00:00 UTC" )
694738def test_forward_only_parent_created_in_dev_child_created_in_prod (
695739 init_and_plan_context : t .Callable ,
@@ -915,7 +959,7 @@ def test_non_breaking_change_after_forward_only_in_dev(
915959 plan .context_diff .snapshots [top_waiters_snapshot .snapshot_id ].change_category
916960 == SnapshotChangeCategory .FORWARD_ONLY
917961 )
918- assert plan .start == to_date ("2023-01-07" )
962+ assert to_timestamp ( plan .start ) == to_timestamp ("2023-01-07" )
919963 assert plan .missing_intervals == [
920964 SnapshotIntervals (
921965 snapshot_id = top_waiters_snapshot .snapshot_id ,
@@ -947,7 +991,7 @@ def test_non_breaking_change_after_forward_only_in_dev(
947991 plan .context_diff .snapshots [top_waiters_snapshot .snapshot_id ].change_category
948992 == SnapshotChangeCategory .NON_BREAKING
949993 )
950- assert plan .start == to_timestamp ("2023-01-01" )
994+ assert to_timestamp ( plan .start ) == to_timestamp ("2023-01-01" )
951995 assert plan .missing_intervals == [
952996 SnapshotIntervals (
953997 snapshot_id = top_waiters_snapshot .snapshot_id ,
0 commit comments