Conversation
Use conn.sio from connect_room fixture instead of creating redundant second socket. The tests previously used the non-existent "join:room" event which was silently ignored - tests passed only due to auto-rejoin behavior in handle_connect. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The `currentRoom` field at user level was a DRY/YAGNI violation:
- Room is already stored per-session in `session:data:{sessionId}.roomId`
- Auto-rejoin in handle_connect caused bugs when navigating between rooms
- Users can now have different tabs in different rooms (as intended)
Changes:
- Remove dead code: `_get_len()`, `get_project_room_from_session()`
- Remove auto-rejoin to `currentRoom` in handle_connect
- Keep `join_room(f"user:{user_name}")` unconditionally (fixes existing bug)
- Get room from session data in handle_disconnect for logging
- Remove `update_user_room()` method from ClientService
- Remove `currentRoom` from `update_user_and_room_membership()`
- Update tests to not expect `currentRoom`
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis pull request refactors session and room management by removing the user's current room storage concept and transitioning to a per-user room architecture. Helper functions that tracked room-to-session mappings are eliminated, socket event handlers now use user-specific rooms, and disconnect cleanup retrieves room association from persisted session data instead of in-memory state. Tests are updated to reflect atomic room membership updates and visited rooms tracking. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (2)**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/test_*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧬 Code graph analysis (3)tests/services/test_client_service.py (2)
src/zndraw/app/events.py (1)
tests/test_lock_socket_events.py (3)
🪛 Ruff (0.14.11)tests/test_lock_socket_events.py110-110: Unpacked variable Prefix it with an underscore or any other dummy variable pattern (RUF059) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (9)
✏️ Tip: You can disable this entire section by setting 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #844 +/- ##
==========================================
- Coverage 79.97% 79.96% -0.01%
==========================================
Files 165 165
Lines 20108 20000 -108
==========================================
- Hits 16081 15993 -88
+ Misses 4027 4007 -20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.