test: assert a fully-declined union still counts as taking arguments

`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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PxYT4eKdnx1yRw7x4bW7Ts
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-06 15:35:14 -04:00
commit 0a30935f4b

View file

@ -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 `{}`.