Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership. Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers. BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
82 lines
2.8 KiB
TypeScript
82 lines
2.8 KiB
TypeScript
import { ok as resultOk } from "../../../src/domain/result.js";
|
|
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { completeReconstructionCoverageData } from "../../../src/domain/reconstructionCoverage.fixture.js";
|
|
import { createReconstructionCoverageData } from "../../../src/domain/reconstructionCoverage.js";
|
|
import { createTestBinarySession } from "../../fixtures/binarySession.js";
|
|
import { createServer } from "../../../src/server/createServer.js";
|
|
import { observed } from "../../fixtures/analysisExecution.js";
|
|
|
|
describe("reconstruction coverage MCP", () => {
|
|
it("evaluates inline fail-closed coverage without session retention", async () => {
|
|
const session = createTestBinarySession(() => ({
|
|
execute: () => Promise.resolve(observed(null)),
|
|
close: () => Promise.resolve(resultOk(null)),
|
|
}));
|
|
const server = createServer(session, session);
|
|
const client = new Client({ name: "coverage-mcp-test", version: "1" });
|
|
const [clientTransport, serverTransport] =
|
|
InMemoryTransport.createLinkedPair();
|
|
try {
|
|
await server.connect(serverTransport);
|
|
await client.connect(clientTransport);
|
|
const boundaryId = "replacement.cli";
|
|
const result = await client.callTool({
|
|
name: "evaluate_reconstruction_coverage",
|
|
arguments: {
|
|
coverage: currentFixtureCoverage(boundaryId),
|
|
boundary_id: boundaryId,
|
|
},
|
|
});
|
|
expect(result.isError).not.toBe(true);
|
|
expect(result.structuredContent).toMatchObject({
|
|
status: "ready",
|
|
boundary_id: boundaryId,
|
|
summary: { reasons: 0 },
|
|
});
|
|
const unknown = await client.callTool({
|
|
name: "evaluate_reconstruction_coverage",
|
|
arguments: {
|
|
coverage: currentFixtureCoverage(boundaryId),
|
|
boundary_id: "replacement.missing",
|
|
},
|
|
});
|
|
expect(unknown.isError).toBe(true);
|
|
expect(unknown.structuredContent).toMatchObject({
|
|
error: {
|
|
code: "invalid_request",
|
|
details: {
|
|
issues: [
|
|
{
|
|
path: [],
|
|
reason: "invalid_value",
|
|
message: "Unknown reconstruction boundary: replacement.missing",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
} finally {
|
|
await client.close();
|
|
await server.close();
|
|
await session.close();
|
|
}
|
|
});
|
|
});
|
|
|
|
const currentFixtureCoverage = (boundaryId: string) => {
|
|
const coverage = completeReconstructionCoverageData();
|
|
return createReconstructionCoverageData({
|
|
...coverage,
|
|
boundaries: coverage.boundaries.map((boundary) => ({
|
|
...boundary,
|
|
boundary_id: boundaryId,
|
|
})),
|
|
verifier_results: coverage.verifier_results.map((result) => ({
|
|
...result,
|
|
observed_at: new Date().toISOString(),
|
|
})),
|
|
});
|
|
};
|