fix(doctor): honor explicit Hopper launcher
This commit is contained in:
+25
-13
@@ -121,14 +121,16 @@ export const runDoctor = async (
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const candidates = [
|
const candidates =
|
||||||
host.configuredHopperPath,
|
host.configuredHopperPath === undefined
|
||||||
DEFAULT_HOPPER,
|
? [
|
||||||
SYSTEM_LINUX_HOPPER,
|
DEFAULT_HOPPER,
|
||||||
linuxHopperLauncherPath(homedir()),
|
SYSTEM_LINUX_HOPPER,
|
||||||
...(await host.manualHopperPaths()),
|
linuxHopperLauncherPath(homedir()),
|
||||||
await host.brewHopperPath(),
|
...(await host.manualHopperPaths()),
|
||||||
].filter((value): value is string => value !== undefined);
|
await host.brewHopperPath(),
|
||||||
|
].filter((value): value is string => value !== undefined)
|
||||||
|
: [host.configuredHopperPath];
|
||||||
let hopperPath: string | undefined;
|
let hopperPath: string | undefined;
|
||||||
for (const candidate of new Set(candidates))
|
for (const candidate of new Set(candidates))
|
||||||
if (await host.executable(candidate)) {
|
if (await host.executable(candidate)) {
|
||||||
@@ -136,11 +138,21 @@ export const runDoctor = async (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
checks.push(
|
checks.push(
|
||||||
check("hopper", hopperPath !== undefined, hopperPath, {
|
check(
|
||||||
remediation:
|
"hopper",
|
||||||
"Run rea setup to install Hopper, or set HOPPER_LAUNCHER_PATH.",
|
hopperPath !== undefined,
|
||||||
classification: "missing_analysis_engine",
|
hopperPath ?? host.configuredHopperPath,
|
||||||
}),
|
{
|
||||||
|
remediation:
|
||||||
|
host.configuredHopperPath === undefined
|
||||||
|
? "Run rea setup to install Hopper, or set HOPPER_LAUNCHER_PATH."
|
||||||
|
: "Unset or update HOPPER_LAUNCHER_PATH to an executable Hopper launcher.",
|
||||||
|
classification:
|
||||||
|
host.configuredHopperPath === undefined
|
||||||
|
? "missing_analysis_engine"
|
||||||
|
: "config_drift",
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (host.platform === "linux" && hopperPath !== undefined)
|
if (host.platform === "linux" && hopperPath !== undefined)
|
||||||
checks.push(
|
checks.push(
|
||||||
|
|||||||
@@ -60,6 +60,25 @@ describe("doctor", () => {
|
|||||||
expect(result.healthy).toBe(true);
|
expect(result.healthy).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not fall back when the configured Hopper launcher is invalid", async () => {
|
||||||
|
const configuredPath = "/invalid/custom/hopper";
|
||||||
|
const result = await runDoctor(
|
||||||
|
undefined,
|
||||||
|
host({ configuredHopperPath: configuredPath }),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(result.hopperPath).toBeUndefined();
|
||||||
|
expect(result.healthy).toBe(false);
|
||||||
|
expect(result.checks.find(({ name }) => name === "hopper")).toEqual({
|
||||||
|
name: "hopper",
|
||||||
|
ok: false,
|
||||||
|
classification: "config_drift",
|
||||||
|
detail: configuredPath,
|
||||||
|
remediation:
|
||||||
|
"Unset or update HOPPER_LAUNCHER_PATH to an executable Hopper launcher.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("distinguishes stale skills, path shadowing, and unobservable live state", async () => {
|
it("distinguishes stale skills, path shadowing, and unobservable live state", async () => {
|
||||||
const result = await runDoctor(
|
const result = await runDoctor(
|
||||||
undefined,
|
undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user