Number hot ops per author, persist the CRDT state - #4638
Open
TrueDoctor wants to merge 1 commit into
Open
TrueDoctor wants to merge 1 commit into
TrueDoctor wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 11 files
Confidence score: 2/5
- In
document.rs, a settled late copy can leave the hot sequence and Lamport clock behind, so the next local edit may reuse an operation ID that peers discard or get a timestamp that is not causally later. Advance both before returning from that path.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="document/graph-storage/src/document.rs">
<violation number="1" location="document/graph-storage/src/document.rs:104">
P1: A settled late copy can return before advancing `last_hot_sequence` or the Lamport clock. The next local edit may reuse a settled `HotOpId` that peers discard, and its timestamp may not be causally later than the observed op; update both counters before these early returns.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Comment on lines
+104
to
+113
| if self.settled.covers(hot_op.id()) { | ||
| return Ok(()); | ||
| } | ||
| if self.hot_timestamps.contains(&hot_op.timestamp) { | ||
| return Ok(()); | ||
| } | ||
| // Our own ops raise the sequence counter too, should the persisted one lag. | ||
| if hot_op.timestamp.peer == self.peer { | ||
| self.last_hot_sequence = self.last_hot_sequence.max(hot_op.sequence); | ||
| } |
Contributor
There was a problem hiding this comment.
P1: A settled late copy can return before advancing last_hot_sequence or the Lamport clock. The next local edit may reuse a settled HotOpId that peers discard, and its timestamp may not be causally later than the observed op; update both counters before these early returns.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At document/graph-storage/src/document.rs, line 104:
<comment>A settled late copy can return before advancing `last_hot_sequence` or the Lamport clock. The next local edit may reuse a settled `HotOpId` that peers discard, and its timestamp may not be causally later than the observed op; update both counters before these early returns.</comment>
<file context>
@@ -82,20 +91,67 @@ impl Document {
- /// Replay a persisted or received hot op. One already reflected in the registry changes nothing.
+ /// Replay a persisted or received hot op. One already settled or held changes nothing.
pub fn replay_hot_op(&mut self, hot_op: HotOp) -> Result<(), CrdtError> {
+ if self.settled.covers(hot_op.id()) {
+ return Ok(());
+ }
</file context>
Suggested change
| if self.settled.covers(hot_op.id()) { | |
| return Ok(()); | |
| } | |
| if self.hot_timestamps.contains(&hot_op.timestamp) { | |
| return Ok(()); | |
| } | |
| // Our own ops raise the sequence counter too, should the persisted one lag. | |
| if hot_op.timestamp.peer == self.peer { | |
| self.last_hot_sequence = self.last_hot_sequence.max(hot_op.sequence); | |
| } | |
| self.clock.observe(hot_op.timestamp); | |
| // Our own ops raise the sequence counter too, should the persisted one lag. | |
| if hot_op.timestamp.peer == self.peer { | |
| self.last_hot_sequence = self.last_hot_sequence.max(hot_op.sequence); | |
| } | |
| if self.settled.covers(hot_op.id()) { | |
| return Ok(()); | |
| } | |
| if self.hot_timestamps.contains(&hot_op.timestamp) { | |
| return Ok(()); | |
| } |
TrueDoctor
force-pushed
the
graph-storage-4-settled-marks
branch
from
October 2, 2026 21:19
ccae3b8 to
36c878c
Compare
TrueDoctor
added this pull request to stack #4643
October 3, 2026 14:04
TrueDoctor
force-pushed
the
graph-storage-4-settled-marks
branch
from
October 5, 2026 20:40
36c878c to
d62dc25
Compare
…nd stage a batch whole
TrueDoctor
force-pushed
the
graph-storage-4-settled-marks
branch
from
October 5, 2026 21:07
d62dc25 to
85414b0
Compare
This branch was successfully deployed
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.
No description provided.