Skip to content

fix(sdk): 💥 serialize unit as no payloads or null payload#1181

Merged
chris-olszewski merged 1 commit into
masterfrom
olszewski/fix_unit_serialization
Mar 25, 2026
Merged

fix(sdk): 💥 serialize unit as no payloads or null payload#1181
chris-olszewski merged 1 commit into
masterfrom
olszewski/fix_unit_serialization

Conversation

@chris-olszewski

Copy link
Copy Markdown
Member

What was changed

Update Rust SDK to:

  • Serialize () as an empty payload vec for input e.g. starting workflow, signals, etc
  • Serialize () as a new binary/null encoded payload for places that expect exactly one output e.g. workflow/handler responses

Why?

This brings us in line with other SDKs for how requests with no input/args are represented on the wire.

Previously we relied on the serde_json serialization of () so we would produce a json/plain encoded null payload. Now we match other SDKs of emitting no payloads in this scenario or a specially marked binary/null payload when exactly one payload is expected.

Checklist

  1. Closes N/A

  2. How was this tested:
    Additional unit tests that specifically verify () to payload round trip. Existing integration tests.

  3. Any docs updates needed?
    N/A

@chris-olszewski
chris-olszewski requested a review from a team as a code owner March 25, 2026 17:48

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

Tip: disable this comment in your organization's Code Review settings.

@chris-olszewski

Copy link
Copy Markdown
Member Author

@claude review

Comment thread crates/common/src/data_converters.rs
val: &T,
) -> Result<Payload, PayloadConversionError> {
// If a single payload is explicitly needed for `()`, then produce a null payload
if std::any::TypeId::of::<T>() == std::any::TypeId::of::<()>() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wow you gotta have eagle eyes to read this line lol

@chris-olszewski
chris-olszewski merged commit 18615a7 into master Mar 25, 2026
36 of 37 checks passed
@chris-olszewski
chris-olszewski deleted the olszewski/fix_unit_serialization branch March 25, 2026 18:13
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.

2 participants