Hi, I wonder if there's any docs about adding/removing members from enum/variant break binary compatibility? And if so, what's the best/safe way to change an existing enum?
I don't think there is any kind of variant subtyping currently implemented in the component model, so any changes to variant cases would be backward-incompatible. The only "safe" ways to migrate would be to create a new variant that is only used by new functions or by updating the package version to indicate the backward-incompatibility.
Thanks Lann, how about enum? Is it backed by integers? Any way to safely change it without breaking anything?
Same for enums and all other value types. The ABI does indeed use integers but components have self-describing interfaces that include most of what is specified in WIT; see the spec here: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Binary.md#type-definitions
In the specific case of enum you can see that the binary type information includes <label> strings.
That feels like a pain :-/
There was a rough outline of subtyping prior to the 0.2 release but it was removed. You can see some discussion of why here: #wasi > `@since` gates on variant and enum members? @ 💬
Last updated: Dec 06 2025 at 07:03 UTC