Skip to content

Conversation

@NathanFlurry
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Dec 23, 2025

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

Project Deployment Review Updated (UTC)
rivetkit-serverless Error Error Jan 6, 2026 2:20am
3 Skipped Deployments
Project Deployment Review Updated (UTC)
rivet-cloud Ignored Ignored Jan 6, 2026 2:20am
rivet-inspector Ignored Ignored Preview Jan 6, 2026 2:20am
rivet-site Ignored Ignored Preview Jan 6, 2026 2:20am

Copy link
Member Author

NathanFlurry commented Dec 23, 2025


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 Dec 23, 2025

PR Review: Allow providing no args to createRivetKit

Summary

This PR allows createRivetKit to be called without arguments by adding a default value of undefined to the clientInput parameter. This enables developers to rely on environment variables for configuration.


Code Quality ✅

Positive aspects:

  • The change is minimal and focused - exactly what's needed
  • TypeScript typing is preserved correctly using Parameters<typeof createClient>[0]
  • The default value of undefined matches the existing behavior of createClient (rivetkit-typescript/packages/rivetkit/src/client/mod.ts:51-52)

Code style:

  • Follows the existing code pattern in the file
  • No formatting issues

Functionality Analysis ✅

How this works:

  1. When clientInput is undefined, it's passed to createClient (line 23)
  2. createClient already handles undefined by defaulting to an empty object {} (rivetkit-typescript/packages/rivetkit/src/client/mod.ts:56-60)
  3. The config schema then falls back to environment variables like RIVET_ENGINE, RIVET_ENDPOINT, RIVET_TOKEN, and RIVET_NAMESPACE (rivetkit-typescript/packages/rivetkit/src/client/config.ts:66-103)

Use case enabled:

// Now possible - relies on environment variables
const { useActor } = createRivetKit<typeof registry>();

This is particularly useful in server-side environments where configuration is typically provided via environment variables.


Potential Issues ⚠️

Type safety consideration:
While the change is functionally correct, there's a minor type inconsistency to be aware of:

The parameter type is Parameters<typeof createClient>[0], which is string | ClientConfigInput | undefined. However, the default value is specifically undefined. This is fine, but it means TypeScript won't prevent someone from explicitly passing undefined:

// All equivalent now
createRivetKit<R>();
createRivetKit<R>(undefined);

This is not a bug - just an observation that the API now has two ways to express "use defaults".


Testing Considerations 🧪

Recommended testing:

  1. Test that createRivetKit() works with environment variables set
  2. Test that it gracefully handles missing environment variables
  3. Verify existing examples still work (they all pass explicit endpoints)

Existing examples analysis:
All current examples in the codebase pass explicit endpoints:

  • examples/state/src/frontend/App.tsx:5 - passes "http://localhost:6420"
  • examples/cursors/src/frontend/App.tsx:9 - passes "http://localhost:6420"

So this change is purely additive and won't affect existing usage.


Security ✅

No security concerns. The change doesn't introduce any new attack vectors.


Performance ✅

No performance impact - this is a compile-time type change only.


Recommendations

  1. The change is good to merge as-is
  2. 📝 Consider adding a code example in documentation showing the environment variable usage pattern
  3. 🧪 Add a test case verifying createRivetKit() works without arguments

Verdict: Approved

This is a clean, minimal change that improves developer experience by supporting environment-based configuration. The implementation correctly leverages the existing createClient behavior.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 23, 2025

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: a2d24db

@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 9c19cbd to a2d24db Compare January 1, 2026 23:24
@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from a2d24db to 258b84d Compare January 2, 2026 22:30
@jog1t jog1t force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 258b84d to 53631b6 Compare January 2, 2026 23:33
@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 53631b6 to 258b84d Compare January 2, 2026 23:59
@jog1t jog1t force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 258b84d to 53631b6 Compare January 3, 2026 00:05
@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch 2 times, most recently from 258b84d to 0f31228 Compare January 5, 2026 18:22
@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 0f31228 to 021457c Compare January 6, 2026 02:04
@claude
Copy link

claude bot commented Jan 6, 2026

PR Review: fix(rivetkit): allow providing no args to createRivetKit

Summary

This PR adds a default value of undefined to the clientInput parameter in the createRivetKit function, allowing it to be called without any arguments.

Code Quality ✅

Positive aspects:

  • The change is minimal and focused, following the principle of simplicity
  • The default value of undefined is semantically correct since createClient already accepts endpointOrConfig?: string | ClientConfigInput (optional parameter)
  • This aligns with the underlying createClient implementation which explicitly handles undefined at line 56-57 in rivetkit-typescript/packages/rivetkit/src/client/mod.ts
  • The type signature Parameters<typeof createClient>[0] correctly extracts the parameter type

Type Safety Analysis ✅

The change is type-safe because:

  1. createClient signature: endpointOrConfig?: string | ClientConfigInput
  2. Parameters<typeof createClient>[0] extracts: string | ClientConfigInput | undefined
  3. Adding = undefined as default is valid for this type union
  4. The underlying implementation handles undefined gracefully by defaulting to {}

Potential Issues ⚠️

Minor consideration:
The TypeScript type Parameters<typeof createClient>[0] already includes undefined in its union (due to the optional ? operator), so technically adding = undefined is redundant from a type perspective. However, it is beneficial for:

  • Developer experience: Makes it immediately clear the parameter is optional without needing to inspect types
  • JavaScript runtime: Ensures the parameter exists with an undefined value rather than not existing at all
  • Consistency: The second parameter opts already has a default value = {}

Alternative Approach

You could also consider making the parameter explicitly optional with just the ? operator instead of providing a default value.

Both approaches are valid. The current PR approach (= undefined) is more explicit about the default value.

Performance Considerations ✅

No performance impact - this is a type-level and default parameter change only.

Security Concerns ✅

No security concerns identified.

Test Coverage 📝

Recommendation: Consider adding a test case to verify that createRivetKit() can be called with no arguments and behaves correctly. This would ensure the change works as intended and prevent future regressions.

Verdict ✅ APPROVED

This is a good, focused change that improves the API ergonomics. The implementation is correct and safe. The only suggestion is to add test coverage for this use case to ensure it remains functional in future refactors.

@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 6, 2026

Merge activity

@NathanFlurry NathanFlurry merged commit 0e3e4bf into main Jan 6, 2026
10 of 14 checks passed
@NathanFlurry NathanFlurry deleted the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch January 6, 2026 02:22
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