Two editors at once

The editor shows who else is on a page and who holds the lock. The lock is advisory - what actually prevents a lost update is a version check at save time.

Open a page someone else is already editing and cmssy tells you so. It does not stop you, and the distinction between those two sentences is the whole of this page.

Presence

An open editor sends a heartbeat. Each heartbeat records that you are on the page and pushes your expiry 30 seconds into the future; the record reaps itself once nobody refreshes it. Close the tab, lose your connection, or put the laptop to sleep, and you drop off the page within half a minute without anyone having to clean up.

The editor reads that list back: who is here now, and which of them holds the lock.

The lock

The first person to arrive holds it. If the holder's presence has expired - they closed the tab, their network died - the next heartbeat takes the lock over automatically, so an abandoned tab cannot leave a page locked forever. There is also an explicit takeover for the case where the holder is still present but you need the page anyway.

The lock is advisory. Nothing in the save path refuses a write because someone else holds it. It exists so that a person can see a colleague is in there and decide to wait, or ask, or take over deliberately - not to make the decision for them.

What actually protects your work

Every save carries the version the client loaded. If the page moved on in between - because the other editor saved first - the write is refused with VERSION_CONFLICT, and the client refetches rather than overwriting work it never saw.

This is the real guarantee, and it is worth understanding why it is separate from the lock. A lock that is not enforced cannot lose your work; a version check that is enforced cannot be talked out of it. Enforcing the lock instead would mean a crashed browser could block a page until a timeout, which is a worse failure than being asked to refresh.

The two answer different questions. The lock answers "is someone else in here?". The version answers "am I about to overwrite something?".

What this is not

This is not collaborative editing. Two people typing into one page do not see each other's characters appear, and there is no merge: the second save is refused, the client reloads, and the work is redone on top of what landed. For simultaneous writing, split the work by block or by page rather than by paragraph.

Next steps