Skip to content

refactor: improve ConflictResolver API with current/proposed context#35

Merged
brunoga merged 1 commit intomainfrom
refactor/conflict-resolver-api
Feb 18, 2026
Merged

refactor: improve ConflictResolver API with current/proposed context#35
brunoga merged 1 commit intomainfrom
refactor/conflict-resolver-api

Conversation

@brunoga
Copy link
Copy Markdown
Owner

@brunoga brunoga commented Feb 18, 2026

This PR enhances the ConflictResolver interface to make it suitable for advanced conflict resolution strategies (like semantic merging or validation).

Key changes:

  • Refined Resolve signature: Resolve(path string, op OpKind, key, prevKey any, current, proposed reflect.Value) (reflect.Value, bool).
  • Passing the current value at the target path allows resolvers to make informed decisions without re-traversing the object.
  • Returning a reflect.Value allows the resolver to perform a merge (e.g., adding two numbers or performing a 3-way string merge) instead of just accepting or rejecting the change.
  • Fixed customDiffPatch which was missing the dependencies method required by the diffPatch interface.
  • Updated all CRDT-related resolvers and tests.

- Updated ConflictResolver.Resolve to include both current and proposed reflect.Value\n- Changed Resolve to return (reflect.Value, bool) to allow for merged results\n- Updated all applyResolved implementations to provide the necessary context\n- Updated LWW and State resolvers to match the new signature\n- Fixed customDiffPatch implementation of diffPatch interface
@brunoga brunoga merged commit 74c8348 into main Feb 18, 2026
1 check passed
@brunoga brunoga deleted the refactor/conflict-resolver-api branch February 18, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant