@@ -2964,7 +2964,7 @@ def test_new_forward_only_model_concurrent_versions(init_and_plan_context: t.Cal
2964
2964
)
2965
2965
new_model_alt = load_sql_based_model (new_model_alt_expr )
2966
2966
2967
- # Add the second version of the model and apply it to dev_b.
2967
+ # Add the second version of the model but don't apply it yet
2968
2968
context .upsert_model (new_model_alt )
2969
2969
snapshot_b = context .get_snapshot (new_model_alt .name )
2970
2970
plan_b = context .plan_builder ("dev_b" ).build ()
@@ -2977,8 +2977,6 @@ def test_new_forward_only_model_concurrent_versions(init_and_plan_context: t.Cal
2977
2977
assert snapshot_b .fingerprint != snapshot_a .fingerprint
2978
2978
assert snapshot_b .version == snapshot_a .version
2979
2979
2980
- context .apply (plan_b )
2981
-
2982
2980
# Apply the 1st version to prod
2983
2981
context .upsert_model (new_model )
2984
2982
plan_prod_a = context .plan_builder ("prod" ).build ()
@@ -2992,10 +2990,20 @@ def test_new_forward_only_model_concurrent_versions(init_and_plan_context: t.Cal
2992
2990
df = context .fetchdf ("SELECT * FROM memory.sushi.new_model" )
2993
2991
assert df .to_dict () == {"ds" : {0 : "2023-01-07" }, "a" : {0 : 1 }}
2994
2992
2993
+ # Modify the 1st version in prod to trigger a forward-only change
2994
+ new_model = add_projection_to_model (t .cast (SqlModel , new_model ))
2995
+ context .upsert_model (new_model )
2996
+ context .plan ("prod" , auto_apply = True , no_prompts = True , skip_tests = True )
2997
+
2998
+ # Apply the 2nd version to dev_b.
2999
+ # At this point the snapshot of the 2nd version has already been categorized but not
3000
+ # persisted in the state. This means that when the snapshot of the 1st version was
3001
+ # being unpaused during promotion to prod, the state of the 2nd version snapshot was not updated
3002
+ context .apply (plan_b )
3003
+
2995
3004
# Apply the 2nd version to prod
2996
3005
context .upsert_model (new_model_alt )
2997
3006
plan_prod_b = context .plan_builder ("prod" ).build ()
2998
- assert snapshot_b .snapshot_id in plan_prod_b .snapshots
2999
3007
assert (
3000
3008
plan_prod_b .snapshots [snapshot_b .snapshot_id ].change_category
3001
3009
== SnapshotChangeCategory .BREAKING
0 commit comments