feat(core): explicit DWARF policy with Strip default (#130 phase 1.5)#135
Merged
Conversation
meld passes input `.debug_*` sections through verbatim while it rewrites and renumbers function bodies into a new merged code section. Every DWARF address inside those passed-through sections then references the wrong instruction (or nothing) in the fused output. Downstream MC/DC tooling (`pulseengine/witness`) trusts the gimli-built `(code-offset -> file, line)` map and silently produces wrong source-line attribution for every `br_if`. Wrong attribution is strictly worse than no attribution because witness has a graceful no-DWARF fallback that the lossy passthrough subverts. Phase 2 of issue #130 will add an actual address-remap pass over `.debug_line` / `.debug_info` / `.debug_ranges`. Until that lands the only non-corrupting policy is to drop `.debug_*`. Phase 1.5 makes that choice explicit: - New `DwarfHandling::{Strip, PassThrough}` enum on `FuserConfig`, default `Strip`. - `lib.rs::encode_output` filters `.debug_*` when `Strip`. - Recorded in attestation `tool_parameters` as `dwarf_handling = "strip" | "passthrough"` so consumers can detect lossy emissions; SR-28 sentinel test extended. - Three integration tests in `meld-core/tests/dwarf_strip.rs` pin the default-strip / passthrough-preserves contract. - LS-CP-4 added to `safety/stpa/loss-scenarios.yaml` (status approved, H-7). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
avrabe
added a commit
that referenced
this pull request
May 11, 2026
DWARF Phase 1.5 (#135 / sub-#130): switch the default DWARF policy from silent passthrough to explicit Strip. Passing input `.debug_*` sections through verbatim produces wrong source-line attribution against the merged code section — strictly worse than no DWARF for downstream MC/DC tooling. `DwarfHandling::PassThrough` remains available for callers that knowingly accept the lossy mapping. This is a behaviour-changing default but the change is contained: non-debug-info input is unaffected, and PassThrough preserves the prior shape for any callers that need it. LS-CP-4 added.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1.5 of issue #130. Today meld passes input
.debug_*sectionsthrough verbatim while it rewrites and renumbers function bodies into
the merged code section, so every DWARF address ends up referencing
the wrong instruction. Downstream MC/DC tooling (
pulseengine/witness)trusts what gimli reads and silently produces wrong source-line
attribution for every
br_if.This PR makes the policy explicit and defaults to dropping DWARF
until Phase 2 ships an actual address-remap pass — wrong attribution
is strictly worse than no attribution because witness has a graceful
no-DWARF fallback that the lossy passthrough subverts.
Changes
DwarfHandling::{Strip, PassThrough}enum onFuserConfig,default
Strip.lib.rs::encode_outputfilters.debug_*whenStrip.tool_parametersasdwarf_handling = "strip" | "passthrough"so consumers can detectlossy emissions; SR-28 sentinel test extended.
meld-core/tests/dwarf_strip.rspin thedefault-strip / passthrough-preserves / default-is-strip contract.
safety/stpa/loss-scenarios.yaml(approved, H-7).FuserConfigupdated with the new field.
Why draft
Logical follow-up to #131 (Phase 1 discovery, also draft). The whole
witness-mapping epic stays draft until at least Phase 2 (address remap)
lands so the changelog story is one coherent fix instead of a "we
silently turned DWARF off" surprise.
Test plan
cargo test -p meld-core— 73 passed (lib + integration)cargo test -p meld-core --test dwarf_strip— 3 passedcargo clippy -p meld-core --all-targets -- -D warningscargo fmt --all -- --checkRefs
🤖 Generated with Claude Code