# A Desktop Document Is a Distributed State Machine

> A desktop office app feels local, but its hardest job is reconciling edits made across devices, people, and unreliable networks.

- **Author:** Uğur Akçıl (https://softwaredeveloper.biz/author/ugur-akcil)
- **Topic:** systems-architecture
- **Published:** 2026-11-26T17:27:05+00:00
- **Canonical URL:** https://softwaredeveloper.biz/p/a-desktop-document-is-a-distributed-state-machine

## Key Thesis

A desktop office app is not just a different window on a server document. It introduces another place where authoritative edits can happen. Three-way merge explains when independent changes combine safely, and why overlapping changes still need clear handling and human judgment.

---

The news around Nextcloud Office’s desktop app invites a familiar question: why bring office work to the desktop when a browser can already open a document? The answer is not simply that some people prefer desktop software. A local app changes where work can happen, how quickly it responds, and what happens when the network disappears.

That last question is the architectural one. Once a document can be edited in more than one place, the system must decide how separate histories become one shared result. A useful way to understand that problem is the three-way merge, a small mechanism with consequences for everything from collaborative writing to distributed data systems.

## Three copies, one decision

Imagine a document at the moment a device last synchronized. Call that version the base, B. While offline, a person edits a local copy, L. Meanwhile, a colleague edits the shared copy, R. When the device reconnects, the software compares all three versions rather than blindly replacing one with another.

The comparison asks a practical question: what changed from B to L, and what changed from B to R? If the changes affect separate parts of the document, the system can often apply both. If both changes affect the same passage, it has encountered a conflict, not a puzzle with an automatically correct answer.

This is the intuition behind three-way merge in version control and many synchronization systems. The base matters because it distinguishes a new edit from text that was already present. Comparing only L with R might show that two copies differ, but not which changes are new or whether one side simply lacks an edit made by the other.

<svg class="acad-diagram" viewBox="0 0 680 180" xmlns="http://www.w3.org/2000/svg">
<rect x="30" y="64" width="150" height="54" stroke="currentColor" fill="none"/>
<text x="54" y="87" fill="currentColor" font-family="monospace" font-size="12">Base B</text>
<text x="47" y="104" fill="currentColor" font-family="monospace" font-size="12">last shared</text>
<line x1="180" y1="91" x2="260" y2="46" stroke="currentColor"/>
<line x1="180" y1="91" x2="260" y2="136" stroke="currentColor"/>
<rect x="260" y="20" width="150" height="54" stroke="currentColor" fill="none"/>
<text x="282" y="43" fill="currentColor" font-family="monospace" font-size="12">Local L</text>
<text x="277" y="60" fill="currentColor" font-family="monospace" font-size="12">offline edits</text>
<rect x="260" y="108" width="150" height="54" stroke="currentColor" fill="none"/>
<text x="280" y="131" fill="currentColor" font-family="monospace" font-size="12">Remote R</text>
<text x="275" y="148" fill="currentColor" font-family="monospace" font-size="12">colleague edits</text>
<line x1="410" y1="47" x2="485" y2="91" stroke="currentColor"/>
<line x1="410" y1="135" x2="485" y2="91" stroke="currentColor"/>
<circle cx="510" cy="91" r="25" stroke="currentColor" fill="none"/>
<text x="501" y="95" fill="currentColor" font-family="monospace" font-size="12">?</text>
<line x1="535" y1="91" x2="590" y2="91" stroke="currentColor"/>
<rect x="590" y="64" width="70" height="54" stroke="currentColor" fill="none"/>
<text x="600" y="87" fill="currentColor" font-family="monospace" font-size="12">Merge</text>
<text x="600" y="104" fill="currentColor" font-family="monospace" font-size="12">or ask</text>
</svg>

Three-way merge is not magic, and office documents make the distinction important. A plain text file has a relatively visible structure. A modern document can contain paragraphs, tables, comments, embedded images, formatting, and application-specific metadata. Two edits that look independent on screen may touch the same underlying object, while a file-level comparison may see only a changed package.

## The cost of pretending edits are simple

The design choice is not simply “merge” or “do not merge.” A product can prevent simultaneous editing, serialize writes, create a conflict copy, or attempt to merge selected document structures. Each policy trades convenience against the risk of silently losing work, and each creates a different recovery experience.

| Dimension | Optimistic merge | Single-writer control | Conflict copy |
|---|---|---|---|
| Editing freedom | High, including offline work | Lower during contention | High |
| Conflict handling | Combines safe changes, flags overlap | Prevents many concurrent writes | Preserves competing versions |
| User burden | Low when merge succeeds | Waiting or lock recovery | Manual comparison |
| Main risk | Incorrect merge assumptions | Stale or abandoned locks | Duplicate work and confusion |

A system that promises effortless collaboration may hide important distinctions. For example, a successful file upload does not prove that the intended edits survived, just as a successful database write does not establish that the write was based on current information. Reliable synchronization needs versions, identity for changes, and an honest way to report when the system cannot infer intent.

This is why offline support is a product and operations decision, not merely a checkbox. It brings value to people on unreliable connections, in travel, or in workplaces where a browser session is a poor fit. It also shifts costs toward conflict handling, support, storage of versions, and testing across operating systems and document formats.

## What the desktop changes

A desktop app moves part of the user experience out of the browser and closer to the file system. That can improve responsiveness and make familiar workflows possible, but it adds another software surface to update, secure, and support. Teams must decide what the app keeps locally, how authentication expires, and what a user sees when a document changes elsewhere.

These details matter because local convenience can create quiet ambiguity. Is the visible file the latest shared version, a local draft awaiting upload, or a conflict copy? Does “saved” mean written to disk, accepted by the server, or visible to collaborators? Good interfaces make these states legible instead of compressing them into one reassuring icon.

The same questions appear in other systems. An ad platform may receive repeated conversion events and need idempotency to avoid counting them twice. A robot may buffer sensor readings through a network outage and later reconcile its record with a control system. In each case, local action and shared truth are related, but they are not identical.

AI automation raises the stakes further. An assistant that edits a document can generate changes quickly, but speed does not resolve whether its version is based on the right context or whether a person has since revised the same passage. The useful engineering question is not only whether the model can produce a patch, but whether the surrounding system can show its basis, preserve alternatives, and support a deliberate decision.

## Design for recovery, not just sync

For a production team, the first step is to define the document’s source of truth and the conditions under which edits can proceed independently. Then test the uncomfortable cases: a device reconnecting after hours, two people editing the same table, an expired login during upload, or a desktop client receiving a server-side rename.

Measure recovery as carefully as successful synchronization. Track conflict frequency, time to resolve, duplicate or lost-file reports, and the share of users who understand the available choices. A low conflict rate can be misleading if the product silently overwrites changes or makes conflict copies difficult to find.

The deeper lesson is that a desktop office app is a compact distributed system. Its success depends on more than opening a document: it depends on whether people can tell what is current, what changed, and

## References

- [Hacker News: Nextcloud Office Desktop app](https://nextcloud.com/blog/euro-office-comes-to-your-desktop-with-the-nextcloud-office-desktop-app/)
- [Uğur Akçıl (ugur.io)](https://ugur.io)

---

## Discussion (1 notes)

- **Greg Miller** (Principal SRE / DBA · Reston, VA · 2026-11-26): Three-way merge is fine until you hit a Postgres deadlock due to simultaneous updates on different nodes. Then you're stuck with manual conflict resolution and a restore from backups, if you tested them recently.
