static value types via KnownValueType + single-param unwrap#19
Merged
colinrozzi merged 1 commit intoMay 10, 2026
Merged
Conversation
Two related fixes for typed actor state in Theater. KnownValueType trait: provides ValueType at the type level, so empty containers (Vec, Option, BTreeSet, BTreeMap, [T; N], Result) carry correct elem_type / inner_type info even when the value is empty. Previously From<Vec<T>> inferred elem_type from the items and defaulted to S32 for empty Vecs, so an empty list<binding> field encoded as list<s32> and theater's host-side type validator rejected it. GraphValue derive emits KnownValueType impls for structs (Record), tuple structs (Tuple), unit structs (Unit), and variants (Variant). Pack's host-side PackType collapses to a blanket impl over Into<Value> + KnownValueType, removing two parallel trait hierarchies. Export macro single-param unwrap: a guest function with one typed parameter (e.g. fn list(state: RouterState) -> ...) was decoding the incoming value directly via try_into(). But theater always wraps inputs as Tuple([...args]), so the wasm side received Tuple([state]) and failed with 'failed to convert parameter'. The state-mode and multi-param branches already unwrapped the wrapping tuple; the single-param branch now does too.
112c806 to
4f94dcb
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.
static value types via KnownValueType + single-param unwrap
Two related fixes for typed actor state in Theater.
KnownValueType trait: provides ValueType at the type level, so empty
containers (Vec, Option, BTreeSet, BTreeMap, [T; N], Result) carry
correct elem_type / inner_type info even when the value is empty.
Previously From<Vec> inferred elem_type from the items and defaulted
to S32 for empty Vecs, so an empty list field encoded as
list and theater's host-side type validator rejected it.
GraphValue derive emits KnownValueType impls for structs (Record),
tuple structs (Tuple), unit structs (Unit), and variants (Variant).
Pack's host-side PackType collapses to a blanket impl over Into
Export macro single-param unwrap: a guest function with one typed
parameter (e.g. fn list(state: RouterState) -> ...) was decoding the
incoming value directly via try_into(). But theater always wraps inputs
as Tuple([...args]), so the wasm side received Tuple([state]) and
failed with 'failed to convert parameter'. The state-mode and
multi-param branches already unwrapped the wrapping tuple; the
single-param branch now does too.