Repository navigation
Description
Found during
Adversarial review of #2091 (OCC error-shape stripping causing a duplicate notification in updateNode()), while checking whether updateTaskNode() has the same duplicate-notification bug. It doesn't — but for a different, arguably worse reason.
The gap
updateTaskNode()'s outer `handle.promise.catch((err) => { ... })` (packages/desktop-app/src/lib/services/shared-node-store.svelte.ts) only checks `err instanceof OperationCancelledError` and returns early for that case. Unlike updateNode()'s and deleteNode()'s outer catches, it has no fallback `conflictNotifications.add({conflictType: 'write-failure', ...})` for the general case. So:
- An OCC (version-conflict) failure IS handled — the inner closure's own `if (occError) {...}` branch raises its own `version-mismatch` notification (this path is fine, and shared-node-store: updateTaskNode()'s OCC direct-hydration path also needs the skip-while-editing guard #2072 already hardened its skip-while-editing guard).
- A non-OCC failure (network error, daemon offline, validation error, etc.) is NOT handled anywhere. The catch handler's inner `catch (dbError)` block for updateTaskNode() logs, tracks the error for tests, does the unconditional `this.nodesSet(nodeId, existingNode)` rollback (see updateTaskNode()'s unconditional rollback-on-failure can clobber a later queued write's result #2088 for issues with that line specifically), and re-throws — but nothing downstream ever calls `conflictNotifications.add(...)` for this case. The outer catch's early-return-only-for-cancellation shape means a genuine write failure is silently swallowed with zero user-visible signal.
Why this matters
`updateTaskNode()` is called fire-and-forget (`void`-returning) from every UI call site (e.g. `task-schema-form.svelte`'s status/priority/due-date/assignee controls) — there is no other mechanism by which a caller would learn the write failed. A user changing a task's status, priority, or due date during a network blip or daemon hiccup sees the local optimistic value revert (via the unconditional rollback) with no toast, no error, nothing — the UI just silently snaps back with no explanation, which reads as a bug/glitch rather than a reported failure.
Comparison
- `updateNode()`: non-OCC failure → generic `write-failure` notification (via `onPersistError` opt-in or the outer catch's fallback — see shared-node-store: OCC/subtree-access-denied errors lose their shape before reaching the outer persist().catch(), causing a spurious duplicate notification #2080/shared-node-store: fix OCC error-shape stripping causing a duplicate notification in updateNode() #2091's context).
- `deleteNode()`: non-OCC failure → generic `write-failure` notification (shared-node-store: distinguish dependency-wait cancellation propagation from direct cancellation #2079).
- `setNode()`: non-OCC failure → generic `write-failure` notification (confirmed working correctly per shared-node-store: fix OCC error-shape stripping causing a duplicate notification in updateNode() #2091's investigation).
- `updateTaskNode()`: nothing.
Suggested fix
Add the same fallback to `updateTaskNode()`'s outer `handle.promise.catch()` that `updateNode()`/`deleteNode()`/`setNode()` already have: after the `OperationCancelledError` check, surface a generic `write-failure` notification for every other rejection (guarding against duplicating the OCC path's own specific notification the same way #2091 does — a captured boolean flag, not a re-derived `isVersionConflict(err)` check, since the re-thrown error has the same shape-stripping issue #2080/#2091 fixed for the sibling methods).
Scope note
Discovered during #2091's review, explicitly flagged as out of scope for that PR (which is about deduplicating a notification, not adding a missing one). Filing separately.
Activity
Address adversarial review: fix a misleading test comment, file a fol…
shared-node-store: fix OCC error-shape stripping causing a duplicate …
mstomar125 commentedon Aug 14, 2026
Fixed in #2098.
updateTaskNode()'s outer catch only handledOperationCancelledErrorand returned early — it had no fallback `write-failure` notification for a genuine non-OCC failure at all (unlike `updateNode()`/`deleteNode()`/`setNode()`, which all have one). Added the same captured-boolean-gated fallback those three already have (`occConflictAlreadyNotified`, mirroring #2091's fix for `updateNode()`'s duplicate-notification bug), so a non-OCC `updateTaskNode()` write failure now surfaces exactly one `write-failure` notification instead of zero.Extended `occ-notification-dedup.test.ts` with an `updateTaskNode()` describe block; the non-OCC test is verified to fail against the pre-fix code (0 notifications) and pass with the fix (1 notification, type `write-failure`).