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 <lukas@zed.dev>
This commit is contained in:
David Anekstein 2026-05-26 03:48:29 -04:00 committed by GitHub
parent 707c00b474
commit 281cfdd7a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {