pchickey opened PR #10054 from bytecodealliance:pch/invoke_wave
to bytecodealliance:main
:
<!--
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
-->
pchickey updated PR #10054.
pchickey updated PR #10054.
tpmccallum commented on PR #10054:
Tried this locally and got the following:
cd /Users/tpmccallum git clone https://github.com/bytecodealliance/wasmtime.git cd wasmtime git checkout main git pull origin main git checkout pch/invoke_wave git merge main cargo clean cargo build --release
Repo I used for testing is at https://github.com/tpmccallum/testing_components/tree/main (specifically the
compress
component):tpmccallum@192-168-1-17 compress % /Users/tpmccallum/wasmtime/target/release/wasmtime run --invoke compress target/wasm32-wasip1/debug/compress.wasm Error: failed to run main module `target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
pchickey commented on PR #10054:
The wave syntax requires functions to be invoked with parens, so
--invoke "compress()"
should hopefully work. one of the big things missing is better error messages...
tpmccallum commented on PR #10054:
Thanks for the response @pchickey
That makes sense. Thank you, and I will try that next and report back here.
tpmccallum commented on PR #10054:
Hi @pchickey
Thanks for the additional info. I got this working - and wrote an article < https://medium.com/wasm/wasm-component-model-seamless-compression-c-rust-and-wasm-3b8d52ed8b31 >
Thanks again!
Let me know if you need/want me to do any further testing on this. Super happy to assist.
tpmccallum commented on PR #10054:
Hi @pchickey,
I have implemented the error message, please see information below.Run.rs
Original/Before
An example of a user typing `--invoke "compress" (with quotes).
Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
After
An example of a user typing `--invoke "compress" (with quotes).
Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
With Arguments
I also updated the Rust function to accept a string argument and then tested that the proper escaping of the string argument worked:
Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress(\"hello\")" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
[40, 181, 47, 253, 0, 88, 41, 0, 0, 104, 101, 108, 108, 111]
Cli-options.md
I also went ahead and updated the documentation that talks about
--invoke
with all of the above information (quotes, parenthesis, etc.).
tpmccallum edited a comment on PR #10054:
Hi @pchickey,
I have implemented the error message, please see information below.Run.rs
Original/Before (Testing error message output)
An example of a user typing `--invoke "compress" (with quotes).
Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
After (Testing error message output)
An example of a user typing `--invoke "compress" (with quotes).
Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
With Arguments (Testing functionality of invoking a function with arguments)
I also updated the Rust function to accept a string argument and then tested that the proper escaping of the string argument worked:
Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress(\"hello\")" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
[40, 181, 47, 253, 0, 88, 41, 0, 0, 104, 101, 108, 108, 111]
Cli-options.md
I also went ahead and updated the documentation that talks about
--invoke
with all of the above information (quotes, parenthesis, etc.).
$ git status modified: docs/cli-options.md modified: src/commands/run.rs $ git commit -m "Finalized enhancements for --invoke: error messages" [invoke_wave_enhancements 4a93050af] Finalized enhancements for --invoke: error messages 2 files changed, 37 insertions(+), 5 deletions(-) $ git push origin invoke_wave_enhancements git push origin invoke_wave_enhancements Enumerating objects: 13, done. Counting objects: 100% (13/13), done. Delta compression using up to 16 threads Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.84 KiB | 1.84 MiB/s, done. Total 7 (delta 6), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (6/6), completed with 6 local objects. remote: remote: Create a pull request for 'invoke_wave_enhancements' on GitHub by visiting: remote: https://github.com/tpmccallum/wasmtime/pull/new/invoke_wave_enhancements remote: To github.com:tpmccallum/wasmtime.git * [new branch] invoke_wave_enhancements -> invoke_wave_enhancements
tpmccallum commented on PR #10054:
Hi @pchickey
When creating the PR, the base repository is set topchickey/wasmtime
, but the drop-down for the base branch does not have apch/invoke_wave
option?
Not sure if you want/need to pushpch/invoke_wave
to your fork so I can set it as the base?
At this stage, I usedmain
as the base because the changed files look relevant to the --invoke work specifically. So perhaps all is fine and you will see my changes.The PR is at
[tpmccallum/wasmtime:invoke_wave_enhancements](https://github.com/pchickey/wasmtime/pull/1)
.
I did not get to the CI errors today, only the CLI output messages and the documentation.
Please let me know your thoughts, and I can get the CI done tomorrow.
Chat soon
Thanks!
tpmccallum edited a comment on PR #10054:
Hi @pchickey
When creating the PR, the base repository is set topchickey/wasmtime
, but the drop-down for the base branch does not have apch/invoke_wave
option?
Not sure if you want/need to pushpch/invoke_wave
to your fork so I can set it as the base?
At this stage, I usedmain
as the base because the changed files look relevant to the --invoke work specifically. So perhaps all is fine and you will see my changes.The PR is at
[tpmccallum/wasmtime:invoke_wave_enhancements](https://github.com/pchickey/wasmtime/pull/1)
.
I did not get to the CI errors today, only the CLI output messages and the documentation.Please let me know your thoughts, and I can get the CI done tomorrow. On that note, I was wondering if you wanted to rebase and bring the PR up to date with the current code base. Happy to be guided by you.
Chat soon
Thanks!
tpmccallum deleted a comment on PR #10054:
Hi @pchickey
When creating the PR, the base repository is set topchickey/wasmtime
, but the drop-down for the base branch does not have apch/invoke_wave
option?
Not sure if you want/need to pushpch/invoke_wave
to your fork so I can set it as the base?
At this stage, I usedmain
as the base because the changed files look relevant to the --invoke work specifically. So perhaps all is fine and you will see my changes.The PR is at
[tpmccallum/wasmtime:invoke_wave_enhancements](https://github.com/pchickey/wasmtime/pull/1)
.
I did not get to the CI errors today, only the CLI output messages and the documentation.Please let me know your thoughts, and I can get the CI done tomorrow. On that note, I was wondering if you wanted to rebase and bring the PR up to date with the current code base. Happy to be guided by you.
Chat soon
Thanks!
tpmccallum edited a comment on PR #10054:
Hi @pchickey,
I have implemented the error message, tested out a bunch of scenarios and also updated the documentation.
Please see the details below.Run.rs
Original/Before (Testing error message output)
An example of a user typing `--invoke "compress" (with quotes).
Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
After (Testing error message output)
An example of a user typing `--invoke "compress" (with quotes).
Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
With Arguments (Testing functionality of invoking a function with arguments)
I also updated the Rust function to accept a string argument and then tested that the proper escaping of the string argument worked:
Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress(\"hello\")" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
[40, 181, 47, 253, 0, 88, 41, 0, 0, 104, 101, 108, 108, 111]
Cli-options.md
I also went ahead and updated the documentation that talks about
--invoke
with all of the above information (quotes, parenthesis, etc.).
How I pushed my changes ...
$ git status modified: docs/cli-options.md modified: src/commands/run.rs $ git commit -m "Finalized enhancements for --invoke: error messages" [invoke_wave_enhancements 4a93050af] Finalized enhancements for --invoke: error messages 2 files changed, 37 insertions(+), 5 deletions(-) $ git push origin invoke_wave_enhancements git push origin invoke_wave_enhancements Enumerating objects: 13, done. Counting objects: 100% (13/13), done. Delta compression using up to 16 threads Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.84 KiB | 1.84 MiB/s, done. Total 7 (delta 6), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (6/6), completed with 6 local objects. remote: remote: Create a pull request for 'invoke_wave_enhancements' on GitHub by visiting: remote: https://github.com/tpmccallum/wasmtime/pull/new/invoke_wave_enhancements remote: To github.com:tpmccallum/wasmtime.git * [new branch] invoke_wave_enhancements -> invoke_wave_enhancements
When creating the PR in the GitHub UI, the base repository is set to
pchickey/wasmtime
, but the drop-down for the base branch does not have apch/invoke_wave
option. Not sure if you want/need to push pch/invoke_wave to your fork so I can set it as the base?At this stage, I used main as the base because the changed files look relevant to the --invoke work specifically. So perhaps all is fine and you will see my changes.
The PR is at tpmccallum/wasmtime:invoke_wave_enhancements.
I did not get to the CI errors today, only the CLI output messages and the documentation.Please let me know your thoughts, and I can get the CI done tomorrow. On that note, I was wondering if you wanted to rebase and bring the PR up to date with the current code base. Happy to be guided by you.
Chat soon
Thanks!
tpmccallum edited a comment on PR #10054:
Hi @pchickey,
I have implemented the error message, tested out a bunch of scenarios and also updated the documentation.
Please see the details below.Run.rs
Original/Before (Original error message)
An example of a user typing
--invoke "compress"
(with quotes).Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
After (Confirming new error message that provides advice about quotes and parentheses)
An example of a user typing `--invoke "compress" (with quotes).
Command:
$ /Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
An example of a user typing
--invoke compress
(no quotes):Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke compress /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
Error: failed to run main module `/Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: failed to parse invoke 'compress': invoked function calls must include parentheses after the function name in quoted wave syntax (e.g., "compress()") 1: unexpected end of input at 8..8
After (Testing functionality of invoking a function with arguments inside the parentheses)
I also updated the Rust function to accept a string argument and then tested that the proper escaping of the string argument worked:
Command:
/Users/tpmccallum/test_wasmtime/wasmtime/target/release/wasmtime run --invoke "compress(\"hello\")" /Users/tpmccallum/testing_components/compress/target/wasm32-wasip1/debug/compress.wasm
Output:
[40, 181, 47, 253, 0, 88, 41, 0, 0, 104, 101, 108, 108, 111]
Documentation (
docs/cli-options.md
)I also went ahead and updated the documentation that talks about
--invoke
with all of the above information (quotes, parenthesis, etc.).Workflow
Below is how I pushed my changes. I hope this is what you were after, if not, please let me know.
Created a new branch called
invoke_wave_enhancements
.$ git branch invoke_wave * invoke_wave_enhancements main $ git status modified: docs/cli-options.md modified: src/commands/run.rs $ git commit -m "Finalized enhancements for --invoke: error messages" [invoke_wave_enhancements 4a93050af] Finalized enhancements for --invoke: error messages 2 files changed, 37 insertions(+), 5 deletions(-) $ git push origin invoke_wave_enhancements git push origin invoke_wave_enhancements Enumerating objects: 13, done. Counting objects: 100% (13/13), done. Delta compression using up to 16 threads Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.84 KiB | 1.84 MiB/s, done. Total 7 (delta 6), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (6/6), completed with 6 local objects. remote: remote: Create a pull request for 'invoke_wave_enhancements' on GitHub by visiting: remote: https://github.com/tpmccallum/wasmtime/pull/new/invoke_wave_enhancements remote: To github.com:tpmccallum/wasmtime.git * [new branch] invoke_wave_enhancements -> invoke_wave_enhancements
When creating the PR in the GitHub UI, the base repository is set to
pchickey/wasmtime
, but the drop-down for the base branch does not have apch/invoke_wave
option. Not sure if you want/need to pushpch/invoke_wave
to your fork so I can set it in the drop-down for the base?At this stage, I used main as the base because the changed files look relevant to the
--invoke
work specifically. So perhaps all is fine and you will see my changes.The PR is at tpmccallum/wasmtime:invoke_wave_enhancements.
I did not get to fixing the CI errors today, only the CLI output messages and the documentation.Please let me know your thoughts, and I can get the CI done tomorrow. On that note, I was wondering if you wanted to rebase and bring the PR up to date with the current code base. Happy to be guided by you.
Chat soon
Thanks!
tpmccallum commented on PR #10054:
Update at https://github.com/bytecodealliance/wasmtime/pull/10511
pchickey updated PR #10054.
pchickey updated PR #10054.
pchickey updated PR #10054.
pchickey has marked PR #10054 as ready for review.
pchickey requested alexcrichton for a review on PR #10054.
pchickey requested wasmtime-core-reviewers for a review on PR #10054.
pchickey requested wasmtime-default-reviewers for a review on PR #10054.
pchickey edited PR #10054:
This PR does two things:
adds the methods
exports
andexports_rec
to Wasmtime'sComponent
type. These expose iterators for the exportedComponentItem
, as well as their string andComponentExportIndex
names, of the top level of a component, and recursively in all of the exports of a component, respectively. These methods are motivated by needing to search for export functions with a given suffix.adds support for
wasmtime run --invoke <wave-function-call> component.wasm
to wasmtime-cli. In the existing invoke for modules, the user provides a bare function name, and only functions that do not take arguments are supported. For components, the argument to invoke is parsed into component vals using the existing wasm-wave parsing introduced in https://github.com/bytecodealliance/wasmtime/pull/8872. We make some effort to provide useful error messages when we can't parse the wave function call.
tpmccallum submitted PR review:
There was an excellent suggestion to use single quotes posted on the article about Invoke.
Using single quotes to surround the whole function call negates the need to escape double quotes around string arguments.
tpmccallum created PR review comment:
$ wasmtime run --invoke 'initialize()' foo.wasm
tpmccallum created PR review comment:
tpmccallum created PR review comment:
tpmccallum created PR review comment:
The exported function's name and exported function's parentheses must both be enclosed in one set of single quotes, i.e. `'initialize()'`.
tpmccallum created PR review comment:
tpmccallum created PR review comment:
tpmccallum created PR review comment:
$ wasmtime run --invoke 'initialize("Pi", 3.14)' foo.wasm
tpmccallum created PR review comment:
$ wasmtime run --invoke 'add(1, 2)' foo.wasm
tpmccallum created PR review comment:
tpmccallum created PR review comment:
**Please note:** If you enclose your function call using double quotes, your string argument will require its double quotes to be escaped (escaping quotes is more complicated and harder to read and therefore not ideal). For example: ```bash wasmtime run - invoke "initialize(\"hello\")" foo.wasm
serve
~~~
tpmccallum submitted PR review.
tpmccallum created PR review comment:
I would like to revisit this logic (and will take some help if possible).
I discussed why Rust is not able to actually check for outer quotes in this comment .
But now that I realize we can use single quotes to surround the whole function there might be another way to attempt to detect the absence of surrounding quotes (that are passed, to Rust, from the CLI). I will try and get back to this in a few hours and do some local testing.
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Just some inline updates that promote the use of
'
instead of"
.
tpmccallum edited a comment on PR #10054:
Hi @pchickey
Thanks for the additional info. I got this working - and wrote an article.
Thanks again!
Let me know if you need/want me to do any further testing on this. Super happy to assist.
tpmccallum edited PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum deleted PR review comment.
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Updates are ready at
https://github.com/bytecodealliance/wasmtime/pull/10533
tpmccallum commented on PR #10054:
Hi @pchickey and @alexcrichton
Thanks for your patience. I have gotten around to some additional new work on a branch that handles the invoke quotes/parentheses and also takes care of the documentation aboutinvoke
's quotes and parentheses, etc.
https://github.com/bytecodealliance/wasmtime/pull/10533
Thanks so much.
Tim
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Updates at https://github.com/bytecodealliance/wasmtime/pull/10533
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Updates at https://github.com/bytecodealliance/wasmtime/pull/10533
pchickey updated PR #10054.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I'm personally a bit hesitant to add too many flavors of accessors for exports, but would it be possible to use
types::Component::exports
here instead of adding these iterators?
alexcrichton created PR review comment:
Is this still necessary? This currently compiles on CI so the ignoring the warning may not be necessary.
alexcrichton created PR review comment:
Mind updating the docs here to clarify that this information related to
--invoke
is component-specific? For example the module/component--invoke
arguments behave pretty differently
alexcrichton created PR review comment:
FWIW I think the long string above is causing rustfmt to bail out here.
alexcrichton created PR review comment:
Personally I'm a bit wary to eagerly include help text like this without more detection around what was being done. Could this perhaps instead link to the wave syntax document for now as an intro to what syntax is expected?
tpmccallum submitted PR review.
tpmccallum created PR review comment:
I believe it is still necessary, yes.
For example, if I remove that line and then run the following:rustfmt --edition 2021 crates/wasmtime/src/runtime/wave/core.rs export CARGO_INCREMENTAL=0 export CARGO_PROFILE_DEV_DEBUG=0 export CARGO_PROFILE_TEST_DEBUG=0 export RUSTFLAGS="-D warnings" export WIT_REQUIRE_SEMICOLONS=1 cargo clippy --workspace --all-targets
An error appears:
error: casting `u128` to `i64` may truncate the value --> crates/wasmtime/src/runtime/wave/core.rs:103:19 | 103 | let low = v as i64; | ^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]` help: ... or use `try_from` and handle the error accordingly | 103 - let low = v as i64; 103 + let low = i64::try_from(v); | error: could not compile `wasmtime` (lib) due to 1 previous error
If I add the
#[allow(clippy::cast_possible_truncation)]
back on line100
the error goes away.
I originally noticed the issue in the GitHub UI. Please see screen capture below:
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Sure thing Alex. Good point. I have updated and will have a new branch with all of these changes for you soon.
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Sure thing, I will add a link in the message and take these examples out of the CLI's response.
Changes will also be on the new branch soon.
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Updates at https://github.com/bytecodealliance/wasmtime/pull/10544/files
tpmccallum submitted PR review.
tpmccallum created PR review comment:
Updates at https://github.com/bytecodealliance/wasmtime/pull/10544/files
pchickey updated PR #10054.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Ah ok makes sense, I think it's because the wave feature must not be enabled on the clippy run which would explain this a well
pchickey updated PR #10054.
pchickey updated PR #10054.
pchickey edited PR #10054:
This PR adds support for
wasmtime run --invoke <wave-function-call> component.wasm
to wasmtime-cli. In the existing invoke for modules, the user provides a bare function name, and only functions that do not take arguments are supported. For components, the argument to invoke is parsed into component vals using the existing wasm-wave parsing introduced in https://github.com/bytecodealliance/wasmtime/pull/8872. We make some effort to provide useful error messages when we can't parse the wave function call.
pchickey commented on PR #10054:
@alexcrichton I rewrote the search for component exports to live in the wasmtime-cli and be much dumber/simpler than the borrowing version that was a method on Component.
alexcrichton submitted PR review.
pchickey merged PR #10054.
Last updated: Apr 17 2025 at 17:03 UTC