Skip to content

fix(cli): warn when meld fuse uses the multi-memory default (#172)#177

Merged
avrabe merged 1 commit into
mainfrom
fix/172-memory-default-warning
May 21, 2026
Merged

fix(cli): warn when meld fuse uses the multi-memory default (#172)#177
avrabe merged 1 commit into
mainfrom
fix/172-memory-default-warning

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 21, 2026

Summary

Addresses #172meld fuse defaults to --memory multi, producing a fused module the canonical optimise → AOT chain can't consume.

A user running the happy path (meld fuse a b -o fused.wasm) gets a multi-memory core module. wasm-opt then rejects it without --enable-multimemory, and synth --cortex-m has no single flat address space for multiple memories. The wall is hit silently at the next tool.

What this PR does (#172 options 2 + 3)

  • meld fuse prints a warning whenever --memory multi is in effect (including the default), naming the downstream implication and pointing at --memory shared --address-rebase.
  • The --memory --help text documents the same.
$ meld fuse a.wasm b.wasm -o fused.wasm
warning: --memory multi produced a multi-memory module. wasm-opt needs
--enable-multimemory to consume it, and it has no single-address-space
(MCU) lowering. For a fused module the wasm-opt → synth chain accepts
directly, re-run with `--memory shared --address-rebase`.

Why not option 1 (flip the default)

#172's recommended option 1 is to default to --memory shared. That's deliberately not done here:

So the default flip is a separate decision for the issue owner. This PR makes the current default non-surprising in the meantime — the lowest-risk of #172's three suggested fixes, shippable now.

Tests

  • test_cli_memory_default_is_multi — pins the default so a future flip is a deliberate edit
  • test_cli_memory_shared_parses
  • 7/7 meld-cli tests pass

🤖 Generated with Claude Code

`meld fuse` defaults to `--memory multi`, which produces a core
module with one linear memory per input component. The canonical
optimise → AOT chain then rejects it: `wasm-opt` needs
`--enable-multimemory`, and `synth --cortex-m` has no single flat
address space for multiple memories. A user on the happy path
(`meld fuse a b -o fused.wasm`) hit that wall silently at the very
next tool.

This is #172 options 2 + 3 (warn + document):

- `meld fuse` now prints a warning whenever `--memory multi` is in
  effect — including the default — naming the downstream
  implication and pointing at `--memory shared --address-rebase`,
  the combination that flows through `wasm-opt` → `synth` cleanly.
- The `--memory` `--help` text documents the same.

#172 option 1 (flip the default to `shared`) is deliberately NOT
done here. Flipping the core memory default is high-blast-radius,
and `shared` is not an unambiguously safe default: it is currently
labelled "legacy mode" and documented as broken when any component
uses `memory.grow`. The default flip is a separate decision and is
left to the issue owner; this PR makes the current default
non-surprising in the meantime.

Tests: `test_cli_memory_default_is_multi` pins the default so a
future flip is a deliberate edit; `test_cli_memory_shared_parses`.
7/7 meld-cli tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

LS-N verification gate

19/19 approved LS entries verified

count
Passed (≥1 test, all green) 19
Failed (≥1 test failure) 0
Missing (no ls_*_NN_* test found) 0

Approved loss-scenarios.yaml entries are expected to have a
regression test named ls_<letter>_<num>_* (e.g. LS-A-11
ls_a_11_*). The gate runs each prefix via cargo test --lib --no-fail-fast and aggregates pass/fail/missing.

Failed LS entries

(none)

Missing regression tests

(none)

Updated automatically by tools/post_verification_comment.py.
Source of truth: safety/stpa/loss-scenarios.yaml.

@avrabe avrabe merged commit fb1a26e into main May 21, 2026
15 of 18 checks passed
@avrabe avrabe deleted the fix/172-memory-default-warning branch May 21, 2026 18:25
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