Repository navigation
fix(native): retain selected Mach-O slice identity - #7940
Conversation
[Medium impact] The PR appears safe to merge; no actionable introduced issues were found. SummaryRetains the selected Mach-O slice record instead of looking it up again by name.
Review was source-based; tests and Apple tools were not run here. GitHub authentication was unavailable, so supersession and existing review threads could not be checked. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[lipo records] --> B[Select one record]
B --> C[Derive tool spelling]
C --> D{Selector collision?}
D -->|Yes| E[Return typed refusal]
D -->|No| F[Run slice commands]
B --> G[Retain selected offset]
F --> H[Normalize observations]
G --> I[Project file locations]
H --> I
Reviews (1) · Last reviewed commit: "fix(native): retain selected Mach-O slic..." · Reviewed by Greptile |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Fixes #7350. A universal Mach-O with ARM64 V8 before ARM64 ALL could return the V8 container offset for commands that inspected ALL, so segment Evidence pointed into a different slice.
Problem and expected behavior
Apple lipo can name both slices
arm64. The selector ranked the correct subtype but returned only its name; a later lookup picked the first same-named record. The selected record now remains authoritative through offset projection. Tool arguments use the selected subtype spelling, and indistinguishable tool selectors receive an explicit refusal rather than a guessed offset.Change and scope
The shared Mach-O selection owner returns the selected lipo record instead of reducing it to a display name. Related binary FAT selection and metadata paths already retain their selected slice and do not repeat this name lookup. No target code executes.
Contract and boundary impact
Expected effects:
Evidence and regression coverage
Executed macOS arm64 public CLI inspection with real Apple tools on three synthetic inert objects: V8-first and ALL-first FAT tables each returned selected base 32768 and segment range [32952, 32968); the thin ALL control returned base 0 and range [184, 200). Both FAT inventory ranges remained present. Source tests cover same-named records, subtype-specific tool spelling, ambiguous selector refusal, and existing architecture selection controls.
Validation performed
npm run test:local -- src/native/NativeMachoInspection.test.ts src/native/AppleMachoSelection.test.ts— 97 passed.npm run test:focused -- tests/acceptance/machoSelectedSliceCli.test.ts— 1 passed, real macOS arm64 Apple tools and public CLI.npm run check:fast— passed.git diff --cached --check— passed before commit.Compatibility, safety, and release
Ambiguous selectors that previously risked wrong coordinates now fail explicitly. MCP, other hosts and Apple-tool versions were not tested. Fixture Mach-O objects are synthetic and are not executed.
Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.