fix(setup): attribute malformed environment keys to their source (#13522)

This commit is contained in:
morluto authored and GitHub committed 2026-11-22 17:56:00 +00:00
1 parent b6ffec43ad
commit 4657cdd219
4 files changed
+118 -102

No files matched your search

@@ -168,6 +168,31 @@ it.each(["legacy", "native"] as const)(
},
);
it("attributes a dotted environment key to its effective OpenCode source", async () => {
const { client, projectDirectory, read } = await fixture();
const upper = join(projectDirectory, "opencode.json");
const key = "CALLER.VALUE";
await writeConfiguration(client.configPath, {
mcp: { rea: { ...localServer("user"), environment: { [key]: 17 } } },
});
await writeConfiguration(upper, {
mcp: {
rea: { ...localServer("project"), environment: { VALUE: "unrelated" } },
},
});
const result = await read();
expect(result).toMatchObject({
ok: false,
error: {
kind: "malformed",
path: client.configPath,
detail: expect.stringContaining("environment.CALLER.VALUE"),
},
});
if (result.ok) throw new Error("Expected invalid environment");
expect(result.error.scope).toBeUndefined();
});
it("keeps OpenCode activation tied to the authored row dialect", async () => {
const { client, projectDirectory, read } = await fixture();
const project = join(projectDirectory, "opencode.json");