fix(rivetkit): fix routing of /websocket#3995
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
63adbe3 to
fcd3d15
Compare
c796f37 to
939ba39
Compare
Code Review - PR #3995: fix routing of /websocketSummaryThis PR fixes a bug where WebSocket routing failed to match paths like /websocket?token=abc because query parameters were included in the path comparison. The fix strips query parameters before routing decisions while preserving them for the actual request handling. Strengths
Observations and Suggestions
Security ConsiderationsQuery Parameter Injection: No issues identified - query parameters are preserved correctly and routing logic only affects path matching. Path Traversal: No new risks - the change does not affect path validation. Performance ConsiderationsString splitting: The split operation is very lightweight and happens once per WebSocket connection. No performance concerns. Test CoverageExcellent coverage including base path without query, base path with query (the bug being fixed), subpath with query, trailing slash, and integration test validating query params are preserved. Code Style and ConventionsFollows CLAUDE.md conventions (hard tabs, lowercase log messages), comments are complete sentences, variable names are clear and descriptive, and test descriptions follow existing patterns. Final VerdictLGTM with minor suggestions. This is a solid bug fix with good test coverage. The implementation is correct and minimal. The suggestions above are optional improvements for consistency and robustness, not blockers. Recommended next steps:
Great work on the thorough testing, especially the unit tests documenting the expected behavior! |
PR Review: Fix WebSocket routing with query parametersOverviewThis PR fixes a bug in WebSocket routing where requests to ✅ Strengths
🔍 Code Quality ObservationsGood:
Minor Suggestions:
🐛 Potential IssuesNone identified. The fix is sound and correctly addresses the root cause. ⚡ PerformanceNo performance concerns. The 🔒 SecurityNo security concerns. The fix actually improves security by ensuring routing works consistently regardless of query parameter presence, which could otherwise lead to unexpected routing failures. 📊 Test CoverageExcellent test coverage:
📝 DocumentationThe inline comments are clear and explain the "why" behind the fix. The test comment provides valuable context about the different driver behaviors. ✨ Overall AssessmentStrong approval. This is a well-crafted fix that:
The fix correctly handles the routing issue while preserving query parameters for the actual handlers to use. RecommendationApprove and merge - This fix is ready to go. The minor suggestions above are optional improvements, not blockers. |
More templates
@rivetkit/virtual-websocket
@rivetkit/cloudflare-workers
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
| import { describe, expect, test } from "vitest"; | ||
| import { | ||
| PATH_WEBSOCKET_BASE, | ||
| PATH_WEBSOCKET_PREFIX, | ||
| } from "@/common/actor-router-consts"; |
There was a problem hiding this comment.
The imports are not properly sorted. Biome linter typically expects imports to be sorted with internal imports (starting with '@/') coming before external module imports (like 'vitest'). Swap the order of these import statements to fix the linting error.
Spotted by Graphite Agent (based on CI logs)
Is this helpful? React 👍 or 👎 to let us know.
939ba39 to
b7a6ac3
Compare
fcd3d15 to
47530e5
Compare
Merge activity
|

No description provided.