{{ message }}
Repository navigation
Deleting a document is an event, and it can be undone - #273
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
WaylandYang
force-pushed
the
feat/deleting-is-an-event
branch
from
September 3, 2026 18:43
cc0d4ed to
275ca4f
Compare
This was referenced Sep 3, 2026
Merged
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.

Implements the Delete half of #268 (the design settled there; the recording-axis as-of in 0019 stays planned).
Before:
DELETE FROM documentscascaded chunks andfact_evidenceaway. Facts stayed live in the graph with no provenance — the opposite of what the privacy policy promised — and a synced document deleted locally came back on the next sync as a new row, re-asserting its facts on top of the old ones.Now: deleting is an event on the recording axis.
documents.deleted_attombstone; chunks takesuperseded_at; nothing is cleared (text, embedding, blob all stay until an explicit purge — follow-up PR).documents.deleted_at, not the chunk'ssuperseded_at: evidence stuck on an old version is stale, not sourceless.document_deletionsrecords which facts and chunks this deletion touched, shaped likeentity_merges; restore revives exactly that list, so a fact retired before the deletion is not accidentally saved.POST /documents/{id}/restore), sync meeting a tombstone whose source still has the file, and re-uploading the same content (it would otherwise hit the(kb_id, sha256)unique index).documentsread filtersdeleted_at IS NULL(library, page, counts, dedupe, extraction queue, retrieval candidates); the evidence panel says "source deleted" on a quote whose document is gone.Wording in the privacy policy and the cleanup dialog now says what actually happens.
Test:
a_deletion_is_an_event(store, DB). Verified end to end in the isolated env: delete → toast "1 fact retired" with Undo → evidence reportsdocument_deleted→ Undo → restored, audit traildocument.deleted/document.restored, ledger rows reverted.Closes #268
🤖 Generated with Claude Code