feat(restore): unify post-restore hydrate orchestrator (step 4) - #159
Conversation
Replace separate trade-DM and peer-chat background spawns with hydrate_after_session_restore and RestoreHydrateReport. Always emit PostRestoreHydrateCompleted so track_startup_chats runs even when there are no peer orders to rebuild. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reachedNext included review available in 50 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (12)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe session restore flow now uses one background hydration task. The task replays trade DMs and rebuilds peer chats in parallel, then reports results through one ChangesSession Restore Hydration
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to This PR unifies post-restore chat hydration and fixes the empty-order path so live subscriptions are re-seeded, but an overlapping restore or terminal order transition could briefly restore stale chat state in the client. The change is mergeable with explicit owner awareness or follow-up to add freshness or cancellation guards. Sequence Diagram(s)sequenceDiagram
participant User
participant SessionRestore
participant spawn_post_restore_hydrate
participant TradeDMReplay
participant PeerChatRebuild
participant MainLoop
User->>SessionRestore: select Restore Session
SessionRestore->>spawn_post_restore_hydrate: start background hydration
spawn_post_restore_hydrate->>TradeDMReplay: replay active trade DMs
spawn_post_restore_hydrate->>PeerChatRebuild: rebuild peer transcripts
TradeDMReplay-->>spawn_post_restore_hydrate: return trade-DM summary
PeerChatRebuild-->>spawn_post_restore_hydrate: return peer summary and order IDs
spawn_post_restore_hydrate-->>MainLoop: send PostRestoreHydrateCompleted
MainLoop->>MainLoop: apply transcripts and re-track startup chats
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Title checkExplanation The title clearly and concisely describes the main change: consolidating the post-restore hydration flow into one orchestrator. The step reference is additional context and does not make the title vague or misleading. Full details: Docstring CoverageExplanation Docstring coverage is 92.86% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 5 files. (7 skipped: 7 unsupported.) ✨ 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 |
Cover session restore orchestrator, trade-DM replay filters, peer chat rebuild, clear_session_chat_projection, and updated peer-channel echo rules. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Reviewed current head 4bb78fdd99c65b413c8d4adbee76b0d072f4293e.
Blocking issue: the PR still does not pass the repository formatting gate. I reproduced it locally with rustup run 1.97.0 cargo fmt --all -- --check, and GitHub's current fmt check is failing too. The required changes are only rustfmt output in:
src/main.rssrc/ui/helpers/startup.rs
I also reviewed the new docs added on top of the orchestrator change. The focused restore-hydrate tests pass locally with rustup run 1.97.0 cargo test --all-features restore_hydrate, and I did not find another correctness blocker in the hydrate orchestration flow. Please run cargo fmt --all (or rustup run 1.97.0 cargo fmt --all) and push the formatted result so CI can go green.
Formal RESTORE_SESSION_ACCEPTANCE.md with criteria matrix, manual smoke scenarios, and sign-off table. Add spawn completion test for empty peer orders. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
RestoreHydrateReport,hydrate_after_session_restore, andspawn_post_restore_hydrateto run trade-DM replay and peer-chat rebuild in parallel behind one background task.PostRestoreTradeDmReplayCompleted/PostRestorePeerChatReplayCompletedwith a singlePostRestoreHydrateCompleted { report }.track_startup_chatsre-seeds live subscriptions even when there are no peer orders to rebuild (fixes the prior early-return on emptyorder_ids).Test plan
cargo test --all-features restore_hydratecargo clippy --all-targets --all-features -- -D warningsMade with Cursor
Summary by CodeRabbit
New Features
Documentation