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 9, 2025 5:46am
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
rivet-cloud Ignored Ignored Nov 9, 2025 5:46am
rivet-inspector Ignored Ignored Preview Nov 9, 2025 5:46am
rivet-site Ignored Ignored Preview Nov 9, 2025 5:46am

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.

@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@3422

@rivetkit/cloudflare-workers

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

@rivetkit/core

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: c298cf6

@claude
Copy link

claude bot commented Nov 9, 2025

PR Review: Rename onStart/onStop to onWake/onSleep

Summary

This PR performs a straightforward renaming of actor lifecycle hooks from onStart/onStop to onWake/onSleep, which better reflects the actor hibernation/wake semantics. The changes are well-contained and consistent across the codebase.

Code Quality ✅

Strengths:

  • Consistent renaming across all public APIs, examples, tests, and documentation
  • All affected files have been properly updated including:
    • Type definitions and schemas
    • Example code
    • Test fixtures and test assertions
    • Documentation (SPEC.md)
    • JSDoc comments

Areas for Improvement:

  1. Internal Method Names (rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:865, 875)

    • Private methods #callOnStart() and #callOnStop() still use the old naming
    • Consider renaming to #callOnWake() and #callOnSleep() for consistency
    • Comments also reference "onStart lifecycle" and "onStop lifecycle" (lines 319, 370)
  2. Log Messages (rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:878, 883, 886, 889)

    • Log messages still say "calling onStop", "onStop completed", "onStop timed out", "error in onStop"
    • Should be updated to reference "onSleep" for consistency
  3. Configuration Timeout (rivetkit-typescript/packages/rivetkit/src/actor/config.ts:64)

    • The config option onStopTimeout should be renamed to onSleepTimeout
    • This is a breaking change to the configuration schema, so ensure it's intended
    • If keeping for backward compatibility, add a comment explaining why
  4. Public API Methods (rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:351)

    • The public method onStop() on ActorInstance is still named with old terminology
    • Consider renaming to onSleep() or documenting why it retains the old name
  5. Driver References

    • rivetkit-typescript/packages/rivetkit/src/drivers/engine/actor-driver.ts has multiple references to onStop in comments and error messages (lines 490, 493, 667, 670, 674, 684, 686)
    • rivetkit-typescript/packages/rivetkit/src/drivers/file-system/global-state.ts:344 calls actor.onStop()

Potential Bugs ⚠️

  1. Breaking Change Considerations
    • If any external code or drivers are calling these hooks by name (reflection, dynamic invocation), this will break
    • Recommend checking if there's any serialization/deserialization of these hook names
    • Consider providing deprecation warnings or backward compatibility shims if this is a public API

Performance Considerations ✅

  • No performance impact - purely a naming change

Security Concerns ✅

  • No security concerns identified

Test Coverage ✅

Strong test coverage:

  • All test assertions properly updated (actor-conn.ts, actor-handle.ts, actor-metadata.ts)
  • Test fixtures updated (lifecycle.ts, metadata.ts, sleep.ts)
  • Event tracking in tests correctly references "onWake" and "onSleep"

Recommendations:

  • Consider adding a test that verifies the old hooks are no longer accepted (if that's the intent)
  • Verify all driver test suites pass with the new naming

Recommendations

Critical (before merge):

  1. Update internal method names #callOnStart()#callOnWake() and #callOnStop()#callOnSleep()
  2. Update all log messages to reference "onSleep" instead of "onStop"
  3. Decide on onStopTimeout config option - rename to onSleepTimeout or document why it stays

Important:
4. Rename public onStop() method to align with new terminology
5. Update driver code references and comments
6. Update comment on line 319 from "Call onStart lifecycle" to "Call onWake lifecycle"
7. Update comment on line 370 from "Call onStop lifecycle" to "Call onSleep lifecycle"

Nice to have:
8. Grep for any remaining "start"/"stop" terminology in comments that should be "wake"/"sleep"

Conclusion

This is a well-executed refactoring that improves API clarity. However, there are several internal references that were missed and should be updated for complete consistency. The changes are mostly cosmetic but important for maintainability and avoiding confusion.

Status: Recommend changes before merge to ensure complete consistency throughout the codebase.

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.

2 participants