fix(execution): MatchResult bincode round-trip — serialize outcome as Option (#135)#136
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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
Fixes #135 —
MatchResultcould not round-trip bincode since 0.9.0.The decode-time validation from #117 deserializes through
MatchResultWire,whose
outcomeisOption<MatchOutcome>(to accept legacy payloads), butthe
Serializederive still emitted a bareMatchOutcome. JSON toleratedthe asymmetry; bincode decodes positionally and read the enum variant index
where the
Optiontag was expected:This blocks OrderBook-rs's
bincodefeature (NATS zero-copy path) frombumping to 0.9 (joaquinbejar/OrderBook-rs#205).
Changes
outcomeis serialized viaSerializer::serialize_some, making theemitted shape symmetric with the wire struct. JSON payload is
byte-identical (serde flattens
Some); bincode encode/decode now agree.valid_result_round_trips_both_encodingsproperty test, a deterministicbincode_round_trip_is_symmetric_issue_135shape test, and a JSON guardasserting the payload still carries the bare
"outcome"value.bincode = "2.0"(serde + std features only,dev-only) to drive the positional-format regression.
Compatibility
(0.9.0 could not decode its own output), so no working payload breaks.
the absent trailing field either way).
Test plan
cargo test --all-features— 528 tests green.make pre-pushclean (clippy -D warnings, fmt, doc -D warnings).