How does one use wasm-tools component semver-check
? For example, say I want to check that a wasi-http change is sermver-compatible with the current interface. The CLI only seems to take one wit directory; is there a convenient way to copy the old world into the new wit directory? Or is there another way to do this?
the rough intention is that both the old and the new are in the same directory so you could do something like:
wasm-tools component semver-check --prev wasi:http/proxy@0.2.0 --new wasi:http/proxy@0.2.1 ./wit
where you'd fill in wit/deps/*
based on the various packages and dependencys (and probably a dummy wit/root.wit
file for now)
How does one put two different versions of the same interfaces in wit/deps/* tree?
oh you can put them in separate folders, for example wit/deps/http@0.2.0/*.wit
and wit/deps/http@0.2.1/*.wit
the names of the directories don't actually matter, they're ignored during parsing -- only used for human-readable organization
$ wasm-tools component semver-check --prev wasi:http/proxy@0.2.2 --new wasi:http/proxy@0.2.3 ./wit
error: the old world is in package wasi:http, which is not the same as the new world, which is in package wasi:http
I think I got everything in versioned directories under wit/deps now, and am now getting this error.
One of them has package wasi:http@0.2.2;
and the other has package wasi:http@0.2.3;
.
This change seems to fix it for me. Does this look reasonable?
diff --git a/crates/wit-component/src/semver_check.rs b/crates/wit-component/src/semver_check.rs
index 1c4a9f4f..58d0aa74 100644
--- a/crates/wit-component/src/semver_check.rs
+++ b/crates/wit-component/src/semver_check.rs
@@ -55,7 +55,7 @@ pub fn semver_check(mut resolve: Resolve, prev: WorldId, new: WorldId) -> Result
.package
.context("new world not in named package")?;
let new_pkg_name = &resolve.packages[new_pkg_id].name;
- if old_pkg_id != new_pkg_id {
+ if old_pkg_name != new_pkg_name {
bail!("the old world is in package {old_pkg_name}, which is not the same as the new world, which is in package {new_pkg_name}", )
}
I've now added a test and posted this as a PR.
oops yeah I think the check there is a bit overly cautious, thanks!
Last updated: Nov 22 2024 at 17:03 UTC