[PR #812] [CLOSED] fix(native): project Mach-O evidence into container file offsets #2259

Closed
opened 2026-10-16 21:16:23 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/812
Author: @rudycelekli
Created: 10/7/2026
Status: ❌ Closed

Base: main ← Head: fix/macho-container-evidence-offsets-20261006


📝 Commits (1)

  • 1e5603c fix(native): project Mach-O evidence into container file offsets

📊 Changes

3 files changed (+147 additions, -4 deletions)

View changed files

📝 docs/native-investigation.md (+6 -0)
📝 src/native/NativeMachoInspection.ts (+45 -4)
📝 tests/boundary/providers/native/nativeSelectedArchitecture.test.ts (+96 -0)

📄 Description

Summary

Project Mach-O segment evidence ranges into the containing file, rather than reporting slice-relative offsets as whole-file locations.

Problem and expected behavior

A normal clang/lipo universal executable has an arm64 slice at byte16384. Public NativeMacOSProvider.inspect_macho currently points its __TEXT evidence at byte0 (the FAT header), although the tool-reported segment belongs to that selected slice. The x86_64 selection has the same problem. Evidence locations should identify the actual container bytes. This is an ordinary reproduced bug fix, not a large contract change requiring an issue.

Change and scope

Use the selected architecture offset from the existing lipo observation when projecting segment evidence. Preserve zero-offset thin binaries. When a FAT slice offset is unavailable, omit the affected segment locations and retain an explicit limitation instead of guessing byte0. Raw segment, section, and entry-point offsets stay slice-relative; document that distinction.

Contract and boundary impact

  • Semantic owner and earliest changed stage: native Mach-O evidence-location projection.
  • CLI and MCP/tool-catalog contract: existing schemas and tools unchanged.
  • Provider, bridge, target-format, or platform compatibility: selected Mach-O container evidence only.
  • Evidence, artifact, provenance, or reconstruction contract: corrected whole-container ranges; original tool observations and raw normalized offsets preserved.
  • Process execution, authorization, cleanup, or containment impact: none; tool arguments unchanged.
  • Generated metadata (docs/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: five thin/FAT/unknown-offset controls in the existing selected-architecture suite; four new failures on the base source.

  • Base reproduction or other evidence: actual existing Clang/lipo binaries, public target resolution and native provider; both thin controls pass before, both selected universal architectures fail before and pass after.

  • User-visible CLI/MCP output: for the observed arm64 universal fixture, __TEXT evidence begins at16384 instead of0. Raw segments.items[].file_offset remains0.

  • Remaining proof gaps: missing FAT offsets are fixture boundary controls, not claimed native lipo failures. Native producer coverage is macOS only; no Hopper/Ghidra, other OS, or full-provider-matrix claim.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • Related native boundary tests:32passed; base selected-architecture tests4failed/4passed.
  • npm run check:5tasks passed,129 existing warnings and zero errors.
  • npm run check:fast:2tasks passed.
  • npm run docs:check and npm run build:passed.
  • Actual public native provider:four thin/selected-FAT controls passed.
  • Temporary combined-source check with #807:both regression files20passed, build and all four native controls passed. Then restored and rebuilt the exact signed source. #807 changes export-name normalization; this PR changes evidence projection.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; unavailable offsets remain explicitly incomplete.
  • Real Hopper/Ghidra, browser, or OS coverage: actual macOS Clang/lipo and native inspection only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no authorization or tool-execution changes; owned native fixture files only.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

AI-assisted implementation and verification; I reviewed the patch and ran the reported checks.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/812 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/macho-container-evidence-offsets-20261006` --- ### 📝 Commits (1) - [`1e5603c`](https://github.com/morluto/rea/commit/1e5603c196ed8e2a9473425e3b2a327222e22442) fix(native): project Mach-O evidence into container file offsets ### 📊 Changes **3 files changed** (+147 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/native-investigation.md` (+6 -0) 📝 `src/native/NativeMachoInspection.ts` (+45 -4) 📝 `tests/boundary/providers/native/nativeSelectedArchitecture.test.ts` (+96 -0) </details> ### 📄 Description ## Summary Project Mach-O segment evidence ranges into the containing file, rather than reporting slice-relative offsets as whole-file locations. ## Problem and expected behavior A normal `clang`/`lipo` universal executable has an arm64 slice at byte16384. Public `NativeMacOSProvider.inspect_macho` currently points its `__TEXT` evidence at byte0 (the FAT header), although the tool-reported segment belongs to that selected slice. The x86_64 selection has the same problem. Evidence locations should identify the actual container bytes. This is an ordinary reproduced bug fix, not a large contract change requiring an issue. ## Change and scope Use the selected architecture offset from the existing `lipo` observation when projecting segment evidence. Preserve zero-offset thin binaries. When a FAT slice offset is unavailable, omit the affected segment locations and retain an explicit limitation instead of guessing byte0. Raw segment, section, and entry-point offsets stay slice-relative; document that distinction. ## Contract and boundary impact - Semantic owner and earliest changed stage: native Mach-O evidence-location projection. - CLI and MCP/tool-catalog contract: existing schemas and tools unchanged. - Provider, bridge, target-format, or platform compatibility: selected Mach-O container evidence only. - Evidence, artifact, provenance, or reconstruction contract: corrected whole-container ranges; original tool observations and raw normalized offsets preserved. - Process execution, authorization, cleanup, or containment impact: none; tool arguments unchanged. - Generated metadata (`docs/product-catalog.json`), package, or installation impact: none. ## Evidence and regression coverage - Tests added or updated: five thin/FAT/unknown-offset controls in the existing selected-architecture suite; four new failures on the base source. - Base reproduction or other evidence: actual existing Clang/lipo binaries, public target resolution and native provider; both thin controls pass before, both selected universal architectures fail before and pass after. - User-visible CLI/MCP output: for the observed arm64 universal fixture, `__TEXT` evidence begins at16384 instead of0. Raw `segments.items[].file_offset` remains0. - Remaining proof gaps: missing FAT offsets are fixture boundary controls, not claimed native lipo failures. Native producer coverage is macOS only; no Hopper/Ghidra, other OS, or full-provider-matrix claim. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - Related native boundary tests:32passed; base selected-architecture tests4failed/4passed. - `npm run check`:5tasks passed,129 existing warnings and zero errors. - `npm run check:fast`:2tasks passed. - `npm run docs:check` and `npm run build`:passed. - Actual public native provider:four thin/selected-FAT controls passed. - Temporary combined-source check with #807:both regression files20passed, build and all four native controls passed. Then restored and rebuilt the exact signed source. #807 changes export-name normalization; this PR changes evidence projection. ## Compatibility, safety, and release - Breaking changes or migration steps: none; unavailable offsets remain explicitly incomplete. - Real Hopper/Ghidra, browser, or OS coverage: actual macOS Clang/lipo and native inspection only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no authorization or tool-execution changes; owned native fixture files only. ## Review checklist - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. AI-assisted implementation and verification; I reviewed the patch and ran the reported checks. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:16:23 +00:00
Sign in to join this conversation.
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
morluto/rea#2259
No description provided.