Harden demo export cleanup safety
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-06-17 23:47:49 +02:00
parent 212be9ae48
commit 949614e336
9 changed files with 140 additions and 9 deletions
+8 -3
View File
@@ -94,21 +94,26 @@ Clean old offline demo export artifacts without touching uploaded source data:
```bash
python scripts/cleanup_demo_artifacts.py
python scripts/cleanup_demo_artifacts.py --keep-latest 3 --apply
python scripts/cleanup_demo_artifacts.py --keep-latest 10 --export-type project_report_html
python scripts/cleanup_demo_artifacts.py --keep-latest 10 --max-delete 100 --apply
```
Against the Docker runtime, run the backend-container entrypoint:
```bash
docker compose exec -T backend python scripts/cleanup_demo_artifacts.py
docker compose exec -T backend python scripts/cleanup_demo_artifacts.py --keep-latest 3 --apply
docker compose exec -T backend python scripts/cleanup_demo_artifacts.py --keep-latest 10 --export-type project_report_html
docker compose exec -T backend python scripts/cleanup_demo_artifacts.py --keep-latest 10 --max-delete 100 --apply
```
The cleanup script is dry-run by default. It only targets the explicit
`GeoIntel Demo - Building QA` project unless `--project-name` is provided, keeps
the newest exports per matching project, deletes only `exports` rows/files when
`--apply` is set, and refuses to remove files outside the configured
`STORAGE_ROOT`.
`STORAGE_ROOT`. `--max-delete` defaults to 25 and blocks large cleanup runs until
the operator raises it after reviewing dry-run output. Repeat `--export-type` to
limit cleanup to specific artifact kinds such as `project_report_html` or
`project_metadata_json`.
## Tower deployment
+1
View File
@@ -21,6 +21,7 @@ DEMO_PROJECT_NAME = _impl.DEMO_PROJECT_NAME
is_within_storage_root = _impl.is_within_storage_root
export_created_at = _impl.export_created_at
select_cleanup_candidates = _impl.select_cleanup_candidates
filter_exports_by_type = _impl.filter_exports_by_type
export_path = _impl.export_path
prune_empty_parents = _impl.prune_empty_parents
cleanup_demo_exports = _impl.cleanup_demo_exports