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 <noreply@anthropic.com>
This commit is contained in:
NomenAK
2026-05-30 15:00:01 +00:00
parent a1e0bc7469
commit dd6104ea38

View File

@@ -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<string, string>).get("MyTool"), "my_tool");
});
it("rewrites mcp_* tool_use names in assistant message history", () => {