Skip to content

Conversation

@jonhealy1
Copy link
Collaborator

@jonhealy1 jonhealy1 commented Dec 9, 2025

Related Issue(s):

  • None

Description:

  • Implemented "Smart Unlink" logic in delete_catalog: when cascade=False (default), collections are unlinked from the catalog and become root-level orphans if they have no other parents, rather than being deleted. When cascade=True, collections are deleted entirely. This prevents accidental data loss and supports poly-hierarchy scenarios where collections belong to multiple catalogs.
  • Fixed delete_catalog to use reverse lookup query on parent_ids field instead of fragile link parsing. This ensures all collections are found and updated correctly, preventing ghost relationships where collections remain tagged with deleted catalogs, especially in large catalogs or pagination scenarios.

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable
  • Changes are added to the changelog

@jonhealy1 jonhealy1 marked this pull request as ready for review December 9, 2025 15:13
@jonhealy1 jonhealy1 merged commit a7cdd15 into stac-utils:main Dec 9, 2025
8 checks passed
@jonhealy1 jonhealy1 deleted the catalogs-cascade-update branch December 9, 2025 15:25
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