System Design Atlas

Collaborative documents with offline edits

02 / 10Worked example

Business rules and operational targets

Which rule allows simultaneous inserts to converge regardless of the delivery order?

The system boundary leads to a business rule: All replicas with the same accepted set of changes show the same text. A change shall be effective at most once. Write permission is checked for server-side acceptance; offline creation does not guarantee later acceptance. An operating goal, on the other hand, describes a measurable property and is initially a test assumption. The character encoding UTF-8 determines the number of bytes transmitted; a visible character may require several bytes.

Starting point Display pending and confirmed changes separately.

Assumptions for the example case

Our own fictitious example design: A text document with a character sequence and comments; several devices per person; deterministic merging; server-side checked permissions during synchronization. Figures and quality goals are illustrative test assumptions. Outside are table formulas, encrypted end-to-end cooperation and automatic content conflict resolution.

Rules governing the result

Acceptance gate · Identity, right, bytes and operational identity

IdentityNotified
Write permissionValid for acceptance
Payload≤ 65,536 UTF-8 bytes
Operationidentical at most once

Offline creation preserves work; server-side adoption decides on the common change inventory.

X and Y are created simultaneously. Set a deterministic merging rule. Both orders of delivery result in AXYB.

Business requirements (functional)

Further reading
Invariant
All replicas with the same accepted set of changes show the same text. A change shall be effective at most once. Write permission is checked for server-side acceptance; offline creation does not guarantee later acceptance.
Boundary test
A single change may contain at most 65,536 UTF-8 bytes: accept 65,535 and 65,536; reject 65,537. Character count and byte count are separate; truncated multibyte characters are invalid.
Unresolved outcome
Server accepts O-91, the response is lost. Device still shows pending and queries the same change state. After reply, confirmed appears; a later permission withdrawal does not remove the already confirmed historical change.

Quality goals (non-functional)

Further reading
Local acceptance
Fictitious target: 95% of local administrative commands within 800 ms in the peak-load profile 50 people in a document × 2 = 100 changes/s as hotspot. External rendering and media transfer shall be measured separately.
Traceability
Every rejected or open operation shows its reason, latest evidenced state and responsible role. Check this in a sample after the failure from step 7.

Define convergence

Define convergence

Define a deterministic merge rule.

X and Y are created simultaneously.

Both orders of delivery result in AXYB.

Alternative considered
A last-arrival-wins policy can produce different results.
Trade-off
A technical ordering rule does not decide whether the text makes sense.
Reassess
Content conflicts require additional moderation.

Terms in this step

Define convergence
Both orders of delivery result in AXYB.

Try it yourself

Deliver O-91 and O-92 in both orders. Provide final text and content-level limit.

A hint for your attempt

Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.

Compare with a possible solution
First part of the solution
Both orders result in AXYB once both changes are accepted, because the established order sets X before Y.
Second part of the solution
Convergence means the same text with the same set of changes. Whether AXYB makes sense in terms of content is decided by the team.

Apply to your project

Which corresponding assumption in your project would you check first? Use as an occasion: Content conflicts need additional moderation.

Step 3 Examined: Measure fan-out.