Extend intent-preserving edits to table cells (Phase 4)#152
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Use splitLevel=1 to split inline nodes at style boundaries and styleByPath to apply attributes. This preserves concurrent text edits that were previously lost to last-writer-wins block replacement. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Phase 2 now uses splitLevel=1 + styleByPath instead of LWW block replacement. Remove the styleByPath limitation note since SDK 0.7.6 supports the split+style pattern for inline styling. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Cover: text insert+style, non-overlapping styles, overlapping styles, text delete+style, and style+block split convergence. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Superseded by YorkieDocStore-level concurrent tests in yorkie-doc-store-concurrent.integration.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
DFS into table/row/cell nodes so insertText and deleteText work for cell-internal blocks via character-level editByPath, replacing the previous LWW table-wide updateBlock approach. Also extends getBlock, getBlockByRegion, setBlockByRegion for cell paths. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Verify native CRDT inline styling works inside table cells, including style after text insertion. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add getBlocksArrayForPath helper to locate the parent Block[] array for cell-internal blocks, enabling split/merge cache updates within cell.blocks instead of only top-level arrays. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Four scenarios: same-cell text insert merge, different-cell independence, text insert + bold in same cell, and split + text insert in same cell. All converge via character-level CRDT. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Doc.insertText, deleteText now call store.insertText/deleteText instead of applyInsertText + updateBlockInStore (full block replacement). Similarly, applyInlineStyle and mergeBlocks route through store.applyStyle/mergeBlock for both top-level and cell blocks. Removes splitBlockInCellInternal, applyStyleToBlock, and related LWW cell routing that is no longer needed. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Remove orphaned normalizeInlines JSDoc comment, simplify getRegionBlocks header/footer index to blockPath[1] (dead ternary branch removed), and fix deleteBlock cache update to use getBlocksArrayForPath for cell-internal block support. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
deleteSelection did not handle cross-block selection within a single table cell — getBlockIndex only searches top-level blocks. Add cell-internal path that uses cell.blocks for index lookup, enabling delete/backspace of multi-block selections in cells. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Enable with localStorage.setItem('DOCS_DEBUG', '1').
Logs cache vs Yorkie Tree state before/after insertText,
deleteText, splitBlock, mergeBlock for diagnosing divergence.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
mergeBlock computed the boundary position from the cache's inline count, but after previous split/merge operations the Yorkie Tree may have more inline nodes than the cache (split fragments). This caused the boundary deletion to include trailing inlines, losing text. Read inline count from the actual tree node instead. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 52 minutes and 22 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe PR refactors Yorkie document editing to use native CRDT operations for inline styling (via Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Keep table cell concurrent integration tests added in this branch. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Verification: verify:selfResult: ✅ PASS in 117.6s
Verification: verify:integrationResult: ✅ PASS |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
resolveBlockTreePath()with DFS — no new*InCellstore methods neededDoc.insertText/deleteText/applyStyle/mergeBlocksthrough store's fine-grained methods instead of full block replacement (updateBlockInStore)mergeBlockreading inline count from cache instead of tree, causing text loss after split/merge sequencesdeleteSelectiondidn't handle cell-internal blocks)splitBlockInCellInternal,applyStyleToBlock, etc.)Key finding
Doc.insertText/deleteTextwere usingstore.updateBlock(full block replacement) even for top-level blocks — Phase 1-3's character-level store methods were never reachable from the actual UI path. This PR fixes that.Test plan
pnpm verify:fastpasses🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests