Skip to content

feat: import/export actors#4640

Draft
NathanFlurry wants to merge 1 commit intomainfrom
04-12-feat_import_export_actors
Draft

feat: import/export actors#4640
NathanFlurry wants to merge 1 commit intomainfrom
04-12-feat_import_export_actors

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link
Copy Markdown

railway-app bot commented Apr 13, 2026

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

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Apr 13, 2026 at 8:38 am
frontend-inspector ❌ Build Failed (View Logs) Web Apr 13, 2026 at 8:27 am
frontend-cloud ❌ Build Failed (View Logs) Web Apr 13, 2026 at 8:27 am
ladle ❌ Build Failed (View Logs) Web Apr 13, 2026 at 8:26 am
kitchen-sink ❌ Build Failed (View Logs) Web Apr 13, 2026 at 8:26 am
mcp-hub ✅ Success (View Logs) Web Apr 13, 2026 at 5:55 am

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown

claude bot commented Apr 13, 2026

PR Review: feat: import/export actors

This is a well-structured feature with clear design intent. Here are my observations:

Correctness & Logic

Inconsistent actor existence check for keyless actors (potential slow path)
In import_export.rs, actor_exists_with_name_and_key has an asymmetry: when key is None, it paginates through all actors with that name checking for a null key. This is an O(N) scan and could be slow for namespaces with many same-named keyless actors. Worth documenting or bounding.

Test ID deduplication may pass for wrong reason
In actor_import_export_e2e.rs, the selector_accepts_actor_ids test creates two Id::new_v1(1) values and asserts ids.len() == 2. If new_v1 is time-based, the two calls produce different IDs, so the deduplication assertion in parse_selector never actually fires. The test should use explicitly identical IDs to prove deduplication works.

Architecture & Design

No actor quiescence before export
There is an explicit TODO noting that live actor KV state can change mid-export. A running actor during export will produce an inconsistent snapshot. This should be called out in docs or surfaced as a warning in the export response.

No archive cleanup / TTL
The archive_path is a server-local temp directory with no automatic garbage collection. If the caller fails to clean it up, temp directories accumulate permanently. Consider a background sweep or at minimum document the caller responsibility.

Import archive path is server-local
ImportRequest.archive_path is a raw filesystem path. This is fine for single-node operational use but should be documented as a constraint for multi-node deployments.

Code Quality

Duplicate default_true function
default_true() -> bool { true } is defined independently in both workflows/actor/mod.rs and workflows/actor2/mod.rs. Extract to a shared location or use serde_with.

CreateComplete reordering in actor2/mod.rs
CreateComplete is now sent before reschedule_actor is called (moved out of the from_v1 branch). If this is intentional for the start_immediately=false path, add a comment explaining the intent, as it changes observable behavior for existing subscribers.

Auth on admin endpoints
export and import use ctx.auth().await?, the same check as normal endpoints. Given they are described as dangerous operational tools, confirm whether a more privileged admin check is needed.

Documentation

The documentation checklist is unchecked. The new POST /admin/actors/export and POST /admin/actors/import endpoints and the start_immediately/create_ts create fields warrant documentation. Per CLAUDE.md, limit-relevant fields should also update website/src/content/docs/actors/limits.mdx.

Minor

  • Archive format is versioned (version: 1) which is good for future migration.
  • Atomic rename of the .tmp directory before returning the path is a solid choice.
  • The 64-entry KV batch size is reasonable; consider a named constant instead of a magic number.

Overall this is a solid operational tool. The main concerns are the lack of consistency guarantees during live export and the missing documentation.

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.

1 participant