@@ -73,6 +73,39 @@ def test_complete_cursor_is_monotonic(tmp_path):
7373 assert store .cursor ("alpha" )["complete_through" ] == newer_end
7474
7575
76+ def test_complete_cursor_metadata_does_not_regress_with_older_complete (tmp_path ):
77+ store = SourceLedgerStore (tmp_path / "state.sqlite3" )
78+ newer_start = "2026-09-04T10:00:00+00:00"
79+ newer_end = "2026-09-04T11:00:00+00:00"
80+ older_start = "2026-09-04T08:00:00+00:00"
81+ older_end = "2026-09-04T09:00:00+00:00"
82+
83+ store .start_attempt (source_handle = "alpha" , window_start = newer_start , window_end = newer_end )
84+ _finish (
85+ store ,
86+ "alpha" ,
87+ newer_start ,
88+ newer_end ,
89+ SourceWindowStatus .COMPLETE ,
90+ provider_cursor = "cursor-new" ,
91+ )
92+ store .start_attempt (source_handle = "alpha" , window_start = older_start , window_end = older_end )
93+ _finish (
94+ store ,
95+ "alpha" ,
96+ older_start ,
97+ older_end ,
98+ SourceWindowStatus .COMPLETE ,
99+ provider_cursor = "cursor-old" ,
100+ )
101+
102+ cursor = store .cursor ("alpha" )
103+ assert cursor ["complete_through" ] == newer_end
104+ assert cursor ["provider_cursor" ] == "cursor-new"
105+ assert cursor ["last_complete_window_start" ] == newer_start
106+ assert cursor ["last_complete_window_end" ] == newer_end
107+
108+
76109def test_counts_and_proof_are_preserved (tmp_path ):
77110 store = SourceLedgerStore (tmp_path / "state.sqlite3" )
78111 start = "2026-09-04T10:00:00+00:00"
0 commit comments