-
Notifications
You must be signed in to change notification settings - Fork 0
Use the websocket infra for sending requests when feature flag is turned on #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements WebSocket-based request/response infrastructure controlled by a new sendViaWebsocket feature flag. When enabled (and WebSocket is connected), API requests are sent via WebSocket instead of HTTP, maintaining backward compatibility through a transport abstraction layer.
Key changes:
- Added
sendViaWebsocketfeature flag and transport abstraction layer that conditionally routes requests through WebSocket or HTTP - Implemented request/response pattern in WebSocketManager with timeout handling, pending request tracking, and error handling
- Migrated all API endpoints (tasks, labels, tokens, notifications) to use the transport layer with corresponding WebSocket action definitions
- Changed token ID type from string to number for consistency across the codebase
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/constants/featureFlags.ts | Added new sendViaWebsocket feature flag definition |
| frontend/test/constants/featureFlags.test.ts | Updated test to include the new feature flag |
| frontend/src/api/transport.ts | New transport abstraction that routes requests to WebSocket or HTTP based on feature flag and connection state |
| frontend/src/utils/websocket.ts | Added request/response handling with pending request tracking, timeout management, and error handling |
| frontend/src/models/websocket.ts | Extended WebSocket action/payload definitions for all API operations and updated token ID types to number |
| frontend/src/api/tasks.ts | Migrated all task endpoints to use transport layer with WebSocket support |
| frontend/src/api/labels.ts | Migrated all label endpoints to use transport layer with WebSocket support |
| frontend/src/api/tokens.ts | Migrated all token endpoints to use transport layer with WebSocket support, updated token ID type to number |
| frontend/src/api/users.ts | Migrated notification settings endpoint to use transport layer with WebSocket support |
| frontend/src/utils/marshalling.ts | Made MarshallLabels generic to work with both Task and Omit<Task, 'id'> types |
| frontend/src/models/token.ts | Changed token ID type from string to number and added optional scopes field |
| frontend/src/store/tokensSlice.ts | Updated deleteToken parameter type from string to number |
| frontend/src/views/Settings/APITokenSettings.tsx | Updated token ID types from string to number |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.