fix: propagate bincode encode errors instead of silently dropping payload - #9
Merged
Merged
Conversation
…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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
encode_payloadpreviously usedif let Ok(...)aroundbincode::encode_to_vec, silently swallowing serialization failures and producing empty payloads on the wire. Callers had no way to detect the failure.Aerrotrait method signature fromfn encode_payload(&self, route: Exposure, buf: &mut Vec<u8>)tofn encode_payload(...) -> Result<(), EncodeError>, propagating errors through the derive macro codegen and surfacing them asCode::Internalstatus at the wire encode boundary.Aerrotrait impls, which must now returnResult).Files changed
crates/aerro/src/traits/aerro.rsResult<(), EncodeError>crates/aerro-macros/src/codegen/aerro_impl.rs?crates/aerro/src/wire/encode.rsErr→Code::Internalstatuscrates/aerro/src/test_support.rscrates/aerro/src/wire/decode.rscrates/aerro/src/remote.rs.unwrap()addedCargo.tomlTest plan
cargo test --workspace— all 50 tests pass, zero warnings🤖 Generated with Claude Code