diff --git a/crates/wasm-pkg-client/src/decoded_component.rs b/crates/wasm-pkg-client/src/decoded_component.rs index 8c8767d..b6377c1 100644 --- a/crates/wasm-pkg-client/src/decoded_component.rs +++ b/crates/wasm-pkg-client/src/decoded_component.rs @@ -208,10 +208,12 @@ fn extract_package_version(decoded: &DecodedWasm) -> Result<(PackageRef, Version Ok((package, version)) } -/// Borrow the inner `wit_parser::Resolve` and resolve a concrete `WorldId`. -/// For a decoded component the world is fixed; for a WIT package we ask -/// `Resolve::select_world` to pick one — deferred until needed so a -/// multi-world WIT package can publish its first version unambiguously. +/// Borrow the inner `wit_parser::Resolve` and resolve a concrete `WorldId` +/// for semver checking. +/// +/// Semver checks compare two versions of the same component, and a +/// component is defined by exactly one world. Therefore it is considered +/// an error if a `WitPackage` defines more than one world. fn extract_resolve_and_world_id( decoded: &DecodedWasm, ) -> Result<(&wit_parser::Resolve, wit_parser::WorldId), Error> { @@ -220,7 +222,7 @@ fn extract_resolve_and_world_id( DecodedWasm::WitPackage(resolve, pkg) => { let world_id = resolve .select_world(&[*pkg], None) - .map_err(Error::InvalidPackage)?; + .map_err(|e| Error::InvalidPackage(e.context("we currently do not support multiple wolds, etc...")))?; Ok((resolve, world_id)) } }