@@ -225,7 +225,10 @@ def __init__(
225225 self ._load_from_disk ()
226226
227227 def _load_from_disk (self ) -> None :
228- if self ._storage_path is None or not self ._storage_path .exists ():
228+ if self ._storage_path is None :
229+ return
230+ if not self ._storage_path .exists ():
231+ self ._history_completeness_unknown = True
229232 return
230233 runs , sequence , evicted_runs , evicted_runs_by_repo , history_unknown = self ._read_from_disk_unlocked ()
231234 with self ._lock :
@@ -238,14 +241,14 @@ def _load_from_disk(self) -> None:
238241
239242 def _read_from_disk_unlocked (self ) -> tuple [dict [str , dict [str , Any ]], int , int , dict [str , int ], bool ]:
240243 if self ._storage_path is None or not self ._storage_path .exists ():
241- return {}, 0 , 0 , {}, False
244+ return {}, 0 , 0 , {}, self . _storage_path is not None
242245 try :
243246 payload = json .loads (self ._storage_path .read_text (encoding = "utf-8" ))
244247 except (OSError , json .JSONDecodeError ):
245- return {}, 0 , 0 , {}, False
248+ return {}, 0 , 0 , {}, True
246249 runs = payload .get ("runs" ) if isinstance (payload , dict ) else None
247250 if not isinstance (runs , dict ):
248- return {}, 0 , 0 , {}, False
251+ return {}, 0 , 0 , {}, True
249252 clean_runs = {str (key ): value for key , value in runs .items () if isinstance (value , dict )}
250253 sequence = _safe_int (payload .get ("sequence" ), len (clean_runs ))
251254 history_unknown = "evicted_runs" not in payload or "evicted_runs_by_repo" not in payload
@@ -278,7 +281,10 @@ def _persist_locked(self) -> None:
278281 self ._persist_with_owner_guard_locked ()
279282
280283 def _refresh_from_disk_locked (self ) -> None :
281- if self ._storage_path is None or not self ._storage_path .exists ():
284+ if self ._storage_path is None :
285+ return
286+ if not self ._storage_path .exists ():
287+ self ._history_completeness_unknown = True
282288 return
283289 lock_handle = None
284290 try :
0 commit comments