Skip to content

Conversation

@NathanFlurry
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Nov 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rivetkit-serverless Ready Ready Preview Comment Nov 13, 2025 8:55pm
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
rivet-cloud Ignored Ignored Nov 13, 2025 8:55pm
rivet-inspector Ignored Ignored Preview Nov 13, 2025 8:55pm
rivet-site Ignored Ignored Preview Nov 13, 2025 8:55pm

Copy link
Member Author

NathanFlurry commented Nov 9, 2025

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.
Learn more


How to use the Graphite Merge Queue

Add 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.

@claude
Copy link

claude bot commented Nov 9, 2025

Code Review: Rename onFetch to onRequest

Overall, this is a clean refactoring that improves naming clarity. The rename from onFetch to onRequest is semantically better since the handler deals with raw HTTP requests, not just fetch operations.

Critical Issue Found

🐛 Typo in Error Class Name (rivetkit-typescript/packages/rivetkit/src/actor/errors.ts:320)

There's a typo in the renamed error class:

export class RequestHandlerNotDfeined extends ActorError {

Should be:

export class RequestHandlerNotDefined extends ActorError {

Impact: This typo will cause a runtime error when the error is thrown, since it's referenced correctly as RequestHandlerNotDfeined in src/actor/instance/mod.ts:653, but the class name itself contains a typo ("Dfeined" instead of "Defined").

Positive Observations

Comprehensive rename: All references have been consistently updated across:

  • Actor configuration and types
  • Error classes and messages
  • Method names (handleFetchhandleRawRequest)
  • Test fixtures and test cases
  • Comments and documentation strings

State field renaming: Good attention to detail renaming onFetchRequest to onRequestRequest in the request-access fixture

Consistent error messages: Error messages have been updated to reflect the new naming (e.g., "Actor must implement onRequest")

Type safety maintained: All TypeScript types and interfaces updated correctly

Minor Observations

  • The WebSocket handler was also renamed from handleWebSocket to handleRawWebSocket for consistency, which is good for clarity
  • All test descriptions updated appropriately
  • Comments in code updated to reflect new naming

Recommendation

Action Required: Fix the typo in the error class name before merging. Otherwise, this PR is good to merge.

Testing

Consider running the driver test suite to ensure the error handling still works correctly after fixing the typo:

# Run driver tests for raw HTTP functionality
cargo test -p rivetkit raw_http

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 9, 2025

More templates

@rivetkit/actor

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/actor@3424

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@3424

@rivetkit/core

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/core@3424

@rivetkit/db

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/db@3424

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@3424

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@3424

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@3424

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@3424

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@3424

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@3424

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@3424

commit: b3ff582

@claude
Copy link

claude bot commented Nov 13, 2025

Code Review: Rename onFetch to onRequest

Thanks for this refactoring! The rename from onFetch to onRequest makes sense semantically since this handler deals with general HTTP requests, not just fetch-specific operations. However, I've identified several issues that need to be addressed before merging.

Critical Issues

1. Typo in Error Class Name (rivetkit-typescript/packages/rivetkit/src/actor/errors.ts:320)

Bug: The error class name has a typo: RequestHandlerNotDfeined should be RequestHandlerNotDefined

// Current (incorrect):
export class RequestHandlerNotDfeined extends ActorError {

// Should be:
export class RequestHandlerNotDefined extends ActorError {

Impact: This typo exists in both the class definition and its usage in src/actor/instance/mod.ts:653. While it currently works, it's a clear typo that will confuse future developers.

Files to fix:

  • rivetkit-typescript/packages/rivetkit/src/actor/errors.ts:320
  • rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:653

2. Stale Comment References (rivetkit-typescript/packages/rivetkit/src/actor/router.ts:201-203)

Bug: Comments still reference the old handleFetch method name:

// Line 201-203 (current):
// This should never happen now since handleFetch throws errors
if (!response) {
    throw new InternalError("handleFetch returned void unexpectedly");
}

Should be:

// This should never happen now since handleRawRequest throws errors
if (!response) {
    throw new InternalError("handleRawRequest returned void unexpectedly");
}

Impact: These outdated references will confuse developers trying to understand the code flow.

Code Quality Observations

Positive

  • Consistent renaming across the codebase - all functional code has been updated
  • Test fixtures properly updated to use the new naming
  • Error messages appropriately updated to reference onRequest
  • Type definitions in config properly updated

Completeness Check

I verified that no remaining references to onFetch exist in the functional code (excluding the comment issues noted above). The renaming is otherwise complete.

Recommendations

