diff --git a/src/application/AnalysisSettings.test.ts b/src/application/AnalysisSettings.test.ts index 7572c4c4b4..ab6afcf4ff 100644 --- a/src/application/AnalysisSettings.test.ts +++ b/src/application/AnalysisSettings.test.ts @@ -6,6 +6,31 @@ import { } from "../config/runtimeAnalysisSettings.js"; import { parseConfig } from "../config/parseConfig.js"; +it.each([ + ["inspect_native_api", [64, 7]], + ["trace_native_ui_action", []], +] as const)( + "reports the decompiler budgets consumed by %s", + (operation, values) => { + const store = new AnalysisSettings({ + REA_GHIDRA_DECOMPILE_TIMEOUT_SECONDS: "7", + REA_GHIDRA_DECOMPILE_MAX_PAYLOAD_MIB: "64", + }); + expect( + store + .inspect({ + provider: "ghidra", + operation, + settings: [ + "ghidra.decompile_max_payload_mib", + "ghidra.decompile_timeout_seconds", + ], + }) + .settings.map(({ value }) => value), + ).toEqual(values); + }, +); + it("updates atomically, restores launch values, and refuses stale or invalid writes", () => { const store = new AnalysisSettings({ REA_ASAR_MAX_HEADER_BYTES: "20000000" }); const inspect = () => store.inspect({ settings: ["asar.max_header_bytes"] }); diff --git a/src/domain/analysisSettingDefinitions.ts b/src/domain/analysisSettingDefinitions.ts index f6f2b030df..4df68a45cf 100644 --- a/src/domain/analysisSettingDefinitions.ts +++ b/src/domain/analysisSettingDefinitions.ts @@ -57,6 +57,16 @@ const timer = { unit: "ms", appliesAt: "next_operation", } as const; + +/** Operations that invoke Ghidra's decompiler directly or through a workflow. */ +const ghidraDecompileOperations = [ + "procedure_pseudo_code", + "analyze_function", + "inspect_native_api", + "decompile_all", + "trace_native_values", +] as const; + /** Metadata aggregates existing owner definitions; no environment mutation or engine discovery. */ export const ANALYSIS_SETTINGS = { "ghidra.decompile_max_payload_mib": { @@ -67,14 +77,7 @@ export const ANALYSIS_SETTINGS = { unit: "MiB", appliesAt: "next_operation", provider: "ghidra", - operations: [ - "procedure_pseudo_code", - "analyze_function", - "inspect_native_api", - "decompile_all", - "trace_native_values", - "trace_native_ui_action", - ], + operations: ghidraDecompileOperations, }, "asar.max_listing_bytes": { environment: "REA_ASAR_MAX_LISTING_BYTES", @@ -212,12 +215,7 @@ export const ANALYSIS_SETTINGS = { unit: "seconds", appliesAt: "next_operation", provider: "ghidra", - operations: [ - "procedure_pseudo_code", - "analyze_function", - "decompile_all", - "trace_native_values", - ], + operations: ghidraDecompileOperations, }, "jadx.operation_timeout_ms": { ...timer,