exlab_wizard.sync.cleanup#
Cleanup safety interlocks. Backend Spec §7.1.6.
The cleanup reaper deletes local files only when all of the following hold for a job:
verify_passes >= nas_cleanup.min_verify_passes(default 2).Hours since the most recent
verified_at>=min_age_hours(default 24).The remote NAS path is reachable (the caller passes the result of a remote
statasremote_stat_ok).No active
validation_overridesrevocation (tombstone) has been written within the lastmin_age_hours– a revoked override re-blocks sync, so we don’t want to delete locally if the run is now blocked.
This module is the pure interlock evaluator. The reaper itself lives in
exlab_wizard.sync.nas_client; it consults this helper before
issuing a delete.
Functions
|
Evaluate every §7.1.6 interlock; return True iff all pass. |
|
Return True if any tombstone was recorded within |
- exlab_wizard.sync.cleanup.cleanup_interlocks_satisfied(*, job, run_path, now_utc, config, overrides_active, remote_stat_ok)[source]#
Evaluate every §7.1.6 interlock; return True iff all pass.
Logs a debug entry naming the failing interlock when one fails so the operator can see why a job stayed in
CLEANUP_ELIGIBLE.The
run_pathparameter is accepted (but currently unused) so callers can pass the run directory through unchanged; future interlocks (e.g., size-on-disk threshold) may consult it.- Parameters:
job (
SyncJobRow)run_path (
Any)now_utc (
datetime)config (
NASCleanupConfig)remote_stat_ok (
bool)
- Return type:
- exlab_wizard.sync.cleanup.has_recent_revocation(overrides, *, now_utc, min_age_hours)[source]#
Return True if any tombstone was recorded within
min_age_hours.A tombstone is an override-list entry with
revoked: True. The timestamp is read fromrecorded_at; entries with a missing or malformed timestamp are treated as recent (fail-safe: we’d rather block cleanup than delete files for a run that may be re-gated).