fix: address Copilot review round 20 — malformed applicators, const-null under anyOf

- rootUnion reads every composition keyword through `membersOf` and every
  `required` through `requiredOf`. These schemas describe the wire and each
  member arrives as `unknown`, so `anyOf: {}` or `required: "x"` really
  can arrive — and reading them as lists threw, taking all three clients down
  rather than declining one malformed tool. Both web and TUI required-field
  checks are guarded the same way.
- admitsNull evaluates a sibling `anyOf` beside a `const: null` instead of
  refusing outright: the union decides in both directions, and
  `{ const: null, anyOf: [{ type: "null" }] }` admits null as plainly as an
  all-string union rejects it. Refusing it left a read-only required field
  seeded with the only value it accepts and submit permanently disabled.

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

View file

@ -284,7 +284,10 @@ function hasMissingIn(
schema: InspectorFormSchema,
values: Record<string, unknown>,
): boolean {
const required = schema.required ?? [];
// `Array.isArray`, not `?? []`: these schemas describe the wire, and a
// nonconforming server can send `required: "x"` — which `.some` would throw
// on, taking the whole panel down rather than one malformed tool.
const required = Array.isArray(schema.required) ? schema.required : [];
const properties = schema.properties ?? {};
return required.some((field) => {
const value = values[field];