Repository navigation
fix(#488): element-segment items are re-resolved from the final function map - #503
Conversation
…ion map Element items were remapped at merge time from function_index_map. For an import crossing a component boundary through an adapter, that entry still named the callee; wire_adapter_indices later rewrote the entry but rebuilt only bodies. An active slot bypassed the adapter (3000 instead of 3090); an `elem declare` no longer matched the body's ref.func (invalid output). Each element item now records its (component, module, local func) origin. MergedModule::refresh_out_of_body_func_refs re-resolves global ref.func initialisers (#482) and element items from the final map, before the dissolve analysis and again immediately before encoding. A missing origin is an error, never identity; trap stubs (#462) carry no origin and stay stubs; task.return shim substitution is reapplied so the refresh cannot undo it. The #462 refusal of a pending-wired import in an elem slot is replaced by this resolution: an import never wired now fails loudly at the refresh. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WrmMqf1iuTS1UBEes5TmdC
SR-101 derives from SYS-2 and refines SR-10 (segment reindexing), SR-98 (global ref.func refresh) and SR-96 (unmapped-import stubs). SWV-113 records the runtime tests, their potency and the byte-identical corpus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WrmMqf1iuTS1UBEes5TmdC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WrmMqf1iuTS1UBEes5TmdC
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 delta-pass: NO FINDINGS for this changeExamined and sound:
Beyond the PR's own tests, two more shapes are fixed by this change:
Both return 3000 on main and 3090 here, matching unfused. Pre-existing, filed separately: an adapted import that is re-exported by one core module and imported by another bypasses the adapter in both the body call and the element slot. This happens on main and on this branch alike, so it is not introduced here. |
LS-N verification gate✅ 59/59 approved LS entries verified
Approved Failed LS entries(none) Missing regression tests(none) Updated automatically by |
Mythos delta-pass (auto)❌ 1 finding(s) across 5 Tier-5 file(s)
Auto-run via |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WrmMqf1iuTS1UBEes5TmdC
Closes #488.
Defect
Element segment items were remapped when their module was merged. For an import that crosses a component boundary through an adapter, the function map still named the callee at that point. Adapter wiring rewrote the map entry afterwards, but rebuilt only function bodies. The result:
ref.funcnamed the adapter, but the declaration still named the callee, so the output failed validation.Fix
ref.funcexpression) records its origin(component, module, module-local function).MergedModule::refresh_out_of_body_func_refsre-resolves those origins from the final function map, together with the A global's ref.func initialiser keeps its module-local function index and names another module's function #482 globalref.funcrefresh. It runs once immediately before encoding, and once beforedissolve_fixups, which reads element items.Evidence (
meld-core/tests/elem_refresh_488.rs)ref.funcexpressionref.funccallname the same function (two structural tests)reviewed-by: avrabe.Test plan
cargo fmt --all -- --check: exit 0cargo clippy --workspace --all-targets -- -D warnings: exit 0, with and without--all-featurescargo test --workspace: exit 0, 969 passed, 0 failedcargo test --workspace --all-features: exit 0, 968 passed, 0 failed🤖 Generated with Claude Code
https://claude.ai/code/session_01WrmMqf1iuTS1UBEes5TmdC