[PR #6153] [MERGED] fix(native): keep truncated empty class-import scans partial #7167

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

📋 Pull Request Information

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

Base: main ← Head: fix/6086-objc-import-empty-incomplete-coverage


📝 Commits (2)

  • 091ca22 fix(native): keep truncated empty class-import scans partial
  • d4eed57 test(native): cover empty truncated class-import candidate scans

📊 Changes

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

View changed files

📝 src/native/AppleObjcClassImportBindings.test.ts (+21 -0)
📝 src/native/AppleObjcClassImportBindings.ts (+3 -1)

📄 Description

Summary

Fixes #6086

inspect_native_dispatch_metadata discarded the caller's explicit objc_class_import_addresses_complete: false whenever objc_class_import_addresses was an empty array. The binding coverage came back as not_requested with a null reason and zero examined and decoded addresses, so an explicitly truncated candidate scan was indistinguishable from a complete empty request.

The producer now treats only an omitted list, or an empty list declared complete, as not requested. An empty list declared incomplete reports partial coverage with the existing reason Candidate address scan reached the existing max_records limit, examined: 0 and decoded: 0, as the input schema already documents for the completeness flag.

Problem and expected behavior

  • Smallest trigger: a direct MCP call inspect_native_dispatch_metadata with objc_class_import_addresses: [] and objc_class_import_addresses_complete: false against a Mach-O target.
  • Violated invariant: an explicit caller limitation must survive into the reported coverage. inspectObjcClassImportBindings returned early on addresses.length === 0 before considering addressesComplete, while the same flag with one address correctly produced partial.
  • Expected: partial with the existing record-budget reason for the incomplete empty case; the omitted and complete-empty cases keep reporting not_requested.

Change and scope

  • src/native/AppleObjcClassImportBindings.ts: the early not_requested return applies to an omitted list or an empty list declared complete. An empty incomplete list continues into the existing path, which records the record-budget reason, examines no address and reports partial. With no supported fixup commands the existing unsupported result still wins, as it already does for non-empty incomplete lists.
  • src/native/AppleObjcClassImportBindings.test.ts: covers the empty incomplete and empty complete cases.
  • Not included: changing get_objc_classes, which returns before binding inspection when it selects no candidates and maps not_requested to unknown; its behavior is unchanged by reading. No schema change.

Follow the contribution scope.
Scope decision: not applicable (ordinary fix within the existing native static reader).

Contract and boundary impact

  • Semantic owner and earliest changed stage: inspectObjcClassImportBindings in src/native/AppleObjcClassImportBindings.ts, the producer of objc_class_import_binding_coverage.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: schemas unchanged. For an explicitly incomplete empty address list, objc_class_import_binding_coverage.status is partial with the record-budget reason instead of not_requested with a null reason.
  • Provider, bridge, target-format, or platform compatibility: native static Mach-O reader on every platform; no external engine.
  • Evidence, artifact, provenance, or reconstruction contract: coverage keeps the caller's declared truncation visible.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/native/AppleObjcClassImportBindings.test.ts, keeps an explicitly truncated empty candidate scan partial.
  • Base reproduction or other evidence: source-derived. On the base revision the early return if (addresses === undefined || addresses.length === 0) yields not_requested before addressesComplete is read, so the new test's first expectation (partial, record-budget reason) fails there. The issue reports the same not_requested result through the built stdio MCP server with the real native reader; AppleDispatchMetadata publishes the producer's coverage for every present array and EnhancedTools forwards both input fields unchanged.
  • User-visible CLI/MCP output (if applicable): objc_class_import_binding_coverage for the incomplete empty request becomes { "facet": "objc_class_import_bindings", "status": "partial", "reason": "Candidate address scan reached the existing max_records limit", "examined": 0, "decoded": 0 }.
  • Remaining proof gaps: the MCP path was not replayed in this PR; the regression is at the producer.

For evidence-bearing changes:

  • 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

  • No local commands were run; verification is source-derived and CI executes the test suite. The repository pre-commit hook formatted and linted the staged files without changes.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Only the explicitly incomplete empty request changes its coverage status.
  • Real Hopper/Ghidra, browser, or OS coverage: none run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no change to target handling.

Author readiness

Human owner: @viniciusdsandrade

  • 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/6153 **Author:** [@viniciusdsandrade](https://github.com/viniciusdsandrade) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/6086-objc-import-empty-incomplete-coverage` --- ### 📝 Commits (2) - [`091ca22`](https://github.com/morluto/rea/commit/091ca226bc1c6b60f97cd652033f6e2aeb22cd90) fix(native): keep truncated empty class-import scans partial - [`d4eed57`](https://github.com/morluto/rea/commit/d4eed5750dc0be8e33747ceee8234a2001fe8f80) test(native): cover empty truncated class-import candidate scans ### 📊 Changes **2 files changed** (+24 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/native/AppleObjcClassImportBindings.test.ts` (+21 -0) 📝 `src/native/AppleObjcClassImportBindings.ts` (+3 -1) </details> ### 📄 Description ## Summary Fixes #6086 `inspect_native_dispatch_metadata` discarded the caller's explicit `objc_class_import_addresses_complete: false` whenever `objc_class_import_addresses` was an empty array. The binding coverage came back as `not_requested` with a null reason and zero examined and decoded addresses, so an explicitly truncated candidate scan was indistinguishable from a complete empty request. The producer now treats only an omitted list, or an empty list declared complete, as not requested. An empty list declared incomplete reports `partial` coverage with the existing reason `Candidate address scan reached the existing max_records limit`, `examined: 0` and `decoded: 0`, as the input schema already documents for the completeness flag. ## Problem and expected behavior - Smallest trigger: a direct MCP call `inspect_native_dispatch_metadata` with `objc_class_import_addresses: []` and `objc_class_import_addresses_complete: false` against a Mach-O target. - Violated invariant: an explicit caller limitation must survive into the reported coverage. `inspectObjcClassImportBindings` returned early on `addresses.length === 0` before considering `addressesComplete`, while the same flag with one address correctly produced `partial`. - Expected: `partial` with the existing record-budget reason for the incomplete empty case; the omitted and complete-empty cases keep reporting `not_requested`. ## Change and scope - `src/native/AppleObjcClassImportBindings.ts`: the early `not_requested` return applies to an omitted list or an empty list declared complete. An empty incomplete list continues into the existing path, which records the record-budget reason, examines no address and reports `partial`. With no supported fixup commands the existing `unsupported` result still wins, as it already does for non-empty incomplete lists. - `src/native/AppleObjcClassImportBindings.test.ts`: covers the empty incomplete and empty complete cases. - Not included: changing `get_objc_classes`, which returns before binding inspection when it selects no candidates and maps `not_requested` to `unknown`; its behavior is unchanged by reading. No schema change. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Scope decision: not applicable (ordinary fix within the existing native static reader). ## Contract and boundary impact - Semantic owner and earliest changed stage: `inspectObjcClassImportBindings` in `src/native/AppleObjcClassImportBindings.ts`, the producer of `objc_class_import_binding_coverage`. - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: schemas unchanged. For an explicitly incomplete empty address list, `objc_class_import_binding_coverage.status` is `partial` with the record-budget reason instead of `not_requested` with a null reason. - Provider, bridge, target-format, or platform compatibility: native static Mach-O reader on every platform; no external engine. - Evidence, artifact, provenance, or reconstruction contract: coverage keeps the caller's declared truncation visible. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `src/native/AppleObjcClassImportBindings.test.ts`, `keeps an explicitly truncated empty candidate scan partial`. - Base reproduction or other evidence: source-derived. On the base revision the early return `if (addresses === undefined || addresses.length === 0)` yields `not_requested` before `addressesComplete` is read, so the new test's first expectation (`partial`, record-budget reason) fails there. The issue reports the same `not_requested` result through the built stdio MCP server with the real native reader; `AppleDispatchMetadata` publishes the producer's coverage for every present array and `EnhancedTools` forwards both input fields unchanged. - User-visible CLI/MCP output (if applicable): `objc_class_import_binding_coverage` for the incomplete empty request becomes `{ "facet": "objc_class_import_bindings", "status": "partial", "reason": "Candidate address scan reached the existing max_records limit", "examined": 0, "decoded": 0 }`. - Remaining proof gaps: the MCP path was not replayed in this PR; the regression is at the producer. For evidence-bearing changes: - [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 - No local commands were run; verification is source-derived and CI executes the test suite. The repository pre-commit hook formatted and linted the staged files without changes. ## Compatibility, safety, and release - Breaking changes or migration steps: none. Only the explicitly incomplete empty request changes its coverage status. - Real Hopper/Ghidra, browser, or OS coverage: none run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no change to target handling. ## Author readiness Human owner: @viniciusdsandrade - [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. - [x] 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:52 +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#7167
No description provided.