test(ida): verify typed timeout and retained cleanup through the CLI

This commit is contained in:
morluto
2026-10-15 05:38:36 +08:00
parent 4946688c33
commit bb49252523
2 changed files with 6 additions and 21 deletions
-20
View File
@@ -7,7 +7,6 @@ import {
RecordingIdaMcp,
} from "../../tests/fixtures/idaMcp.js";
import { IdaSessionClient } from "./IdaSessionClient.js";
import { AnalysisTimeoutError } from "../domain/analysisErrorCore.js";
import { functionDossierSchema } from "../domain/hopperValues.js";
import { jsonValueSchema, type JsonValue } from "../domain/jsonValue.js";
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
@@ -474,25 +473,6 @@ describe("attached IDA function observations", () => {
});
});
it("preserves a typed MCP request timeout through the public session result", async () => {
const { producer, client } = await fixture();
expect((await client.execute("health", {})).ok).toBe(true);
producer.overrideCall = (name) => {
if (name === "decompile_function")
throw new AnalysisTimeoutError(name, 1_000);
return undefined;
};
const result = await client.execute("procedure_pseudo_code", {
procedure: "main",
});
if (result.ok) throw new Error("Expected the request timeout to surface");
expect(result.error._tag).toBe("AnalysisTimeoutError");
expect(projectAnalysisError(result.error).code).toBe("provider_timeout");
await client.close();
});
const busyHealth = (busyTool?: JsonValue): JsonValue => ({
status: "busy",
uptime_sec: 1.041,
@@ -65,11 +65,16 @@ describe("headless IDA timeout through the one-shot CLI", () => {
expect(result.json).toMatchObject({
code: "cleanup_incomplete",
details: {
provider_id: "ida",
cleanup: "incomplete",
execution_failure: "provider_timeout",
operation: "idb_open",
timeout_ms: 500,
resources: [expect.stringContaining(workspaceRoot)],
cleanup_error: {
code: "cleanup_incomplete",
details: {
provider_id: "ida",
operation: "close",
diagnostics: {
upstream_sessions: {
state: "unverified",