clarify single-world requirement in extract_resolve_and_world_id#229
clarify single-world requirement in extract_resolve_and_world_id#229ryan-surname-p wants to merge 3 commits into
Conversation
| /// component is defined by exactly one world. Therefore it is considered | ||
| /// an error if a `WitPackage` defines more than one world. |
There was a problem hiding this comment.
Are we saying that a multi world package is unsupported or unexpected/undesired?
There was a problem hiding this comment.
I'd say it's more of a limitation of the current implementation because I was working under the incorrect assumption that a published artifact would map 1:1 to a component.
This is likely to be the common case but it's not strictly true and it will require some additional handling on the client to fix this.
Namely that we need to decode the WitPackage and extract all the components defined within.
While I'm quite certain there is a 1:1 mapping of Component to world I'm not sure if there is a 1:1 mapping of world to component.
Do you happen to know?
Given that you are preparing a release it seemed prudent not to try expand this functionality today but to instead document the existing behavior.
There was a problem hiding this comment.
I'm probably getting a bit too hung up on the wording here but "can be thought of" causes some doubt.
https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md?plain=1#L159C42-L160C57
There was a problem hiding this comment.
While I'm quite certain there is a 1:1 mapping of Component to world I'm not sure if there is a 1:1 mapping of world to component.
You're usually able to map a component to a known world or one that a component creates, you can see this by calling --importize in wasm-tools:
$ wasm-tools component wit my_component_0.1.0.wasm --importize
package root:component;
world root-importized {
...There was a problem hiding this comment.
I think for now it's safe to go with the assumption that a component will map to a well-known world or a root:component it creates for itself.
pinged @salmans to config.
Co-authored-by: Mikhail Katychev <mkatych@gmail.com>
|
Would it be useful for the error text to distinguish a package with zero worlds from one with multiple worlds? Both violate the single-world requirement, but the likely corrective action differs: define a world versus select or split the intended component contract. Including the observed world count, and possibly names when there are only a few, could make this clarification more actionable. |
The original wording was factually inaccurate as wit_parser will not arbitrarily select a world from a wit package.
Furthermore semver checks are performed on a per component basis so the wit package being decoded must too define as a single world.
https://component-model.bytecodealliance.org/design/wit.html#worlds