-
Notifications
You must be signed in to change notification settings - Fork 131
chore(rivetkit): add connection for raw http #3425
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
base: 11-09-chore_rivetkit_rename_onfetch_to_onrequest_
Are you sure you want to change the base?
chore(rivetkit): add connection for raw http #3425
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
PR Review: Add connection for raw HTTPSummaryThis PR adds a new Code Quality & Best Practices✅ Good Practices:
1. Connection Lifecycle Inconsistency (rivetkit-typescript/packages/rivetkit/src/actor/router-endpoints.ts:548-572)Issue: The signature of In getConnectionReadyState: (): DriverReadyState | undefined => {
// HTTP connections are always considered open until the request completes
return DriverReadyState.OPEN;
},But the getConnectionReadyState(
actor: AnyActorInstance,
conn: AnyConn,
): DriverReadyState | undefined;Fix: Update the signature to match the interface: getConnectionReadyState: (_actor, _conn): DriverReadyState | undefined => {
return DriverReadyState.OPEN;
},This matches the pattern used in 2. Disconnect Signature Inconsistency (rivetkit-typescript/packages/rivetkit/src/actor/conn/drivers/raw-http.ts:16-18)Issue: The Current implementation: disconnect: async () => {
// Noop
},Expected signature from interface: disconnect(
actor: AnyActorInstance,
conn: AnyConn,
reason?: string,
): Promise<void>;Fix: Update to match interface: disconnect: async (_actor, _conn, _reason?) => {
// Noop
},3. Missing Error Handling Context (rivetkit-typescript/packages/rivetkit/src/actor/router-endpoints.ts:560-571)Issue: If Current code: try {
const conn = await actor.createConn(createRawHttpSocket(), {}, req);
createdConn = conn;
return await actor.handleRawRequest(req, {});
} finally {
if (createdConn) {
actor.connDisconnected(createdConn, true);
}
}Recommendation: This is actually correct as-is - if try {
const conn = await actor.createConn(createRawHttpSocket(), {}, req);
createdConn = conn;
return await actor.handleRawRequest(req, {});
} catch (error) {
// Connection creation or request handling failed
// Only clean up if connection was successfully created
throw error;
} finally {
if (createdConn) {
actor.connDisconnected(createdConn, true);
}
}Performance Considerations✅ Good:
Security ConcernsNo major security issues identified. The implementation properly:
Test Coverage
Recommendation: Add tests to verify:
Additional NotesRouter path handling (rivetkit-typescript/packages/rivetkit/src/actor/router.ts:178): const originalPath = url.pathname.replace(/^\/request/, "") || "/";This is simpler than the previous implementation and correctly handles the path stripping. SummaryRequired Changes:
Recommended Changes:
Overall, this is a solid implementation that follows existing patterns well. The required fixes are minor TypeScript signature issues that should be straightforward to address. |
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: |
30eb6e5 to
ec5e52d
Compare
PR Review - Raw HTTP Connection DriverI've reviewed PR #3425 which adds connection tracking for raw HTTP requests. Overall, this is a solid addition that brings consistency to how RivetKit handles different connection types. Here's my detailed feedback: ✅ Strengths
🔍 Observations & Suggestions1. Connection State HandlingThe new driver doesn't accept parameters like the WebSocket version does ( // New driver
export function createRawHttpSocket(): ConnDriver {
return {
requestId: crypto.randomUUID(),
requestIdBuf: undefined,
hibernatable: false,
// ...
};
}Question: Are raw HTTP connections intentionally non-hibernatable, or might there be future use cases for hibernatable HTTP connections? If hibernation is never needed for HTTP, consider adding a comment explaining why. 2. Connection Parameters in
|
5bab9a4 to
5bf1455
Compare
ec5e52d to
2c681e1
Compare
PR Review: Add Raw HTTP Connection DriverOverall Assessment: This PR adds connection lifecycle management for raw HTTP requests. The approach is sound but needs interface compliance fixes and better documentation. Critical Issues:
Recommendation: Document why connection tracking is necessary for raw HTTP requests.
Recommendation: Add _actor and _conn parameters to match the interface.
Recommendation: Add _actor, _conn, and _reason parameters. Design Questions:
Recommendation: Add tests for streaming responses or document why immediate cleanup is safe.
Recommendation: Clarify when each tracking mechanism should be used. Good Points:
Must Fix:
Should Address:
Performance Note: Connection object overhead per request could impact high-throughput endpoints. Consider benchmarking. |
2c681e1 to
d1c3287
Compare
5bf1455 to
fc159fd
Compare
Code Review: PR #3425 - Add Connection for Raw HTTPOverviewThis PR adds a new ✅ Positive Observations
🔍 Issues & Concerns1. Missing Connection Cleanup on Error Path
|
PR Review: Add Connection for Raw HTTPSummaryThis PR adds connection lifecycle management for raw HTTP requests by creating a Code Quality & Best Practices ✅Positive aspects:
Issues & Concerns1. Missing connection cleanup on error path
|

No description provided.