bytecodealliance / bytecodealliance/wasm-pkg-tools

Unknown escaped wit keywords are not preserved

Open
#181 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
160
Forks
42
Avg merge
7h 57m
Merged PRs (30d)
3

Description

[`map` is being considered as a new wit type](https://github.com/WebAssembly/component-model/pull/554) and reserved word. The latest `wit-bindgen` [implemented the proposal](https://github.com/bytecodealliance/wasm-tools/pull/2356) and now fails to generate bindings if a reserved word is encountered in an invalid context. While this is a breaking change for the ecosystem it's understandable. However, I'm unable to use wkg to fetch this wit interface as the escaped keyword is replaced with the unescaped value in the emitted wit. This in turn causes the component to [fail to build](https://github.com/componentized/valkey/actions/runs/21068032917/job/60590094246#step:12:23).

To ensure forwards compatibility, wkg should preserve all escaped wit identifiers with their escaped value.

Source wit:

https://github.com/componentized/valkey/blob/da24efeb1e4134971890c66b52748c316f9bc3e8/wit/resp.wit#L16

Problematic `wkg fetch`'d wit:

https://github.com/componentized/valkey/blob/da24efeb1e4134971890c66b52748c316f9bc3e8/components/wit/deps/componentized-valkey/package.wit#L22

In this case, the wit is not published, but defined as a [local override](https://github.com/componentized/valkey/blob/da24efeb1e4134971890c66b52748c316f9bc3e8/components/wkg.toml#L2) within the same repository.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.