mirror of
https://github.com/morluto/rea.git
synced 2026-10-27 18:05:45 +00:00
* fix(setup): name invalid client config shape errors clearly Setup was dumping raw Zod issues for non-object roots or server tables, and uninstall always claimed the file was not valid JSON. Report the structural problem instead, and reserve parse failures for real syntax errors. Fixes #2152 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(setup): preserve client configuration record validation Keep descriptive shape errors while retaining Zod record validation and its own-property copy. Reject tagged YAML objects before setup or uninstall writes and prevent inherited JSONC properties from fabricating client registrations. Add production-boundary regressions for tagged YAML roots and server tables, plus inherited Cursor and OpenCode settings. All 91 focused tests, npm run check, verify:test-discovery, verify:package, and npm pack --dry-run passed. --------- Co-authored-by: Beqa Ksovreli <beqa@Beqas-Macbook-Pro-2.local> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
35 lines
1002 B
TypeScript
35 lines
1002 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { parseClientConfiguration } from "./ClientConfigurationDocument.js";
|
|
|
|
describe("parseClientConfiguration shape diagnostics", () => {
|
|
it.each([
|
|
["null", "null"],
|
|
["array", "[]"],
|
|
["string", '"x"'],
|
|
] as const)("names a non-object JSON root (%s)", (_label, text) => {
|
|
expect(() => parseClientConfiguration(text, "json")).toThrow(
|
|
new TypeError("The configuration root must be an object"),
|
|
);
|
|
});
|
|
|
|
it.each([
|
|
["null", "null"],
|
|
["array", "[]"],
|
|
["string", '"x"'],
|
|
] as const)(
|
|
'names a non-object "mcpServers" value (%s)',
|
|
(_label, servers) => {
|
|
expect(() =>
|
|
parseClientConfiguration(`{"mcpServers":${servers},"keep":1}`, "json"),
|
|
).toThrow(new TypeError('"mcpServers" must be an object'));
|
|
},
|
|
);
|
|
|
|
it("still rejects unparsable JSON with SyntaxError", () => {
|
|
expect(() => parseClientConfiguration("not-json", "json")).toThrow(
|
|
SyntaxError,
|
|
);
|
|
});
|
|
});
|