fix: address setup, upgrade, and process test regressions

This commit is contained in:
morluto
2026-07-15 06:34:25 +00:00
parent 90ba7b03da
commit 02f12b927a
6 changed files with 72 additions and 19 deletions
+2 -2
View File
@@ -967,7 +967,7 @@ describe("process capture adapter", () => {
} finally {
await rm(root, { recursive: true, force: true });
}
});
}, 20_000);
it("does not follow or disclose symlink targets outside declared roots", async () => {
const root = await mkdtemp(join(tmpdir(), "rea-symlink-test-"));
@@ -1186,5 +1186,5 @@ describe("process capture adapter", () => {
const { stdout } = await execFileAsync("ps", ["-axo", "command="]);
expect(stdout).not.toContain(`${processFixture} tree-child`);
expect(stdout).not.toContain(`${processFixture} tree-grandchild`);
});
}, 20_000);
});
+27 -2
View File
@@ -24,6 +24,7 @@ class FakeSetupHost implements SetupHost {
hopperInstalls = 0;
configurations = 0;
skillInstalls = 0;
checkedHopperPaths: Array<string | undefined> = [];
doctorHealthy: boolean | undefined;
linuxDemoRuntimeMissing = false;
unsupportedHopperVersion = false;
@@ -63,10 +64,15 @@ class FakeSetupHost implements SetupHost {
this.clientResults.get(client.name) ?? { status: "configured" },
);
};
clientNeedsConfigure = (client: SetupClient): Promise<boolean> =>
Promise.resolve(
clientNeedsConfigure = (
client: SetupClient,
hopperPath: string | undefined,
): Promise<boolean> => {
this.checkedHopperPaths.push(hopperPath);
return Promise.resolve(
this.clientResults.get(client.name)?.status !== "unchanged",
);
};
skillNeedsInstall = (): Promise<boolean> =>
Promise.resolve(this.skill !== "unchanged");
installSkill = (): Promise<"installed" | "unchanged" | "failed"> => {
@@ -227,6 +233,25 @@ describe("setup workflow", () => {
expect(host.hopperInstalls).toBe(0);
});
it("reinstalls existing Hopper when explicitly requested", async () => {
const host = new FakeSetupHost();
host.hopper = "/Applications/Hopper";
host.skill = "unchanged";
host.clients = [{ name: "codex", configPath: "/codex.toml" }];
host.clientResults.set("codex", { status: "unchanged" });
const result = await runSetup(options(true, true), host);
expect(result.plannedActions.map(({ kind }) => kind)).toEqual([
"install_hopper",
"configure_client",
]);
expect(result.appliedActions).toEqual(["installed_hopper"]);
expect(host.hopperInstalls).toBe(1);
expect(host.configurations).toBe(0);
expect(host.checkedHopperPaths).toEqual(["/manual/Hopper"]);
});
it("omits an aligned managed skill from an otherwise empty plan", async () => {
const host = new FakeSetupHost();
host.hopper = "/Applications/Hopper";
+6
View File
@@ -123,6 +123,8 @@ describe("JSON client configuration transaction", () => {
const configPath = join(directory, "mcp.json");
const hopperPath = "/Applications/Hopper v6.app/Contents/MacOS/hopper";
const client = { name: "cursor", configPath };
const original = "{}\n";
await writeFile(configPath, original);
expect(await configureJsonClient(client, hopperPath)).toMatchObject({
status: "configured",
});
@@ -138,6 +140,10 @@ describe("JSON client configuration transaction", () => {
expect(await configureJsonClient(client, hopperPath)).toEqual({
status: "unchanged",
});
expect(
await configureJsonClient(client, "/opt/hopper/bin/Hopper"),
).toMatchObject({ status: "configured" });
expect(await readFile(`${configPath}.rea.backup`, "utf8")).toBe(original);
});
it("refuses malformed existing JSON without overwriting it", async () => {