Skip to content

Commit a853591

Browse files
committed
build(wasm_sandbox): commit compiled WIT artifact + CI drift check
host_bindgen!() consumes a compiled WIT component (sandbox-world.wasm), which was previously .gitignored and only produced by `just wasm guest-compile-wit`. That left silent breakage for source-distribution consumers (`pip install git+...`, `cargo install`, etc.) because the artifact is read by transitive deps -- specifically the hyperlight-wasm-runtime proc-macro -- BEFORE our own build scripts can run. A build.rs in this crate cannot solve the bootstrap (the runtime is compiled first in the dep graph, and would race ABI with our fresh bindings even if it succeeded). The pragmatic, well-trodden fix used by most WIT-component projects: check the compiled artifact into git so it exists from clone time. Changes: - .gitignore: add `!src/wasm_sandbox/wit/sandbox-world.wasm` to opt this specific artifact out of the broad `*.wasm` exclusion. - Commit the current 16235-byte canonical artifact produced by `wasm-tools component wit ... -w`. - CI: add a `Check WIT artifact is in sync` step to the wasm-sandbox matrix job that regenerates the file via `just wasm guest-compile-wit` then `git diff --exit-code`s it, failing fast if a contributor edits the .wit source without committing the regenerated artifact. Developer flow stays the same: edit .wit, run `just wasm guest-compile-wit` (also chained inside `just wasm build`), commit both files together. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent cda573b commit a853591

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ jobs:
8787
sudo udevadm trigger --name-match=kvm
8888
sudo chmod 666 /dev/kvm
8989
90+
- name: Check WIT artifact is in sync with .wit source
91+
# sandbox-world.wasm is the compiled WIT used by host_bindgen!. It
92+
# is consumed by transitive deps (hyperlight-wasm-runtime) before
93+
# our crate's build scripts run, so it must live in git. Detect any
94+
# drift between the committed artifact and the .wit source.
95+
run: |
96+
just wasm guest-compile-wit
97+
git diff --exit-code -- src/wasm_sandbox/wit/sandbox-world.wasm
98+
9099
- name: Build
91100
run: just wasm build
92101

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ target/
22
.venv/
33
*.aot
44
*.wasm
5+
# Exception: the compiled WIT artifact is checked in as a build input.
6+
# host_bindgen! reads this file *before* our build scripts can run (it is
7+
# consumed by transitive deps like hyperlight-wasm-runtime), so the file
8+
# must exist from `git clone` time. CI regenerates and diffs to catch drift.
9+
!src/wasm_sandbox/wit/sandbox-world.wasm
510
__pycache__/
611
*.so
712
*.pyd
15.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)