System Design Atlas

Collaborative documents with offline edits

05 / 10Worked example

Authoritative data and states

What is the effect of the permission withdrawal before or after the acceptance of the change?

The interfaces require an authoritative state. 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. The following table separates current states from the evidence of their formation.

Starting point Compare identity and canonical payload.

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.

Data relationships and permitted transitions

Replicates, operations and causal change inventory

Document D-91Base AB
D-91 → O-91G-91 adds X
D-91 → O-92G-92 adds Y
O-91Item 1 · X
O-92Position 1 · Y
O-91 → AXYBOperation ordering
O-92 → AXYBOperation ordering
AXYBConverged text
local → pendingPending → Confirmed / RejectedConfirmed → Combined → Archived

Text is built from accepted operations; snapshots compact a known revision watermark without replacing permission checks.

Write permission ends during offline work. Check current rights in the server commit. Subsequently submitted changes may be rejected.

Entities and relationships

EntityAuthoritative dataResponsibility
Document D-91Confirmed set of changes, rights versionLeading accepted content.
Devices G-91 and G-92Local changes, last confirmed statusOffline version remains distinguishable from server confirmation.
Changes O-91 and O-92Device, counter, parent reference, contentStable identity and deterministic order.
Permission grantPerson, document, role, current versionIs considered when new changes are adopted.
SnapshotText and full change stateAccelerates loading; it does not replace pending device changes.

Document D-91

Authoritative data
Confirmed set of changes, rights version
Responsibility
Leading accepted content.

Devices G-91 and G-92

Authoritative data
Local changes, last confirmed status
Responsibility
Offline version remains distinguishable from server confirmation.

Changes O-91 and O-92

Authoritative data
Device, counter, parent reference, content
Responsibility
Stable identity and deterministic order.

Permission grant

Authoritative data
Person, document, role, current version
Responsibility
Is considered when new changes are adopted.

Snapshot

Authoritative data
Text and full change state
Responsibility
Accelerates loading; it does not replace pending device changes.

Permitted state transitions

Starting pointTargetCondition
LocalPendingChange permanently stored in the device.
PendingbestätigtServer checks right and accepts change.
PendingRejectedRight withdrawn or content invalid; local copy remains exportable.
bestätigtMergedAll required dependent changes are present.
MergedarchiviertThe snapshot contains the documented revision.
RejectedterminalNew acceptance needs new legitimate intent; old change is not quietly accepted.

Local

Target
Pending
Condition
Change permanently stored in the device.

Pending

Target
bestätigt
Condition
Server checks right and accepts change.

Pending

Target
Rejected
Condition
Right withdrawn or content invalid; local copy remains exportable.

bestätigt

Target
Merged
Condition
All required dependent changes are present.

Merged

Target
archiviert
Condition
The snapshot contains the documented revision.

Rejected

Target
terminal
Condition
New acceptance needs new legitimate intent; old change is not quietly accepted.

Check permissions at acceptance

Check permissions at acceptance

Check current permissions when the server commits.

Write permission ends during offline work.

Subsequently submitted changes may be rejected.

Alternative considered
The old offline permission grant would bypass withdrawal indefinitely.
Trade-off
Local work can remain outside the document.
Reassess
An explicit offline contract is agreed.

Terms in this step

Check permissions at acceptance
Subsequently submitted changes may be rejected.

Try it yourself

A write permission is withdrawn before or after server acceptance. Determine both outcomes.

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
Withdrawal first: new change is rejected and remains locally exportable.
Second part of the solution
Acceptance first: the change remains historically confirmed. Subsequent permission withdrawal does not remove it retroactively.

Apply to your project

Which corresponding assumption in your project would you check first? Use as an occasion: An explicit offline contract is agreed.

Step 6 Examined: Separate Gateway and Merge.