[PR #1270] [MERGED] fix(native): distinguish batch selectors from resolved entries #2753

Closed
opened 2026-10-17 21:09:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1270
Author: @N0zoM1z0
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/batch-procedure-identity


📝 Commits (3)

  • bfaa5a6 fix(native): distinguish batch selectors from resolved entries
  • 8342e3a chore: merge current main into batch identity fix
  • 933fcb3 test(native): assert batch identity in production registration

📊 Changes

10 files changed (+293 additions, -15 deletions)

View changed files

📝 docs/native-investigation.md (+12 -0)
➕ scripts/lib/real-ghidra-batch-identity.mjs (+41 -0)
📝 scripts/lib/real-ghidra-boundaries.mjs (+3 -0)
📝 src/application/EnhancedTools.ts (+44 -2)
📝 src/application/InvestigationProviders.ts (+3 -1)
📝 src/application/WorkflowEvidence.ts (+33 -1)
📝 src/contracts/enhancedToolContracts.ts (+1 -1)
📝 src/contracts/toolOutputSchemaGroups.ts (+25 -2)
📝 tests/boundary/mcp/enhancedTools.01-lists-the-complete-target-open.test.ts (+12 -2)
📝 tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts (+119 -6)

📄 Description

An interior selector accepted by batch_decompile was returned as the item's only address, so consumers could mistake it for the analyzed function entry. Preserve that caller selector in address and add procedure with an observed canonical entry and the provider's entry label. Decompile using that resolved entry; do not infer identity from pseudocode labels.

Example from an owned fixture:

{"address":"0x40115e","procedure":{"status":"resolved","address":"0x40115a","name":"rea_ghidra_inventory_leaf"},"status":"ok","pseudocode":"..."}

Identity failures use procedure.status: "unknown" with a typed error and still attempt the existing decompilation. Label lookup failures preserve the resolved address, a null name and name_error. Ordered successes, per-item failures, complete output and aggregate counts remain useful. Composed Evidence records the resolved entries as locations and commits an operation-specific workflow revision; retained historical Evidence remains valid.

Validation:

  • Real Ghidra 12.1.4 / JDK 21 on Linux x64: owned fixture entry/interior/symbol selectors, identical canonical pseudocode, no-containing-function failure, exported canonical Evidence location, and the original audited target's two interior addresses. Original bytes unchanged; both sessions closed and MCP recovered.
  • Compared actual single-procedure CLI output with the batch item's code. Batch has no dedicated CLI command; this change adds none.
  • SDK MCP/schema tests cover ordering, empty batches, partial errors, unavailable and malformed identity, provider label failure, a named external address space, and labels unrelated to pseudocode.
  • Four focused files / 25 tests; converted schemas; npm run check; npm run docs:check.
  • Added the owned-fixture assertion to the real Ghidra boundary lane and ran that helper against real Ghidra. The entire long Ghidra lane was not repeated for this shared workflow change. No new real Hopper, IDA, macOS, ARM or Windows verification is claimed.

Closes #1243
Related: #1065


🔄 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/1270 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/batch-procedure-identity` --- ### 📝 Commits (3) - [`bfaa5a6`](https://github.com/morluto/rea/commit/bfaa5a6c2c0ddc9e6fcf16cd11ad06f24db174a2) fix(native): distinguish batch selectors from resolved entries - [`8342e3a`](https://github.com/morluto/rea/commit/8342e3a78f44df572ce60c813a3acf185fab9fbb) chore: merge current main into batch identity fix - [`933fcb3`](https://github.com/morluto/rea/commit/933fcb33c1fa1eae109228b89c1200abb7745eb8) test(native): assert batch identity in production registration ### 📊 Changes **10 files changed** (+293 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `docs/native-investigation.md` (+12 -0) ➕ `scripts/lib/real-ghidra-batch-identity.mjs` (+41 -0) 📝 `scripts/lib/real-ghidra-boundaries.mjs` (+3 -0) 📝 `src/application/EnhancedTools.ts` (+44 -2) 📝 `src/application/InvestigationProviders.ts` (+3 -1) 📝 `src/application/WorkflowEvidence.ts` (+33 -1) 📝 `src/contracts/enhancedToolContracts.ts` (+1 -1) 📝 `src/contracts/toolOutputSchemaGroups.ts` (+25 -2) 📝 `tests/boundary/mcp/enhancedTools.01-lists-the-complete-target-open.test.ts` (+12 -2) 📝 `tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts` (+119 -6) </details> ### 📄 Description An interior selector accepted by `batch_decompile` was returned as the item's only address, so consumers could mistake it for the analyzed function entry. Preserve that caller selector in `address` and add `procedure` with an observed canonical entry and the provider's entry label. Decompile using that resolved entry; do not infer identity from pseudocode labels. Example from an owned fixture: ```json {"address":"0x40115e","procedure":{"status":"resolved","address":"0x40115a","name":"rea_ghidra_inventory_leaf"},"status":"ok","pseudocode":"..."} ``` Identity failures use `procedure.status: "unknown"` with a typed error and still attempt the existing decompilation. Label lookup failures preserve the resolved address, a null name and `name_error`. Ordered successes, per-item failures, complete output and aggregate counts remain useful. Composed Evidence records the resolved entries as locations and commits an operation-specific workflow revision; retained historical Evidence remains valid. Validation: - Real Ghidra 12.1.4 / JDK 21 on Linux x64: owned fixture entry/interior/symbol selectors, identical canonical pseudocode, no-containing-function failure, exported canonical Evidence location, and the original audited target's two interior addresses. Original bytes unchanged; both sessions closed and MCP recovered. - Compared actual single-procedure CLI output with the batch item's code. Batch has no dedicated CLI command; this change adds none. - SDK MCP/schema tests cover ordering, empty batches, partial errors, unavailable and malformed identity, provider label failure, a named external address space, and labels unrelated to pseudocode. - Four focused files / 25 tests; converted schemas; `npm run check`; `npm run docs:check`. - Added the owned-fixture assertion to the real Ghidra boundary lane and ran that helper against real Ghidra. The entire long Ghidra lane was not repeated for this shared workflow change. No new real Hopper, IDA, macOS, ARM or Windows verification is claimed. Closes #1243 Related: #1065 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:50 +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#2753
No description provided.