From 2623bd75a279e08018925a511dbdf722b9b6017e Mon Sep 17 00:00:00 2001 From: basedcorp99 Date: Sat, 6 Jun 2026 18:53:52 +0200 Subject: [PATCH] test(ai): add stripResidualCombiners regression for mixed-type string|array collapse --- packages/ai/test/schema-normalization.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/ai/test/schema-normalization.test.ts b/packages/ai/test/schema-normalization.test.ts index c7e55d9d1..b2c23fbc4 100644 --- a/packages/ai/test/schema-normalization.test.ts +++ b/packages/ai/test/schema-normalization.test.ts @@ -728,6 +728,18 @@ describe("stripResidualCombiners", () => { expect(normalized.anyOf).toBeUndefined(); expect(normalized.oneOf).toBeUndefined(); }); + + it("drops array-only keys when mixed-type collapse picks string from anyOf fixpoint", () => { + const stripped = stripResidualCombiners({ + anyOf: [{ type: "string" }, { type: "array", items: { type: "string" } }], + description: "pr number, url, or branch", + }) as Record; + + expect(stripped.type).toBe("string"); + expect(stripped.items).toBeUndefined(); + expect(stripped.anyOf).toBeUndefined(); + expect(stripped.description).toBe("pr number, url, or branch"); + }); }); // ---------------------------------------------------------------------------