Hypothetical scenario. A Northwind editor remains offline while the server creates snapshots and retires old context. Their permission is revoked before reconnect. Dev proposes merging every operation that names the known document. Priya asks whether old causal knowledge grants current access.
Dev: “The client can identify the draft it edited.”
Maya: “Can we still interpret its operations, and is that principal permitted to submit them now?”
Specify the supported offline horizon, retained synchronization context and behavior outside that horizon. Keep convergence, accepted-operation authority and business validity distinct. The offline duration is a selected teaching assumption, not an existing product promise.
How long can a returning editor reconcile safely?
Offline support requires more than storing a client’s latest text. The chosen merge protocol can need operation identities, dependencies, deletion evidence or other context. Retiring that information changes which returning replicas can reconcile safely. Specify the supported horizon and the response when a client falls outside it.
A full resynchronization may be appropriate after that horizon, but it needs a policy for the user’s unaccepted local edits. Preserve them for a deliberate review or reapplication workflow where possible. Do not label locally composed changes accepted merely because the client retained a document copy.
Budget retained context without promising a serialized size
Hypothetical worked example. Retain the baseline selected two hundred operations per second and one hundred bytes of logical operation payload. Arrival payload is 200 × 100 = 20,000 bytes per second. For a selected twenty-four-hour offline horizon, time is 24 × 60 × 60 = 86,400 seconds.
Uncompressed payload across that horizon is 20,000 × 86,400 = 1,728,000,000 bytes, or 1.728 decimal GB. This excludes identifiers beyond the chosen payload, snapshots, indexes, replicas and physical allocation. It is not a measurement of Yjs or another CRDT’s encoding.
If a client returns after thirty hours while the declared support horizon is twenty-four, it is 30 − 24 = 6 hours outside that contract. A new snapshot does not independently prove that the six-hour gap is recoverable. Use the protocol’s supported full-resync or explicit conflict workflow instead of discarding dependencies and hoping the text still looks right.
Make compaction depend on the rejoin contract
Hypothetical scenario. Snapshot S summarizes accepted operations through a causal frontier. An offline client still holds an operation naming an element deleted before S. If the server discarded the element's identity and necessary mapping, accepting that operation as though the history were complete may corrupt interpretation or resurrect deleted content.
| Rejoin evidence | Purpose | Failure response |
|---|---|---|
| Snapshot identity | Known base state | Fetch required base |
| Client causal frontier | History client may reference | Compare retention boundary |
| Retained mappings / tombstones | Interpret old operations | Resnapshot / explicit rebase |
| Current authorization | Admit proposed edits | Reject revoked client |
Causal stability requires assumptions about which replicas or clients may still submit relevant old operations. An indefinitely offline client prevents unconditional reclamation under some models. Define a retention horizon and require a resnapshot or explicit rebase when the client falls behind it. A rebase is a user-visible interpretation step, not proof that the original operation means exactly the same thing.
Authorization applies before old work is admitted. A revoked client cannot regain edit authority because its CRDT operations converge. Keep the accepted-operation set and current permission rule separate from snapshot transport. Preserve operation identity across reconnect to suppress duplicates, and make an unresolved stale-base edit visible rather than silently dropping it.
In the wild: synchronization is an implementation contract
Yjs documents its shared types, updates and provider separation. Inspect the chosen persistence and synchronization behavior before specifying compaction or restore. A generic CRDT label does not establish compatible history retention, application durability or current document permission.
Convergence and validity are different requirements
A merged document can converge while containing an invalid business state. Two people can independently add conflicting approval statements or change fields whose relationship must remain constrained. Separate collaborative text behavior from authoritative workflow decisions.
Presence and cursor positions are usually ephemeral observations. Do not retain them as durable document operations unless the product requires that history. A disappearing cursor does not establish that a person's last edit failed.
Deletion and compaction need particular care. Logical deletion markers or retained identifiers can be necessary for interpreting later offline operations. Garbage collection depends on the chosen algorithm and knowledge about participants, not simply elapsed age.
An offline editor returns after permission revocation
Hypothetical failure scenario. A user edits offline, then loses access to the document. On reconnect, a synchronization endpoint merges their operations without checking current permission because the client once possessed a valid document state.
Replication context proves neither continuing identity nor continuing authority. Validate permission at the accepted-operation boundary and define how rejected offline edits are presented to their author. The client may retain local content, but it cannot force the shared document to accept it.
Snapshots and synchronization caches can also disclose restricted content. Scope read access and history retention explicitly. An invitation revoked today cannot retroactively erase every copy already delivered, so keep that limit distinct from preventing future synchronization.
Three collaboration misconceptions
“A CRDT means no conflicts matter.” It provides particular convergence semantics. User intent, application invariants and permissions still require decisions.
“A snapshot replaces the synchronization protocol.” A snapshot records state, but clients still need compatible context to reconcile edits or a declared full-resync path.
“Receiving the same operations is enough.” Interpretation, dependencies and algorithm rules determine the result. Raw arrival order is not a universal correctness rule.
Start with a narrow collaborative object
Select a maintained implementation whose actual data model matches the product. Begin with plain text or a clearly defined structured object, then test concurrent insertion, deletion, undo, reconnect and long-offline behavior. Explain unsupported merges rather than pretending every conflict has a natural answer.
Monitor accepted and rejected operations, synchronization lag, replay cost, snapshot compatibility and history growth. Exercise restore with offline clients still holding old state. Recovery that produces readable text but cannot interpret those clients is incomplete.
Reject a custom merge algorithm built from timestamps and string offsets unless its requirements and correctness argument are genuinely established. Reject unlimited offline history without storage and permission semantics. Use explicit version conflicts when they better fit the business.
What convergence does not guarantee
The operation-size example is a hypothetical payload budget, not a measurement of a particular replicated object. Metadata, snapshots and retained history change storage demand. Convergence applies under the selected operation model; permission and policy approval still need independent authoritative decisions.
Restore accepted history before accepting new merges
A restored server can be internally readable while missing accepted operations known to a surviving client. Decide which history remains authoritative and how the selected protocol recovers compatible state. Do not reset identities so that old operations become new edits, and do not let a stale restored permission grant bypass a later revocation.
Keep publication or approval tied to an explicit accepted document revision. A convergent draft can still require human interpretation where concurrent statements conflict. The next case changes the workload to crawling, where the main retained obligation is a bounded and polite fetch rather than a shared edit.
Challenge the proposed mechanism
A client returns after the supported history horizon. May the server just discard unknown operations and report synchronization success?
Reveal the design reasoning
No. Return a clear stale-base outcome and the resnapshot/rebase path. Preserve the recoverable user proposal if the product supports it, while checking current permission. Silent omission misrepresents accepted history.
Decision and reconsideration: Compact only under a declared client and retention model. Treat convergence, rejoin completeness and authorization as separate acceptance checks.
Defend returning-client behavior
The client has a valid causal context but access was revoked. May it alter the shared draft?
Check accepted authority
No under the selected current-permission policy. Context describes history; it does not grant continuing permission. Return a deliberate denial and handle local edits separately.
A snapshot contains readable text. May old context be removed automatically?
Respect the protocol’s retention rule
Not from readability alone. Returning replicas may require identifiers or dependencies absent from the visible text. Establish safe compaction or a supported resynchronization boundary.
The thirty-hour client exceeds the twenty-four-hour horizon. Is silently dropping its edits acceptable?
Expose the unsupported transition
The contract should give an explicit recovery or review path. It must not misreport unaccepted local edits as durably merged or silently reinterpret unsupported operations.
The collaboration pair bounds accepted work from known participants. Page 57 moves to discovered public supplier links, where the frontier must decide which candidates deserve bounded fetching rather than accept every input as an obligation.
Northwind decision log
Bound offline support with retained protocol context and explicit resynchronization.
Reauthorize accepted operations and preserve approval as a separate transition.
Next, build a crawler frontier with resource and host-policy boundaries.
Go deeper: history and distributed recovery
- Book chapter: Distributed Computing: Principles, Algorithms, and Systems, chapter 3: Logical time — Ajay D. Kshemkalyani and Mukesh Singhal. Reason about dependencies independently of wall-clock arrival.
- Book chapter: Distributed Computing, chapter 13: Checkpointing and rollback recovery — the same authors. Inspect recovery context beyond a visible snapshot.
- Video lecture: CRDTs: The Hard Parts — Martin Kleppmann. Examine practical history and operation-model difficulties.
- Primary document: Yjs documentation — Yjs project. Check the actual supported synchronization model.