alexcrichton requested pchickey for a review on PR #7994.
alexcrichton opened PR #7994 from alexcrichton:linker-semver-awawre
to bytecodealliance:main
:
This commit is an implementation of #7860 for Wasmtime where
wasmtime::component::Linker
is now "semver aware". This means that it assumes that hosts are always managing WIT interfaces in a semver-aare fashion meaning that semver-compatible upgrade exclusively adds functionality. This neatly fits into the idea of subtyping at the instance-level where if a binary built against 0.2.0 only requests a subset of functionality from a runtime that provides 0.2.1, that should work just fine.Specifically what this change does is:
For all names inserted into a
Linker
there might also be a "semver compatible name" which is registered as well. For example..@1.0.0
is also registered as..@1
.Semver-compatible names are only provided for versions without a prerelease and with either a nonzero major or minor version number.
When looking up an item in the linker if no exact match is found then if a semver-compatible-name is available for the lookup key then that's consulted as well.
This semantically means that if a components imports WASI 0.2.0 then a runtime which only provides WASI 0.2.1 will be able to instantiate the component. Furthermore if a component imports WASI 0.2.1 but only imports the subset of WASI that was available in 0.2.0 then it will be instantiable in a runtime that only supports 0.2.0.
This implementation is intended to be a crucial part of the evolution to WASI to make it more seamless to upgrade WASI from both a host and guest perspective. This no longer requires everyone to upgrade to the same version all at the same time but instead decouples the upgrade schedules.
Closes #7860
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested wasmtime-core-reviewers for a review on PR #7994.
alexcrichton requested wasmtime-default-reviewers for a review on PR #7994.
github-actions[bot] commented on PR #7994:
Subscribe to Label Action
cc @peterhuene
<details>
This issue or pull request has been labeled: "wasmtime:api"Thus the following users have been cc'd because of the following labels:
- peterhuene: wasmtime:api
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
pchickey submitted PR review:
Thanks, this is very nicely commented code
alexcrichton merged PR #7994.
Last updated: Dec 23 2024 at 12:05 UTC