You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for verifying whether a component conforms to a world #1011
In the thread linked above, it was suggested that a wasm-tools component implements foo.wit foo.wasm could be useful for verifying that a component properly conforms to a world pre-instantiation.
@rylev and I were discussing this morning and will start working on this. We were thinking that we could maybe expose an implements function out of the wit-parser crate that takes 2 worlds and performs this check where the first world is the targeted world in question, and the second is the world derived from the component binary.
I think that an "implements" check may not be too too hard at the WIT level, but an alternative strategy I might lean towards is something along the lines of:
Given a WIT world, translate that to a component type. This is already done in the WIT-to-wasm translation.
Generate a component which embeds the component to test. Then embed a new component which imports a component of the type from the WIT-to-world translation. Then intantiate the second component with the first.
This would rely on and leverate wasmparser's preexisting validation of components and hopefully provide somewhat reasonable error messages (but not perfect since it's wasm-vs-WIT)
The main reason I'd lean towards this is that it gets to leverage preexisting tools and additionally doesn't have to wade into the complications that are resources with respect to type-checking.
Does that sound reasonable from y'all's perspective?
Activity
alexcrichton commentedon May 3, 2023
I think that an "implements" check may not be too too hard at the WIT level, but an alternative strategy I might lean towards is something along the lines of:
This would rely on and leverate
wasmparser's preexisting validation of components and hopefully provide somewhat reasonable error messages (but not perfect since it's wasm-vs-WIT)The main reason I'd lean towards this is that it gets to leverage preexisting tools and additionally doesn't have to wade into the complications that are resources with respect to type-checking.
Does that sound reasonable from y'all's perspective?
fibonacci1729 commentedon May 3, 2023
Ah great idea; this makes a lot of sense. Will explore this path first.