From e8c838e8bd4fe46f06aaefea793fcc39b00b50de Mon Sep 17 00:00:00 2001 From: gensokyo-dev Date: Fri, 13 Nov 2026 20:17:18 +0000 Subject: [PATCH] test(mcp): keep the surrogate path handler check within its deadline The handler regression added in #10390 listed tools under the full input profile and matched every advertised schema before calling each tool. It took about 14 s locally and passed the 30 s deadline on loaded CI runners. advertisedPatternsVMode.test.ts already proves that no input or output profile advertises the surrogate escape, so this case now checks only the runtime refusal through the default-profile handlers, as the relative-path case does. Co-Authored-By: gensokyo-dev Co-Authored-By: Claude Opus 5.5 --- .../boundary/mcp/absoluteLocalPathSchema.test.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/boundary/mcp/absoluteLocalPathSchema.test.ts b/tests/boundary/mcp/absoluteLocalPathSchema.test.ts index da46d49764..436124fd08 100644 --- a/tests/boundary/mcp/absoluteLocalPathSchema.test.ts +++ b/tests/boundary/mcp/absoluteLocalPathSchema.test.ts @@ -354,23 +354,16 @@ it("rejects relative paths through in-memory MCP handlers", async () => { } }); -it("rejects unpaired surrogates through in-memory MCP handlers without advertising them", async () => { +// advertisedPatternsVMode.test.ts proves no schema profile advertises the +// surrogate escape; this case proves the handlers still refuse such paths. +it("rejects unpaired surrogates through in-memory MCP handlers", async () => { const firmwareCalls: string[] = []; - const { client, close } = await createMcp(firmwareCalls, "full"); + const { client, close } = await createMcp(firmwareCalls); try { const absolute = resolve("rea-absolute-input"); const cases = inputCases(absolute, `${absolute}\ud800`); - const listed = await client.listTools(); const checked: string[] = []; for (const { name, field, invalid, issuePath } of cases) { - const schema = listed.tools.find( - (tool) => tool.name === name, - )?.inputSchema; - if (schema === undefined) - throw new Error(`Missing advertised tool ${name}`); - // Strict pattern compilers refuse the complete tools request for a - // `\uD800-\uDFFF` range, so the rule is enforced only by the handler. - expect(JSON.stringify(schema), name).not.toMatch(/\\\\u[dD][89a-fA-F]/u); const result = await client.callTool({ name, arguments: invalid }); expect(result.isError, `${name}.${field}`).toBe(true); expect(parseMcpToolError(result).error, `${name}.${field}`).toMatchObject(