fix(ida): declare GUI navigation for attached legacy analysis (#1764)

Attached IDA mode always uses the legacy 1.4 producer, whose
disassemble_function jumps to the function and whose decompile_function
opens or reuses a pseudocode view whenever an IDA window is active.
Session discovery still advertised may_show_ui: false for every
operation.

Declare the UI effect for the attached operations that reach those
tools: pseudocode, assembly, raw function instructions and the function
dossier. Headless operations and the other attached operations keep
false. A conformance check now compares each declaration with the
upstream tools the operation actually calls.

Fixes #1712

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-11 01:36:56 -07:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 6d5d71fab5
commit cf692072b5
3 changed files with 60 additions and 3 deletions
@@ -3,7 +3,10 @@ import { rm } from "node:fs/promises";
import { afterEach, describe, expect, it } from "vitest";
import { createIdaTarget, RecordingIdaMcp } from "../../fixtures/idaMcp.js";
import { IdaSessionClient } from "../../../src/ida/IdaSessionClient.js";
import { IDA_OPERATIONS } from "../../../src/ida/IdaProviderCapabilities.js";
import {
IDA_OPERATIONS,
idaCapabilities,
} from "../../../src/ida/IdaProviderCapabilities.js";
import { toolContract } from "../../../src/contracts/toolContracts.js";
import { createEvidence } from "../../../src/domain/evidence.js";
import type { JsonValue } from "../../../src/domain/jsonValue.js";
@@ -16,6 +19,12 @@ afterEach(async () => {
for (const root of roots.splice(0))
await rm(root, { recursive: true, force: true });
});
/** Pinned upstream tools that navigate an active IDA GUI as a side effect. */
const GUI_NAVIGATING_TOOLS: ReadonlySet<string> = new Set([
"disassemble_function",
"decompile_function",
]);
const parametersFor = (
operation: string,
): Readonly<Record<string, JsonValue>> => {
@@ -28,6 +37,38 @@ const parametersFor = (
describe.each(["attached", "headless"] as const)(
"IDA %s caller-visible contracts",
(mode) => {
it.each(IDA_OPERATIONS)(
"declares %s UI effects matching the upstream tools it reaches",
async (operation) => {
const { root, target } = await createIdaTarget();
roots.push(root);
const producer = new RecordingIdaMcp(target, mode);
const client = new IdaSessionClient(
{
command: "fixture",
args: [],
env: {},
mode,
workspaceRoot: root,
timeoutMs: 1000,
},
target,
producer,
);
try {
await client.execute(operation, parametersFor(operation));
} finally {
await client.close();
}
const descriptor = idaCapabilities(mode, true).find(
(capability) => capability.operation === operation,
);
expect(descriptor?.effects.mayShowUi).toBe(
producer.calls.some(({ name }) => GUI_NAVIGATING_TOOLS.has(name)),
);
},
);
it.each(IDA_OPERATIONS)(
"serializes %s against its named advertised output contract",
async (operation) => {