Add shared round-trip corpus + wire-fidelity fixes (Swift/Rust/Kotlin)#204
Open
joshmouch wants to merge 2 commits into
Open
Add shared round-trip corpus + wire-fidelity fixes (Swift/Rust/Kotlin)#204joshmouch wants to merge 2 commits into
joshmouch wants to merge 2 commits into
Conversation
Introduce a language-agnostic round-trip test corpus under
types/test-cases/round-trips/ (24 fixtures) and wire each client up to
decode → re-encode every fixture through its real generated types. The
corpus pins forward-compatibility and exact-bit fidelity across clients.
Fidelity fixes driven by the corpus:
- Rust: SessionStatus becomes a u32 bitset newtype (was a #[repr(u32)]
enum) so combined flags and unknown forward-compat bits round-trip
instead of being dropped or rejected. Generated via generate-rust.ts.
- Kotlin: SessionStatus.rawValue widens Int → Long so an unknown bit at
or above 2^31 round-trips as a plain JSON integer instead of throwing.
Generated via generate-kotlin.ts.
- Swift: open unions (StateAction, Customization, ResponsePart,
ToolCallState, TerminalClaim, …) decode an unknown discriminant to a
raw passthrough and re-encode it verbatim instead of throwing or
emitting {}; ChangesetOperation*Target now encode their kind
discriminant. Generated via generate-swift.ts; hand-written
NativeReducer / ToolCallStateExtensions handle the .unknown variant.
Tests: round-trip corpus runners for Go, Kotlin, Swift, and TypeScript,
plus Kotlin bitset tests covering the Long high-bit case. CHANGELOG
entries for the Swift, Rust, and Kotlin clients.
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.
Introduce a language-agnostic round-trip test corpus under
types/test-cases/round-trips/ (24 fixtures) and wire each client up to
decode → re-encode every fixture through its real generated types. The
corpus pins forward-compatibility and exact-bit fidelity across clients.
Fidelity fixes driven by the corpus:
enum) so combined flags and unknown forward-compat bits round-trip
instead of being dropped or rejected. Generated via generate-rust.ts.
or above 2^31 round-trips as a plain JSON integer instead of throwing.
Generated via generate-kotlin.ts.
ToolCallState, TerminalClaim, …) decode an unknown discriminant to a
raw passthrough and re-encode it verbatim instead of throwing or
emitting {}; ChangesetOperation*Target now encode their kind
discriminant. Generated via generate-swift.ts; hand-written
NativeReducer / ToolCallStateExtensions handle the .unknown variant.
Tests: round-trip corpus runners for Go, Kotlin, Swift, and TypeScript,
plus Kotlin bitset tests covering the Long high-bit case. CHANGELOG
entries for the Swift, Rust, and Kotlin clients.
Shares the reducer fixtures with #203 and a follow-up; cleanest to land after #203.