Repository navigation
Closed
Description
Overview
When users rapidly create nested nodes and then press Shift+Tab to outdent, the operation fails with "Sibling not found" error. The node visually jumps two levels up instead of one, and the UI becomes out of sync with the backend.
Problem Statement
User Experience:
- User creates a series of nested nodes (successfully)
- User creates a new node below a nested node
- User immediately presses Shift+Tab to outdent the new node
- Error appears:
Sibling not found: <uuid> - Node jumps two levels up visually (incorrect)
- Refresh required to restore correct UI state
Evidence:
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (parent, line 0)
[Error] [outdentNode] Failed to move node, rolled back: – Error: Operation failed: Query failed: Sibling not found: aee71ba9-8ca2-4728-9920-e1f0f5d6e011 — backend-adapter.ts:335
Root Cause
Location: packages/desktop-app/src/lib/services/reactive-node-service.svelte.ts (line 871)
When outdenting, the frontend calls:
await sharedNodeStore.waitForNodeSaves([nodeId]);
moveNodeCommand(nodeId, newParentId, oldParentId);The oldParentId is passed as insertAfterNodeId to tell the backend where to position the outdented node. However:
- We only wait for
nodeId(the node being moved) to be persisted - We don't wait for
oldParentId(the "insert after" sibling) - The backend queries for children of
newParentIdand looks foroldParentIdamong them - If
oldParentIdhasn't been fully persisted with its parent edge yet, the backend fails with "Sibling not found"
Why it happens:
- Rapid node creation causes a queue of pending saves
- When outdenting immediately after creation,
oldParentIdmay still be pending persistence - The backend can't find the sibling reference and fails
Proposed Solution
Wait for BOTH the node being moved AND the oldParentId to be fully persisted before calling moveNodeCommand:
// Before (broken):
await sharedNodeStore.waitForNodeSaves([nodeId]);
// After (fixed):
await sharedNodeStore.waitForNodeSaves([nodeId, oldParentId]);Acceptance Criteria
- Shift+Tab outdent succeeds after rapid node creation
- No "Sibling not found" errors during normal outdent operations
- Node moves only one level up (correct behavior)
- UI stays in sync with backend after outdent
- No new test failures
- Code passes bun run quality:fix
Technical Specifications
Files to Modify
- reactive-node-service.svelte.ts:
packages/desktop-app/src/lib/services/reactive-node-service.svelte.ts(line 871)
Implementation Details
Change at line 871:
// CRITICAL: Wait for BOTH the node AND oldParentId to be persisted before moving
// The backend needs oldParentId to exist as a child of newParentId to find it as the "insert after" sibling.
await sharedNodeStore.waitForNodeSaves([nodeId, oldParentId]);Related Backend Code
The error originates from:
packages/core/src/db/surreal_store.rs(line 2806)- Backend queries for
has_childedges and expects to findoldParentIdin the result
Related Issues
- Fix: Enter key, indent/outdent, and SSE sync issues #655 (recent fix for Enter key and indent/outdent issues)
Activity
Fix Shift+Tab outdent 'Sibling not found' error after rapid node crea…
Fix outdent race condition by flushing debounced saves before moveNode
Address review: track outdent operations, cleanup unused method, add …
Test: Add comprehensive unit tests for PR #861 helper functions (closes
Test Coverage: Address gaps from PR #861 and improve race condition d…
Fix Shift+Tab outdent failing with 'Sibling not found' error after ra…
Test Coverage: Address gaps from PR #861 and improve race condition d…
Fix Shift+Tab outdent failing with 'Sibling not found' error after ra…
Test Coverage: Address gaps from PR #861 and improve race condition d…
Fix Shift+Tab outdent failing with 'Sibling not found' error after ra…
Test Coverage: Address gaps from PR #861 and improve race condition d…
Test the real Tauri-to-daemon seam end-to-end (ADR-048) (#1563)