From dd6104ea38778bf9371e4e440f689e1eb1da14b5 Mon Sep 17 00:00:00 2001 From: NomenAK Date: Sat, 30 May 2026 15:00:01 +0000 Subject: [PATCH] test(cliproxyapi): update executor test for the broadened tool-name cloak The CPA executor now cloaks non-Claude-Code tool names (not just mcp_*), so the prior "does not rewrite non-mcp_ tool names" assertion no longer holds: my_tool is aliased to MyTool and restored on the response via _toolNameMap. Co-Authored-By: Claude Opus 4.8 --- tests/unit/cliproxyapi-executor.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/cliproxyapi-executor.test.ts b/tests/unit/cliproxyapi-executor.test.ts index c5f1aab86c..3db932cfc1 100644 --- a/tests/unit/cliproxyapi-executor.test.ts +++ b/tests/unit/cliproxyapi-executor.test.ts @@ -457,14 +457,18 @@ describe("CliproxyapiExecutor", () => { ); }); - it("does not rewrite non-mcp_ tool names", () => { + it("cloaks non-mcp third-party tool names to PascalCase (fingerprint defense, PR #2943)", () => { const exec = new CliproxyapiExecutor(); const body = anthropicBodyWithTools([ { name: "my_tool", description: "My tool", input_schema: {} }, ]); const result = exec.transformRequest("claude-opus-4-7", body, true, {}); const toolName = (result.tools as Array<{ name: string }>)[0].name; - assert.equal(toolName, "my_tool"); + // Non-Claude-Code tool names are now cloaked (my_tool -> MyTool) so Anthropic + // does not fingerprint the third-party harness; restored on the response via + // the non-enumerable _toolNameMap. + assert.equal(toolName, "MyTool"); + assert.equal((result._toolNameMap as Map).get("MyTool"), "my_tool"); }); it("rewrites mcp_* tool_use names in assistant message history", () => {