Skip to content

Auto-delete Datasets left empty by missing-file cleanup - #19

Merged
d33bs merged 1 commit into
mainfrom
cleanup-empty-datasets
Aug 18, 2026
Merged

Auto-delete Datasets left empty by missing-file cleanup#19
d33bs merged 1 commit into
mainfrom
cleanup-empty-datasets

Conversation

@d33bs

@d33bs d33bs commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

  • delete_missing_imports removes OMERO Images whose source file disappeared (e.g. an upstream folder rename), but previously left the now-empty Dataset container behind indefinitely.
  • Track which Datasets had images removed; once a run's cleanup finishes, delete any Dataset left with zero remaining images and prune its dataset_state entry so it isn't recreated on the next scan.
  • Follow-up to Security hardening, group/user access fixes, and OMERO delete cleanup fix #18, which fixed the underlying delete --wait bug this builds on.

Test plan

  • uv run pytest tests/ — 35/35 passing
  • uv run pre-commit run --all-files — all hooks passing
  • New regression test (test_delete_missing_imports_removes_now_empty_dataset) covers both the delete-when-empty case and a non-empty sibling dataset being left alone; caught two real bugs while writing this (an undefined-name typo and an unmocked live-call risk in the existing test), now fixed.

Note: this does not retroactively clean up datasets that were already emptied via a manual bulk delete outside this code path (a one-time cleanup for those is being handled separately).

delete_missing_imports removes OMERO Images whose source file disappeared
(e.g. an upstream folder rename), but left the now-empty Dataset container
behind. Track which datasets had images removed and, once cleanup for a run
finishes, delete any that ended up with zero remaining images, pruning their
dataset_state entries so they aren't recreated on the next scan.
@d33bs
d33bs merged commit e88a71d into main Aug 18, 2026
7 checks passed
@d33bs
d33bs deleted the cleanup-empty-datasets branch August 18, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant