fix(setup): name invalid client config shape errors clearly (#2157)
* 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>
This commit is contained in:
co-authored by
Beqa Ksovreli
Cursor
morluto
parent
7711b00005
commit
b1bf4a70d4
@@ -1661,8 +1661,9 @@ describe("uninstall configuration preflight", () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
['{"mcpServers": null}', '"mcpServers" must be an object'],
|
||||
['{"mcpServers":null,"keep":1}', '"mcpServers" must be an object'],
|
||||
["[]", "The configuration root must be an object"],
|
||||
['{"mcpServers":"x"}', '"mcpServers" must be an object'],
|
||||
])(
|
||||
"names the structural problem in valid JSON %s",
|
||||
async (content, problem) => {
|
||||
@@ -1679,12 +1680,14 @@ describe("uninstall configuration preflight", () => {
|
||||
},
|
||||
});
|
||||
const result = await runUninstall(false, systemUninstallHost(home));
|
||||
expect(result.status).toBe("failed");
|
||||
expect(result.items).toContainEqual({
|
||||
name: "cursor",
|
||||
status: "failed",
|
||||
detail: `Configuration was not changed: ${problem}. Repair it, then rerun uninstall.`,
|
||||
});
|
||||
expect(await readFile(config, "utf8")).toBe(content);
|
||||
await expect(readFile(`${config}.rea.backup`, "utf8")).rejects.toThrow();
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user