refactor: improve ConflictResolver API with current/proposed context#35
Merged
refactor: improve ConflictResolver API with current/proposed context#35
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enhances the
ConflictResolverinterface to make it suitable for advanced conflict resolution strategies (like semantic merging or validation).Key changes:
Resolvesignature:Resolve(path string, op OpKind, key, prevKey any, current, proposed reflect.Value) (reflect.Value, bool).currentvalue at the target path allows resolvers to make informed decisions without re-traversing the object.reflect.Valueallows 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.customDiffPatchwhich was missing thedependenciesmethod required by thediffPatchinterface.