-
Notifications
You must be signed in to change notification settings - Fork 131
chore(rivetkit): add support for conn params on onRequest and onWebSocket #3445
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
chore(rivetkit): add support for conn params on onRequest and onWebSocket #3445
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
3b51494 to
9a434c7
Compare
8cf9a31 to
7d2f44d
Compare
Code ReviewSummaryThis PR adds support for passing connection parameters ( Positive Observations✅ Consistent implementation - The changes follow the existing pattern used for the ✅ Proper use of existing utilities - Leverages ✅ Complete implementation - Updates all relevant drivers (engine and file-system) to ensure the feature works across different execution environments. Issues & Recommendations1. Missing Error Handling in
|
Merge activity
|
9a434c7 to
f539782
Compare
7d2f44d to
26c9559
Compare
Code ReviewThis PR adds support for passing connection parameters ( ✅ Strengths
🔍 Observations
🧪 Testing ConsiderationsImportant: I notice there are existing (commented-out) tests in
Recommendation: Consider adding or updating driver tests to verify this new functionality works correctly for both:
📊 Code Quality
🎯 SummaryThis is a clean, well-implemented change that consistently adds connection parameter support across the actor routing layer. The implementation correctly handles both HTTP and WebSocket protocols using existing utility functions. Approval Status: ✅ Approved with minor suggestion to consider test coverage Minor Suggestion: Consider restoring or improving the removed comment in |
Code ReviewSummaryThis PR adds support for connection parameters (connParams) on onRequest and onWebSocket handlers. The changes ensure that connection parameters are properly extracted and passed through to the connection manager for both raw HTTP requests and WebSocket connections. Positives
Issues and Concerns1. Inconsistent Parameter Extraction (Medium Priority)In handleRawRequest (router-endpoints.ts:344), the parameters are extracted from headers using getRequestConnParams(c.req), while for WebSocket connections, parameters are extracted using parseWebSocketProtocols(protocols) from the Sec-WebSocket-Protocol header. This means HTTP requests use the HEADER_CONN_PARAMS header while WebSocket requests use the Sec-WebSocket-Protocol header. Question: Is this intentional? Should both code paths support both methods of parameter passing? Consider documenting this behavior or making it consistent. 2. Missing Type Safety (Medium Priority)The connParams parameter in handleRawWebSocket is typed as unknown | undefined. While this is flexible, it provides no type safety. Consider adding JSDoc comments explaining what structure is expected, or adding runtime validation if the structure is critical. 3. Missing Test Coverage (High Priority)This change modifies critical connection handling code but does not include any tests. I could not find existing tests that verify connection parameters are properly passed through. Recommendation: Add tests covering:
You could add these to tests/driver-file-system.test.ts or tests/driver-engine.test.ts. 4. Error Handling for HTTP Requests (Low Priority)In handleRawRequest, getRequestConnParams can throw an InvalidParams error if JSON parsing fails. However, there is no try-catch around the connection creation. The error will bubble up, which is probably fine, but it is worth confirming this is the intended behavior. 5. Documentation Gap (Low Priority)The PR description is empty. Consider adding:
Minor Observations
Security Considerations
Performance ConsiderationsNo significant performance concerns. The added header/protocol parsing is minimal overhead. RecommendationsBefore merging:
Future improvements:
ConclusionThe implementation is clean and focused, but would benefit from test coverage and better documentation. The core functionality appears sound, assuming the dual parameter-passing mechanisms (headers for HTTP, WebSocket protocols for WS) are intentional. Recommendation: Request changes - primarily to add test coverage before merging. Review generated by Claude Code |

No description provided.