@@ -1732,6 +1732,43 @@ def test_deployability_index_unpaused_forward_only(make_snapshot):
17321732 assert deplyability_index .is_representative (snapshot_b )
17331733
17341734
1735+ def test_deployability_index_unpaused_auto_restatement (make_snapshot ):
1736+ model_a = SqlModel (
1737+ name = "a" ,
1738+ query = parse_one ("SELECT 1, ds" ),
1739+ kind = IncrementalByTimeRangeKind (
1740+ time_column = "ds" , forward_only = True , auto_restatement_cron = "@weekly"
1741+ ),
1742+ )
1743+ snapshot_a = make_snapshot (model_a )
1744+ snapshot_a .categorize_as (SnapshotChangeCategory .FORWARD_ONLY )
1745+ snapshot_a .unpaused_ts = 1
1746+
1747+ # Snapshot B is a child of a model with auto restatement and is not paused,
1748+ # so it is not deployable but is representative
1749+ snapshot_b = make_snapshot (SqlModel (name = "b" , query = parse_one ("SELECT 1" )))
1750+ snapshot_b .categorize_as (SnapshotChangeCategory .BREAKING )
1751+ snapshot_b .parents = (snapshot_a .snapshot_id ,)
1752+ snapshot_b .unpaused_ts = 1
1753+
1754+ # Snapshot C is paused and hence is neither deployable nor representative
1755+ snapshot_c = make_snapshot (SqlModel (name = "c" , query = parse_one ("SELECT 1" )))
1756+ snapshot_c .categorize_as (SnapshotChangeCategory .BREAKING )
1757+ snapshot_c .parents = (snapshot_b .snapshot_id ,)
1758+
1759+ deplyability_index = DeployabilityIndex .create (
1760+ {s .snapshot_id : s for s in [snapshot_a , snapshot_b , snapshot_c ]}
1761+ )
1762+
1763+ assert not deplyability_index .is_deployable (snapshot_a )
1764+ assert not deplyability_index .is_deployable (snapshot_b )
1765+ assert not deplyability_index .is_deployable (snapshot_c )
1766+
1767+ assert deplyability_index .is_representative (snapshot_a )
1768+ assert deplyability_index .is_representative (snapshot_b )
1769+ assert not deplyability_index .is_representative (snapshot_c )
1770+
1771+
17351772def test_deployability_index_uncategorized_forward_only_model (make_snapshot ):
17361773 model_a = SqlModel (
17371774 name = "a" ,
0 commit comments