Files
rea/tests/runtime.test.ts
T
N0zoM1z0andN0zoM1z0 8cbc125b93 feat(dotnet): verify managed native boundaries
Add the verify_managed_native_boundaries workflow for comparing authenticated inspect_managed_native_boundaries Evidence with supplied native export or function Evidence. The workflow verifies only P/Invoke declaration names against observed native symbols, keeps verified, inferred, contradicted, unresolved, and unsupported-native states explicit, and does not translate managed metadata tokens or RVAs into native addresses.

Expose schema-identical MCP and CLI surfaces, update managed workflow contracts, product catalog facts, TypeDoc output, README/localized docs, ADR status, package verification, and the REA analysis skill metadata for the 90-tool/50-command inventory.

Verification: npx vitest run tests/managedNativeVerification.test.ts --coverage=false; npm run typecheck; npm run docs:generate; npm run check (first run hit a load-sensitive sessionMcp timeout, isolated rerun passed); npx vitest run tests/sessionMcp.test.ts --coverage=false; npm run check; npm run knip; npm run jscpd; npm run scan:todos; npm run verify:managed; CXX=/usr/bin/g++-13 CC=/usr/bin/gcc-13 npm run verify:package.
2026-07-16 21:26:38 +09:00

88 lines
2.8 KiB
TypeScript

import { fileURLToPath } from "node:url";
import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { describe, expect, it } from "vitest";
const mainPath = fileURLToPath(new URL("../dist/main.js", import.meta.url));
const fixturePath = fileURLToPath(
new URL("./fixtures/fakeLauncher.mjs", import.meta.url),
);
describe("production stdio runtime", () => {
it("starts the built entrypoint, lists 90 tools, calls one, and shuts down", async () => {
const transport = new StdioClientTransport({
command: process.execPath,
args: [mainPath],
cwd: process.cwd(),
env: {
PATH: process.env.PATH ?? "",
HOPPER_LAUNCHER_PATH: process.execPath,
HOPPER_TARGET_PATH: process.execPath,
HOPPER_LOADER_ARGS_JSON: JSON.stringify([fixturePath]),
},
stderr: "pipe",
});
let stderr = "";
transport.stderr?.on("data", (chunk: Buffer | string) => {
stderr += chunk.toString();
});
const client = new Client({ name: "runtime-smoke", version: "1.0.0" });
try {
await client.connect(transport);
const tools = await client.listTools();
expect(tools.tools).toHaveLength(90);
const result = await client.callTool({
name: "current_document",
arguments: {},
});
expect(result.isError === true).toBe(process.platform === "linux");
} finally {
await client.close();
await transport.close();
}
const records = stderr
.trim()
.split("\n")
.filter((line) => line.length > 0)
.map((line: string): unknown => JSON.parse(line));
expect(records).toContainEqual(
expect.objectContaining({
application: "rea",
mode: "mcp",
layer: "server",
tool: "current_document",
status: process.platform === "linux" ? "error" : "ok",
}),
);
expect(stderr).not.toContain("HOPPER_LOADER_ARGS_JSON");
expect(stderr).not.toContain(fixturePath);
}, 15_000);
it("honors the configured kind for an initial database target", async () => {
const transport = new StdioClientTransport({
command: process.execPath,
args: [mainPath],
cwd: process.cwd(),
env: {
PATH: process.env.PATH ?? "",
HOPPER_LAUNCHER_PATH: process.execPath,
HOPPER_TARGET_PATH: new URL(import.meta.url).pathname,
HOPPER_TARGET_KIND: "database",
HOPPER_LOADER_ARGS_JSON: JSON.stringify([fixturePath]),
},
stderr: "pipe",
});
const client = new Client({ name: "database-runtime", version: "1.0.0" });
try {
await client.connect(transport);
expect((await client.listTools()).tools).toHaveLength(90);
} finally {
await client.close();
await transport.close();
}
}, 15_000);
});