Skip to content

Codex/trash record deletion - #131

Merged
brendan-m-murphy merged 4 commits into
mainfrom
codex/trash-record-deletion
May 26, 2026
Merged

brendan-m-murphy merged 4 commits into
mainfrom
codex/trash-record-deletion

Conversation

@brendan-m-murphy

Copy link
Copy Markdown
Contributor

Implemented the trash-style deletion lifecycle and opened issue #130.

Added:

  • Catalog.delete(), Catalog.restore(), Catalog.purge()
  • CatalogRecord.status and lifecycle_metadata
  • active-only default search, plus include_deleted / only_deleted
  • lifecycle operation runner via the existing operation layer
  • CLI commands: ogcat delete, ogcat restore, ogcat purge
  • docs updates and focused lifecycle/CLI tests

Key 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 pyright
  • uv run pytest tests/test_record_lifecycle.py tests/test_search.py tests/test_audit.py tests/test_storage.py tests/test_cli.py -q
  • uv run pytest487 passed, 4 skipped

Copilot AI review requested due to automatic review settings May 26, 2026 07:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(), and Catalog.purge() backed by a new RecordLifecycleOperationRunner.
  • 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.

Comment thread src/ogcat/operation_runner.py Outdated
Comment thread src/ogcat/operation_runner.py
Comment thread src/ogcat/catalog.py
Comment thread src/ogcat/search.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Comment thread src/ogcat/exceptions.py Outdated
Comment thread src/ogcat/catalog.py
@brendan-m-murphy
brendan-m-murphy requested review from Copilot and removed request for Copilot May 26, 2026 10:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@brendan-m-murphy
brendan-m-murphy merged commit d0b47e6 into main May 26, 2026
@brendan-m-murphy
brendan-m-murphy deleted the codex/trash-record-deletion branch May 26, 2026 11:52
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.

2 participants