Repository navigation
Restoring a document preserves a later human rejection - #1498
Merged
WaylandYang merged 2 commits intoNov 16, 2026
Merged
Conversation
Signed-off-by: Maya Kid <BinjunYann@gmail.com>
WaylandYang
approved these changes
Nov 16, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thanks — restore now keeps a later rejection, and the delete/restore ordering holds. Merging.
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.
Why
Two documents can support the same fact. If both are deleted, restoring the first brings the shared fact back. If a reviewer then rejects it, restoring the second document clears that rejection because the fact still appears in the second document's deletion record.
What changes
Capture the document's deletion timestamp while holding its row lock. Restore a fact from that deletion record only if its current invalidation timestamp matches. The deletion transaction writes the same timestamp on the document and the facts it invalidates. The regression checks that the shared fact keeps its exact rejection timestamp and that the restored document, its chunk, and its exclusively supported fact all return.
How it was checked
With Rust 1.98.1 and a fresh PostgreSQL 16.15 database on Linux, the new regression failed against
dev(f33f9fc9). All four deletion and restoration tests passed on9bace61b, including shared evidence, restoration after the other source was purged, and reupload of the same content.cargo fmt --all --checkpassed.cargo clippy --workspace --all-targets -- -D warningspassed on Linux.cargo test --workspacepassed on Linux with PostgreSQL and Poppler required. 1,848 passed and 6 were ignored.Before review
git commit -s).UTOPIA_DATABASE_URLset andUTOPIA_TEST_REQUIRE_DB=1.