sched: typed history recorder with exactly-once terminal reconcile (F4)
This commit is contained in:
@@ -168,6 +168,29 @@ class FileScheduleStore:
|
||||
entries.append(record.model_dump(mode="json"))
|
||||
self._write_json(path, entries)
|
||||
|
||||
def has_history_entry(
|
||||
self,
|
||||
schedule_id: str,
|
||||
*,
|
||||
run_id: str,
|
||||
kind: str,
|
||||
checkpoint_id: str | None = None,
|
||||
) -> bool:
|
||||
"""Whether this exact stopped result already has a history entry.
|
||||
|
||||
Idempotency identity is ``(run_id, kind, checkpoint_id)``: repeats
|
||||
of one recovery pass dedup, while a resumed run that stops again
|
||||
(new checkpoint id) records a new entry.
|
||||
"""
|
||||
for item in self._read_history_locked(schedule_id):
|
||||
if (
|
||||
item.get("run_id") == run_id
|
||||
and item.get("kind") == kind
|
||||
and item.get("checkpoint_id") == checkpoint_id
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def _sort_key(
|
||||
item: OccurrenceRecord,
|
||||
|
||||
Reference in New Issue
Block a user