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?
Read 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.
Original practice scenario: A hypothetical productivity platform caches document permissions. A user is removed from a team while a long-running export is active. Design the authorization boundaries.
Read model answer +
Define when revocation must take effect and which actions require a fresh decision. A cache expiration policy alone may leave long-lived jobs authorized after their permission changes.
Work through it
Attach tenant, principal, resource and policy version to authorization decisions; keep caches scoped to those identities rather than just document URLs.
Recheck authority at sensitive stages such as starting an export and delivering its output, with a revocation event or bounded cache lifetime.
Cancel or quarantine affected jobs, retain an audit trail without document contents, and test delayed revocation messages and service partitions.
Tradeoffs to discuss
Immediate checks improve revocation guarantees but add dependency latency; bounded caches need an explicitly accepted exposure window.
Common pitfalls
Do not authorize a download solely because an earlier computation was permitted.
A user changing tenants or reusing a session must not inherit cached authority from another organizational context.