Clarify demo cleanup dry-run output
This commit is contained in:
@@ -69,6 +69,7 @@ def cleanup_demo_exports(project_name: str, keep_latest: int, apply: bool) -> di
|
||||
"matched_export_count": 0,
|
||||
"selected_export_count": 0,
|
||||
"deleted_export_count": 0,
|
||||
"candidate_files": [],
|
||||
"deleted_files": [],
|
||||
"missing_files": [],
|
||||
"skipped_outside_storage": [],
|
||||
@@ -109,7 +110,9 @@ def cleanup_demo_exports(project_name: str, keep_latest: int, apply: bool) -> di
|
||||
if apply:
|
||||
path.unlink()
|
||||
summary["pruned_dirs"].extend(prune_empty_parents(path, storage_root))
|
||||
summary["deleted_files"].append(str(path))
|
||||
summary["deleted_files"].append(str(path))
|
||||
else:
|
||||
summary["candidate_files"].append(str(path))
|
||||
else:
|
||||
summary["missing_files"].append({"export_id": str(export.id), "storage_path": str(path)})
|
||||
|
||||
|
||||
@@ -73,3 +73,11 @@ def test_cleanup_script_defaults_to_explicit_demo_project() -> None:
|
||||
assert args.project_name == cleanup.DEMO_PROJECT_NAME
|
||||
assert args.keep_latest == 3
|
||||
assert args.apply is False
|
||||
|
||||
|
||||
def test_cleanup_script_reports_dry_run_candidates_separately() -> None:
|
||||
script = Path(__file__).resolve().parents[2] / "backend" / "scripts" / "cleanup_demo_artifacts.py"
|
||||
content = script.read_text(encoding="utf-8")
|
||||
|
||||
assert '"candidate_files": []' in content
|
||||
assert 'summary["candidate_files"].append(str(path))' in content
|
||||
|
||||
Reference in New Issue
Block a user