From c59c627f173b315dcce2320d0c67a09a186daf39 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 22 Feb 2026 01:21:23 +0900 Subject: [PATCH] fix(deps): address ajv v8 breaking changes for compatibility Fixes CI failures in PR #1099. PR #1099 bumped ajv from 6.12.6 to 8.18.0, which caused two test failures due to breaking changes in ajv v8. ## 1. Error message wording change ajv v8 changed validation error messages from "should" to "must". ``` Expected substring: "should be number" Received string: "data/temperature must be number" ``` Updates the assertion in schemaUtils.test.ts to use "must be number". ## 2. Strict mode rejects unknown format keywords ajv v8 enables strict mode by default, which throws on unknown format keywords (e.g. `format: "email"`) instead of ignoring them. In ElicitationRequest.tsx, this caused the catch block to set a validation error instead of calling onResolve. Passes `{ strict: false }` to the Ajv constructor in ElicitationRequest.tsx so that format keywords from external MCP server schemas are silently ignored rather than throwing. --- client/package.json | 2 +- client/src/components/ElicitationRequest.tsx | 2 +- .../src/utils/__tests__/schemaUtils.test.ts | 2 +- package-lock.json | 29 ++++++++++++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/client/package.json b/client/package.json index 30fadb51b..ca435d9c9 100644 --- a/client/package.json +++ b/client/package.json @@ -40,7 +40,7 @@ "@radix-ui/react-tabs": "^1.1.1", "@radix-ui/react-toast": "^1.2.6", "@radix-ui/react-tooltip": "^1.1.8", - "ajv": "^6.12.6", + "ajv": "^8.18.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cmdk": "^1.0.4", diff --git a/client/src/components/ElicitationRequest.tsx b/client/src/components/ElicitationRequest.tsx index 4488a9620..91928605e 100644 --- a/client/src/components/ElicitationRequest.tsx +++ b/client/src/components/ElicitationRequest.tsx @@ -79,7 +79,7 @@ const ElicitationRequest = ({ return; } - const ajv = new Ajv(); + const ajv = new Ajv({ strict: false }); const validate = ajv.compile(request.request.requestedSchema); const isValid = validate(formData); diff --git a/client/src/utils/__tests__/schemaUtils.test.ts b/client/src/utils/__tests__/schemaUtils.test.ts index 2d1b686f9..48c8fd2ad 100644 --- a/client/src/utils/__tests__/schemaUtils.test.ts +++ b/client/src/utils/__tests__/schemaUtils.test.ts @@ -507,7 +507,7 @@ describe("Output Schema Validation", () => { }); expect(result.isValid).toBe(false); - expect(result.error).toContain("should be number"); + expect(result.error).toContain("must be number"); }); test("rejects missing required fields", () => { diff --git a/package-lock.json b/package-lock.json index da310ffb5..dce981d43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,7 +93,7 @@ "@radix-ui/react-tabs": "^1.1.1", "@radix-ui/react-toast": "^1.2.6", "@radix-ui/react-tooltip": "^1.1.8", - "ajv": "^6.12.6", + "ajv": "^8.18.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cmdk": "^1.0.4", @@ -139,6 +139,22 @@ "vite": "^7.1.11" } }, + "client/node_modules/ajv": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "client/node_modules/jest-environment-jsdom": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz", @@ -167,6 +183,12 @@ } } }, + "client/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, "node_modules/@adobe/css-tools": { "version": "4.4.4", "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.4.tgz", @@ -5149,6 +5171,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", @@ -7054,6 +7077,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, "license": "MIT" }, "node_modules/fast-levenshtein": { @@ -9593,6 +9617,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, "license": "MIT" }, "node_modules/json-schema-typed": { @@ -10987,6 +11012,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -13287,6 +13313,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0"