Skip to content

Automatically handle semver-compatibility in wasmtime::component::Linker #7860

@alexcrichton

Description

@alexcrichton

This was discussed this past week at the BA plumbers summit and the conclusion was that part of the WASI release process will be the expectation that runtimes can update WASI and won't need to carry weighty "old" implementation of prior versions of WASI. For example updating from 0.2.1 to 0.2.0 should mean that only one copy of the 0.2.1 WITs are required and only one host implementation is required. Additionally it was concluded that it should be possible to load a module which imports 0.2.0 into a runtime that has updated to 0.2.1, and additionally it should be possible to be forwards compatible as well. Any APIs defined in 0.2.0 but imported at 0.2.1 should still be possible to run on a runtime that only supports 0.2.0. This means, for example, that guest languages can update to 0.2.1 and so long as no new functionality is used from 0.2.1 they'll still run on all 0.2.0 runtimes.

I believe the best way to implement this in Wasmtime will be more fancy logic in the wasmtime::component::Linker type. More-or-less this would involve updating the string used to register imports to chop off the semver-compatible parts. For example foo:bar/[email protected] would be inserted as foo:bar/[email protected]. Additionally foo:bar/[email protected] would become foo:bar/baz@1. That lookup string should be enough for both forwards and backwards compatibility. We'll still be able to rely on normal type-checking as well so this in theory shouldn't cause runtime issues.

This issue is intended to track this implementation change to wasmtime::component::Linker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasm-proposal:component-modelIssues related to the WebAssembly Component Model proposalwasmtime:apiRelated to the API of the `wasmtime` crate itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions