[PR #6069] [MERGED] fix(native): retain decoded zero-address Swift class references #7138

Closed
opened 2026-11-01 21:45:40 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6069
Author: @xiaofeilovecoding
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @morluto

Base: main ← Head: fix/swift-conformance-zero-rebase-6000


📝 Commits (1)

  • 34a9919 fix(native): retain decoded zero-address Swift class references

📊 Changes

2 files changed (+106 additions, -1 deletions)

View changed files

📝 src/native/AppleDispatchMetadata.test.ts (+104 -0)
📝 src/native/AppleSwiftConformanceTypeReference.ts (+2 -1)

📄 Description

Summary

Fixes #6000. Preserve a decoded kind-3 Swift conformance rebase to address zero instead of publishing a null target.

Problem and expected behavior

The indirect Objective-C class decoder treats both raw zero and a known rebase to zero as absent. Only unfixed raw zero is nullable. A known mapped zero must remain {address:"0x0",file_offset:0}; class-name recovery remains partial.

Change and scope

Restrict null conversion to raw pointers, matching the neighboring kind-1 and relative-pointer readers. Add five byte-fixture cases through the real Mach-O fixup and dispatch decoders: zero/nonzero/unmapped rebases and raw zero/nonzero. Preserve protocol and indirect-cell locations, nullable names and runtime-lookup limitations.

Contract and boundary impact

  • Semantic owner: decodeIndirectObjcClass.
  • Scope decision: not applicable; correction within existing static analysis.
  • CLI/MCP schemas, provider authority, cleanup and installation: unchanged. Existing result now retains a known address.
  • Evidence: partial status and source locations remain; no guessed class identity.
  • Package/generated metadata: unchanged.

Expected effects:

  • Read existing files or captured data.

Evidence and regression coverage

Executed on Windows with Node 24.18.0/npm 11.16.0. On the original implementation, the same dispatch module had 1 failure/86 passes: the zero-rebase target was null. The fixed assertion returns {address:"0x0",file_offset:0}. The other four pointer controls pass in both versions. The fixture is hand-authored bytes, not Apple linker output; it does not establish a valid runtime class at zero.

  • 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

  • npm run test:local -- src/native/AppleDispatchMetadata.test.ts src/native/AppleSwiftConformanceTypeReference.test.ts src/native/AppleSwiftVtables.test.ts src/native/AppleMachoFixups.test.ts — 163 passed across 4 files.
  • npm run check:fast and npm run check — passed; existing lint warnings remain. The latter is the static gate, not the complete test suite.
  • npm run verify:test-discovery — all 1,924 test files discovered exactly once.
  • git diff --check and actual pre-commit formatting/lint hooks — passed.

Compatibility, safety, and release

No schema, package, execution or authority expansion. Inspected fixture bytes are never executed. macOS public CLI/MCP and Apple clang/dyld_info replay were unavailable on Windows; no real Hopper/Ghidra/Frida run is claimed.

Author readiness

Human owner: @xiaofeilovecoding

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • 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.

🔄 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/6069 **Author:** [@xiaofeilovecoding](https://github.com/xiaofeilovecoding) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/swift-conformance-zero-rebase-6000` --- ### 📝 Commits (1) - [`34a9919`](https://github.com/morluto/rea/commit/34a9919ceb0181cb52494ff601bfe8d78b6732a6) fix(native): retain decoded zero-address Swift class references ### 📊 Changes **2 files changed** (+106 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/native/AppleDispatchMetadata.test.ts` (+104 -0) 📝 `src/native/AppleSwiftConformanceTypeReference.ts` (+2 -1) </details> ### 📄 Description ## Summary Fixes #6000. Preserve a decoded kind-3 Swift conformance rebase to address zero instead of publishing a null target. ## Problem and expected behavior The indirect Objective-C class decoder treats both raw zero and a known rebase to zero as absent. Only unfixed raw zero is nullable. A known mapped zero must remain `{address:"0x0",file_offset:0}`; class-name recovery remains partial. ## Change and scope Restrict null conversion to raw pointers, matching the neighboring kind-1 and relative-pointer readers. Add five byte-fixture cases through the real Mach-O fixup and dispatch decoders: zero/nonzero/unmapped rebases and raw zero/nonzero. Preserve protocol and indirect-cell locations, nullable names and runtime-lookup limitations. ## Contract and boundary impact - Semantic owner: `decodeIndirectObjcClass`. - Scope decision: not applicable; correction within existing static analysis. - CLI/MCP schemas, provider authority, cleanup and installation: unchanged. Existing result now retains a known address. - Evidence: partial status and source locations remain; no guessed class identity. - Package/generated metadata: unchanged. Expected effects: - [x] Read existing files or captured data. ## Evidence and regression coverage Executed on Windows with Node 24.18.0/npm 11.16.0. On the original implementation, the same dispatch module had 1 failure/86 passes: the zero-rebase target was null. The fixed assertion returns `{address:"0x0",file_offset:0}`. The other four pointer controls pass in both versions. The fixture is hand-authored bytes, not Apple linker output; it does not establish a valid runtime class at zero. - [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 - `npm run test:local -- src/native/AppleDispatchMetadata.test.ts src/native/AppleSwiftConformanceTypeReference.test.ts src/native/AppleSwiftVtables.test.ts src/native/AppleMachoFixups.test.ts` — 163 passed across 4 files. - `npm run check:fast` and `npm run check` — passed; existing lint warnings remain. The latter is the static gate, not the complete test suite. - `npm run verify:test-discovery` — all 1,924 test files discovered exactly once. - `git diff --check` and actual pre-commit formatting/lint hooks — passed. ## Compatibility, safety, and release No schema, package, execution or authority expansion. Inspected fixture bytes are never executed. macOS public CLI/MCP and Apple clang/dyld_info replay were unavailable on Windows; no real Hopper/Ghidra/Frida run is claimed. ## Author readiness Human owner: @xiaofeilovecoding - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [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. - [ ] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:45:40 +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#7138
No description provided.