Stream: git-wasmtime

Topic: wasmtime / PR #10054 wasmtime-cli: support `run --invoke`...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 20 2025 at 20:20):

pchickey opened PR #10054 from bytecodealliance:pch/invoke_wave to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jan 20 2025 at 20:24):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 20 2025 at 20:26):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 26 2025 at 05:08):

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

view this post on Zulip Wasmtime GitHub notifications bot (Feb 26 2025 at 17:19):

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...

view this post on Zulip Wasmtime GitHub notifications bot (Feb 27 2025 at 23:20):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 03 2025 at 04:27):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 06:35):

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.).

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 06:41):

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

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 06:59):

tpmccallum commented on PR #10054:

Hi @pchickey
When creating the PR, the base repository is set to pchickey/wasmtime, but the drop-down for the base branch does not have a pch/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](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!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 07:02):

tpmccallum edited a comment on PR #10054:

Hi @pchickey
When creating the PR, the base repository is set to pchickey/wasmtime, but the drop-down for the base branch does not have a pch/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](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!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 07:03):

tpmccallum deleted a comment on PR #10054:

Hi @pchickey
When creating the PR, the base repository is set to pchickey/wasmtime, but the drop-down for the base branch does not have a pch/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](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!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 07:04):

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 a pch/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!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 10:45):

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 a pch/invoke_wave option. Not sure if you want/need to push pch/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!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 08:35):

tpmccallum commented on PR #10054:

Update at https://github.com/bytecodealliance/wasmtime/pull/10511

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 14:39):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2025 at 15:58):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2025 at 22:44):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2025 at 22:45):

pchickey has marked PR #10054 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2025 at 22:45):

pchickey requested alexcrichton for a review on PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2025 at 22:45):

pchickey requested wasmtime-core-reviewers for a review on PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2025 at 22:45):

pchickey requested wasmtime-default-reviewers for a review on PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2025 at 22:54):

pchickey edited PR #10054:

This PR does two things:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

$ wasmtime run --invoke 'initialize()' foo.wasm

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

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()'`.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

$ wasmtime run --invoke 'initialize("Pi", 3.14)' foo.wasm

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

$ wasmtime run --invoke 'add(1, 2)' foo.wasm

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

tpmccallum created PR review comment:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:28):

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

~~~

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:35):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:35):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:40):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 00:40):

tpmccallum created PR review comment:

Just some inline updates that promote the use of ' instead of ".

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 03:03):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2025 at 03:07):

tpmccallum edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 06:23):

tpmccallum deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 07:27):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 07:27):

tpmccallum created PR review comment:

Updates are ready at
https://github.com/bytecodealliance/wasmtime/pull/10533

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 07:29):

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 about invoke's quotes and parentheses, etc.
https://github.com/bytecodealliance/wasmtime/pull/10533
Thanks so much.
Tim

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 07:30):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 07:30):

tpmccallum created PR review comment:

Updates at https://github.com/bytecodealliance/wasmtime/pull/10533

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 07:30):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 07:30):

tpmccallum created PR review comment:

Updates at https://github.com/bytecodealliance/wasmtime/pull/10533

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 16:41):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 20:55):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 20:55):

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?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 20:55):

alexcrichton created PR review comment:

Is this still necessary? This currently compiles on CI so the ignoring the warning may not be necessary.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 20:55):

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

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 20:55):

alexcrichton created PR review comment:

FWIW I think the long string above is causing rustfmt to bail out here.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2025 at 20:55):

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?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 00:44):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 00:44):

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 line 100 the error goes away.
I originally noticed the issue in the GitHub UI. Please see screen capture below:

![Screenshot 2025-04-08 at 10 42 38](https://github.com/user-attachments/assets/ee17b4b8-fe79-4c98-accb-ebdb4e426bdb)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 04:08):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 04:08):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 04:12):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 04:12):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 05:02):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 05:02):

tpmccallum created PR review comment:

Updates at https://github.com/bytecodealliance/wasmtime/pull/10544/files

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 05:02):

tpmccallum submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 05:02):

tpmccallum created PR review comment:

Updates at https://github.com/bytecodealliance/wasmtime/pull/10544/files

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2025 at 20:52):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2025 at 16:10):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2025 at 16:10):

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

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2025 at 18:11):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2025 at 18:13):

pchickey updated PR #10054.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2025 at 18:17):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2025 at 18:18):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2025 at 19:57):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2025 at 22:22):

pchickey merged PR #10054.


Last updated: Apr 17 2025 at 17:03 UTC