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
+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";