From 281cfdd7a207ea2fde46a8ff01a0045ee71e5374 Mon Sep 17 00:00:00 2001 From: David Anekstein Date: Tue, 26 May 2026 03:48:29 -0400 Subject: [PATCH] Clarify Lamport ordering comment in remote edit (#52037) ## Context This PR updates a misleading comment in the remote edit merge path in the text CRDT. At `crates/text/src/text.rs`, the code skips fragments when `fragment.timestamp > timestamp`, but the comment described this as "lower lamport timestamp." In this codebase, Lamport ordering is ascending (`value`, then `replica_id`), so `>` means a higher Lamport timestamp. This change is comment-only and does not change runtime behavior. ## How to Review 1. Open `crates/text/src/text.rs` and inspect the updated two-line comment above the `while let Some(fragment) = old_fragments.item()` loop in `apply_remote_edit`. 2. Confirm the condition directly below is unchanged: `fragment.timestamp > timestamp`. 3. (Optional) Cross-check Lamport ordering in `crates/clock/src/clock.rs` (`impl Ord for Lamport`) to confirm the wording. ## Self-Review Checklist - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior (comment-only change; no behavior changes) - [x] Performance impact has been considered and is acceptable Release Notes: - N/A Co-authored-by: Lukas Wirth --- crates/text/src/text.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/text/src/text.rs b/crates/text/src/text.rs index 4b947234054..fa07a7922e9 100644 --- a/crates/text/src/text.rs +++ b/crates/text/src/text.rs @@ -1176,7 +1176,7 @@ impl Buffer { fragment_start = old_fragments.start().0.full_offset(); } - // Skip over insertions that are concurrent to this edit, but have a lower lamport + // Skip over insertions that are concurrent to this edit, but have a higher lamport // timestamp. while let Some(fragment) = old_fragments.item() { if fragment_start == range.start && fragment.timestamp > timestamp {