  1. Fix the typo in RequestHandlerNotDfeinedRequestHandlerNotDefined
  2. Update comments in router.ts lines 201-203 to reference handleRawRequest instead of handleFetch
  3. Consider updating documentation links - The error messages still reference https://www.rivet.dev/docs/actors/fetch-and-websocket-handler/. If the docs are being updated to reflect this naming change, consider updating this URL path as well (though keeping it as-is for now is fine if the docs redirect properly).

Test Coverage

The test updates look good - test descriptions have been updated to reflect the new naming, which will help maintain clarity in test output.


Verdict: Almost there! Please address the typo and stale comments before merging. These are quick fixes that will prevent future confusion.

@graphite-app graphite-app bot force-pushed the 11-09-refactor_rivetkit_add_state_manager_for_conn_with_symbol-based_access branch from 37bad6b to 5aebfdc Compare November 13, 2025 20:53
@graphite-app graphite-app bot force-pushed the 11-09-chore_rivetkit_rename_onfetch_to_onrequest_ branch from fc159fd to 1109cc5 Compare November 13, 2025 20:53
@NathanFlurry NathanFlurry force-pushed the 11-09-refactor_rivetkit_add_state_manager_for_conn_with_symbol-based_access branch from 5aebfdc to d2d01ea Compare November 13, 2025 20:53
@NathanFlurry NathanFlurry force-pushed the 11-09-chore_rivetkit_rename_onfetch_to_onrequest_ branch from 1109cc5 to b3ff582 Compare November 13, 2025 20:53
@claude
Copy link

claude bot commented Nov 13, 2025

Pull Request Review

Thanks for this refactoring! The rename from onFetch to onRequest makes sense for better semantic clarity. However, I found a few issues that need to be addressed:

Issues Found

1. Typo in Error Class Name ⚠️

File: rivetkit-typescript/packages/rivetkit/src/actor/errors.ts:320

The error class name has a typo:

export class RequestHandlerNotDfeined extends ActorError {

Should be: RequestHandlerNotDefined (missing the D and i is in the wrong position)

This typo is also used in:

  • rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:653

2. Incomplete Refactoring in Comments/Error Messages ⚠️

File: rivetkit-typescript/packages/rivetkit/src/actor/router.ts:201-203

The comments and error messages still reference the old handleFetch name:

// This should never happen now since handleFetch throws errors
if (!response) {
    throw new InternalError("handleFetch returned void unexpectedly");
}

Should reference handleRawRequest instead for consistency.

Positive Observations

✅ The rename is consistently applied across:

  • Actor config definitions
  • Test files and fixtures
  • Handler implementations
  • Type definitions
  • Documentation strings

✅ All method calls updated correctly (handleFetchhandleRawRequest)

✅ State property names updated appropriately (onFetchRequestonRequestRequest)

✅ Test descriptions updated to reflect the new naming

Recommendations

  1. Fix the typo in RequestHandlerNotDfeined to RequestHandlerNotDefined
  2. Update the comments and error message in router.ts:201-203 to reference handleRawRequest
  3. Consider running a final search for any remaining Fetch references related to this feature to ensure complete consistency

Code Quality

  • ✅ No performance concerns
  • ✅ No security issues identified
  • ✅ Follows TypeScript best practices
  • ✅ Test coverage appears adequate (tests updated alongside implementation)

Overall, this is a clean refactoring with just a couple of typos/missed references to fix. Great job maintaining consistency across the codebase!

@claude
Copy link

claude bot commented Nov 13, 2025

PR Review: Rename onFetch to onRequest

Summary

This PR performs a consistent rename across the RivetKit codebase from onFetch to onRequest. This is a sensible naming change that better reflects the handler's purpose of processing HTTP requests.

Critical Bug Found 🐛

Typo in error class name (src/actor/errors.ts:320):

export class RequestHandlerNotDfeined extends ActorError {

Should be:

export class RequestHandlerNotDefined extends ActorError {

The word "Defined" is misspelled as "Dfeined". This typo is used in:

  • Class name declaration (errors.ts:320)
  • Instantiation in instance/mod.ts:653

This will cause runtime errors when actors without an onRequest handler are invoked.

Code Quality ✅

Positives:

  1. Comprehensive rename: All references to onFetch have been systematically updated to onRequest
  2. Consistent changes: Config types, error messages, test descriptions, and comments are all updated
  3. Method renames: Internal methods like handleFetchhandleRawRequest and handleWebSockethandleRawWebSocket maintain consistency
  4. Error message updates: Error messages now correctly reference onRequest instead of onFetch
  5. Test coverage: Test files and fixtures are updated to match the new naming

Formatting:

