Expand description
Merge conflicts, as data.
§Why a conflict is a struct and not a string
A conflict is not an error message, it is a FACT about three values: what
the document was at the fork point, what the destination did to it, and what
the branch did to it. Rendering that into "conflict on orders/42" throws
away the only information a resolver needs and forces every caller —
operator, CLI, API client, future automatic resolver — to go back and dig
the three sides out again. So the three sides travel with the conflict.
§Whose side is whose
Consistently, everywhere in this engine:
- ours is the DESTINATION — the branch being merged INTO, as it is now
- theirs is the BRANCH being merged
- base is the common ancestor: the destination as of
base_seq
§Resolution is a write, never a repair
resolve does not patch the conflicting versions and does not reach into
history. It writes the chosen value as an ordinary new write at the tip, and
records what was chosen and why in CONFLICTS. Both halves matter: the
write keeps the append-only contract, and the record is what lets a later
merge know that TakeOurs was a DECISION rather than an unresolved
difference — without it, choosing the destination’s value would leave the
two sides still disagreeing and the same conflict would be reported forever.
Structs§
- Conflict
- One document that two lines of history disagree about.
- Resolution
Record - The durable record that a conflict was settled, and how.
Enums§
- Choice
- Which way a conflict went, as recorded. Kept separate from
Resolutionso the audit record serialises to something stable and readable rather than to an enum shape that would change ifResolutiongrew a variant. - Conflict
Kind - The shape of a disagreement.
- Resolution
- What to do about it.
Constants§
- CONFLICTS
- The audit log of resolved conflicts. Ids are a hash of (coll, id); the version chain on each record is the history of decisions about that document, newest last.
Functions§
- resolution_
for - The most recent decision recorded about a document, if any.
- resolutions
- Every conflict decision currently recorded, sorted by (coll, id).
- resolve
- Settle a conflict by writing the chosen value, append-only, and recording the decision.