Files
reverse-engineering-anything/tests/boundary/mcp/toolInputCapacityStdio.test.ts
T
46728ca41d test: remove per-test deadlines owned by project policy
Explicit deadlines at or below the project deadline only shortened it:
a literal 30-second value also disabled the coverage scaling, which timed
out wide-capacity regressions on main. Workloads above the built
deadline use the long-running tag. Deadlines derived from an operation
budget remain.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 05:27:07 +08:00

59 lines
2.1 KiB
TypeScript

import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { join, resolve } from "node:path";
import { expect, it, onTestFinished } from "vitest";
import { parseMcpToolError } from "../../fixtures/mcpToolError.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
it("applies the selected input allowance through the public deferred stdio entry point", async () => {
const root = await createTestTempDirectory("rea-input-capacity-stdio-");
const transport = new StdioClientTransport({
command: process.execPath,
args: [resolve("scripts/rea.mjs"), "mcp"],
env: {
PATH: process.env.PATH ?? "",
HOME: root,
USERPROFILE: root,
XDG_CONFIG_HOME: join(root, "config"),
XDG_CACHE_HOME: join(root, "cache"),
XDG_DATA_HOME: join(root, "data"),
HOPPER_LAUNCHER_PATH: "/rea-unconfigured-deep-provider/hopper",
NODE_OPTIONS: "--max-old-space-size=3072",
REA_LOG_LEVEL: "silent",
REA_MCP_MAX_INPUT_ELEMENTS: "8192",
},
stderr: "pipe",
});
transport.stderr?.on("data", () => undefined);
const client = new Client({ name: "input-capacity-stdio", version: "1" });
onTestFinished(async () => {
try {
await client.close();
} finally {
await transport.close();
}
});
await client.connect(transport);
const result = await client.callTool({
name: "compare_bundles",
arguments: {
left_bundle_path: join(root, "absent-left"),
right_bundle_path: join(root, "absent-right"),
record_pairs: Array.from({ length: 8192 }, () => 0),
},
});
const { error } = parseMcpToolError(result);
expect(error.code).toBe("resource_constraint");
expect(error.details).toMatchObject({
resource: "transport",
reported_limits: { max_input_elements: 8192 },
});
expect(Buffer.byteLength(JSON.stringify(result))).toBeLessThan(4096);
await client.ping();
const healthy = await client.callTool({
name: "inspect_analysis_settings",
arguments: {},
});
expect(healthy.isError).not.toBe(true);
});