Skip to content

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Jan 10, 2026

TL;DR

Added a helper function to standardize actor output creation with timestamps.

What changed?

  • Created a new buildActorOutput helper function that constructs an ActorOutput object with all timestamp fields
  • Replaced multiple instances of manual ActorOutput object creation with calls to this helper function
  • Ensured consistent handling of timestamps across all actor-related operations

How to test?

  • Verify that actor creation, lookup, and listing operations return consistent output format
  • Check that all timestamp fields (createTs, startTs, connectableTs, sleepTs, destroyTs) are properly populated
  • Test actor operations to ensure the refactored code maintains the same functionality

Why make this change?

This refactoring improves code maintainability by centralizing the logic for building actor output objects. It eliminates duplication and ensures that all actor-related operations return consistent data structures with properly formatted timestamps. This change also makes it easier to modify the actor output format in the future, as changes would only need to be made in one place.

@vercel
Copy link

vercel bot commented Jan 10, 2026

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

Project Deployment Review Updated (UTC)
rivet-cloud Ready Ready Preview, Comment Jan 10, 2026 0:04am
3 Skipped Deployments
Project Deployment Review Updated (UTC)
rivet-inspector Ignored Ignored Preview Jan 10, 2026 0:04am
rivet-site Ignored Ignored Preview Jan 10, 2026 0:04am
rivetkit-serverless Skipped Skipped Jan 10, 2026 0:04am

@vercel vercel bot temporarily deployed to Preview – rivetkit-serverless January 10, 2026 00:02 Inactive
@railway-app
Copy link

railway-app bot commented Jan 10, 2026

🚅 Deployed to the rivet-pr-3808 environment in rivet-frontend

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Jan 11, 2026 at 4:14 pm
frontend-inspector 😴 Sleeping (View Logs) Web Jan 11, 2026 at 4:14 pm
frontend-cloud 😴 Sleeping (View Logs) Web Jan 11, 2026 at 4:13 pm

@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-3808 January 10, 2026 00:02 Destroyed
Copy link
Contributor Author

jog1t commented Jan 10, 2026


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 Jan 10, 2026

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@3808

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 6d330ea

@claude
Copy link

claude bot commented Jan 10, 2026

PR Review: fix(drivers/fs): return proper data for all endpoints

Summary

This PR addresses an important issue with the file system driver where actor endpoints were not returning complete timestamp data. The changes improve code organization through:

  1. Removed unused imports (ClientConfigSchema and logger)
  2. Fixed import ordering to follow the project's conventions (grouped type imports)

However, I notice a discrepancy between the PR description and the actual changes made.


Issues Found

🚨 Critical: PR Description Mismatch

The PR description mentions creating a buildActorOutput helper function, but the actual diff shows:

  • No helper function was added
  • Only import cleanup was performed

Looking at the current code (manager.ts:335-347), there IS a actorStateToOutput helper function that converts ActorState to ActorOutput and is used consistently across all endpoints:

  • getForId (line 233)
  • getWithKey (line 246)
  • getOrCreateWithKey (line 271)
  • createActor (line 285)
  • listActors (line 294)

This suggests one of two scenarios:

  1. The helper function was already added in a previous commit, and this PR is just cleaning up imports
  2. The PR description is incorrect/outdated

Could you clarify which scenario applies?


Code Quality Assessment

✅ Positives

  1. Import cleanup is good: Removing unused imports (ClientConfigSchema, logger) reduces bundle size and improves maintainability
  2. Import grouping: The reordering groups type-only imports together, which aligns with TypeScript best practices
  3. Existing helper function: The actorStateToOutput function is well-implemented:
    • Properly handles null values for optional timestamps
    • Converts BigInt timestamps to Numbers correctly
    • Used consistently across all actor methods

Import Organization

The changes improve import organization by grouping type imports:

// Before: Mixed regular and type imports
import { ClientConfigSchema } from "@/client/config";
import { logger } from "./log";
import { RegistryConfig, DriverConfig } from "@/registry/config";
import { GetUpgradeWebSocket } from "@/utils";

// After: Type imports grouped together
import type { DriverConfig, RegistryConfig } from "@/registry/config";
import type { GetUpgradeWebSocket } from "@/utils";

Verification Notes

Testing the Helper Function

The existing actorStateToOutput function (lines 335-347) correctly handles all timestamp fields:

  • createTs: Always set from state.createdAt (converted to Number)
  • startTs: Conditionally set, handles null
  • connectableTs: Conditionally set, handles null
  • sleepTs: Conditionally set, handles null
  • destroyTs: Conditionally set, handles null

Consistency Check

All 5 endpoints that return ActorOutput now use the helper:

  • getForIdactorStateToOutput(actor.state) (line 233)
  • getWithKeyactorStateToOutput(actor.state) (line 246)
  • getOrCreateWithKeyactorStateToOutput(state) (line 271)
  • createActoractorStateToOutput(state) (line 285)
  • listActorsactorStateToOutput(actor) (line 294)

Recommendations

  1. Update PR description to accurately reflect the actual changes (import cleanup) or explain if the helper function was added in a previous commit
  2. Consider adding tests for the actorStateToOutput function to ensure timestamp conversion edge cases are handled (e.g., very large timestamps, zero values)
  3. Verify BigInt handling: The conversion from state.createdAt (likely BigInt) to Number() could lose precision for very large timestamps. Consider if this is acceptable for your use case.

Conclusion

Verdict: ✅ Approve with clarification needed

The code changes are solid - import cleanup is always beneficial. However, the PR description needs to be updated to match the actual changes, or you need to explain if this is part of a larger changeset where the helper function was already added.

The existing actorStateToOutput helper is well-implemented and addresses the core issue described in the PR (ensuring consistent timestamp handling across all actor endpoints).

@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 10, 2026

Graphite Automations

"Test" took an action on this PR • (01/10/26)

1 assignee was added to this PR based on Kacper Wojciechowski's automation.

@jog1t jog1t force-pushed the 01-10-fix_drivers_fs_return_proper_data_for_all_endpoints branch from 02177f1 to 6d330ea Compare January 11, 2026 16:04
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-3808 January 11, 2026 16:04 Destroyed
@jog1t jog1t closed this Jan 11, 2026
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