Repository navigation
Reload the conflict journal on database switch and start the startup notice after routing (closes #3067) - #3069
Conversation
…notice after routing (closes #3067) - conflictsStore gains a generation guard on load/loadForNode plus invalidateForDatabaseSwitch(), which also clears records immediately so the per-node indicator never flags the new database's nodes from the old journal. load() now resolves whether its result was applied. - evictAndReloadActiveDatabase() invalidates and reloads the conflicts store alongside collections/schemas/ai-chats. - app-shell starts the startup conflicts notice once databaseStore has a selection, so list_conflicts is routed to the restored database; a load discarded by a switch shows no notice. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pragmatic Code Review — PR #3069Review Type: Initial review (no prior reviews/comments) SummarySmall, well-scoped fix that brings Requirements Check
Code Review FindingsCorrectness checks (verified, no issue)
🟡 Improvement (optional, can be a follow-up)📁 🟢 Nits
Recommendation: APPROVEAll three acceptance criteria are met, the change follows the established generation-guard pattern, and the tests cover the real race paths. The |
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.
… switch - resolve() drops its local patch if a switch landed while in flight; conflict ids are deterministic, so the same id can exist in both databases. - merge() skips its post-merge loadForNode refresh after a switch. - Fix the stale 'unconditionally' startup comment in app-shell. Skipped: shared Tauri-bridge helper (pre-existing inline pattern, out of scope), dedup of the double list_conflicts on non-default startup (harmless, both routed), component test for the app-shell effect (trivial gating; store logic covered). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review addressed (acff822)✅ Addressed
⏭️ Skipped
Re-review: not needed. The changes are small guards that follow the pattern the review already approved, and each has a test. |
Summary
conflictsStore: generation guard onload()/loadForNode()plusinvalidateForDatabaseSwitch(), matching the schemas/ai-chats stores. Invalidate also clearsrecordsimmediately, because node ids can repeat across databases (date nodes). Without that, the per-node indicator would flag the new database's nodes from the old journal until the reload lands.load()now resolvestrue/falsefor applied/discarded.databaseStore.evictAndReloadActiveDatabase()invalidates and reloads the conflicts store. This covers bothswitchToand the non-default startup path.app-shellstarts the startup "N unresolved conflicts" notice oncedatabaseStore.activeDatabaseIdis set, solist_conflictsis routed to the restored database. A load discarded by a switch shows no notice.On a non-default startup
list_conflictsruns twice: once from the evict and once from the notice. Both calls happen after routing is set, so both return the same database's journal.Acceptance Criteria
conflictsStore.recordsdescribes the new databaseTests
conflicts.test.ts: new tests for invalidate clearing records, a stale load (success or failure) resolving after the reload, and a stale per-node load.database.test.ts: asserts invalidate runs before load on both the switch and non-default-startup paths.🤖 Generated with Claude Code