Learn / Who changes state
What a reader sees while a change is in flight
Remote and Sync both let a change show before its authority has agreed to it, and they do it by different mechanisms — optimistic layers over a cache, and durable operations replayed over a replica. The shape underneath is the same, so they use the same four words:
confirmed / committed the authority's own last word
+
pending the changes asked for and not yet answered
=
visible what a view draws| Word | Remote | Sync |
|---|---|---|
| The authority's last word | Data.confirmed(projection) | mounted.committed |
| Asked for, not yet answered | optimistic layers and connection overlays | durable operations not yet exchanged |
| What a view draws | the projection itself | the replica's shared slice |
| Answered, either way | settled — the mutation applied or failed | the exchange rebased the operation |
Two rules follow, and they are the reason the words are worth keeping straight:
A view wants the visible read. That is why it is the plain one in both packages: a projection is already visible, and the replica's slice is already optimistic. Neither makes you ask for what you almost always want.
A reporter wants the confirmed one. Something that tells the world a change
happened must not believe it before the authority does. In practice that is an
Agent capability completing on state, which is why Agent.when takes either:
Agent.when({ projection: Data.confirmed(ProjectName), predicate }) // Remote
Agent.when({ source: mounted.committed, predicate }) // SyncNeither package generalises the other. There is deliberately no shared overlay primitive: the algebra is shared, the mechanisms are not, and one implementation forced over both would hide which authority a reader is actually waiting on.
Where the two meet, on rows a server holds and edits a journal owns, the
overlay is still not shared: Remote's rows stay Remote's, and the edits not
yet in them are laid over the rows by each row's revision, by the
application, through foldkit-sync/entity. Editing server data through a
journal is that case.