test(mcp): preserve typed input refusal and finalization contracts
This commit is contained in:
1 parent
67d02f4787
commit
27976a8fcb
6 files changed
+19
-20
No files matched your search
@@ -84,7 +84,7 @@ it.each([
|
||||
name: "compare_functions",
|
||||
arguments: { left: evidence, right: evidence },
|
||||
});
|
||||
expect(reply.isError).not.toBe(true);
|
||||
expect(reply.isError, JSON.stringify(reply)).not.toBe(true);
|
||||
const comparison = functionComparisonResultSchema.parse(
|
||||
sessionEvidence(harness.session, reply.structuredContent)
|
||||
.normalized_result,
|
||||
@@ -176,7 +176,7 @@ it("retains terminal-call qualifications across function views and snapshot repl
|
||||
: { procedure: identity.address, document: "fixture" },
|
||||
};
|
||||
const reply = await harness.mcp.callTool(request);
|
||||
expect(reply.isError, name).not.toBe(true);
|
||||
expect(reply.isError, `${name}: ${JSON.stringify(reply)}`).not.toBe(true);
|
||||
const evidence = sessionEvidence(
|
||||
harness.session,
|
||||
reply.structuredContent,
|
||||
@@ -231,7 +231,7 @@ it("retains handler-region limitations on incoming and outgoing reference Eviden
|
||||
name: "procedure_references",
|
||||
arguments: { procedure: dossier.procedure.address, direction },
|
||||
});
|
||||
expect(reply.isError).not.toBe(true);
|
||||
expect(reply.isError, JSON.stringify(reply)).not.toBe(true);
|
||||
const evidence = sessionEvidence(
|
||||
harness.session,
|
||||
reply.structuredContent,
|
||||
|
||||
@@ -265,6 +265,8 @@ const resultBuilders = new Map<GhidraOperation, GhidraResultBuilder>([
|
||||
procedure: ghidraFunctionIdentity(),
|
||||
direction: input.direction ?? "outgoing",
|
||||
references: [ghidraReferenceEdge()],
|
||||
reference_kinds_available: true,
|
||||
unresolved_calls: [],
|
||||
}),
|
||||
],
|
||||
["xrefs", () => ["0x401001"]],
|
||||
|
||||
@@ -14,7 +14,7 @@ import { parseMcpToolError } from "../../fixtures/mcpToolError.js";
|
||||
import { ghidraInstallationHost } from "./ghidraMcpHarness.js";
|
||||
|
||||
const REFUSAL =
|
||||
"REA_GHIDRA_LANGUAGE_ID cannot override the admitted raw-binary import.";
|
||||
"Processor or compiler specification overrides cannot replace the admitted raw-binary import.";
|
||||
|
||||
const openRawArm = async (languageId: string | undefined) => {
|
||||
const directory = await mkdtemp(join(tmpdir(), "rea-profile-refusal-"));
|
||||
@@ -67,24 +67,15 @@ const openRawArm = async (languageId: string | undefined) => {
|
||||
}
|
||||
};
|
||||
|
||||
it("returns provider-selection diagnostics when the selected provider refuses its profile", async () => {
|
||||
it("returns configuration diagnostics when a language override conflicts with the admitted profile", async () => {
|
||||
const { result, clients } = await openRawArm("ARM:LE:32:v7");
|
||||
expect(clients).toBe(0);
|
||||
const { error } = parseMcpToolError(result);
|
||||
expect(error).toMatchObject({
|
||||
code: "capability_unavailable",
|
||||
code: "configuration_invalid",
|
||||
message: expect.stringContaining(REFUSAL),
|
||||
details: {
|
||||
selection_reason: "target_unsupported",
|
||||
requested_provider_id: "ghidra",
|
||||
candidate_ids: ["ghidra"],
|
||||
rejections: [
|
||||
expect.objectContaining({
|
||||
provider_id: "ghidra",
|
||||
code: "target_format_unsupported",
|
||||
reason: REFUSAL,
|
||||
}),
|
||||
],
|
||||
settings: [{ setting: "REA_GHIDRA_LANGUAGE_ID", constraint: REFUSAL }],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -156,8 +156,11 @@ it("routes observe_native_calls through MCP with schema-checked input and output
|
||||
details: {
|
||||
issues: [
|
||||
expect.objectContaining({
|
||||
path: ["environment", "__proto__"],
|
||||
reason: "invalid_type",
|
||||
path: [],
|
||||
reason: "invalid_value",
|
||||
message: expect.stringMatching(
|
||||
/environment\.__proto__:.*expected string, received number/u,
|
||||
),
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
@@ -81,7 +81,7 @@ it.each([false, true])(
|
||||
...(fails
|
||||
? {
|
||||
cleanup: "incomplete",
|
||||
execution_failure: "execution_failure",
|
||||
execution_failure: "provider_timeout",
|
||||
diagnostics: {
|
||||
primary_error: { code: "provider_timeout" },
|
||||
},
|
||||
|
||||
@@ -243,6 +243,9 @@ it("continues rejecting duplicate explicit record_unknown identities", async ()
|
||||
name: "record_unknown",
|
||||
arguments: input,
|
||||
});
|
||||
expect(parseMcpToolError(duplicate).error.code).toBe("revision_conflict");
|
||||
expect(parseMcpToolError(duplicate).error).toMatchObject({
|
||||
code: "invalid_request",
|
||||
message: expect.stringContaining("already exists"),
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user