feat(361): support same-memory string transcoding (lift the #360 hard-fail)#367
Conversation
…-fail) #360 hard-failed a sync boundary that needs transcoding but does not cross memory (`--memory shared` fusion of a UTF-8 caller + UTF-16 callee) — the loud-not-silent placeholder for the gap the call-lowering seam surfaced. This lands the actual support. Root: the transcode adapter (`generate_transcoding_adapter`) is already memory-index-parameterised — source reads use `caller_memory`, destination writes use `callee_memory`, and it transcodes byte-by-byte (no cross-memory `memory.copy`). So when the two are the SAME memory (both 0 under `--memory shared`) it transcodes correctly within that one memory. Only the class dispatch was gating it: it reached `Transcode` only when memory was crossed. Fix = route `needs_transcoding` → `Transcode` regardless of `crosses_memory`, and drop the hard-fail. - call_lowering.rs: `resolve_call_lowering_plan` routes any transcoding boundary to `Transcode`; the `same_memory_transcoding_hard_fails` unit test becomes `..._routes_to_transcode`. - adapter_safety.rs: `test_361_same_memory_utf8_to_utf16_transcoding` — the SR-17 UTF-8→UTF-16 'Hello' fusion under `SharedMemory`, executed on wasmtime, returns 500 (correct transcode), not a verbatim mis-copy. (Confirmed it hard-failed before this change.) - verification-matrix: SR-17 gains the same-memory execution oracle. Full meld-core suite green (0 failures); fmt + clippy clean. Tier-5 (adapter/) → Mythos delta-pass to follow. Closes #361. Refs #360, #272, SR-17. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mythos delta-pass requiredThis PR modifies one or more Tier-5 source files (per Before merge, run the Mythos discover protocol on the
Why this gate exists: LS-A-10 The gate check on this PR will pass once the label is |
Mythos discover pass (#361 same-memory transcoding) — NO FINDINGSSelf-conducted (backed by the execution oracle) + CI auto-Mythos as the independent second check. The change is small: Hypotheses examined:
Coverage note (honest): the execution oracle covers UTF-8→UTF-16 only; the other same-memory directions (UTF-16→UTF-8, latin1+utf16) route through the same parameterised adapter but are not separately execution-tested. Not a correctness risk introduced here (same adapter as the verified cross-memory SR-17 matrix), but a follow-up could add the same-memory direction matrix. |
Mythos delta-pass (auto)✅ NO FINDINGS across 1 Tier-5 file(s)
Auto-run via |
LS-N verification gate✅ 59/59 approved LS entries verified
Approved Failed LS entries(none) Missing regression tests(none) Updated automatically by |
…s + static-PIC + same-memory transcoding (#369) Ships the full ADR-7 path-H arc (address-strategy seam #359, call-lowering seam #360, multiply-instantiated modules #362/#363, static-PIC fold #365, ADR record #354) plus the extended-const fold completion (#368), the #364 safety fix (#366), and same-memory string transcoding (#367). New capabilities: multiply-instantiated module support (RFC-46 Q1, MultiMemory, SR-55), static-PIC data/element offset folding (#353), same-memory string transcoding (#361). Safety: multiply-instantiated gated to the execution- verified MultiMemory case (#364); the sync same-memory cross-encoding miscompile closed (#360/#361). Falsification statements in CHANGELOG. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes #361 — supports same-memory string transcoding, lifting the #360
hard-fail.
Background
#360 hard-failed a sync boundary that needs transcoding but does not cross
memory (e.g.
--memory sharedfusion of a UTF-8 caller + UTF-16 callee) — theloud-not-silent placeholder for the gap the call-lowering seam surfaced. This
lands the actual capability.
The fix is small — the adapter already supported it
generate_transcoding_adapteris memory-index-parameterised: source readsuse
caller_memory, destination writes usecallee_memory, and it transcodesbyte-by-byte (there is no cross-memory
memory.copy). So when the two arethe same memory (both
0under--memory shared), it transcodes correctlywithin that one memory. Only the class dispatch was gating it — it reached
Transcodeonly when memory was crossed.call_lowering.rs—resolve_call_lowering_plannow routes anyneeds_transcodingboundary toTranscoderegardless ofcrosses_memory, andthe refactor(adr7): extract the per-boundary call-lowering seam (path-H inc 2) #360 hard-fail is dropped. (
same_memory_transcoding_hard_failsunit test →..._routes_to_transcode.)Verification
test_361_same_memory_utf8_to_utf16_transcoding— the SR-17 UTF-8→UTF-16'Hello' fusion under
SharedMemory, executed on wasmtime, returns 500(correct transcode within the shared memory), not a verbatim mis-copy.
Confirmed it hard-failed before this change (baseline).
call_loweringtruth-table unit tests updated + green.meld-coresuite green (0 failures); fmt + clippy clean.Coverage note
The execution oracle covers UTF-8→UTF-16. The other same-memory directions
(UTF-16→UTF-8, latin1+utf16) route through the same memory-index-parameterised
adapter, but are not separately execution-tested here — a follow-up could add
them, mirroring the cross-memory SR-17 direction matrix.
Tier-5 (
adapter/) → Mythos delta-pass below.