Files
rea/tests/boundary/mcp/reconstructionCoverageMcp.test.ts
T
morlutoandGitHub 4fbc501121 feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)
* fix(hopper): normalize string-backed addresses and update verification

* feat(native): add inspection primitives, dispatch traces and approved UI observation

* test: prioritize real artifact E2E and captured golden regressions

* fix(process): queue observed output before reactive rendering actions

* test: prune redundant cases and strengthen boundary assertions

* fix(cli): route native value tracing through shared workflows

* test: replace synthetic success with real workflows and captured data

* fix(catalog): separate portable metadata from native host availability
2026-10-04 16:02:36 +08:00

59 lines
2.1 KiB
TypeScript

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(),
}));
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 },
});
} 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(),
})),
});
};