feat: Make board angle part of session state for synchronized angle changes#664
feat: Make board angle part of session state for synchronized angle changes#664marcodejongh wants to merge 6 commits intomainfrom
Conversation
…hanges - Add `angle` field to Session type in GraphQL schema (computed from boardPath) - Add `AngleChanged` event to SessionEvent union for broadcasting angle changes - Add `updateSessionAngle` mutation for changing session angle - Add `updateSessionAngle` method to RoomManager that updates boardPath in both Postgres and Redis - Add `updateBoardPath` method to RedisSessionStore - Update PersistentSessionContext to handle AngleChanged events and update URL for all users - Update AngleSelector to call updateSessionAngle mutation when in a session When a user changes the board angle in a session, all session members' UIs now update to reflect the new angle. The angle is stored as part of the session's boardPath, ensuring consistency when joining a session. https://claude.ai/code/session_01XKTGqyTM9634sT2tL1khNM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Claude ReviewIssues
|
When the session angle is updated, the backend now: - Fetches updated climb stats (difficulty, quality, ascent count) for each queue item at the new angle - Updates the queue state with the refreshed climb data - Sends a FullSync event so all clients update their queue display This ensures that when someone changes the board angle during a session, all users see the correct difficulty grades for climbs in the queue. https://claude.ai/code/session_01XKTGqyTM9634sT2tL1khNM
Claude Review✅ Ready to merge - Minor issues noted below, but nothing blocking. Issues
DocumentationThe |
- Add warning log when boardPath cannot be parsed but queue items exist - Fix URL navigation to use fixed position (index 5) for angle segment instead of finding last numeric segment which could match wrong segments - Add debug logging when angle segment cannot be found in pathname https://claude.ai/code/session_01XKTGqyTM9634sT2tL1khNM
Claude Review✅ Ready to merge - Minor issues noted below, but nothing blocking. Issues
|
Claude Review✅ Ready to merge - Minor issues noted below, but nothing blocking. Issues
DocumentationThe
TestsNo tests were added for the new
|
…r angle changes Backend changes: - Add rate limiting to updateSessionAngle mutation (limit: 10 per window) - Import VersionConflictError and MAX_RETRIES for retry logic - Implement retry loop with optimistic locking for queue updates - Cache already-updated items to avoid redundant database queries on retry - Broadcast AngleChanged event before queue update to ensure URL updates happen even if queue update fails Frontend changes: - Add toast notification when angle change fails in session - Keep drawer open on error so user can retry The retry logic handles race conditions where another mutation modifies the queue between reading and writing. When a version conflict occurs, the code re-fetches the queue state and only updates new items that weren't in our cache. https://claude.ai/code/session_01XKTGqyTM9634sT2tL1khNM
Claude Review✅ Ready to merge - Minor issues noted below, but nothing blocking. Issues
DocumentationThe PR changes affect the session system documented in docs/websocket-implementation.md. The doc mentions Different angle as adjustable during session but does not describe the new AngleChanged event or updateSessionAngle mutation. Consider adding a section about synchronized angle changes. |
…ests Fixes for code review feedback: 1. Consistent angle parsing: - Updated type-resolvers.ts to use index 4 (same as parseBoardPath) - Both now use filter(Boolean) to handle leading slashes consistently 2. Authentication check: - Use requireSession() helper for consistency with other mutations - Removed duplicate sessionId assignment 3. URL navigation robustness: - Use boardPath from event to reconstruct URL instead of hardcoded index - Properly handles trailing path segments (e.g., /list, /climb/uuid) - Added detailed debug logging when URL update fails 4. Added tests: - Test sessionTypeResolver.angle for various boardPath formats - Test URL segment extraction and reconstruction logic https://claude.ai/code/session_01XKTGqyTM9634sT2tL1khNM
Claude Review✅ Ready to merge - Minor issues noted below, but nothing blocking. Issues
Documentation
|
- Fix room-manager to use index 4 with filter(Boolean) for angle parsing - Add NaN validation to parseBoardPath in mutations - Fix URL update condition from > 5 to >= 6 segments - Add parseBoardPath helper tests with full coverage - Add integration test stubs for updateSessionAngle mutation - Improve debug logging in URL update warning https://claude.ai/code/session_01XKTGqyTM9634sT2tL1khNM
Claude Review✅ Ready to merge - Minor issues noted below, but nothing blocking. Issues
DocumentationThe |
anglefield to Session type in GraphQL schema (computed from boardPath)AngleChangedevent to SessionEvent union for broadcasting angle changesupdateSessionAnglemutation for changing session angleupdateSessionAnglemethod to RoomManager that updates boardPath in both Postgres and RedisupdateBoardPathmethod to RedisSessionStoreWhen a user changes the board angle in a session, all session members' UIs
now update to reflect the new angle. The angle is stored as part of the
session's boardPath, ensuring consistency when joining a session.
https://claude.ai/code/session_01XKTGqyTM9634sT2tL1khNM