Build: auto-invalidate WASM cache when island dependencies change #46

Open
opened 2026-03-19 00:48:11 +00:00 by mik-tf · 0 comments
Owner

Problem

make dist uses Docker named volumes (hero-wasm-target, hero-cargo-registry, hero-cargo-git) to cache WASM compilation. When island Cargo.toml dependencies change (e.g. adding pulldown-cmark), cargo inside the container may not detect the change and reuse stale artifacts.

This caused a wasted debug cycle in Session 18 — the markdown rendering fix was compiled on the host but wasm-pack used cached old WASM.

Current workaround

docker volume rm hero-wasm-target before make dist

Fix options

  1. Hash check: In build-local.sh, hash all island Cargo.toml files and compare with a stored hash in the volume. If changed, clean the volume automatically.
  2. Always clean: Add --force or remove pkg/ directories before wasm-pack runs in build-wasm.sh
  3. Document: Add a note in hero_services/README.md or Makefile help about the cache

Option 1 is best — automatic invalidation with no manual steps.

## Problem `make dist` uses Docker named volumes (`hero-wasm-target`, `hero-cargo-registry`, `hero-cargo-git`) to cache WASM compilation. When island Cargo.toml dependencies change (e.g. adding `pulldown-cmark`), cargo inside the container may not detect the change and reuse stale artifacts. This caused a wasted debug cycle in Session 18 — the markdown rendering fix was compiled on the host but wasm-pack used cached old WASM. ## Current workaround `docker volume rm hero-wasm-target` before `make dist` ## Fix options 1. **Hash check**: In `build-local.sh`, hash all island `Cargo.toml` files and compare with a stored hash in the volume. If changed, clean the volume automatically. 2. **Always clean**: Add `--force` or remove `pkg/` directories before wasm-pack runs in `build-wasm.sh` 3. **Document**: Add a note in `hero_services/README.md` or Makefile help about the cache Option 1 is best — automatic invalidation with no manual steps.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/home#46
No description provided.