Skip to content

fix(rivetkit): treat empty actor input bytes as absent - #5529

Open
abcxff wants to merge 1 commit into
mainfrom
stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns
Open

fix(rivetkit): treat empty actor input bytes as absent#5529
abcxff wants to merge 1 commit into
mainfrom
stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns

Conversation

@abcxff

@abcxff abcxff commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@railway-app

railway-app Bot commented Jul 31, 2026

Copy link
Copy Markdown

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

Service Status Web Updated (UTC)
frontend-cloud 😴 Sleeping (View Logs) Web Aug 7, 2026 at 1:13 am
website 😴 Sleeping (View Logs) Web Aug 2, 2026 at 7:07 pm
kitchen-sink 😴 Sleeping (View Logs) Web Aug 2, 2026 at 7:58 am
frontend-inspector 😴 Sleeping (View Logs) Web Aug 2, 2026 at 7:30 am
ladle ✅ Success (View Logs) Web Jul 31, 2026 at 4:13 am
mcp-hub ✅ Success (View Logs) Web Jul 31, 2026 at 4:13 am

Base automatically changed from stack/revert-rivetkit-core-drop-dangling-http-body-stream-re-exports-nwmvwykt to main July 31, 2026 04:14
@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from 226de9f to e9dadf6 Compare July 31, 2026 05:27
@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from e9dadf6 to 0283e79 Compare July 31, 2026 06:03
@claude

claude Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review

Small, well-targeted fix: Input::decode() / decode_or() now treat a zero-length input buffer the same as an absent one, mirroring the existing Snapshot::decode() behavior. The rationale in the comment (engine omits input entirely, but an empty base64 string round-trips to Some(vec![]) rather than None) is clear, and the added tests (input_decode_or_default_treats_empty_bytes_as_missing, input_decode_treats_empty_unit_as_unit, run_actor_invalid_input_fails_to_start) cover the fix and guard the "invalid non-empty bytes still error" case.

Bug: is_present() was not updated to match the new semantics

present_bytes() is now the source of truth for "does this input have real bytes", used by both decode() and decode_or(). But is_present() (start.rs:44-46) still does the old check:

pub fn is_present(&self) -> bool {
    self.bytes.is_some()
}

Since is_present() is pub on a type reachable from actor authors via Start::input, this creates an observable inconsistency: for an empty (but Some) byte buffer, is_present() reports true while decode()/decode_or() now behave as if the input were absent (defaulting, or erroring with MissingInput when required). A caller branching on is_present() to decide whether to trust decode()s result vs. apply its own fallback would get the wrong signal for exactly the case this PR fixes.

Suggested fix:

pub fn is_present(&self) -> bool {
    self.present_bytes().is_some()
}

Minor

  • The fix is scoped to rivetkit-rusts Input decode path. Worth double-checking whether the equivalent input path in rivetkit-typescript (or wherever the empty-base64-vs-omitted distinction can arise) has the same latent issue, since rivetkit (Rust) is meant to mirror rivetkit-typescript per the layer-architecture doc. Not blocking if TS already normalizes this elsewhere.

Overall a solid fix with good regression tests; the is_present() inconsistency should be addressed before merge.

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