Skip to content

fix: propagate bincode encode errors instead of silently dropping payload - #9

Merged
ae2rs merged 2 commits into
mainfrom
fix/encode-payload-error-propagation
May 26, 2026
Merged

fix: propagate bincode encode errors instead of silently dropping payload#9
ae2rs merged 2 commits into
mainfrom
fix/encode-payload-error-propagation

Conversation

@ae2rs

@ae2rs ae2rs commented May 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Correctness bug fix: encode_payload previously used if let Ok(...) around bincode::encode_to_vec, silently swallowing serialization failures and producing empty payloads on the wire. Callers had no way to detect the failure.
  • Changes the Aerro trait method signature from fn encode_payload(&self, route: Exposure, buf: &mut Vec<u8>) to fn encode_payload(...) -> Result<(), EncodeError>, propagating errors through the derive macro codegen and surfacing them as Code::Internal status at the wire encode boundary.
  • Bumps version to 0.6.3 (patch — breaking only for manual Aerro trait impls, which must now return Result).

Files changed

File Change
crates/aerro/src/traits/aerro.rs Trait signature returns Result<(), EncodeError>
crates/aerro-macros/src/codegen/aerro_impl.rs All 3 variant arms (unit, tuple, named) propagate via ?
crates/aerro/src/wire/encode.rs Call site handles ErrCode::Internal status
crates/aerro/src/test_support.rs Manual impl updated
crates/aerro/src/wire/decode.rs Test impl updated
crates/aerro/src/remote.rs Test call site .unwrap() added
Cargo.toml Version bump 0.6.2 → 0.6.3

Test plan

  • cargo test --workspace — all 50 tests pass, zero warnings
  • Existing roundtrip, polyglot, UI, and integration tests all green
  • trybuild UI tests still compile correctly (macro codegen validated)

🤖 Generated with Claude Code

ae2rs and others added 2 commits May 26, 2026 08:50
…load

The macro-generated `encode_payload` used `if let Ok(...)` around
bincode::encode_to_vec, silently swallowing serialization failures and
producing empty payloads. This changes the trait method to return
`Result<(), EncodeError>` so callers can detect and surface the failure.

- Aerro trait: encode_payload now returns Result<(), EncodeError>
- Macro codegen: all three variant arms (unit, tuple, named) propagate
  the error via `?` instead of silently dropping it
- wire::encode: surfaces encode failures as Code::Internal status
- test_support + test impls: updated to match new signature

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ae2rs
ae2rs merged commit 526b75b into main May 26, 2026
4 checks passed
@ae2rs
ae2rs deleted the fix/encode-payload-error-propagation branch May 26, 2026 08:55
ae2rs added a commit that referenced this pull request May 26, 2026
…load (#9)

* fix: propagate bincode encode errors instead of silently dropping payload

The macro-generated `encode_payload` used `if let Ok(...)` around
bincode::encode_to_vec, silently swallowing serialization failures and
producing empty payloads. This changes the trait method to return
`Result<(), EncodeError>` so callers can detect and surface the failure.

- Aerro trait: encode_payload now returns Result<(), EncodeError>
- Macro codegen: all three variant arms (unit, tuple, named) propagate
  the error via `?` instead of silently dropping it
- wire::encode: surfaces encode failures as Code::Internal status
- test_support + test impls: updated to match new signature


* style: rustfmt


---------

Co-authored-by: ae2rs <ae2rs@users.noreply.github.com>
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