Skip to content

Restoring a document preserves a later human rejection - #1498

Merged
WaylandYang merged 2 commits into
deeplethe:devfrom
Maya-Kid:codex/preserve-rejection-on-restore
Nov 16, 2026
Merged

WaylandYang merged 2 commits into
deeplethe:devfrom
Maya-Kid:codex/preserve-rejection-on-restore

Conversation

@Maya-Kid

Copy link
Copy Markdown
Contributor

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 on 9bace61b, including shared evidence, restoration after the other source was purged, and reupload of the same content.

  • cargo fmt --all --check passed.
  • cargo clippy --workspace --all-targets -- -D warnings passed on Linux.
  • cargo test --workspace passed on Linux with PostgreSQL and Poppler required. 1,848 passed and 6 were ignored.

Before review

  • Every commit is signed off (git commit -s).
  • Workspace formatting, Clippy, and tests pass.
  • Store SQL was tested with UTOPIA_DATABASE_URL set and UTOPIA_TEST_REQUIRE_DB=1.

Signed-off-by: Maya Kid <BinjunYann@gmail.com>

@WaylandYang WaylandYang 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.

Thanks — restore now keeps a later rejection, and the delete/restore ordering holds. Merging.

@WaylandYang
WaylandYang merged commit 01d6d26 into deeplethe:dev Nov 16, 2026
6 checks passed
@Maya-Kid
Maya-Kid deleted the codex/preserve-rejection-on-restore branch November 29, 2026 05:59
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