Contributing

View Source

This page is for you if you change wasm_tools rather than use it: what you need, the checks every change passes, and the rules a review holds you to. Read Architecture first to find the code, and the design for why it is the way it is.

What you need

  • Erlang/OTP 29 or later and rebar3.
  • To rebuild the test components: Rust with the wasm32-wasip2 and wasm32-unknown-unknown targets, and the wasm-tools CLI.
  • Optional: wasmtime (the interop suite) and mix (the Elixir example). Their suites skip without them.

Run the checks

Every change passes these before it is committed:

rebar3 compile
rebar3 xref
rebar3 as test dialyzer
rebar3 lint
rebar3 ct
rebar3 ex_doc          # no warning in its output

rebar3 xref runs in the default profile, where barrel_mcp is not fetched: it proves wasm_tools builds without it. Dialyzer runs in the test profile, where it is.

The docs site is set up in ex_doc.config: a new page goes in its extras and in one of its groups_for_extras. The README is read on GitHub and on HexDocs, so its header is plain HTML with absolute links: ex_doc does not read Markdown inside HTML.

The benchmarks are not among the checks:

rebar3 ct --suite=test/wasm_tools_bench_SUITE --group=bench

Rebuild the test components

The components in test/fixtures/component/ are committed, with their Rust sources and WIT. After changing a source or a WIT file:

scripts/build-fixtures.sh

and commit the sources and the rebuilt .component.wasm together. The ones in test/fixtures/component/erlang_wasm/ are copied from erlang_wasm; their README says from where.

The rules

  • A test fails without your change. Run it on the code before the change.
  • Nothing raises. Errors are maps #{class, kind, msg, ctx}, in the classes of Call a component.
  • Only erlang_wasm's supported API (Architecture). A gap there is fixed there, in its own pull request.
  • No new runtime dependency. barrel_mcp stays optional: only wasm_tools_mcp calls it, and those calls are listed in its -ignore_xref.
  • Nothing a component names becomes an atom.
  • A page that describes what you changed is updated in the same change. The Erlang in it is checked by wasm_tools_docs_SUITE: mark a block that must run with <!-- check: run -->.
  • A claim about speed or memory comes with numbers from the bench suite, in Benchmarks.

Commits and pull requests

  • One commit per step, each with its tests. A commit message is one imperative subject line, with a body only for a reason that is not obvious. No attribution trailers.
  • A pull request says what was wrong and why it matters, the change in a few lines, and any breaking change. It does not list the tests or walk through the diff.
  • A release is a version bump and a CHANGELOG.md section in short, plain English: what is new or what was wrong, and what it means for a user.