[PR #5355] [MERGED] perf(ghidra): omit redundant raw results #6892

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5355
Author: @gensokyo-dev
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @gensokyo-dev

Base: main ← Head: perf/5337-ghidra-raw-evidence-20261020


📝 Commits (1)

  • ce97c2d perf(ghidra): omit redundant raw results

📊 Changes

17 files changed (+1249 additions, -73 deletions)

View changed files

📝 docs/mcp-contracts.md (+8 -0)
📝 experiments/analysis-efficiency/README.md (+5 -0)
➕ experiments/analysis-efficiency/ghidra-evidence-projection.json (+719 -0)
➕ experiments/analysis-efficiency/ghidra-evidence-projection.md (+165 -0)
➕ experiments/analysis-efficiency/ghidra-evidence-projection.mjs (+216 -0)
📝 scripts/lib/real-ghidra-large-results.mjs (+6 -12)
📝 scripts/verify-real-ghidra-function.mjs (+1 -1)
📝 scripts/verify-real-ghidra-inventory.mjs (+1 -1)
📝 scripts/verify-real-ghidra-windows.mjs (+1 -1)
📝 src/ghidra/GhidraFunctionValues.test.ts (+3 -2)
📝 src/ghidra/GhidraFunctionValues.ts (+3 -0)
📝 src/ghidra/GhidraInventoryValues.test.ts (+35 -1)
📝 src/ghidra/GhidraInventoryValues.ts (+25 -6)
📝 src/ghidra/GhidraProvider.behavior.test.ts (+3 -5)
📝 src/ghidra/GhidraProviderClient.ts (+26 -39)
📝 tests/boundary/mcp/ghidraEvidenceMcp.test.ts (+2 -5)
📝 tests/boundary/mcp/ghidraInventoryMcp.test.ts (+30 -0)

📄 Description

Problem and change

Ghidra repeated complete inventories and function observations in raw_result, despite preserving their facts in normalized_result and canonical Evidence metadata. Let the bridge parsers own independent upstream representations and use named execution metadata. Ordinary results now have raw_result: null; overview details, attestation inputs, file-offset roles and pre-overlay database types remain available. CLI/MCP share this implementation. Existing retained Evidence is not rewritten.

Fixes #5337. Ordinary fix within existing analysis boundaries; no new capability or authority.

Evidence and validation

  • A 30,000-row production-boundary regression fails on unchanged main with resource_constraint and passes completely on the candidate at the same 10 MiB budget. This uses a simulated bridge, not a real 30,000-function analysis.
  • Real Ghidra 12.1.4 stdio MCP tasks on true and official jq 1.8.2 preserve every selected normalized fact and provenance field, excluding only record ID/raw representation. Exported Evidence and unchanged source hashes validate. For jq, RPC replies are 2,375,466 → 1,264,884 bytes; catalog + arguments + replies are 5,639,932 → 4,529,351 bytes (19.7% lower). Actual model tokens are unmeasured.
  • No latency/CPU/peak-memory gain is claimed: jq scope wall was 279.699 → 399.097 s, concentrated in the first preparation query. A subsequent unchanged-main repeat differed by three discovered procedures and failed the strict oracle. That control, an earlier SDK deadline and all harness/resource-stop attempts are retained.
  • npm run check, final npm run check:fast, 247 source/MCP assertions and npm run docs:check pass. Real oversized-result retention/recovery and complete CLI readback pass; the public real file-offset/address-context CLI/MCP verifier also passes, with unchanged source and verified cleanup.

Measurements, driver, receipt and limitations. Heavy work is serial under CPU/family-memory guards. Real Windows/macOS, other engine versions, real NativeAOT overlays and post-GC retained heap remain unqualified. Read function results from normalized_result, rather than raw_result.value.

Author readiness

Human owner: @gensokyo-dev

  • 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.

🔄 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/5355 **Author:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Created:** 10/20/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `perf/5337-ghidra-raw-evidence-20261020` --- ### 📝 Commits (1) - [`ce97c2d`](https://github.com/morluto/rea/commit/ce97c2d4682ffcb97c7b25084485133c91746134) perf(ghidra): omit redundant raw results ### 📊 Changes **17 files changed** (+1249 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `docs/mcp-contracts.md` (+8 -0) 📝 `experiments/analysis-efficiency/README.md` (+5 -0) ➕ `experiments/analysis-efficiency/ghidra-evidence-projection.json` (+719 -0) ➕ `experiments/analysis-efficiency/ghidra-evidence-projection.md` (+165 -0) ➕ `experiments/analysis-efficiency/ghidra-evidence-projection.mjs` (+216 -0) 📝 `scripts/lib/real-ghidra-large-results.mjs` (+6 -12) 📝 `scripts/verify-real-ghidra-function.mjs` (+1 -1) 📝 `scripts/verify-real-ghidra-inventory.mjs` (+1 -1) 📝 `scripts/verify-real-ghidra-windows.mjs` (+1 -1) 📝 `src/ghidra/GhidraFunctionValues.test.ts` (+3 -2) 📝 `src/ghidra/GhidraFunctionValues.ts` (+3 -0) 📝 `src/ghidra/GhidraInventoryValues.test.ts` (+35 -1) 📝 `src/ghidra/GhidraInventoryValues.ts` (+25 -6) 📝 `src/ghidra/GhidraProvider.behavior.test.ts` (+3 -5) 📝 `src/ghidra/GhidraProviderClient.ts` (+26 -39) 📝 `tests/boundary/mcp/ghidraEvidenceMcp.test.ts` (+2 -5) 📝 `tests/boundary/mcp/ghidraInventoryMcp.test.ts` (+30 -0) </details> ### 📄 Description ## Problem and change Ghidra repeated complete inventories and function observations in `raw_result`, despite preserving their facts in `normalized_result` and canonical Evidence metadata. Let the bridge parsers own independent upstream representations and use named execution metadata. Ordinary results now have `raw_result: null`; overview details, attestation inputs, file-offset roles and pre-overlay database types remain available. CLI/MCP share this implementation. Existing retained Evidence is not rewritten. Fixes #5337. Ordinary fix within existing analysis boundaries; no new capability or authority. ## Evidence and validation - A 30,000-row production-boundary regression fails on unchanged main with `resource_constraint` and passes completely on the candidate at the same 10 MiB budget. This uses a simulated bridge, not a real 30,000-function analysis. - Real Ghidra 12.1.4 stdio MCP tasks on `true` and official jq 1.8.2 preserve every selected normalized fact and provenance field, excluding only record ID/raw representation. Exported Evidence and unchanged source hashes validate. For jq, RPC replies are 2,375,466 → 1,264,884 bytes; catalog + arguments + replies are 5,639,932 → 4,529,351 bytes (19.7% lower). Actual model tokens are unmeasured. - No latency/CPU/peak-memory gain is claimed: jq scope wall was 279.699 → 399.097 s, concentrated in the first preparation query. A subsequent unchanged-main repeat differed by three discovered procedures and failed the strict oracle. That control, an earlier SDK deadline and all harness/resource-stop attempts are retained. - `npm run check`, final `npm run check:fast`, 247 source/MCP assertions and `npm run docs:check` pass. Real oversized-result retention/recovery and complete CLI readback pass; the public real file-offset/address-context CLI/MCP verifier also passes, with unchanged source and verified cleanup. [Measurements, driver, receipt and limitations](https://github.com/morluto/rea/blob/ce97c2d4682ffcb97c7b25084485133c91746134/experiments/analysis-efficiency/ghidra-evidence-projection.md). Heavy work is serial under CPU/family-memory guards. Real Windows/macOS, other engine versions, real NativeAOT overlays and post-GC retained heap remain unqualified. Read function results from `normalized_result`, rather than `raw_result.value`. ## Author readiness Human owner: @gensokyo-dev - [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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:43: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#6892
No description provided.