The integration point with the live database: stages every clean entry through Table’s
put_from_buffer/patch_from_buffer/delete_from_buffer, in the order merge produced —
never through a lower-level path that could smuggle in a historical _seq, and never through
the trigger-firing put/patch/delete (the entry’s originating live write already fired
them once). A TableError::Unique here means the entry was clean against other buffers but
violates a unique constraint against the CURRENT registry state (which may have changed since
the entry was buffered) — that also becomes a Conflict, not a silent error. Any other
TableError (validation, not-found on a patch, …) is surfaced to the caller instead of being
folded into a conflict, since it is not something conflict resolution can fix.
K-way merges every buffer entry by buffered_at — this is the relative order WITHIN one merge
operation only. It never looks at what is already committed in the database: whatever comes out
as clean still has to go through apply_clean_entries, which stages each entry through the
table’s normal put/patch/delete path and so always lands after the current end of the log,
no matter how early buffered_at claims to be — this is what satisfies the “never retroactive”
rule, not anything in this function.
Reads every *.jsonl file directly inside folder (not recursive), in filename order, and
every line inside each file in file order — this is the enumeration order later fed to merge
before buffered_at sorting takes over.
Reads every folder in folders via parse_buffer_folder and concatenates the results in the
order the folders were given — merge is the one that imposes the real buffered_at order.
Picks one of conflict’s versions (Ours/Theirs, both by explicit source name — there is no
“current vs incoming” side at this generic level, that distinction belongs to whatever UI drives
this, see the TODO below) or builds a fresh Put from Custom. Panics if the named source is
not one of conflict’s versions — the caller is expected to only offer resolutions built from
conflict.versions in the first place.