fix(setup): validate retained Codex registration fields

This commit is contained in:
morluto
2026-10-13 20:10:19 +08:00
643 changed files with 62834 additions and 4034 deletions
@@ -270,3 +270,23 @@ it("replaces a remote server entry instead of merging its fields", async () => {
.rea,
).toEqual(clientRegistrationEntry("json", command, {}));
});
it.each([
["tool_timeout_sec", "900"],
["enabled_tools", "analyze_function"],
["disabled_tools", [123]],
] as const)("repairs invalid Codex field %s before reporting alignment", async (field, value) => {
const root = await createTestTempDirectory("rea-codex-field-repair-");
const configPath = join(root, "config.toml");
const client: SetupClient = { name: "codex", format: "toml", configPath };
await writeFile(configPath, serializeClientConfiguration({ mcp_servers: {
rea: { command: "rea", args: ["mcp"], [field]: value, timeout_note: "keep" },
} }, "toml"));
expect((await configureClientConfiguration(client, {}, command)).status).toBe("configured");
const entry = parseClientConfiguration(await readFile(configPath, "utf8"), "toml").servers.rea;
expect(entry).not.toHaveProperty(field);
expect(entry).toHaveProperty("timeout_note", "keep");
expect(await clientConfigurationAligned(client, {}, command)).toBe(true);
expect((await configureClientConfiguration(client, {}, command)).status).toBe("unchanged");
});