Repository navigation
Implement a compliant SliM V0.5 wire codec - #4
Merged
Merged
Conversation
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.
The existing SliM codec used one length rule at every layer, so Unicode messages could be decoded incorrectly and malformed instructions could terminate the server. For example, nested strings were measured as UTF-8 bytes even though SliM V0.5 requires UTF-16 code units, while only the outer frame uses a byte count.
This change separates outer framing from recursive value encoding, adds a recursive
SlimValue, validates frame/list structure, supports lengths beyond six digits, and preserves ordinary strings inside nested result lists. Well-formed instruction lists with unknown operations or invalid arity now returnMALFORMED_INSTRUCTIONfor their original ID and allow the rest of the batch to continue.The public
Instructionenum gains aMalformedvariant, so downstream exhaustive matches will need to handle it. Typed list instruction arguments and the typed fixture runtime remain follow-up work.Validation:
cargo test --workspace --all-featurescargo clippy -p slim_protocol --all-targets -- -D warningscargo fmt --all -- --check