fix: correct path navigation, map-nested writes, and CRDT Text convergence#39
Merged
fix: correct path navigation, map-nested writes, and CRDT Text convergence#39
Conversation
…gence internal/core/path.go: - Navigate: check keyed-slice unconditionally before falling back to positional index, fixing non-numeric keys (e.g. "todo", "in-progress") that were never resolved because the old guard required IsIndex=true - Set/Delete: replace ResolveParent+switch with recursive setAtPath/ deleteAtPath that copy-modify-put-back at every map boundary, fixing silent write loss when a value is nested inside a map - makeMapKey: extracted helper with Convert for named-string and uint key types, fixing a panic on uint-keyed maps crdt/crdt.go: - Replace post-apply full-tree remergeTextFields walk with per-op textAncestorPath detection during the Merge filter loop; Text field paths are collected in O(depth) per op and merged via MergeTextRuns after the LWW apply — no tree walk, no index-alignment bug on keyed slices - Remove the early break in textAncestorPath so that TextRun sub-field ops (e.g. /Body/<id>/Deleted, depth 3) correctly walk up to the Text ancestor Tests added for each fix in path_test.go and crdt_test.go.
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.
internal/core/path.go:
crdt/crdt.go:
Tests added for each fix in path_test.go and crdt_test.go.