wit-component, wit-parser: preserve doc comments through embed path#2532
wit-component, wit-parser: preserve doc comments through embed path#2532Mees-Molenaar wants to merge 4 commits into
Conversation
|
Thanks! Given the test failures I think it might make sense to ignore errors when decoding this section rather than propagating them up? That looks to be masking other errors and/or causing minor issues. |
|
Thanks for quick review, I agree with your comment. I only see that an offset is now not matching because of an offset. Is that something I need to commit, or do I need to change the implementation so that the offset keeps the same? |
|
Oh offsets changing is fine, that's because there's more stuff in the wasm module now the docs). You can fix that by running the test suite with |
e3a8083 to
db517c1
Compare
|
Added a comment specifying that it is best effort and only drops the documentation when it fails and commited both offset changes. |
|
I did a sanity check with building a wasm component using Figured out (together with an AI) that the last commit was necessary, however, I am having more trouble understanding the changes now. Currently I kow that when building a wasm component with Then wasm-component-ld is called to link. This calls Then finally we use And the encoding.rs and decoding.rs both use metadata.rs under the hood, so I guess the changes are correct and necessary for this use case. Any thoughts on this? |
|
Ah ok yeah I think I see what's going on here, thanks for digging in! This reveals a few things to me and thoughts:
Overall this is unfortunately turning a bit more gnarly than intended. Given all of this there's a few discrete items that need to happen, much of which this PR already covers but I think we'll want to formalize it a bit more:
One possibly unfortunate wrench to throw into all of this is compatibility with other versions of encoding documentation. The struct has I realize that I suspect you didn't think this was going to become such a broad feature, so if you'd prefer to not take this on that's totally understandable. I feel like this is at the very least a good exploration and this can all be recorded in an issue if needed. Would you be interested in still pursuing this though? |
For our use case, we want to store some metadata in comments in the wit file. According to the documentation, this should be available. However, we encountered that the embedding path (which is used by wit-bindgen) did not include the comments. This PR fixes that.