fix(ida): report missing tools when a compatibility profile mismatches (#2307)
A profile mismatch reached the caller as a bare AnalysisProtocolError, which projects to `unreadable_output` with a generic message. The error already named every missing tool, but none of that detail survived, so the only way to identify the cause was to log the JSON-RPC traffic and notice the exchange stopping after `tools/list`. Throw a ProviderAdapterError instead, carrying the mode, the expected profile and the missing tool names through the diagnostics channel that already surfaces in `details`. Document which upstream versions each profile accepts, since upstream `main` now serves neither. Refs #2301 Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { rm, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { projectAnalysisError } from "../../src/domain/analysisErrorProjection.js";
|
||||
import { IdaProvider } from "../../src/ida/IdaProvider.js";
|
||||
import { createIdaTarget, RecordingIdaMcp } from "../fixtures/idaMcp.js";
|
||||
import { createTestBinarySession } from "../fixtures/binarySession.js";
|
||||
@@ -157,12 +158,21 @@ describe("IDA provider composition", () => {
|
||||
expect(analyzed).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisProtocolError",
|
||||
message: expect.stringContaining(
|
||||
_tag: "ProviderAdapterError",
|
||||
userMessage: expect.stringContaining(
|
||||
"headless compatibility profile is missing tools: idb_open",
|
||||
),
|
||||
},
|
||||
});
|
||||
if (analyzed.ok) throw new Error("Expected incompatible IDA profile");
|
||||
expect(projectAnalysisError(analyzed.error).details).toMatchObject({
|
||||
provider_id: "ida",
|
||||
diagnostics: {
|
||||
mode: "headless",
|
||||
expected_profile: "database-supervisor",
|
||||
missing_tools: expect.arrayContaining(["idb_open"]),
|
||||
},
|
||||
});
|
||||
expect(producer.connects).toBe(1);
|
||||
expect((await session.close()).ok).toBe(true);
|
||||
expect(producer.closes).toBe(1);
|
||||
|
||||
Reference in New Issue
Block a user