Rebasely Beta: data may be purged

examples/live-notes Public

Markdown · 1.2 KiB · at 6e3dc76

id: 0002-drop-inserts-inside-concurrent-deletes
type: decision
owner: justin
reviewed: 2026-10-13
status: accepted

0002 Drop inserts inside a concurrent delete

Context

Alice deletes a sentence while Bob types a word in the middle of it. To keep Bob's word, the delete has to be split into two deletes around it, which means an op can turn into several ops, and every transform rule then has to handle lists.

Decision

An insert that lands strictly inside a range someone else deleted at the same time is dropped, and the delete grows to cover the inserted text. Both orders of applying the two ops give the same result: the sentence and Bob's word are gone.

An insert exactly at either end of the deleted range is kept.

Consequences

  • Every transform returns exactly one op, and transform() stays a few lines per case.
  • Bob loses a word he typed into text that was being deleted. He sees it disappear right away, and in practice he was typing into a sentence somebody else had decided to remove.
  • If this ever matters, splitting deletes is a contained change to src/ops.ts; the room, the protocol and the session would not change. See [[conflict-strategy]].