Repository navigation
Stop re-logging a replicated delete that is re-delivered onto its own tombstone (#2761 → v5.2) - #2815
Merged
Merged
Conversation
… tombstone (#2761 → v5.2) A replicated delete whose key already holds the tombstone it left (same origin, same version) re-applied and appended a fresh audit entry on every delivery; in a mesh each copy is new log tail that every peer forwards and re-logs in turn. The delete now returns without writing, checking the nearest staged write in the transaction (or the stored entry) as main does. This line has no isAuditEntryWrite or separate log key, so identity is compared as version and origin. A retry round repeats its first round's decision. (ported from commit df188d9) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the node-id map Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request prevents replicated deletes that are re-delivered onto the state they already produced from being re-logged. It introduces a check in resources/Table.ts to detect redelivered deletes, marking them as skipped and returning early to avoid appending redundant audit entries. Additionally, a comprehensive test suite is added in unitTests/resources/replicatedDeleteRedelivery.test.js to verify various scenarios of redelivered deletes. There are no review comments, so we have no feedback to provide.
kriszyp
marked this pull request as ready for review
September 25, 2026 17:28
github-actions
Bot
requested review from
Ethan-Arrowood,
cb1kenobi and
heskew
September 25, 2026 17:29
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.
Backport of #2761 to
v5.2: a replicated delete that is re-delivered onto the tombstone it already left is no longer applied and logged again (#1162).When a delete is delivered again with the same version and origin, the key already holds the tombstone it left.
_writeDeleteused to skip only a strictly older write, so a tie re-applied and appended a fresh audit entry on every delivery. In a mesh each copy is new log tail that every peer forwards and re-logs in turn. Now such a delete returns without writing. It still stages the removal, so later writes in the transaction see the key as removed.For the human reviewer
Requirement: port Stop re-logging a replicated delete that is re-delivered onto its own tombstone #2761 closely.
v5.2has the in-transaction staged-write chain (priorStagedWrite,stagedEntry,priorWrite), so this keepsmain'sremovalBeforewalk:v5.2has neitherisAuditEntryWritenor a transaction-log key separate from the version. So the identity check isisSameRemoval: no record, the same version as this transaction, and the same origin id.A retried commit repeats its first round's decision. On an
ERR_BUSYrecommit the kept write batch shows this write's own round-one tombstone as the existing entry, and conflict recovery depends on writing the key again. The Stop re-logging a replicated delete that is re-delivered onto its own tombstone (#2761 → v5.1) #2813 review flagged this forv5.1, and the same fix is applied here.A local delete's origin compares as 0, which is the id this node's own name is pinned to. The node-id map is not read on every delete.
Test note.
main'sreplicatedDeleteRedelivery.test.jsis ported unchanged. Two of its cases pass aversionoption that this line doesn't read ("reuses the tombstone version under a new log key", "shares its version with the live record"), so onv5.2they never produce a version tie.Changes
resources/Table.ts,_writeDelete:removalBefore, frommain;isSameRemoval.unitTests/resources/replicatedDeleteRedelivery.test.js: ported frommain.Verification
v5.2, 6 fail.npm run test:unit:resources: 1807 passing.Complexity: medium
🤖 Generated with Claude Code
Review-Coverage: authored=claude; ran=codex,gemini; adjudicated=domain; blocked=cursor-composer(auth); declined=cursor-grok,cursor-kimi,cursor-muse; rounds=1; full=1 @ 7123cf9
Human-Review-Need: 3 (decisions: dedup-by-tombstone-identity, carry-first-round-decision-on-retry, receiver-side-idempotency-vs-relay-fix) @ 74ad415