Repository navigation
Conversation
Sync and undo for DataNodeAdded/DataNodeRemoved/ValueModified, with array-position transform rules. Depends on fix-ot-client-convergence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gohabereg
force-pushed
the
docs/openspec-add-data-node-operations
branch
from
October 17, 2026 18:11
e6d4bd2 to
cf3df7f
Compare
Reversean
requested changes
Nov 4, 2026
| ### D6. Same-key conflicts that do not shift | ||
|
|
||
| - **Modify vs. Modify, same block and key.** Last-writer-wins in server order: `op` becomes `Neutral` iff `against` comes later (`againstIsLater`). Otherwise `op` is kept and applied after `against`. This is the rule `fix-ot-client-convergence` sets for values. | ||
| - **Insert vs. Insert on the same object key** (last segment not an integer). The same rule as Modify. With replace-on-insert (D4), the later write in server order wins on the server and on every client, exactly as for values. |
Contributor
There was a problem hiding this comment.
For concurrent inserts at meta ({url: 'a'}) and meta.url ('b'), processing meta first leaves the server at b, but its broadcast overwrites the second client's pending b with a. Define ancestor/descendant conflicts for replace-on-insert as well as exact-key ties.
|
|
||
| ### D7. Undo/redo | ||
|
|
||
| `Operation.inverse()` already swaps Insert ↔ Delete with the same payload and swaps `payload` / `prevPayload` for Modify. With D3 and D4 in place, collaboration undo of a data operation works without new code. Core's `UndoRedoManager` replays `event.data` for Added/Removed (the raw subtree, which matches the model) and inverts Modified, so it works once D1 (skip the marker), D2 (attribution) and D4 (`modifyData`) are in place. |
Contributor
There was a problem hiding this comment.
Two local inserts at items.0, followed by a remote insert at items.1, leave both stored undo indexes at 0 under D5. Undoing twice then deletes the remote element and leaves the first local element; the stack needs rebasing in each entry's historical coordinates.
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.
What
Planning only: the
add-data-node-operationsOpenSpec change. It is stacked on #210, so review that one first.Why
Data-node and value changes (
DataNodeAddedEvent,DataNodeRemovedEvent,ValueModifiedEvent) stay local today: they aren't sent to collaborators and can't be undone. The v3 List tool depends on all of them, because it stores items as one flat array:items: [{ content, depth, checked? }]. Tab and checkbox toggles areupdateValue, Enter inserts an array element, and a Backspace merge removes one.What changes (summary)
createDataNodedispatches synchronously, with the author'suserId. Today the event has none.isInitialization. Undo and collaboration skip them; adapters still get them, so data-first rendering keeps working.modifyDatahandlesDataIndex.insertDataon an existing object key replaces the node.payload: [subtree]) and Modify (payload/prevPayload).Out of scope
InputsRegistry. That is a separate change and a hard prerequisite for List.ModifyOperationData) and with docs(openspec): propose undo grouping by browser task #201 (whose R2 test relies on initialization events having nouserId). Whichever lands second adjusts.🤖 Generated with Claude Code