Skip to content

Conversation

@abcxff
Copy link
Contributor

@abcxff abcxff commented Dec 11, 2025

No description provided.

@vercel
Copy link

vercel bot commented Dec 11, 2025

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

Project Deployment Review Updated (UTC)
rivetkit-serverless Error Error Dec 25, 2025 2:46am
3 Skipped Deployments
Project Deployment Review Updated (UTC)
rivet-cloud Ignored Ignored Dec 25, 2025 2:46am
rivet-inspector Ignored Ignored Preview Dec 25, 2025 2:46am
rivet-site Ignored Ignored Preview Dec 25, 2025 2:46am

Copy link
Contributor Author

abcxff commented Dec 11, 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 Dec 11, 2025

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 2f65035

@claude
Copy link

claude bot commented Dec 11, 2025

PR Review: feat(engine): actors lifecycle testing

Overview

This PR introduces a comprehensive Rust-based test runner infrastructure for Rivet Actors lifecycle testing, replacing the previous TypeScript-based runner. The implementation adds ~2817 lines implementing a WebSocket-based test runner with 22 lifecycle tests.

✅ Strengths

Architecture & Design

  1. Well-structured test infrastructure: The new test_runner module is cleanly separated into runner.rs (core), behaviors.rs (test actors), actor.rs (traits), and protocol.rs (helpers)

  2. Comprehensive test coverage: Tests cover creation, initialization, start timeout, crash policies (Restart/Sleep/Destroy), graceful shutdown, sleep/wake cycles, and exponential backoff

  3. Behavioral composition pattern: Builder pattern with with_actor_behavior allows flexible test setup

Code Quality

  1. Good use of async primitives with tokio::sync::oneshot channels
  2. Consistent structured logging with tracing
  3. Strong typing with ActorStartResult, ActorStopResult enums

⚠️ Issues & Concerns

Critical Issues

1. Debug Code Left in Production (CRITICAL)

Location: engine/packages/runtime/src/term_signal.rs:119-123

Debug log with "hello?" message and commented-out code in production runtime. This needs to be removed or cleaned up.

2. Stale TODO Comments

Location: engine/packages/engine/tests/common/test_runner/runner.rs:818-825

Commented-out test checklist at end of file, but these tests are already implemented. Remove these comments.

3. Synchronous Sleep Blocks Message Loop

Location: engine/packages/engine/tests/common/test_runner/runner.rs:592-607

tokio::time::sleep blocks the entire message loop during ActorStartResult::Delay. If an actor delays 5 seconds, no other messages can be processed. Implement proper async handling or document the limitation.

High Priority Issues

4. Silent Error Handling

Location: Multiple locations in actor.rs

Errors when sending events are silently ignored with let _ = self.event_tx.send(). Should at minimum log errors.

5. Race Condition in Shutdown

Location: engine/packages/engine/tests/common/test_runner/runner.rs:271-278

Race between checking shutdown flag and closing websocket. Consider using CancellationToken.

6. Unbounded Memory Growth

Location: engine/packages/engine/tests/common/test_runner/runner.rs:51

event_history grows unbounded until acks arrive. Add size limit or document assumptions.

Medium Priority Issues

7. Empty Test File

Location: engine/packages/engine/tests/actors_alarms.rs

Empty test file checked in. Either implement or remove.

8. Missing HTTP Tunneling

Location: engine/packages/engine/tests/actors_lifecycle.rs:259-261

Good TODO about missing HTTP tunneling, but unclear if/when it will be implemented. Consider filing tracking issue.

Low Priority

9. Polling Pattern Repetition

Multiple tests use similar polling loops. Consider extracting helpers like poll_until_destroyed, poll_until_connectable.

🔍 Security

  • No obvious vulnerabilities (test infrastructure)
  • Proper WebSocket protocol usage
  • No credential leakage

📊 Performance

  • actor_start_timeout takes 35+ seconds (properly documented)
  • 50ms polling is reasonable
  • Unbounded event history could be issue in long tests

🧪 Test Coverage

Excellent coverage: creation, timeouts, all crash policies, shutdown, sleep/wake, backoff

Missing: alarm functionality, HTTP/WebSocket connectivity tests

Recommendations Summary

Must Fix Before Merge

  1. ❌ Remove debug code from term_signal.rs:119-123
  2. ❌ Remove stale TODO comments at end of runner.rs
  3. ❌ Remove or implement actors_alarms.rs empty file

Should Fix Before Merge

  1. ⚠️ Address synchronous sleep blocking message loop (or document limitation)
  2. ⚠️ Improve error handling for send_event
  3. ⚠️ Add bounded memory for event history or document assumptions

Nice to Have

  1. 📋 Extract common polling patterns into helpers
  2. 📋 File tracking issue for HTTP tunneling

Final Assessment

Overall: Strong implementation with cleanup needed

Well-designed test infrastructure with comprehensive coverage. Main concerns are debug code in production files (must fix) and architectural limitations (should address or track).

Recommendation: Request changes to address critical issues (#1-3), then approve after fixes.

@abcxff abcxff requested a review from NathanFlurry December 11, 2025 02:18
@NathanFlurry NathanFlurry force-pushed the 11-10-chore_cleanup_rivet-engine_tests branch from ebaa134 to 681064f Compare December 25, 2025 01:40
@NathanFlurry NathanFlurry force-pushed the 11-17-feat_engine_actors_lifecycle_testing branch from 2fc28aa to 2f65035 Compare December 25, 2025 01:41
@abcxff abcxff marked this pull request as ready for review December 25, 2025 01:42
@@ -0,0 +1 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty file

@NathanFlurry NathanFlurry force-pushed the 11-10-chore_cleanup_rivet-engine_tests branch from 681064f to ccf9736 Compare December 25, 2025 02:45
@NathanFlurry NathanFlurry force-pushed the 11-17-feat_engine_actors_lifecycle_testing branch from 2f65035 to 270d196 Compare December 25, 2025 02:45
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 25, 2025

Merge activity

  • Dec 25, 2:46 AM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Dec 25, 2:46 AM UTC: CI is running for this pull request on a draft pull request (#3674) due to your merge queue CI optimization settings.
  • Dec 25, 2:47 AM UTC: Merged by the Graphite merge queue via draft PR: #3674.

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