From 0a30935f4be236e88b8d87bd8ca8f3c6ab960a16 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Sun, 6 Sep 2026 15:35:14 -0400 Subject: [PATCH] test: assert a fully-declined union still counts as taking arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `declaresAnyFields` decides whether a tool is auto-invoked with `{}` or asked about, and it counts a required name a schema never declares — so the #2224 check making such a union render nothing must not be read as "no arguments". Nothing changed here; the invariant just had no test of its own. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01PxYT4eKdnx1yRw7x4bW7Ts Signed-off-by: cliffhall --- clients/web/src/test/core/rootUnion.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/clients/web/src/test/core/rootUnion.test.ts b/clients/web/src/test/core/rootUnion.test.ts index e25ff630..2879de8f 100644 --- a/clients/web/src/test/core/rootUnion.test.ts +++ b/clients/web/src/test/core/rootUnion.test.ts @@ -997,6 +997,24 @@ describe("resolveRootUnion", () => { ).toBe(true); }); + it("still counts a union whose every branch is now declined", () => { + // The #2224 check makes such a union render nothing, which must not be + // read as "this tool takes no arguments" — an App tool carrying one would + // then be auto-invoked with `{}` rather than asked about. + expect( + declaresAnyFields({ + type: "object", + oneOf: [ + { + type: "object", + properties: { kind: { const: "a" } }, + required: ["kind", "payload"], + }, + ], + }), + ).toBe(true); + }); + it("counts a required name a schema never declares", () => { // Legal, and the tool plainly takes an argument — an App tool shaped this // way must ask rather than being auto-invoked with `{}`.