Skip to content

Commit f1c56df

Browse files
committed
Use symlink-aware backup cleanup checks
1 parent d9fa47e commit f1c56df

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/openstatspec/spss/sav.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def _raise_export_cleanup_failed(
338338
"destination": _path_reference(destination, role="destination"),
339339
"destination_exists": destination.exists(),
340340
"backup": _path_reference(backup, role="durable_backup"),
341-
"backup_exists": backup.exists(),
341+
"backup_exists": _path_entry_exists(backup),
342342
"staged_export": _path_reference(staged, role="staged_export"),
343343
"staged_export_exists": staged.exists(),
344344
}
@@ -366,7 +366,7 @@ def _raise_export_cleanup_failed(
366366
"cleanup_attempted": True,
367367
"cleanup_succeeded": False,
368368
"previous_destination_existed": had_previous,
369-
"durable_backup_survives_staging_cleanup": backup.exists(),
369+
"durable_backup_survives_staging_cleanup": _path_entry_exists(backup),
370370
}
371371
cleanup_audit_operation_id = None
372372
cleanup_audit_fault = None
@@ -452,7 +452,7 @@ def _mark_export_failed_after_restore(
452452
"backup": _path_reference(
453453
backup, role="durable_backup",
454454
),
455-
"backup_exists": backup.exists(),
455+
"backup_exists": _path_entry_exists(backup),
456456
"operation_id": operation_id,
457457
},
458458
"deterministic_recovery_evidence": {
@@ -750,21 +750,21 @@ def export_sav_dataset(
750750
"backup": _path_reference(
751751
backup, role="durable_backup",
752752
),
753-
"backup_exists": backup.exists(),
753+
"backup_exists": _path_entry_exists(backup),
754754
},
755755
"deterministic_recovery_evidence": {
756756
"procedure_id": "openstatspec.export-audit-reconciliation.v1",
757757
"operation_terminal_state_verified": False,
758758
"automatic_filesystem_recovery_performed": False,
759759
"published_file_preserved": destination_path.exists(),
760-
"durable_backup_preserved": backup.exists(),
760+
"durable_backup_preserved": _path_entry_exists(backup),
761761
"manual_reconciliation_required": True,
762762
"terminal_reporting": "out_of_band_exception",
763763
},
764764
"success_forbidden": True,
765765
},
766766
) from finalization_error
767-
if backup.exists():
767+
if _path_entry_exists(backup):
768768
try:
769769
backup.unlink()
770770
except Exception as cleanup_error:

0 commit comments

Comments
 (0)