-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
ChronDB’s data model builds on Git commits to record immutable histories. However, when multiple updates touch the same key, traditional Git merges may not yield deterministic outcomes for structured data (e.g., JSON documents).
Why
Users and operators must be able to choose how conflicts are resolved. In distributed systems, common strategies include:
- LWW (Last Write Wins) — simple but non-deterministic under clock skew.
- JSON Merge Patch (RFC 7386) — structured, good for document merges.
- Custom Hook — developer-defined pure function deciding the merge result.
What to do
- Add config option per namespace:
merge.policy = lww | json-merge | hook
- Implement JSON merge using JSON Merge Patch (RFC 7386).
- Expose hook registration API in Clojure, allowing a user-defined merge function:
(fn [old new] merged)
. - Include tests for deterministic outcomes under each policy.
Acceptance Criteria
- Merge policy configurable globally and per namespace.
- JSON merge adheres to RFC 7386 semantics.
- Hooks executed safely with sandboxing.
- Unit tests for conflict scenarios.