diff --git a/src/application/ClientRegistrationShape.ts b/src/application/ClientRegistrationShape.ts index d4866d34b2..46740ae3e4 100644 --- a/src/application/ClientRegistrationShape.ts +++ b/src/application/ClientRegistrationShape.ts @@ -36,7 +36,8 @@ export const registrationFieldAccepted = ( key: string, value: unknown, ): boolean => { - const shape: Readonly> = registrationSchemaFor(dialect).shape; + const shape: Readonly> = + registrationSchemaFor(dialect).shape; const field = Object.hasOwn(shape, key) ? shape[key] : undefined; return field === undefined || field.safeParse(value).success; }; diff --git a/src/application/ClientRegistrationStatus.ts b/src/application/ClientRegistrationStatus.ts index 134f13d4c4..85f1853251 100644 --- a/src/application/ClientRegistrationStatus.ts +++ b/src/application/ClientRegistrationStatus.ts @@ -14,7 +14,10 @@ import { resolve } from "node:path"; import { z } from "zod"; -import { registrationSchema, registrationSchemaFor } from "./ClientRegistrationShape.js"; +import { + registrationSchema, + registrationSchemaFor, +} from "./ClientRegistrationShape.js"; import { PRODUCT_IDENTITY } from "../identity.js"; import { MCP_STARTUP_POLICY } from "../mcpStartupPolicy.js"; import { @@ -322,7 +325,9 @@ const parseRegistration = ( args, }); } - const registration = registrationSchemaFor(client.format ?? "json").parse(value); + const registration = registrationSchemaFor(client.format ?? "json").parse( + value, + ); if ( (client.format === "vscode" || client.format === "copilot_cli") && registration.type !== "stdio" diff --git a/src/application/SetupClientConfiguration.ts b/src/application/SetupClientConfiguration.ts index ba14c57b52..5f408df48d 100644 --- a/src/application/SetupClientConfiguration.ts +++ b/src/application/SetupClientConfiguration.ts @@ -476,7 +476,6 @@ export const inspectClientConfiguration = async ( "The existing configuration is malformed. Repair it before setup applies any other changes.", }; } - }; const clientRegistrationDialect = ( diff --git a/tests/boundary/filesystem/clientRegistrationFields.test.ts b/tests/boundary/filesystem/clientRegistrationFields.test.ts index 568e25571a..52125b3b88 100644 --- a/tests/boundary/filesystem/clientRegistrationFields.test.ts +++ b/tests/boundary/filesystem/clientRegistrationFields.test.ts @@ -271,22 +271,44 @@ it("replaces a remote server entry instead of merging its fields", async () => { ).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"); -}); +] 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"); + }, +);