sched: bind ownership to store composition; stable recovery failure; schema-checked prepare; guarded settle (R4 wave 2)

This commit is contained in:
lda
2026-09-08 18:36:09 +07:00 Verified
parent b9d8eb9d16
commit 3f1d5d158b
16 changed files with 1299 additions and 60 deletions
+8 -8
View File
@@ -98,7 +98,7 @@ def _admitted(store: FileScheduleStore, sid: str) -> list[dict[str, Any]]:
def test_exact_boundary_admits_latest_once(tmp_path: Path) -> None:
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
try:
sched, store, runs, sources = _harness(
tmp_path, ownership, script={"*": "hang"}
@@ -120,7 +120,7 @@ def test_exact_boundary_admits_latest_once(tmp_path: Path) -> None:
def test_second_poll_at_same_instant_admits_nothing(tmp_path: Path) -> None:
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
try:
sched, store, runs, sources = _harness(
tmp_path, ownership, script={"*": "hang"}
@@ -140,7 +140,7 @@ def test_second_poll_at_same_instant_admits_nothing(tmp_path: Path) -> None:
def test_between_ticks_admits_latest(tmp_path: Path) -> None:
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
try:
sched, store, runs, sources = _harness(
tmp_path, ownership, script={"*": "hang"}
@@ -163,7 +163,7 @@ def test_between_ticks_admits_latest(tmp_path: Path) -> None:
def test_restart_after_catchup_admits_nothing(tmp_path: Path) -> None:
now = ts(2026, 9, 8, 12, 0)
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
try:
sched, store, _, sources = _harness(tmp_path, ownership, script={"*": "hang"})
store.create_schedule(
@@ -174,7 +174,7 @@ def test_restart_after_catchup_admits_nothing(tmp_path: Path) -> None:
sched.poll(now)
finally:
ownership.release()
ownership2 = SchedulerOwnership(tmp_path / "sched", owner="test2").acquire()
ownership2 = SchedulerOwnership(tmp_path, owner="test2").acquire()
try:
sched2, store2, runs2, sources2 = _harness(
tmp_path, ownership2, script={"*": "hang"}
@@ -188,7 +188,7 @@ def test_restart_after_catchup_admits_nothing(tmp_path: Path) -> None:
def test_long_catchup_stays_bounded(tmp_path: Path) -> None:
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
try:
sched, store, runs, sources = _harness(
tmp_path, ownership, script={"*": "complete"}
@@ -208,7 +208,7 @@ def test_long_catchup_stays_bounded(tmp_path: Path) -> None:
def test_skip_policy_exact_boundary_spans_without_admission(
tmp_path: Path,
) -> None:
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
try:
sched, store, runs, sources = _harness(
tmp_path, ownership, script={"*": "hang"}
@@ -229,7 +229,7 @@ def test_skip_policy_exact_boundary_spans_without_admission(
def test_overlap_skip_exact_boundary_skips_once(tmp_path: Path) -> None:
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
try:
sched, store, runs, sources = _harness(
tmp_path, ownership, script={"*": "hang"}