sched: bind ownership to store composition; stable recovery failure; schema-checked prepare; guarded settle (R4 wave 2)
This commit is contained in:
@@ -124,7 +124,7 @@ def _entries(store: FileScheduleStore, sid: str, kind: str) -> list[dict[str, An
|
||||
def _recover(
|
||||
sched_store: FileScheduleStore, run_store: FileRunStore, now: datetime
|
||||
) -> list[str]:
|
||||
ownership = SchedulerOwnership(sched_store.root, owner="test").acquire()
|
||||
ownership = SchedulerOwnership(sched_store.root.parent, owner="test").acquire()
|
||||
try:
|
||||
return sched_recovery.recover(
|
||||
schedule_store=sched_store,
|
||||
@@ -223,7 +223,7 @@ def test_history_write_failure_reconciles_once_on_recovery(tmp_path: Path) -> No
|
||||
|
||||
sched_store = FailCompletedHistoryOnce(tmp_path / "sched")
|
||||
run_store = FileRunStore(tmp_path / "runs")
|
||||
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
|
||||
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
|
||||
try:
|
||||
sched = Scheduler(
|
||||
schedule_store=sched_store,
|
||||
@@ -271,7 +271,7 @@ def test_history_write_failure_reconciles_once_on_recovery(tmp_path: Path) -> No
|
||||
|
||||
|
||||
def test_dispatch_and_recovery_share_entry_identity(tmp_path: Path) -> None:
|
||||
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
|
||||
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
|
||||
try:
|
||||
sched_store = FileScheduleStore(tmp_path / "sched")
|
||||
run_store = FileRunStore(tmp_path / "runs")
|
||||
@@ -383,7 +383,7 @@ def test_admission_tear_returns_existing_run_without_dup(tmp_path: Path) -> None
|
||||
)
|
||||
materialize_admitted_view(store=run_store, admission=admission)
|
||||
sched_store.save_consumed("a", intended - timedelta(hours=1))
|
||||
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
|
||||
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
|
||||
try:
|
||||
sched = _owned_scheduler(
|
||||
sched_store, run_store, ownership, script={"*": "hang"}
|
||||
@@ -426,7 +426,7 @@ def test_parallel_tear_never_double_admits(tmp_path: Path) -> None:
|
||||
)
|
||||
materialize_admitted_view(store=run_store, admission=admission)
|
||||
sched_store.save_consumed("a", intended - timedelta(hours=1))
|
||||
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
|
||||
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
|
||||
try:
|
||||
sched = _owned_scheduler(
|
||||
sched_store, run_store, ownership, script={"*": "hang"}
|
||||
@@ -460,7 +460,7 @@ def test_consumed_write_failure_recovers_without_dup(tmp_path: Path) -> None:
|
||||
intended = ts(2026, 9, 8, 12, 0)
|
||||
sched_store.save_consumed("a", intended - timedelta(hours=1))
|
||||
sched_store.armed = True # arm only the poll's watermark write
|
||||
ownership = SchedulerOwnership(tmp_path / "sched", owner="test").acquire()
|
||||
ownership = SchedulerOwnership(tmp_path, owner="test").acquire()
|
||||
try:
|
||||
sched = _owned_scheduler(
|
||||
sched_store, run_store, ownership, script={"*": "hang"}
|
||||
|
||||
Reference in New Issue
Block a user