fix: harden structured configuration comparisons (#467)

* refactor(process): split ownership observation helpers

* fix: compare structured configuration canonically

* test(conformance): tolerate Markdown line wrapping

* refactor: name caught values explicitly
This commit is contained in:
morluto
2026-08-09 11:58:01 +08:00
committed by GitHub
parent 8f229ede70
commit 6901edc05d
15 changed files with 319 additions and 199 deletions
@@ -114,6 +114,39 @@ describe("JSON client configuration transaction", () => {
readFile(`${configPath}.rea.backup`, "utf8"),
).rejects.toThrow();
});
it("does not rewrite an equivalent configuration with reordered environment keys", async () => {
directory = await createTestTempDirectory("rea-setup-");
const configPath = join(directory, "mcp.json");
await writeFile(
configPath,
`${JSON.stringify({
mcpServers: {
rea: {
env: {
JAVA_HOME: "/usr/lib/jvm/jdk-21",
GHIDRA_INSTALL_DIR: "/opt/ghidra",
},
args: ["-y", pinnedPackage, "mcp"],
command: "npx",
},
},
})}\n`,
);
expect(
await configureJsonClient(
{ name: "cursor", configPath },
{
GHIDRA_INSTALL_DIR: "/opt/ghidra",
JAVA_HOME: "/usr/lib/jvm/jdk-21",
},
),
).toEqual({ status: "unchanged" });
await expect(
readFile(`${configPath}.rea.backup`, "utf8"),
).rejects.toThrow();
});
});
describe("JSON client configuration migration and provider paths", () => {