Work around editByPath merge failure after split#163
Conversation
When blocks are created by editByPath with splitLevel>=2, the CRDT nodes are linked via insNextID. A subsequent cross-boundary editByPath to merge them back fails silently because the SDK's Phase 3 Range Narrowing follows the insNextID chain and narrows the collection range to empty. Decompose the single cross-boundary edit into two same-parent operations: (1) delete the next block element, (2) insert its inline children at the end of the first block. Both edits stay within the same parent, avoiding the Range Narrowing path. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Verification: verify:selfResult: ✅ PASS in 92.5s
Verification: verify:integrationResult: ✅ PASS |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
editByPathinto two same-parent operations to avoid the SDK's Phase 3 Range Narrowing bugProblem
When pressing Enter in a paragraph (e.g., "as|df" → "as" + "df"), the split creates CRDT nodes linked via
insNextID. A subsequent backspace callingeditByPath([blockPath, inlineCount], [nextPath, 0])fails silently because the SDK's Range Narrowing follows theinsNextIDchain and narrows the collection range to empty.Fix
Replace the single cross-boundary edit with two same-parent operations:
editByPath(nextPath, [parentPath, nextIdx+1])editBulkByPath(...)Both operations stay within the same parent element, avoiding the Range Narrowing code path.
Related SDK issue: yorkie-team/yorkie-js-sdk#1237
Test plan
pnpm verify:fastpasses (all 622 docs + 1204 sheets + 167 frontend tests)🤖 Generated with Claude Code
Summary by CodeRabbit