  • Changes follow consistent code style
  • Proper indentation maintained
  • Multi-line function signatures formatted appropriately

Potential Issues

Minor:

  1. Documentation link: The error messages reference https://www.rivet.dev/docs/actors/fetch-and-websocket-handler/. If this documentation exists, it should be updated to reflect the new onRequest naming.

  2. State property naming: In request-access.ts, the state property is renamed from onFetchRequest to onRequestRequest, which reads a bit awkwardly ("request request"). Consider renaming to something like onRequestHandlerData or requestHandlerState in a future refactor.

Security Concerns

No security issues identified. This is purely a refactoring/rename operation.

Performance Considerations

No performance impact. The changes are purely naming-related with no algorithmic changes.

Test Coverage

The PR updates test fixtures and test descriptions appropriately. The test suite should catch the typo issue if run.

Recommendations

  1. MUST FIX: Correct the typo RequestHandlerNotDfeinedRequestHandlerNotDefined
  2. SHOULD DO: Verify tests pass after the typo fix
  3. NICE TO HAVE: Update documentation referenced in error messages if it exists

Overall Assessment

This is a clean refactoring PR with one critical typo that needs to be fixed before merging. The rename improves code clarity by using a more appropriate name for HTTP request handling. Once the typo is corrected, this should be good to merge.


Generated with Claude Code

@claude
Copy link

claude bot commented Nov 13, 2025

PR Review: chore(rivetkit): rename onFetch to onRequest

Summary

This PR performs a straightforward renaming refactor from onFetch to onRequest throughout the RivetKit codebase. The change improves naming clarity by using a more generic term that better represents handling HTTP requests.

Issues Found

🐛 Critical: Typo in Error Class Name

Location: rivetkit-typescript/packages/rivetkit/src/actor/errors.ts:320

export class RequestHandlerNotDfeined extends ActorError {

Issue: Class name has a typo: NotDfeined should be NotDefined

Impact: This is a critical bug that will cause runtime errors when this error class is instantiated. The instantiation happens in src/actor/instance/mod.ts:653.

Fix Required:

export class RequestHandlerNotDefined extends ActorError {

Also update the reference in src/actor/instance/mod.ts:653:

throw new errors.RequestHandlerNotDefined();

⚠️ Moderate: Outdated Comment Reference

Location: rivetkit-typescript/packages/rivetkit/src/actor/router.ts:201-203

// This should never happen now since handleFetch throws errors
if (!response) {
    throw new InternalError("handleFetch returned void unexpectedly");
}

Issue: Comment and error message still reference handleFetch instead of handleRawRequest

Fix Required:

// This should never happen now since handleRawRequest throws errors
if (!response) {
    throw new InternalError("handleRawRequest returned void unexpectedly");
}

Positive Observations

Comprehensive Rename: The renaming is thorough across all relevant files:

  • Config definitions
  • Type definitions
  • Handler implementations
  • Test fixtures
  • Test cases
  • Comments and documentation

Consistent Naming Pattern: The new naming follows a clear pattern:

  • onFetchonRequest
  • handleFetchhandleRawRequest
  • FetchHandlerNotDefinedRequestHandlerNotDefined
  • InvalidFetchResponseInvalidRequestHandlerResponse
  • onFetchRequestonRequestRequest (in state tracking)

Test Coverage: All test descriptions and assertions were updated to match the new naming.

No Breaking Changes Introduced: The refactor maintains the same API structure and behavior.


Recommendations

  1. Fix the typo immediately - This will cause runtime failures
  2. Update the comment in router.ts - For code maintainability
  3. Consider searching for fetch in comments/docs - There might be other documentation references that need updating

Code Quality: ⭐⭐⭐⭐ (4/5)

The refactor is well-executed and comprehensive, but the typo prevents a perfect score. Once fixed, this will be a clean, straightforward improvement to the codebase.

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 13, 2025

Merge activity

  • Nov 13, 9:15 PM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Nov 13, 9:15 PM UTC: CI is running for this pull request on a draft pull request (#3465) due to your merge queue CI optimization settings.
  • Nov 13, 9:16 PM UTC: Merged by the Graphite merge queue via draft PR: #3465.

graphite-app bot pushed a commit that referenced this pull request Nov 13, 2025
@graphite-app graphite-app bot closed this Nov 13, 2025
@graphite-app graphite-app bot deleted the 11-09-chore_rivetkit_rename_onfetch_to_onrequest_ branch November 13, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants