Skip to content

feat(rivetkit): re-export serverless_http and default absent actor input#5395

Open
abcxff wants to merge 1 commit into
stack/docs-deploy-add-container-runner-page-mqospzuufrom
stack/feat-rivetkit-re-export-serverless_http-and-default-absent-actor-input-kknzrylw
Open

feat(rivetkit): re-export serverless_http and default absent actor input#5395
abcxff wants to merge 1 commit into
stack/docs-deploy-add-container-runner-page-mqospzuufrom
stack/feat-rivetkit-re-export-serverless_http-and-default-absent-actor-input-kknzrylw

Conversation

@abcxff

@abcxff abcxff commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@abcxff

abcxff commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@claude

claude Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review

Reviewed the diff (Cargo.toml, actor.rs, lib.rs, start.rs).

Summary of the change:

  • Registers rivetkit in [workspace.dependencies] so other in-repo crates can depend on it via workspace = true.
  • Re-exports rivetkit_core::serverless_http from the rivetkit crate.
  • Adds a Default bound to Actor::Input and switches run_actor to call input.decode_or_default() instead of input.decode(), so a missing input now falls back to Default::default() instead of erroring with MissingInput. The comment correctly explains this mirrors rivetkit-typescript, where createState just receives undefined.
  • Updates test fixtures (LifecycleInput, UnitInput) to derive Default and fixes several test-helper Start/Snapshot struct literals that were missing the is_new field (pre-existing from an earlier stacked change) so the crate compiles again.

Findings:

  1. Test coverage gap for the actual behavior change. The new default-on-missing-input path is only exercised at the Input::decode_or_default() unit level (input_decode_or_default_uses_default_when_missing). There's no run_actor-level test (like run_actor_missing_unit_input_creates_state, but for a non-unit Default input) that proves create_state actually receives the defaulted value end-to-end when no input bytes are sent. The DefaultActor/DefaultInput fixtures added for the unit test don't implement create_state, so they can't currently be reused for that. Worth adding a run_actor-level integration test to lock in the new lifecycle behavior, since this is the actual production code path being changed.

  2. Behavioral/breaking-change note (minor). Adding Default as a supertrait bound on Actor::Input changes the failure mode for any actor whose input is logically required: previously, a missing input would surface as an explicit ActorRuntime::MissingInput error; now it silently proceeds with Default::default() for any type where that's meaningful (not just unit-like types). This is presumably intentional (matches TS parity, and rivetkit (Rust) is called out as a preview API in CLAUDE.md), but it's a real semantic change for anyone relying on the old "missing input fails loudly" behavior, and it's also a breaking API change for downstream implementors whose Input type doesn't derive Default. Might be worth a one-line callout in the PR description / changelog.

  3. Nit: unconditional re-export of a feature-gated module. rivetkit_core::serverless_http is behind #[cfg(feature = "native-runtime")] in rivetkit-core. The new pub use rivetkit_core::serverless_http; in rivetkit/src/lib.rs is unconditional. Today this is safe because rivetkit-core's default features (and thus rivetkit's dependency on it) include native-runtime, and rivetkit isn't part of the wasm build gate (scripts/cargo/check-rivetkit-core-wasm.sh only checks -p rivetkit-core). Just flagging so this doesn't bite later if rivetkit ever grows a wasm-targeted build.

No security or performance concerns — this is internal SDK/lifecycle wiring with no new trust-boundary-crossing code. Code style (comments, hard tabs, derive placement) matches CLAUDE.md conventions.

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