Repository navigation
perf(evidence): stop copying normalized results into raw_result - #1402
Conversation
createAnalysisExecution defaulted an omitted rawResult to a second complete copy of the result. Every caller that had no distinct provider representation therefore doubled its Evidence: decode_interface_builder, inspect_keyed_archive, inspect_asset_catalog, trace_dylib_resolution, inspect_native_dispatch_metadata, observe_native_calls, observe_native_ui/capture_native_ui_scenario (including screenshots), and small Ghidra/IDA lifecycle records. Sibling operations of the same providers already recorded null. An omitted rawResult now records null. Normalized results are unchanged. MCP responses repeat Evidence in text and structured content, so each response and its share of the 10 MiB transport budget shrink by the same half; e.g. trace_dylib_resolution on a real app bundle drops from 3,217,119 to 1,612,524 bytes per representation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: The full typecheck passes on Linux. It peaks near 2.4 GiB, which is over a 2 GiB cap. The fix works. It cut two sample outputs by about 40%. This is a check after the merge. I tested Full typecheckI ran
The compiler is native, so the Node version matters little here. Peak RSS is the largest process, from So the default run goes past 2 GiB on this box. That would trip a 2 GiB cap. I tried
TestsThe PR changes three test files. All 17 tests pass on Node 22, 24 and 26. I also put the new tests on the parent commit. Four tests fail there. Each one gets a full copy where it expects Before and afterThe repo ships two keyed archives as XML. The CLI wants binary, so I converted them. Then I ran
These are the pretty JSON bytes from Before, Not run
Thanks to kaoru0822-kitauji for the fix and the new tests. Test setup
🤖 Generated with Claude Code (Opus 5.5) 🦊 |
…uto#1402) createAnalysisExecution defaulted an omitted rawResult to a second complete copy of the result. Every caller that had no distinct provider representation therefore doubled its Evidence: decode_interface_builder, inspect_keyed_archive, inspect_asset_catalog, trace_dylib_resolution, inspect_native_dispatch_metadata, observe_native_calls, observe_native_ui/capture_native_ui_scenario (including screenshots), and small Ghidra/IDA lifecycle records. Sibling operations of the same providers already recorded null. An omitted rawResult now records null. Normalized results are unchanged. MCP responses repeat Evidence in text and structured content, so each response and its share of the 10 MiB transport budget shrink by the same half; e.g. trace_dylib_resolution on a real app bundle drops from 3,217,119 to 1,612,524 bytes per representation.
Problem
createAnalysisExecutionfilled an omittedrawResultwith a second complete copy of the result:Every adapter call site that has no distinct provider representation therefore recorded the whole
normalized_resulttwice in its Evidence (raw_resultbyte-identical tonormalized_result). MCP results repeat Evidence in both text and structured content, so these responses carried four copies of the result. The duplicate also counted twice against the 10 MiB transport budget, and twice in the context of every agent that reads the result.Affected call sites (all omitted
rawResult):rea-artifact-graphdecode_interface_builder,inspect_keyed_archive,inspect_asset_catalog,trace_dylib_resolutioninspect_native_dispatch_metadata,observe_native_calls,observe_native_ui/capture_native_ui_scenario(whose results include base64 screenshots)Sibling operations of the same providers (
inspect_artifact,extract_artifact, managed static analysis) already passrawResult: null. Providers with a real upstream representation (Hopper, Ghidra calls, IDA, JADX, EVMole, Wakaru,inspect_plistprovenance, …) pass it explicitly and are unchanged.Change
An omitted
rawResultnow recordsnull. The JSDoc anddocs/mcp-contracts.mdstate the meaning:raw_resultholds a provider representation distinct from the result, and isnullwhen there is none.normalized_result, limitations, locations and subjects are unchanged. Evidence IDs of the affected operations change because the record changed.Measurements (real MCP stdio client, pinned SDK,
open_binarythen the tool)maintext / structured bytestrace_dylib_resolutiontrace_dylib_resolutiondecode_interface_builderdecode_interface_builderinspect_asset_catalogEach figure is one representation. The MCP response carries it twice.
normalized_resultwas compared byte for byte and is identical before and after on every target.Tests
src/application/AnalysisProvider.test.ts: an omitted raw result recordsnull, and explicit raw results (including an explicitnull) are preserved.tests/boundary/cli/dylibResolutionCli.test.tsassertsraw_result: nullon the real CLI path.tests/composition/directAnalysisCleanup.test.tspinned the old copy in its partial-observation expectations. It now expectsnull; the retainednormalized_resultassertion is unchanged.main's default and pass here.Verification:
vitest run: 6200 passed. The remaining failures fail identically on unmodifiedmainon this Mac: ibtool-compiled NIB tests (Command Line Tools only),hdiutil verifyrefusal, and three Node-discovery path tests. The MCP catalog tests needed the generated.cachecatalog and pass once it is generated.npm run check:fast,npm run docs:checkNot verified: real Ghidra and IDA (their only affected records are the small open/health ones), and real
observe_native_uicapture (needs Accessibility permission). Refs #723, #1065 (T4: response repetition). This removes a duplicate inside Evidence; it does not change the text/structured repetition tracked there.🤖 Generated with Claude Code