-
Notifications
You must be signed in to change notification settings - Fork 131
fix(rivetkit): use loggerWithoutContext for websocket error when actor undefined #3412
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
More templates
@rivetkit/actor
@rivetkit/cloudflare-workers
@rivetkit/core
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
Code ReviewSummaryThis PR fixes a bug where actor.rLog was being accessed when the actor object was undefined in the error handler of handleWebSocketConnect. The fix correctly uses loggerWithoutContext() instead, which is appropriate since the actor failed to load. AnalysisThe Bug: The Fix: This is the correct approach because:
ObservationsConsistency:
Potential Related Issues: Test CoverageThe codebase appears to have driver tests in the tests/ directory. It would be valuable to add a test case that verifies proper error handling when loadActor fails, ensuring:
Consider adding a test that mocks actorDriver.loadActor to throw an error and verifies the onOpen handler closes the connection gracefully. VerdictLGTM - This is a correct bug fix that:
Suggestions:
Great catch on this edge case! |
5066d9c to
cb9465d
Compare
44ab040 to
c5ed5d6
Compare
Code Review: PR #3412SummaryThis PR fixes a bug where ✅ Positive Feedback
📋 Observations
🤔 Considerations
✨ VerdictLGTM - This is a clean, correct bug fix that prevents a potential runtime error. The change is minimal, follows existing patterns, and uses the appropriate logger for the context. The only suggestion would be to add test coverage for this specific error path to prevent future regressions. Suggested Test Scenario: // Test that websocket error handler works when actor loading fails
it('should handle websocket connection when actor fails to load', async () => {
// Mock actorDriver.loadActor to throw
// Attempt websocket connection
// Verify graceful error handling without accessing undefined actor.rLog
}); |
PR Review: fix(rivetkit): use loggerWithoutContext for websocket error when actor undefinedSummaryThis PR fixes a critical bug where the code attempts to access Code Quality ✅Positive aspects:
Analysis:
Potential Issues
|
c5ed5d6 to
819085b
Compare
cb9465d to
28c0736
Compare
Code ReviewSummaryThis PR fixes a bug where AnalysisBug Context: Fix:
Code Quality ✅Strengths:
Potential IssuesMinor Observation:
Test Coverage:
Performance ✅No performance concerns. The change doesn't affect the execution path. Security ✅No security concerns. The fix maintains the same error exposure behavior through Best Practices ✅Follows the repository's error handling patterns and logging conventions from CLAUDE.md. RecommendationLGTM ✅ This is a good bug fix that prevents a potential runtime error. The implementation is correct and follows existing patterns in the codebase. Optional follow-up: 🤖 Generated with Claude Code |
c3c45ab to
4aa3109
Compare
Code ReviewSummaryThis PR fixes a bug where actor.rLog was being used in an error handler when the actor variable could be undefined. The fix correctly uses loggerWithoutContext() instead. AnalysisThe Bug: The onError handler has a try-catch that attempts to use actor.rLog, which would throw an error since actor is undefined at this point. The Fix:
Issues FoundCritical Issue - Incomplete Fix: Test Coverage:
RecommendationAction Required: Positive Notes
Verdict: Needs changes - please fix the additional actor.rLog reference at line 305 before merging. |
8f15eea to
5418633
Compare
4aa3109 to
7eb9e5f
Compare
5418633 to
edd8a45
Compare
7eb9e5f to
af583ac
Compare
Code ReviewSummaryThis PR fixes a bug where attempting to access Analysis✅ Correctness ✅ Consistency
This is exactly the right use case - when the actor failed to load and we don't have access to its logger. ✅ Pattern Verification
ObservationsMinor: Error handling at line 298-309 VerdictLGTM ✅ This is a clean, focused bug fix that resolves a potential crash when actor loading fails during WebSocket initialization. The change is minimal, correct, and follows the established logging patterns in the codebase. Review conducted following CLAUDE.md conventions |
PR ReviewSummaryThis PR fixes a bug where Code Quality ✅Excellent fix! This is a well-targeted bug fix that addresses a clear edge case.
Potential IssuesNone identified. However, I did notice a few related observations:
Security Considerations ✅No security concerns. The fix:
Performance Considerations ✅No performance impact. The change is in an error path that only executes when actor loading fails. Test Coverage 📝Suggestion: Consider adding a test case that:
This would prevent regression of this bug. The test would fit well in a driver test suite given the RivetKit architecture. Recommendations✅ Approve and merge - This is a clean, necessary bug fix with no issues identified. 🤖 Generated by Claude Code |
Code ReviewSummaryThis PR fixes a bug where actor.rLog was being accessed in an error handler when the actor variable is undefined. The change correctly uses loggerWithoutContext() instead. AnalysisThe Bug: In handleWebSocketConnect at line 118-140, when actorDriver.loadActor(actorId) throws an error, the code catches it and returns WebSocket handlers. However, since the actor failed to load, the actor variable is never assigned. The original code at line 125 was trying to use actor.rLog, which would cause a runtime error. The Fix: The change correctly replaces actor.rLog with loggerWithoutContext(). This is the appropriate solution because:
Code Quality: Good
Potential Issues: Minor observation
Performance: No concernsSecurity: No concernsThe change maintains the same error exposure behavior via exposeInternalError. Recommendation: ApproveThis is a valid bug fix. The change is correct and necessary. Consider adding the test coverage and extra logging context mentioned above as follow-up improvements. Review generated with Claude Code |
Merge activity
|

No description provided.