1 Commits
Author SHA1 Message Date
root 4d2f0b047b Add KDBX merge with KeePass synchronization semantics
Why: picking a winner is what a sync server does when it cannot read the
file. Once it can, the right answer is the union of both edits.

What: kdbx.Merge folds one database into another. Objects are matched by
UUID; the most recently modified version of each wins and the loser is filed
in the entry's history, so nothing is dropped. Deletions apply only when the
deletion is newer than the other side's edit, otherwise the edit resurrects
the object and the stale record is discarded. Groups keep their nesting,
objects move when the other side moved them later, database settings follow
Meta/SettingsChanged, and custom data and icons are unioned by key.
Attachments are remapped from the incoming pool into the target's, since an
entry that kept its old index would silently gain the wrong file.

Proved: twelve tests over independent additions, both conflict directions
with history, deletion, resurrection, nested groups, relocation, attachment
remapping, idempotence, order independence and settings. The last one
marshals a merged database and has keepassxc-cli decrypt an entry that only
ever existed in the incoming copy.
2026-10-29 17:14:01 +01:00