ORIGINAL COMPANY-CONTEXT PRACTICE
Maintain a shared document through retries
Original practice scenario: Design a hypothetical cloud document editor where users insert text concurrently and connections drop. What must an edit protocol guarantee before discussing implementation choices?
Written for independent practice using company context; this is not a verified question from a company interview.
A REASONED APPROACH
Model answer.
Start with convergence, stable operation identity and an explicit user-visible conflict policy. Reliable delivery does not imply that independently ordered text edits produce the same document.
Work through it
- Describe operations using stable character or position references and track the document revision or causal state against which each edit was created.
- Choose a consistent transformation or replicated-data approach, then define how concurrent inserts, deletes and undo interact.
- Deduplicate retried operations, persist acknowledgments and replay from checkpoints; test all arrival permutations for a small set of conflicting edits.
Tradeoffs to discuss
- Central ordering simplifies reasoning but adds coordination; local-first editing improves offline responsiveness while increasing metadata and reconciliation complexity.
Common pitfalls
- Undo should reverse the user intention rather than blindly restoring an obsolete document snapshot.
- Include cursor movement and deleted anchors in tests instead of validating only final text length.