fix: address Copilot review round 9 — canonical constant comparison, name-based inference, permissive schemas

- rootUnion: schema values are compared through a key-sorted rendering, so two
  discriminator constants written as {a,b} and {b,a} are recognized as the same
  value rather than as mutually exclusive alternatives.
- selectBranchIndex: after the const and required passes, a name only ONE
  alternative declares identifies that alternative; a name several declare is
  ambiguous and says nothing.
- additionalProperties counts as restrictive only when its schema states an
  assertion — an annotation-only `{ title: ... }` is the equivalent of
  `true`, like `{}`.
- Drop the unjustified double casts from the ToolTestModal fixtures; the
  schemas are assignable to Partial<Tool> as written.

Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-26 04:07:50 -04:00
commit 246ee1c262

View file

@ -100,7 +100,7 @@ describe("ToolTestModal", () => {
},
],
},
} as unknown as Partial<Tool>);
});
const api = render(
<ToolTestModal
tool={tool}
@ -129,7 +129,7 @@ describe("ToolTestModal", () => {
properties: { a: { type: "string" }, b: { type: "string" } },
required: ["a", "b"],
},
} as unknown as Partial<Tool>);
});
const api = render(
<ToolTestModal
tool={tool}