fix(app): cache detached todo updates for fresh sessions - #484
Conversation
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughThis PR fixes a bug where the todo dock does not refresh when creating the first todo in a fresh session. It adds handling for events arriving before a directory child store exists via a new ChangesDetached Directory Event Handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to handle "detached" todo update events, which occur before a directory child store is fully initialized. This ensures that the todo dock can correctly display todos for the first todowrite action in a fresh session. Key changes include the implementation of applyDetachedDirectoryEvent in the event reducer, its integration into the global sync logic, and the addition of both unit and E2E tests to verify the fix. I have no feedback to provide as there were no review comments.
Summary
todo.updatedevents intoglobalSync.data.session_todoeven when the directory child store is not mounted yet.session.deletedor archivedsession.updatedevents arrive.todowritedock visibility and detached todo event handling.Why
Issue #480 reports that a brand-new session can receive its first todo update without the composer todo dock appearing until the user switches away and back. The backend already publishes complete
todo.updatedpayloads, and #472 already fixed reconnect replay. The missing path was app-side live sync: directory-scoped events were dropped when the matching child store did not exist yet, so the dock cache never received the fresh todo snapshot.Related Issue
Closes #480
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
todo.updated,session.deleted, and archivedsession.updated.Risk Notes
Low. This writes the existing session todo cache from complete
todo.updatedpayloads before a directory child store exists, then clears that cache if the same detached path later receives session delete/archive events. It does not change replay whitelist behavior, dock rendering, todo machine state, message/permission/question handling, or add polling.How To Verify
Screenshots or Recordings
Not attached. This PR changes data sync behavior, not visual styling or copy. The rendered dock path is covered by the targeted Playwright E2E above.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
New Features
Tests