feat(resolver): decode self-describing argument values#343
Merged
Conversation
2729eb8 to
37cdc94
Compare
Bind arguments through one path in `interop::from_json`: a tagged value is self-describing and decodes from its tags via `decode_tagged` (recursively, no schema) whatever its kind, while a bare value carries no tag and is coerced via the param's flat TIR `Type` — the legacy form a top-level scalar may still take. This replaces the old `TargetTypeNotSupported` catch-all for `List`/`Map`/`Tuple`/`Custom` params, so an argument of an aggregate type (record, list, tuple, map) now resolves. `decode_tagged` turns the tagged wire form into the matching `ArgValue` (scalar leaves reuse the existing per-scalar coercions; `struct` carries its constructor index and positional fields), with precise errors for unknown tags, malformed structs/map-pairs, and untagged nested values. Also sweeps the new `ArgValue` variants through the crate's exhaustive matches: `arg_to_json` round-trips aggregates through the tagged form, and the hand-rolled `partial_eq` test helper is dropped now that `ArgValue` derives `PartialEq`. Adopts `tx3-tir` 0.19.0 (the `ArgValue` aggregate variants). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37cdc94 to
437f4a0
Compare
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.
What
Makes an argument of an aggregate type (record,
List,Map,Tuple) resolve, instead of failing withtarget type not supported. Server half of the client-side-encoding approach: the TIR stays untyped, and the resolver decodes the deterministic, self-describing wire form the client builds from the.tii.interop::from_jsonbecomes one path:{ "int" | … | "struct": … }) is self-describing and decodes from its tags via the new recursivedecode_encoded, no schema, whatever its kind.Type— the legacy form a top-level scalar may still take.There is no scalar-vs-aggregate fork: the kind is not a branch in the road, only "tagged or bare."
decode_encodedmaps the tagged wire form toArgValue(scalar leaves reuse the existingvalue_to_*coercions;structcarries its constructor index + positional fields;mapis an array of[key, value]pairs). Precise errors replace the blanket unsupported case: unknown tag, malformed struct / map-pair, untagged nested value.Downstream
ArgValuesweepThe new
tx3-tirvariants break the crate's exhaustiveArgValuematches; fixed here:arg_to_jsonround-trips aggregates through the tagged form (via a newencoded_arg_to_json).partial_eqtest helper is removed now thatArgValuederivesPartialEq.Adopts
tx3-tir0.19.0 (theArgValueaggregate variants — tx3-lang/tir#4).Tests
struct { list[int], int }of the05-invokefixture, plus reject cases (unknown tag, malformed struct/map-pair, untagged nested, bare aggregate). All existing scalarfrom_json_*tests stay green.cargo test --workspacegreen (184 + 96 + …); builds clean against the publishedtx3-tir 0.19.0(no[patch.crates-io]).The crate version bump + publish is a separate release step.
🤖 Generated with Claude Code