Skip to content

chore: pull in more wit-bindgen 0.58 tests#1372

Draft
rvolosatovs wants to merge 17 commits into
mainfrom
chore/wit-bindgen-0.58-test
Draft

chore: pull in more wit-bindgen 0.58 tests#1372
rvolosatovs wants to merge 17 commits into
mainfrom
chore/wit-bindgen-0.58-test

Conversation

@rvolosatovs

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Rewrite the verbatim upstream guest-API runner.rs/test.rs into the
async host API the wRPC generator emits: runner exposes
`run(wrpc)` invoking the generated `to-test` client functions, and
test provides a `Component` implementing the generated `Handler`
trait. Result-returning functions are handled across both the
transport layer and the inner WIT result.
…, list-in-variant)

Rewrite the upstream guest-API runner.rs/test.rs sources for these four
runtime tests against the wRPC async host bindings: runner.rs exposes an
async run() driving the generated client invoke functions, and test.rs
implements the generated Handler trait on a Component struct.

Assisted-by: anthropic:claude-opus-4-8
Load runtime tests via `push_path` on the test directory and point the
bindings generator at the directory too, so a sibling `deps/` directory
of dependency packages (used by the `versions` test) is resolved.

Assisted-by: anthropic:claude-opus-4-8
Port resource_aggregates, resource_alias, resource_alias_redux,
resource-borrow and resource_borrow_in_record from upstream's guest API
to the wRPC async host API (per-resource `Handler*` impls returning
`ResourceOwn`, server resource state encoded in the handle bytes).

Assisted-by: anthropic:claude-opus-4-8
The wRPC harness links a single `runner` against a single `test` world
over the transport; it cannot express upstream's `wac`-composed
multi-component tests (runner -> intermediate -> leaf) or the core/
component `.wat` demo. Drop common-types, resource_floats,
resource-import-and-export, resources, resource_with_lists, results and
demo. Their type coverage (records/variants/results/resources) is
retained by flavorful and the resource_* tests.

Assisted-by: anthropic:claude-opus-4-8
These tests exercise wit-bindgen Rust *codegen* knobs or multi-component
structures the wRPC generator/harness intentionally does not support, so
they cannot run as transport tests without unrelated generator work:

- unsupported generator flags: disable-custom-section-link-helpers,
  method-chaining (--enable-method-chaining), ownership (--ownership),
  raw-strings (--raw-strings/--std-feature),
  run-ctors-once-workaround (--disable-run-ctors-once-workaround)
- wac multi-component / multi-world: equal-types
  (also --merge-structurally-equal-types), two-wit-packages,
  with-only-affects-imports, xcrate
- other-dependencies: two packages in one directory, which the
  single-package runtime-test loader cannot parse

Assisted-by: anthropic:claude-opus-4-8
Port the legacy tests/runtime/rust tests whose generator flags/structure
the wRPC generator supports: alternative-bitflags, custom-derives,
owned-resource-deref-mut, resource_into_inner, skip (drop the no_std
test variant), with, with-and-resources, with-types,
with-option-generate and type_section_suffix.

Assisted-by: anthropic:claude-opus-4-8
Update to wasm-tokio 0.6.1 / leb128-tokio 0.1.7, which carry the signed
LEB128 sign-extension decode fix, and drop the transitional
`--rust-leb128-tokio-path` patch flag from the runtime-test harness; the
generated dependency crate now resolves the fixed codec directly.

Assisted-by: anthropic:claude-opus-4-8
Imported client functions were generated with a handle type parameter
named `C` (`fn foo<'a, C: Invoke>(wrpc__: &'a C, ...)`). A WIT type whose
upper-camel name is `C` (e.g. a type/variant named `c`) then resolved to
the generic parameter instead of the type, breaking `Encode`/`Decode`.
Rename the generic to `C__`; generated WIT type names never contain
underscores, so it cannot collide (matching the existing `wrpc__`/`cx__`
parameter-naming convention).

Restore the with-types runtime test to use the natural `c` type name it
previously had to rename to dodge this bug.

Assisted-by: anthropic:claude-opus-4-8
Point `--bitflags-path` at a local `my_bitflags` re-export under the
driver's `runner`/`test` module (mirroring upstream's crate-root alias)
rather than the default path, so the flag is genuinely exercised.

Assisted-by: anthropic:claude-opus-4-8
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
The wRPC generators do not yet implement the `map` or fixed-length
`list<T, N>` WIT types, so bindings generation for these runtime tests
panics. Treat their failures as expected (mirroring the codegen
`should_fail` mechanism) so the suite stays green; if a test here starts
succeeding the harness flags it so the entry can be removed.

Assisted-by: anthropic:claude-opus-4-8
@rvolosatovs rvolosatovs marked this pull request as draft June 24, 2026 08:32
Implement `go_runtime_test`: generate the runner and test world bindings
into a single `driver` Go module (distinct `driver/runner` and
`driver/test` import paths), drop each test's source in beside its world
package, and build a fixed `main.go` that serves the `test` world's
exports and runs the `runner` world's `Run` against an in-process TCP
client — mirroring the Rust driver. Port the numbers Go sources to the
wRPC host API as the worked example.

Assisted-by: anthropic:claude-opus-4-8
The generated flags decoder rejected "unassociated" high bits using a
shift of `flags.len() % 8`. When the flag count is a multiple of 8 the
final byte is fully used, so the shift was 0 and every legitimately-set
bit in that byte was rejected with "bit not associated with any flag is
set". Shift by the number of meaningful bits in the last byte
(`(len-1) % 8 + 1`) instead, which is 8 for byte-aligned counts.

Assisted-by: anthropic:claude-opus-4-8
Port the Go runner/test sources (strings, strings-simple, lists,
records, variants, many-arguments, resource-borrow, flavorful) from
upstream's guest API to the wRPC Go host API: runner `Run(ctx, Invoker)`
clients and `test` package handlers implementing the generated exports
interfaces.

Assisted-by: anthropic:claude-opus-4-8
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant