Repository navigation
waitForPersistence follows a replaced queued write to its replacement (closes #3062) - #3070
Conversation
…closes #3062) waitForPersistence() and flushAndWaitForNodes() now share settleNode(), which looks the pending entry up again after every OperationCancelledError. A startDebounced flag keeps waitForPersistence() from starting a debounced write early. A cancellation that leaves nothing pending is still a failure. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pragmatic Code Review: PR #3070Review Type: Initial review. There were no earlier reviews or comments. Requirements Check (#3062)
Verified locally: SummaryThis is a small, well-targeted change that follows DRY. It does what the issue asked: one helper,
Code Review Findings🟡 [Improvement] 📁 packages/desktop-app/src/lib/services/reactive-node-service.svelte.ts:357: the only caller ignores the return value 🟢 [Nit] 📁 packages/desktop-app/src/lib/services/shared-node-store.svelte.ts:~3937 and ~573: docstrings are stale 🟢 [Nit] 📁 packages/desktop-app/src/tests/services/persistence-coordinator-flush-wait.test.ts: debounced-to-debounced replacement is untested 🟢 [Nit] 📁 persistence-coordinator-flush-wait.test.ts No security, architecture or performance concerns. The change is atomic and removes duplicated code. Recommendation: APPROVEThis is a correct, minimal, well-tested change that improves code health. The 🟡 item is a problem that predates this PR, in the caller, and should get its own issue. It does not block this PR. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
…d wait - waitForNodeSaves/flushAndWaitForNodes/flushNodeSaves docstrings said the wait covers only in-flight writes; it covers pending, executing and queued writes and just doesn't start a debounced one early. - Test waitForPersistence following a debounced write replaced by another debounced write (cancelPending path). Skipped: fake timers for the debounce test (marginal); caller discarding the failed set in reactive-node-service predates this PR, filed separately. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review feedback addressed (ab1bfe8)
Pushed with Re-review decision: NO RE-REVIEW NEEDED. The only production-code changes are docstrings, plus one new test. |
Summary
waitForPersistence()andflushAndWaitForNodes()now sharesettleNodes()/settleNode(). After everyOperationCancelledError, it looks the node's pending entry up again, so a queued write that gets replaced no longer reports the node as failed.startDebouncedflag stopswaitForPersistence()from starting a debounced write early. Only the flush path starts them.clearQueued()after an OCC conflict) still counts as a failure.waitForPersistence()now uses a single shared timeout for all nodes, the same as the flush path, instead of a separate timer per node.Tests
New
waitForPersistenceblock inpersistence-coordinator-flush-wait.test.ts:All 59 coordinator/store tests pass. Pushed with
--no-verifyat the user's request, because the pre-push gate was competing with another worktree's gate for CPU. The full pyramid did not run on this push.Closes #3062
🤖 Generated with Claude Code