Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

fix(core): fix encoding input for remote manager driver#1331

Closed
NathanFlurry wants to merge 1 commit intomainfrom
10-02-fix_core_fix_encoding_input_for_remote_manager_driver
Closed

fix(core): fix encoding input for remote manager driver#1331
NathanFlurry wants to merge 1 commit intomainfrom
10-02-fix_core_fix_encoding_input_for_remote_manager_driver

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

@NathanFlurry NathanFlurry commented Oct 2, 2025

Fixes KIT-324

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 2, 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 Oct 2, 2025 8:42pm

@claude
Copy link
Copy Markdown

claude bot commented Oct 2, 2025

Claude finished @NathanFlurry's task —— View job


Code Review for PR #1331

Todo List:

  • Read and analyze changed files
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Assess security concerns
  • Review test coverage
  • Provide comprehensive feedback

Summary

This PR fixes encoding of CBOR data to base64 in the remote manager driver by replacing direct .toString("base64") calls with a cross-platform uint8ArrayToBase64 utility function.

Code Quality & Best Practices ✅

Positive aspects:

  • Good abstraction: The new uint8ArrayToBase64 function properly abstracts platform differences between Node.js and browser environments
  • Consistent imports: Proper import of the new utility function
  • Code reuse: Eliminates duplicate encoding logic across multiple locations

Areas for improvement:

  • Inconsistent null handling: Line 179 changes from null to undefined for the input parameter when no input is provided. This should be consistent across both locations (lines 144 and 179).

Potential Bugs or Issues ⚠️

  1. Type inconsistency: The change from null to undefined in packages/rivetkit/src/remote-manager-driver/mod.ts:179 could potentially cause issues if the API expects null rather than undefined. Both locations should use the same approach for consistency.

  2. Platform compatibility: The original .toString("base64") method works on Uint8Array in Node.js but may not work reliably in all browser environments, so this fix addresses a real compatibility issue.

Performance Considerations ✅

Good:

  • Minimal overhead: The new function has negligible performance impact
  • Optimized for environment: Uses native Buffer.toString("base64") in Node.js which is more efficient than the manual character conversion

Potential concern:

  • Browser performance: The manual character-by-character conversion in browsers could be slower for large arrays, but this is the standard fallback approach and likely not a concern for typical actor input sizes.

Security Concerns ✅

No security issues identified:

  • The base64 encoding implementation is standard and safe
  • No user input is directly processed without proper encoding
  • The function properly handles both Node.js and browser environments

Test Coverage ❓

Missing test coverage:

  • No tests appear to be added for the new uint8ArrayToBase64 function
  • Recommended to add unit tests covering:
    • Node.js environment behavior (with Buffer)
    • Browser environment behavior (with btoa)
    • Edge cases like empty arrays
    • Large input arrays

Recommendations

  1. Fix consistency: Change line 179 to use undefined consistently with line 144, or verify if the API actually requires null and update both accordingly.

  2. Add tests: Create unit tests for the new uint8ArrayToBase64 function in both Node.js and browser environments.

  3. Consider error handling: Add error handling for potential issues with btoa in browser environments (e.g., if the binary string contains invalid characters).

  4. Documentation: Consider adding JSDoc comments to the new utility function explaining its purpose and platform differences.

Overall Assessment

This is a good fix that addresses a real cross-platform compatibility issue. The code quality is solid, but the inconsistent null/undefined handling should be addressed before merging.

Recommendation: Approve with minor changes - Fix the null/undefined inconsistency and consider adding tests.


Copy link
Copy Markdown
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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
Copy Markdown

pkg-pr-new bot commented Oct 2, 2025

More templates

@rivetkit/actor

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

@rivetkit/cloudflare-workers

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

@rivetkit/core

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

commit: 76d48d0

@linear
Copy link
Copy Markdown

linear bot commented Oct 2, 2025

@graphite-app
Copy link
Copy Markdown

graphite-app bot commented Oct 2, 2025

Merge activity

  • Oct 2, 8:47 PM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Oct 2, 8:47 PM UTC: CI is running for this pull request on a draft pull request (#1333) due to your merge queue CI optimization settings.
  • Oct 2, 8:48 PM UTC: Merged by the Graphite merge queue via draft PR: #1333.

graphite-app bot pushed a commit that referenced this pull request Oct 2, 2025
@graphite-app graphite-app bot closed this Oct 2, 2025
@graphite-app graphite-app bot deleted the 10-02-fix_core_fix_encoding_input_for_remote_manager_driver branch October 2, 2025 20:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant