Learn / Who changes state
What a reader sees while a change is in flight
Both foldkit-remote and foldkit-sync show optimistic changes immediately before the server confirms them. Remote layers optimistic patches over its normalized cache; Sync replays pending durable operations over its committed replica slice. Because both share the same model, both use the same four terms:
visible = confirmed / committed + pending
| Concept | In foldkit-remote | In foldkit-sync |
|---|---|---|
| Authority's last word | Data.confirmed(projection) | mounted.committed |
| Pending, unanswered work | Optimistic layers and overlays | Durable operations in the outbox |
| What views render | The projection itself | The replica's shared slice |
| Settled either way | settled (applied or failed) | Exchange rebased the operation |
Two rules follow from separating visible from confirmed state:
- Views read the visible state. Passing a Projection to
foldkit-remoteor reading afoldkit-syncslice gives you the optimistic view by default, because that is what screens want. - Reporters wait for the confirmed state. Any check confirming a write to an outside caller — such as an
Agent.whencompletion predicate — must readData.confirmed(projection)(Remote) ormounted.committed(Sync). That way it waits for the server instead of trusting a local edit.
Remote and Sync keep separate implementations instead of hiding behind one shared overlay abstraction, because a single wrapper would obscure which authority a reader is waiting on. Where server-owned rows are edited offline through a journal (foldkit-sync/entity), the application lays pending journal edits over Remote rows by row revision; see Editing server data through a journal.