sched: select latest eligible occurrence <= now; watermarks never regress (F3)

This commit is contained in:
lda
2026-09-08 11:31:15 +07:00 Verified
parent 1cf44e3a5c
commit 78a966d722
3 changed files with 299 additions and 8 deletions
+6 -1
View File
@@ -256,10 +256,15 @@ def test_long_downtime_is_bounded(tmp_path: Path) -> None:
assert src.next_calls + src.prev_calls <= SCAN_CAP + 2
admitted = [r for r in _history(store, "m") if r["kind"] == "admitted"]
assert len(admitted) == 1
assert datetime.fromisoformat(admitted[0]["resolved_at"]) == ts(2026, 9, 8, 11, 59)
# Latest-eligible <= now: a poll exactly at a due instant selects that
# instant (F3), not its exclusive predecessor.
assert datetime.fromisoformat(admitted[0]["resolved_at"]) == ts(2026, 9, 8, 12, 0)
assert (
len([r for r in _history(store, "m") if r["kind"] == "interval-summary"]) == 1
)
# A second poll at the same instant admits nothing more.
sched.poll(ts(2026, 9, 8, 12, 0, 0))
assert len([r for r in _history(store, "m") if r["kind"] == "admitted"]) == 1
sched.ownership.release()