-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mismatch in stability attributes error in wit-parser when using Unstable
attribute in wit
#1995
Comments
Thanks for the report! I'm traveling for a bit so may take me a bit to dig in to this but I plan on doing so in the not-too-distant future |
Digging into this, can you confirm that the reduced test case you have reproduces the original error you were seeing? Locally if I revert your fix on your branch and run the test suite I see:
which looks different from "mismatch in stability attributes" that you were seeing with I'm definitely seeing some funny behavior that I wouldn't expect with package wasmtime:test;
interface types {
@unstable(feature = notsure)
use wasi:dep2/stable@0.2.3.{unstable-resource};
}
package wasi:dep2@0.2.3 {
interface stable {
@unstable(feature = notsure)
resource unstable-resource;
}
} which yields:
and while this looks problematic it looks different from the problems you were seeing originally too |
This commit addresses an issue where stability attributes on a `use` didn't quite work as expected when a type to another package was referred to. This fix was to update the "merging" process to skip types being processed in one more location which involved threading some more contexts around. Additionally `use` items, when elaborated, now contain their stability instead of the default stability to ensure that's propagated correctly as well. cc bytecodealliance#1995 but doesn't fix it
I've fixed the issue of your reduced test case (I think) as part of #2046, and it may actually end up helping the original test case, but I'd still want to confirm before closing. |
This commit addresses an issue where stability attributes on a `use` didn't quite work as expected when a type to another package was referred to. This fix was to update the "merging" process to skip types being processed in one more location which involved threading some more contexts around. Additionally `use` items, when elaborated, now contain their stability instead of the default stability to ensure that's propagated correctly as well. cc #1995 but doesn't fix it
Thanks for looking into this. I messed up when I included the I am still getting an error, using your simplified example as a guide, I've reduced the failure to:
|
This might have broken general features, when I run the latest tools against the wasi-cli repo with no features I get:
Where as if I checkout right before the change:
|
This fixes a regression from bytecodealliance#2046 identified in bytecodealliance#1995
Oops, good catch! Should be fixed in #2053 |
That's working again. Does #1995 (comment) make sense as something that should work? This was the original issue I was running into. With a little guidance I would be happy to take a look at fixing it. |
Oh dear I apologize I completely missed that comment! I'll try to dig in to that soon. |
Ok I started to take a look at this and it's going to be tricky. What I think is happening is something like:
At the very least this should have a better error, but otherwise solving this is something I'm not quite sure how to do just yet |
That was my analysis as well. I couldn't find a great solution either so nice to hear it isn't trivial :-) The real world use case for this is something like taking the cli world which has wasi-sockets and adding wasi-tls (see bytecodealliance/wasmtime#10249). If we aren't able to do this then we can't ever have an unstable interface use types from other worlds when building from worlds that already use it. My thoughts are that if we are using a type from another world that is stable and that version already exists in the imports of the world then we should use the existing types stability. This assumes that feature is enabled and the type version being used is compatible version wise with what is already being used. If I understand correctly, that approach seems to be how it works in a scenario where we use the type from two stable interfaces, the type version info is merged together and is why my temp fix works wasm-tools/crates/wit-parser/src/resolve.rs Lines 3819 to 3824 in 0e5b565
|
I agree that the shape of the fix you describes is what we should implement, and I also definitely agree it's something we want to solve! (sorry I've been quite swamped this week so I haven't sat down to think through and write up what a full fix would be, but you've already done 90% of that now!) A caveat I might add is that instead of fixing Would you be up for making a PR to fix this? |
When a new interface is marked as
@unstable (feature = somefeaturegate)
and it uses a stable type from another package viause package:interface/type.{name}
the resulting package can't be imported into other packages that use it. The resulting error is:example
I've demonstrated this by adding a test: jsturtevant@4495325
As well as trying to integrate it into another world: https://github.com/WebAssembly/wasi-cli/compare/main...jsturtevant:wasi-cli:wasi-tls-example?expand=1 (note that this was just a test to see if I was getting in the a set up similiar to other imports)
I was getting this original from wit-bindgen macro: https://github.com/bytecodealliance/wit-bindgen/tree/main?tab=readme-ov-file#supported-guest-languages
workaround
for now I've patched wit-parser like jsturtevant@22cfe2e but it seems like there is probably a better way to approach?
The text was updated successfully, but these errors were encountered: