Skip to content

Conversation

@NathanFlurry
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Nov 10, 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 10, 2025 9:09pm
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
rivet-cloud Ignored Ignored Nov 10, 2025 9:09pm
rivet-inspector Ignored Ignored Preview Nov 10, 2025 9:09pm
rivet-site Ignored Ignored Preview Nov 10, 2025 9:09pm

Copy link
Member Author

NathanFlurry commented Nov 10, 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 10, 2025

More templates

@rivetkit/actor

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

@rivetkit/cloudflare-workers

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

@rivetkit/core

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 4599c4a

@claude
Copy link

claude bot commented Nov 10, 2025

Code Review: Standardize Error Metadata Return Type

Summary

This PR improves the consistency of error metadata handling by changing it from nullable to optional (TypeScript undefined vs null). This is a good change that aligns with TypeScript best practices and the BARE protocol specification.

Positive Aspects

  1. Protocol Alignment: The change correctly aligns with the BARE protocol schema which uses optional for the metadata field in both v1.bare and v2.bare.

  2. TypeScript Best Practices: Using undefined for optional fields is more idiomatic in TypeScript than using null. This avoids the confusion of having both null and undefined representing no value.

  3. Consistent Handling: The PR updates all the serialization/deserialization paths consistently across JSON protocol, BARE/CBOR protocol, and client-side deserialization.

  4. Careful Implementation: The conditional logic to only include metadata when defined prevents serializing undefined values in JSON, which is correct behavior.

Code Quality Observations

Good Practices

  • The comments explaining the different serialization strategies are helpful
  • The use of any type for the temporary val object is pragmatic given the conditional property assignment

Minor Concerns

  1. Type Safety: The use of any on line 304 in old.ts could be improved with a more specific type.

  2. Inconsistent Nullability Check: On line 332, the truthy check would treat empty strings, 0, false, etc. as no metadata. Consider using an explicit !== undefined check instead.

  3. Similar Pattern in router.ts: Line 92-94 in router.ts has the same truthy check issue.

Test Coverage Concerns

Critical Gap: There are no tests that specifically validate error metadata handling. Recommended test cases:

  • Verify errors with undefined metadata are serialized correctly
  • Test errors with actual metadata values
  • Validate the JSON vs BARE/CBOR serialization differences
  • Confirm client-side deserialization handles both null and undefined correctly
  • Test falsy metadata values like 0, false, empty string

Recommendations

  1. High Priority: Add test coverage for error metadata handling, especially around the undefined vs null semantics
  2. Medium Priority: Change truthy checks to explicit !== undefined checks to properly handle falsy metadata values
  3. Low Priority: Consider strengthening the type of val on line 304 if possible

Conclusion

This is a solid improvement that makes the codebase more consistent and aligns with TypeScript conventions. The main concern is the lack of test coverage for this critical change in behavior. Consider adding tests before merging to prevent regressions.

Approval Status: Approve with recommendation to add tests

@jog1t jog1t merged commit 0c93402 into 11-09-fix_rivetkit_remove_incorrect_getendpoint_call_in_metadata_handler Nov 10, 2025
14 of 15 checks passed
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