fix(setup): retain only registration fields doctor can parse

Setup kept malformed startup_timeout_sec and tools values that doctor
rejects, and the approval plan restated retention rules by client name.
Both now use the registration schema and the entry the writer builds.
This commit is contained in:
Cursor Agent
2026-10-12 21:37:33 -04:00
committed by xeropresence
parent ff34e7aeff
commit ecd92970a4
8 changed files with 192 additions and 61 deletions
+29 -5
View File
@@ -154,10 +154,10 @@ describe("setup workflow", () => {
"configure_client:codex",
]);
expect(result.plannedActions[0]?.detail).toContain(
`startup_timeout_sec, which setup sets to ${String(MCP_STARTUP_POLICY.codexStartupTimeoutSeconds)}`,
`startup_timeout_sec with ${JSON.stringify(MCP_STARTUP_POLICY.codexStartupTimeoutSeconds)}`,
);
expect(result.plannedActions[0]?.detail).toContain(
"non-boolean enabled or disabled values, which are removed",
"registration fields that do not parse are removed",
);
expect(host.hopperInstalls).toBe(0);
expect(host.configurations).toBe(0);
@@ -202,6 +202,7 @@ describe("setup approval disclosure", () => {
name: "grok_build",
displayName: "Grok Build",
configPath: "/grok.toml",
format: "grok",
},
];
@@ -211,10 +212,10 @@ describe("setup approval disclosure", () => {
);
expect(result.plannedActions[0]?.detail).toContain(
`startup_timeout_sec, which setup sets to ${String(MCP_STARTUP_POLICY.codexStartupTimeoutSeconds)}`,
`startup_timeout_sec with ${JSON.stringify(MCP_STARTUP_POLICY.codexStartupTimeoutSeconds)}`,
);
expect(result.plannedActions[0]?.detail).toContain(
"A boolean entry disabled flag is kept.",
"A boolean disabled value is kept.",
);
});
@@ -227,6 +228,7 @@ describe("setup approval disclosure", () => {
name: "copilot_cli",
displayName: "GitHub Copilot CLI",
configPath: "/copilot.json",
format: "copilot_cli",
},
];
@@ -236,7 +238,29 @@ describe("setup approval disclosure", () => {
);
expect(result.plannedActions[0]?.detail).toContain(
"tools, which setup sets to every tool",
`tools with ${JSON.stringify(["*"])}`,
);
});
it("discloses that a legacy OpenCode entry keeps only its environment", async () => {
const host = new FakeSetupHost();
host.hopper = "/Applications/Hopper";
host.skill = "unchanged";
host.clients = [
{
name: "opencode",
displayName: "OpenCode",
configPath: "/opencode.json",
},
];
const result = await runSetup(
{ ...options(false), dryRun: true, clientIds: ["opencode"] },
host,
);
expect(result.plannedActions[0]?.detail).toContain(
"A legacy OpenCode entry moved into the native server table keeps only its environment.",
);
});
});