Repository navigation
Batch A (P0): data-integrity fixes — transactional move_node (#1429) + window-close/reload store guards (#1435, #1436) - #1453
Merged
mstomar125 merged 2 commits intoJun 24, 2026
Merged
Conversation
Moving a node to a different parent ran two separate `db.execute` calls with no enclosing transaction: DELETE the old `has_child` edge, then INSERT the new one. If the INSERT failed (constraint / IO / crash / cancel) after the DELETE committed, the node was left with NO has_child edge — a silently-orphaned root. Sibling mutations (`move_children_to_parent`, `delete_subtree_atomic`) already wrap their multi-statement work in a transaction; this path did not. Wrap the delete-old + insert-new pair in one `transaction()` + `commit()` so it is all-or-nothing. The make-root and same-parent-reorder paths are single statements and already atomic. Add a test asserting a cross-parent move leaves exactly one has_child edge under the new parent. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…loses #1435, closes #1436) Two data-loss guards in shared-node-store, mirroring guards that already exist on sibling paths: #1435 — flushPending (run by flushAllPending on window close) called `pending.operation()` for every entry unconditionally, even ones already executing. Its sibling flushAndWaitForNodes guards exactly this with `!executingOperations.has(nodeId)`. Without the guard, a debounced save mid-RPC at window close fires a second time -> OCC conflict or duplicate create at the most data-loss-sensitive moment. Add the same executing-op guard; still await the in-flight promise. #1436 — batchSetNodes (used by doLoadChildrenTree with a database source) lacked setNode's `isFocused || hasPending` skip, so a concurrent tree reload for a parent whose child is being edited overwrote the child's optimistic content mid-keystroke (the sync#76 corruption class). Apply the same skip-while-editing guard + server-confirmed-version stash per node in the database-source loop. Tests: flushPending double-execute guard; four batchSetNodes guard cases. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Jun 24, 2026
Contributor
Author
|
APPROVE — Tight, well-scoped P0 batch. All three fixes are grounded in real sibling patterns and each ships a targeted test. Verified against #1429 — transactional cross-parent move (
#1435 —
#1436 —
Community/Pro mandate: all three are additive hardening of shared local-store / db paths with no Pro-gating semantics changed; Non-blocking:
|
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.
Summary
Phase 1 bug-sweep Batch A, core half — three P0 data-integrity fixes. Each mirrors a guard/pattern that already exists on a sibling path, so they're small and low-risk.
#1429— make cross-parentmove_nodetransactionalmove_noderan DELETE oldhas_childedge + INSERT new edge as two un-encloseddb.executecalls. An INSERT failure after the committed DELETE left the node with no parent edge — a silently-orphaned root.move_children_to_parent/delete_subtree_atomicalready wrap their multi-statement work in a transaction.Fix: wrap delete-old + insert-new in one
transaction()+commit(). Make-root / same-parent-reorder are single statements (already atomic).#1435—flushPendingexecuting-op guardflushPending(run byflushAllPendingon window close) re-invokedpending.operation()for every entry, including ones already executing — a debounced save mid-RPC fires twice → OCC conflict / duplicate create at the worst moment. SiblingflushAndWaitForNodesguards this with!executingOperations.has(nodeId).Fix: add the same guard; still await the in-flight promise.
#1436—batchSetNodesskip-while-editing guardbatchSetNodes(used bydoLoadChildrenTreewith adatabasesource) lackedsetNode'sisFocused || hasPendingskip, so a concurrent tree reload overwrote a child being edited mid-keystroke (the sync#76 corruption class).Fix: apply the same skip-while-editing guard + server-confirmed-version stash per node in the database-source loop.
Tests
test_move_node_cross_parent_leaves_exactly_one_edge(asserts exactly one edge, under the new parent).cargo fmt/clippy -D warningsclean.flushPendingdouble-execute test + 4batchSetNodesguard cases. Full suite 3890/3890 pass.test:free-users: 7/7 pass — community build behaviorally unchanged.Free/community impact
None behaviorally —
#1435/#1436harden existing local-store guards (additive skips),#1429makes a store mutation atomic.test:free-usersgreen.Closes #1429, closes #1435, closes #1436.