Repository navigation
Description
Overview
During fast typing, a single node's version number climbs rapidly — meaning many UpdateNode commits fire for what should be one logical edit — and edits can OCC-conflict against the user's own prior keystroke. The 500ms debounce does not prevent this.
Problem Statement
Content edits are debounced, and the coordinator's cancelPending coalesces keystrokes that arrive while waiting. But a keystroke that arrives while an UpdateNode RPC is in flight takes the isExecuting branch and is queued, then re-fired after the RPC returns. Fast typing keeps at least one RPC perpetually in flight, so the queue keeps re-firing — producing one commit per RPC round-trip instead of one per pause (the version churn).
The self-conflict follows from the same path: the OCC version is read from localNode.version at execute time and written back on commit; the queued re-run can read that version stale relative to the prior RPC's confirmation (or have it overwritten by an echo or a pending-move in the gap), sending a stale version that OCC-rejects against the user's own previous write. The accumulated scar tissue (serverConfirmedVersions, the pending-move await, "re-read at execute time" comments) works around this gap rather than closing it.
The debounce didn't help because it guards the scheduling gap, not the in-flight gap, and the queue path explicitly bypasses coalescing while executing.
Proposed Solution
Replace the queue-and-re-fire behavior with a genuine per-node serial writer: while a write for a node is in flight, collapse further edits into a single latest-wins pending write that runs after the prior write's version confirmation lands (so it always reads a confirmed version). This makes a conflict-with-self structurally impossible and makes the debounce a pure UX nicety rather than a correctness crutch. Ties into the reactive-store refactor (persistence/version/optimistic state stop being three hand-synced subsystems).
Acceptance Criteria
- Typing a word quickly produces a single committed
UpdateNodeafter the pause, not one per RPC round-trip - A node's version increments once per coalesced edit, not per keystroke-burst
- No OCC conflict can occur between two writes to the same node originating from the same client's sequential edits
- The queued-operation re-fire path is replaced by a latest-wins serial writer that reads the version only after prior confirmation
- Code passes
bun run quality:fix; tests pass (bun run test:all)
Technical Specifications
Reference Files
- shared-node-store.svelte.ts:
packages/desktop-app/src/lib/services/shared-node-store.svelte.ts—SimplePersistenceCoordinator(theisExecuting/queuedOperationsre-fire path) and theUpdateNodeexecute closure (version selectioncurrentNode.version, write-back on commit) - Related pattern: ADR-049 (reactivity store)
Implementation Details
- The commits-per-edit assertion belongs in the Tauri-seam e2e suite (tracked separately)
Dependencies
- SharedNodeStore fakes reactivity — replace the version-counter Map with a genuinely reactive per-node source #1490 (reactive store — enables cleanly separating persistence/version state)
Activity
malibio commentedon Jul 5, 2026
Related work: the commits-per-edit regression test lives in the Tauri-seam e2e harness (#1499); the outbound-coalescing defense-in-depth is tracked in nodespace-sync (#256).
malibio commentedon Jul 6, 2026
Frontend baseline: 146 test files passed, 3939 tests passed
Edit persistence amplifies writes and self-conflicts during fast typi…
Test the real Tauri-to-daemon seam end-to-end (ADR-048) (#1563)