fix(rivetkit): treat empty actor input bytes as absent - #5529
Conversation
|
🚅 Deployed to the rivet-pr-5529 environment in rivet-frontend
|
226de9f to
e9dadf6
Compare
e9dadf6 to
0283e79
Compare
|
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: 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: Minor
Overall a solid fix with good regression tests; the is_present() inconsistency should be addressed before merge. |
0283e79 to
bf4c501
Compare
No description provided.