Codex/trash record deletion - #131
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a “trash-style” record lifecycle to ogcat so users can tombstone records (hidden from default search), restore them, or permanently purge records and managed artifacts, while keeping the existing operation/unit-of-work + audit patterns.
Changes:
- Introduces
Catalog.delete(),Catalog.restore(), andCatalog.purge()backed by a newRecordLifecycleOperationRunner. - Adds record lifecycle state to the data model (
CatalogRecord.status,CatalogRecord.lifecycle_metadata) and updates search defaults to hide deleted records unless requested. - Extends the CLI (
ogcat delete|restore|purge) and documentation, plus adds focused lifecycle + CLI tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_record_lifecycle.py | New tests covering tombstone/restore/purge behavior, search visibility, rollback semantics, and audit events. |
| tests/test_cli.py | Adds CLI tests for delete/restore and purge confirmation + deletion behavior. |
| src/ogcat/search.py | Reserves new top-level fields (status, lifecycle_metadata) for field resolution. |
| src/ogcat/operation_runner.py | Adds lifecycle operation request/runner; implements delete/restore/purge orchestration and audit emission. |
| src/ogcat/models.py | Extends CatalogRecord with status and lifecycle_metadata plus serialization/back-compat. |
| src/ogcat/cli.py | Adds CLI flags for deleted record search and new lifecycle commands. |
| src/ogcat/catalog.py | Adds lifecycle APIs, status-based filtering for search/describe/field helpers, and transaction validation. |
| src/ogcat/catalog_application.py | Adds application service methods that build lifecycle operation requests and run them. |
| README.md | Documents the new trash-style deletion workflow and CLI usage. |
| docs/concepts/transactions-and-logging.md | Describes audit/rollback semantics for lifecycle operations, especially purge. |
| docs/concepts/catalog-records.md | Documents new record fields and search visibility semantics for deleted records. |
| docs/cli.md | Documents new CLI commands and flags. |
| docs/api/catalog.rst | Notes the new lifecycle APIs in the Catalog API docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented the trash-style deletion lifecycle and opened issue #130.
Added:
Catalog.delete(),Catalog.restore(),Catalog.purge()CatalogRecord.statusandlifecycle_metadatainclude_deleted/only_deletedogcat delete,ogcat restore,ogcat purgeKey files changed include catalog.py, operation_runner.py, catalog_application.py, models.py, cli.py, and new test_record_lifecycle.py.
Checks run:
uv run ruff check ...uv run ruff format --check ...uv run pyrightuv run pytest tests/test_record_lifecycle.py tests/test_search.py tests/test_audit.py tests/test_storage.py tests/test_cli.py -quv run pytest→487 passed, 4 skipped