Skip to content

[Merge Strategy] Configurable Conflict Resolution Policies #49

@avelino

Description

@avelino

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions