@@ -2980,7 +2980,7 @@ def test_new_forward_only_model_concurrent_versions(init_and_plan_context: t.Cal
29802980 )
29812981 new_model_alt = load_sql_based_model (new_model_alt_expr )
29822982
2983- # Add the second version of the model and apply it to dev_b.
2983+ # Add the second version of the model but don't apply it yet
29842984 context .upsert_model (new_model_alt )
29852985 snapshot_b = context .get_snapshot (new_model_alt .name )
29862986 plan_b = context .plan_builder ("dev_b" ).build ()
@@ -2993,8 +2993,6 @@ def test_new_forward_only_model_concurrent_versions(init_and_plan_context: t.Cal
29932993 assert snapshot_b .fingerprint != snapshot_a .fingerprint
29942994 assert snapshot_b .version == snapshot_a .version
29952995
2996- context .apply (plan_b )
2997-
29982996 # Apply the 1st version to prod
29992997 context .upsert_model (new_model )
30002998 plan_prod_a = context .plan_builder ("prod" ).build ()
@@ -3008,10 +3006,20 @@ def test_new_forward_only_model_concurrent_versions(init_and_plan_context: t.Cal
30083006 df = context .fetchdf ("SELECT * FROM memory.sushi.new_model" )
30093007 assert df .to_dict () == {"ds" : {0 : "2023-01-07" }, "a" : {0 : 1 }}
30103008
3009+ # Modify the 1st version in prod to trigger a forward-only change
3010+ new_model = add_projection_to_model (t .cast (SqlModel , new_model ))
3011+ context .upsert_model (new_model )
3012+ context .plan ("prod" , auto_apply = True , no_prompts = True , skip_tests = True )
3013+
3014+ # Apply the 2nd version to dev_b.
3015+ # At this point the snapshot of the 2nd version has already been categorized but not
3016+ # persisted in the state. This means that when the snapshot of the 1st version was
3017+ # being unpaused during promotion to prod, the state of the 2nd version snapshot was not updated
3018+ context .apply (plan_b )
3019+
30113020 # Apply the 2nd version to prod
30123021 context .upsert_model (new_model_alt )
30133022 plan_prod_b = context .plan_builder ("prod" ).build ()
3014- assert snapshot_b .snapshot_id in plan_prod_b .snapshots
30153023 assert (
30163024 plan_prod_b .snapshots [snapshot_b .snapshot_id ].change_category
30173025 == SnapshotChangeCategory .BREAKING
0 commit comments